diff --git a/archived/event-adapter/.gitignore b/archived/event-adapter/.gitignore
deleted file mode 100644
index 4d13914d6..000000000
--- a/archived/event-adapter/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.swp
-*~
-build/*
diff --git a/archived/event-adapter/Dockerfile b/archived/event-adapter/Dockerfile
deleted file mode 100644
index 2fbd4d8f9..000000000
--- a/archived/event-adapter/Dockerfile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2016 The Kubernetes Authors. All rights reserved
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM gcr.io/google-containers/debian-base-amd64:0.1
-
-ADD build/adapter adapter
-
-RUN clean-install ca-certificates
-
-RUN chmod +x adapter
diff --git a/archived/event-adapter/Makefile b/archived/event-adapter/Makefile
deleted file mode 100644
index 5cf72089a..000000000
--- a/archived/event-adapter/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-OUT_DIR = build
-PACKAGE = k8s.io/event-adapter
-PREFIX ?= staging-k8s.gcr.io
-TAG = 1.0
-
-PKG := $(shell find pkg/* -type f)
-CMD := $(shell find cmd/* -type f)
-
-build: build/adapter
-
-build/adapter: adapter.go $(PKG) $(CMD)
- go build -mod=vendor -a -o $(OUT_DIR)/adapter adapter.go
-
-docker: build/adapter
- docker build --pull -t ${PREFIX}/event-adapter:$(TAG) .
-
-push: docker
- gcloud docker -- push ${PREFIX}/event-adapter:$(TAG)
-
-test:
- go test -mod=vendor ./...
-
-clean:
- rm -rf build apiserver.local.config
diff --git a/archived/event-adapter/README.md b/archived/event-adapter/README.md
deleted file mode 100644
index c5472d693..000000000
--- a/archived/event-adapter/README.md
+++ /dev/null
@@ -1,179 +0,0 @@
-# Event Adapter
-This tool allows users to read Kubernetes events from Stackdriver. This is brief guide that explains how to use it.
-
-# 1. Create a cluster ensuring that Stackdriver Logging API is enabled (both reading and writing)
-
-Download Kubernetes and create a cluster with Stackdriver Logging enabled:
-```sh
-mkdir -p $GOPATH/src/k8s.io
-cd $GOPATH/src/k8s.io
-git clone git@github.com:kubernetes/kubernetes.git
-cd kubernetes
-git checkout 9aef242a4c1e423270488206670d3d1f23eaab52
-sed -i 's/logging-write/https:\/\/www.googleapis.com\/auth\/logging.admin/g' cluster/gce/config-common.sh
-make quick-release
-./cluster/kube-up.sh
-```
-
-# 2. Install the API
-
-Clone the project "https://github.com/GoogleCloudPlatform/k8s-stackdriver" into your GOPATH.
-```sh
-mkdir -p $GOPATH/src/github.com/GoogleCloudPlatform
-cd $GOPATH/src/github.com/GoogleCloudPlatform
-git clone git@github.com:GoogleCloudPlatform/k8s-stackdriver.git
-cd k8s-stackdriver
-git checkout 692c11f5395b3b1d321d8384cde56a4112b5696d
-cd k8s-stackdriver/event-adapter
-```
-Now, you need to set it to work with your project. You should define a variable that identify your project GCP_PROJECT=myProject.
-```sh
-sed -i 's/google-containers/'"$GCP_PROJECT"'/g’adapter.yaml
-make push GCP_PROJECT
-kubectl create -f adapter.yaml --validate=false
-```
-The adapter.yaml file specifies the source of Event Adapter Docker image, and Makefile describes the destination where the image you build is going to be pushed.
-Every time you change one of these values, you should change the other one accordingly.
-Calling "make push", it will compile the code and push the image.
-Then call "kubectl create -f adapter.yaml --validate=false", it will require a bit (~1 minute) to install everything.
-You can check everything is installed:
-```sh
-kubectl api-versions | grep v1events/v1alpha1
-```
-If you need to re-install it, then you will have to delete it using "kubectl delete -f adapter.yaml".
-```sh
-kubectl delete -f adapter.yaml
-make push GCP_PROJECT
-kubectl create -f adapter.yaml --validate=false
-```
-
-# 3. Create a proxy
-Create a proxy so you can conveniently query API Server from your workstation. You can specify the port on which it will serve:
-```sh
-KUBE_PORT=8001
-kubectl proxy --port=${KUBE_PORT}
-```
-
-# 4. Use the API
-The API enables 3 differents URLs in the API group /apis/v1events/v1alpha1. If you have the proxy on, you can see them with:
-```sh
-curl http://localhost:${KUBE_PORT}/apis/v1events/v1alpha1
-```
-Now you can see:
-* namespaces/{namespace}/events/{eventName}
- * GET : it will allow you to retrieve from Stackdriver a single event giving the name {eventName} and namespace {namespace} in which it occurs.
- * namespaces/{namespace}/events
- * GET : it will allow you to retrieve from Stackdriver a list of events with the given namespace {namespace} in which them occurs.
- * POST : it is not implemented yet, it should allow you to store in Stackdriver an event in the given namespace {namespace}.
- * events
- * GET : it will retrieve from Stackdriver a list of events.
-
-For example, calling:
- ```sh
-curl -X GET http://localhost:${KUBE_PORT}/apis/v1events/v1alpha1/namespaces/default/events
- ```
-you will get something like this:
-```
-{
- "kind": "EventList",
- "apiVersion": "v1events/v1alpha1",
- "metadata": {
- "selfLink": "/apis/v1events/v1alpha1/namespaces/default/events"
- },
- "items": [
- {
- "kind": "Event",
- "apiVersion": "v1",
- "metadata": {
- "name": "event-adapter-3051674978-3mt16.14e3920fe82c7b4c",
- "namespace": "default",
- "selfLink": "/apis/v1events/v1alpha1/namespaces/default/events",
- "uid": "ea55efed-9799-11e7-be52-42010a800002",
- "resourceVersion": "22248",
- "creationTimestamp": "2017-09-12T09:08:17Z"
- },
- "involvedObject": {
- "kind": "Pod",
- "namespace": "default",
- "name": "event-adapter-3051674978-3mt16",
- "uid": "e7756e8d-9799-11e7-be52-42010a800002",
- "apiVersion": "v1",
- "resourceVersion": "2290232",
- "fieldPath": "spec.containers{pod-event-adapter}"
- },
- "reason": "Pulled",
- "message": "Successfully pulled image \"gcr.io/erocchi-gke-dev-1attempt/event-adapter:1.0\"",
- "source": {
- "component": "kubelet",
- "host": "kubernetes-minion-group-lbfg"
- },
- "firstTimestamp": "2017-09-12T09:08:17Z",
- "lastTimestamp": "2017-09-12T09:08:17Z",
- "count": 1,
- "type": "Normal"
- },
-
- ...
- ]
-}
-```
-Other examples may be:
-```sh
-curl -X GET http://localhost:${KUBE_PORT}/apis/v1events/v1alpha1/events
-```
-You can also retrieve a single event, you should set EVENT_NAME variables equal to the name of the event. Then call:
-```sh
-curl -X GET http://localhost:${KUBE_PORT}/apis/v1events/v1alpha1/namespaces/default/events/$EVENT_NAME
-```
-Then, there is the one that is not supported yet.
-```sh
-curl -X POST http://localhost:${KUBE_PORT}/apis/v1events/v1alpha1/namespaces/default/events
-```
-There are flags you can use if you want to limit the events you are going to retrieve.
-* ***max-retrieved-events=N***
-If you want to retrieve at most N events. The default of 100 events will be used.
-* ***retrieve-events-since-millis=T***
-It will retrieve only events that were logged after timestamp T (number of milliseconds after epoch -- 1 January 1970). The default of last 1h will be used.
-If T < 0 the default option will be used as well.
-
-In order to change these flags, modify the adapter.yaml file.
-You should change the deployment declaration, for example:
-
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
- name: event-adapter
- namespace: default
- labels:
-run: event-adapter
- k8s-app: event-adapter
-spec:
- replicas: 1
- selector:
- matchLabels:
- run: event-adapter
- k8s-app: event-adapter
- template:
- metadata:
- labels:
- run: event-adapter8001
- k8s-app: event-adapter
- kubernetes.io/cluster-service: "true"
- spec:
- containers:
- - image: gcr.io/google-containers/event-adapter:1.0
- imagePullPolicy: Always
- name: pod-event-adapter
- command:
- - /adapter
- - --max-retrieved-events=123
- - --retrieve-events-since-millis=0
- resources:
- cpu: 250m
- memory: 200Mi
- requests:
- cpu: 250m
- memory: 200Mi
-
-This will allow you to retrieve at most 123 events that happens after epoch (T = 0 milliseconds).
-
diff --git a/archived/event-adapter/adapter.go b/archived/event-adapter/adapter.go
deleted file mode 100644
index 76e0e46bd..000000000
--- a/archived/event-adapter/adapter.go
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package main
-
-import (
- "flag"
- "os"
- "runtime"
-
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/cmd/server"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/apiserver/pkg/util/logs"
-)
-
-var (
- maxRetrievedEvents = flag.Int("max-retrieved-events", 100, "Maximum number of events can be retrieved")
- sinceMillis = flag.Int64("retrieve-events-since-millis", -1, "Retrieve only events logged after given timestamp since epoch, if the given timestamp is < 0 the default of last 1h will be used")
-)
-
-func main() {
- logs.InitLogs()
- defer logs.FlushLogs()
- flag.Parse()
- if len(os.Getenv("GOMAXPROCS")) == 0 {
- runtime.GOMAXPROCS(runtime.NumCPU())
- }
- cmd := server.NewCommandStartSampleAdapterServer(os.Stdout, os.Stderr, wait.NeverStop, *maxRetrievedEvents, *sinceMillis)
- cmd.Flags().AddGoFlagSet(flag.CommandLine)
- if err := cmd.Execute(); err != nil {
- panic(err)
- }
-}
diff --git a/archived/event-adapter/adapter.yaml b/archived/event-adapter/adapter.yaml
deleted file mode 100644
index ade417a95..000000000
--- a/archived/event-adapter/adapter.yaml
+++ /dev/null
@@ -1,132 +0,0 @@
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: event-adapter
- namespace: default
----
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
- name: event-adapter
- namespace: default
- labels:
- run: event-adapter
- k8s-app: event-adapter
-spec:
- replicas: 1
- selector:
- matchLabels:
- run: event-adapter
- k8s-app: event-adapter
- template:
- metadata:
- labels:
- run: event-adapter
- k8s-app: event-adapter
- kubernetes.io/cluster-service: "true"
- spec:
- containers:
- - image: gcr.io/google-containers/event-adapter:1.0
- imagePullPolicy: Always
- name: pod-event-adapter
- command:
- - /adapter
- resources:
- limits:
- cpu: 250m
- memory: 200Mi
- requests:
- cpu: 250m
- memory: 200Mi
----
-apiVersion: v1
-kind: Service
-metadata:
- labels:
- run: event-adapter
- k8s-app: event-adapter
- kubernetes.io/cluster-service: 'true'
- kubernetes.io/name: Adapter
- name: event-adapter
- namespace: default
-spec:
- ports:
- - port: 443
- protocol: TCP
- targetPort: 443
- selector:
- run: event-adapter
- k8s-app: event-adapter
- type: ClusterIP
----
-apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: ClusterRoleBinding
-metadata:
- name: apiextensions:system:auth-delegator
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: system:auth-delegator
-subjects:
-- apiVersion: v1
- kind: ServiceAccount
- name: event-adapter
- namespace: default
----
-apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: RoleBinding
-metadata:
- name: apiextensions-auth-reader
- namespace: default
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: Role
- name: extension-apiserver-authentication-reader
-subjects:
-- apiVersion: v1
- kind: ServiceAccount
- name: event-adapter
- namespace: default
----
-apiVersion: apiregistration.k8s.io/v1beta1
-kind: APIService
-metadata:
- name: v1alpha1.v1events
-spec:
- insecureSkipTLSVerify: true
- group: v1events
- groupPriorityMinimum: 100
- versionPriority: 100
- priority: 100
- service:
- name: event-adapter
- namespace: default
- version: v1alpha1
----
-apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: ClusterRole
-metadata:
- name: events-reader
-rules:
-- apiGroups:
- - "v1events"
- resources:
- - "*"
- verbs: ["list", "get", "post", "create"]
----
-apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: ClusterRoleBinding
-metadata:
- creationTimestamp: null
- name: all-events-reader
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: events-reader
-subjects:
-- apiVersion: rbac.authorization.k8s.io/v1beta1
- kind: Group
- name: system:anonymous
-- apiVersion: rbac.authorization.k8s.io/v1beta1
- kind: Group
- name: system:unauthenticated
diff --git a/archived/event-adapter/cmd/provider/provider.go b/archived/event-adapter/cmd/provider/provider.go
deleted file mode 100644
index fa4a67942..000000000
--- a/archived/event-adapter/cmd/provider/provider.go
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
- gce "cloud.google.com/go/compute/metadata"
- "fmt"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/provider"
- sd "google.golang.org/api/logging/v2"
- api "k8s.io/client-go/pkg/api/v1"
- "time"
-)
-
-//TODO(erocchi) Add implementation to write events to Stackdriver
-//TODO(erocchi) Use the Kubernetes AIP - compatible errors, see example definitions here: https://github.com/kubernetes-incubator/custom-metrics-apiserver/blob/master/pkg/provider/errors.go
-
-// StackdriverProvider implements EventsProvider
-type StackdriverProvider struct {
- stackdriverService *sd.EntriesService
- maxRetrievedEvents int
- sinceMillis int64
-}
-
-// NewStackdriverProvider creates a new Provider with standard settings
-func NewStackdriverProvider(stackdriverService *sd.Service, maxRetrievedEvents int, sinceMillis int64) provider.EventsProvider {
- return &StackdriverProvider{
- stackdriverService: sd.NewEntriesService(stackdriverService),
- maxRetrievedEvents: maxRetrievedEvents,
- sinceMillis: sinceMillis,
- }
-}
-
-// GetNamespacedEventsByName gets the event with the given namespace and name
-func (p *StackdriverProvider) GetNamespacedEventsByName(namespace, eventName string) (*api.Event, error) {
- standardFilter, err := standardFilter()
- if err != nil {
- return nil, err
- }
- filter := "(" + standardFilter + " AND jsonPayload.metadata.namespace = \"" + namespace + "\" AND jsonPayload.metadata.name = \"" + eventName + "\")"
- event, err := p.getEvents(filter)
- if err != nil {
- return nil, err
- }
- if len(event.Items) == 0 {
- return nil, fmt.Errorf("Event not found")
- }
- return &event.Items[0], nil
-}
-
-// ListAllEventsByNamespace gets all the events with the given namespace
-func (p *StackdriverProvider) ListAllEventsByNamespace(namespace string) (*api.EventList, error) {
- standardFilter, err := standardFilter()
- if err != nil {
- return nil, err
- }
- filter := "(" + standardFilter + " AND jsonPayload.metadata.namespace = \"" + namespace + "\")"
- if err != nil {
- return nil, err
- }
- return p.getEvents(filter)
-}
-
-// ListAllEvents gets all the events
-func (p *StackdriverProvider) ListAllEvents() (*api.EventList, error) {
- filter, err := standardFilter()
- if err != nil {
- return nil, err
- }
- return p.getEvents(filter)
-}
-
-func standardFilter() (string, error) {
- projectID, err := gce.ProjectID()
- if err != nil {
- return "", fmt.Errorf("Cannot retrieve projectID. %v", err)
- }
- return "(logName = \"projects/" + projectID + "/logs/events\" AND jsonPayload.kind = \"Event\")", nil
-}
-
-// CreateNewEvent creates a new event in the given namespace
-func (p *StackdriverProvider) CreateNewEvent(namespace string) (*api.Event, error) {
- return nil, fmt.Errorf("CreateNewEvent is not implemented yet.")
-}
-
-func (p *StackdriverProvider) getEvents(filter string) (*api.EventList, error) {
- projectID, err := gce.ProjectID()
- if err != nil {
- return nil, fmt.Errorf("Cannot retrieve projectID. %v", err)
- }
- resource := []string{
- "projects/" + projectID,
- }
- var timeLimit time.Time
- if p.sinceMillis < 0 {
- timeLimit = time.Now().Add(-1 * time.Hour)
- } else {
- timeLimit = time.Unix(0, p.sinceMillis*1e6)
- }
- timeFilter := "(" + filter + " AND " + "jsonPayload.metadata.creationTimestamp >= \"" + timeLimit.Format(time.RFC3339) + "\")"
- eventsList := &api.EventList{}
- eventIndex := make(map[string]int)
- firstRedirection := true
- var response *sd.ListLogEntriesResponse
- for {
- request := &sd.ListLogEntriesRequest{
- ResourceNames: resource,
- Filter: timeFilter,
- OrderBy: "timestamp desc",
- }
- if !firstRedirection {
- request.PageToken = response.NextPageToken
- }
- firstRedirection = false
- response, err = p.stackdriverService.List(request).Do()
- if err != nil {
- return nil, fmt.Errorf("Failed request to Stackdriver: %v", err)
- }
- eventsList, eventIndex, err = translateToEventList(response, eventsList, eventIndex, p.maxRetrievedEvents)
- if err != nil {
- return nil, fmt.Errorf("Failed to translate the response from Stackdriver: %v", err)
- }
- if response.NextPageToken == "" || len(eventsList.Items) >= p.maxRetrievedEvents {
- break
- }
- }
- return eventsList, nil
-}
diff --git a/archived/event-adapter/cmd/provider/translator.go b/archived/event-adapter/cmd/provider/translator.go
deleted file mode 100644
index 0b5f070c0..000000000
--- a/archived/event-adapter/cmd/provider/translator.go
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
- "encoding/json"
- "fmt"
- sd "google.golang.org/api/logging/v2"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- api "k8s.io/client-go/pkg/api/v1"
-)
-
-type eventTime struct {
- Timestamp metav1.Time `json:"timestamp,omitempty"`
-}
-
-func extractEvent(e *sd.LogEntry) (*api.Event, error) {
- a, err := e.JsonPayload.MarshalJSON()
- if err != nil {
- return nil, fmt.Errorf("Cannot marshall the answer: %v", err)
- }
- var event api.Event
- err = json.Unmarshal(a, &event)
- if err != nil {
- return nil, fmt.Errorf("Cannot unmarshall the answer to an event: %v", err)
- }
- return &event, nil
-}
-
-func extractTime(e *sd.LogEntry) (*eventTime, error) {
- a, err := e.MarshalJSON()
- if err != nil {
- return nil, fmt.Errorf("Cannot marshall the time: %v", err)
- }
- var time eventTime
- err = json.Unmarshal(a, &time)
- if err != nil {
- return nil, fmt.Errorf("Cannot unmarshall the time of the event: %v", err)
- }
- return &time, nil
-}
-
-func translateToEventList(response *sd.ListLogEntriesResponse, eventsList *api.EventList, eventIndex map[string]int, maxListLength int) (*api.EventList, map[string]int, error) {
- for _, value := range response.Entries {
- event := value
- newEvent, err := extractEvent(event)
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to parse event : %v", err)
- }
-
- time, err := extractTime(event)
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to parse timestamp : %v", err)
- }
- timestamp := time.Timestamp
-
- if ind, ok := eventIndex[newEvent.Name]; ok {
- item := &eventsList.Items[ind]
- if item.FirstTimestamp.After(timestamp.Time) {
- item.FirstTimestamp = timestamp
- }
- if item.LastTimestamp.Before(timestamp) {
- item.LastTimestamp = timestamp
- }
- item.Count++
- } else {
- newEvent.Count = 1
- newEvent.FirstTimestamp = timestamp
- newEvent.LastTimestamp = timestamp
- eventsList.Items = append(eventsList.Items, *newEvent)
- eventIndex[newEvent.Name] = len(eventsList.Items) - 1
- }
- if len(eventsList.Items) >= maxListLength {
- break
- }
- }
- return eventsList, eventIndex, nil
-}
diff --git a/archived/event-adapter/cmd/server/start.go b/archived/event-adapter/cmd/server/start.go
deleted file mode 100644
index 66f921f2d..000000000
--- a/archived/event-adapter/cmd/server/start.go
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package server
-
-import (
- "fmt"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/cmd/provider"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/cmd/server"
- "github.com/spf13/cobra"
- "golang.org/x/oauth2"
- "golang.org/x/oauth2/google"
- sd "google.golang.org/api/logging/v2"
- "io"
- coreclient "k8s.io/client-go/kubernetes/typed/core/v1"
- "k8s.io/client-go/rest"
- "k8s.io/client-go/tools/clientcmd"
-)
-
-// NewCommandStartSampleAdapterServer provides a CLI handler for 'start master' command
-func NewCommandStartSampleAdapterServer(out, errOut io.Writer, stopCh <-chan struct{}, maxRetrievedEvents int, sinceMillis int64) *cobra.Command {
- baseOpts := server.NewEventsAdapterServerOptions(out, errOut)
- o := SampleAdapterServerOptions{
- EventsAdapterServerOptions: baseOpts,
- }
- cmd := &cobra.Command{
- Short: "Launch the events API adapter server",
- Long: "Launch the events API adapter server",
- RunE: func(c *cobra.Command, args []string) error {
- if err := o.Complete(); err != nil {
- return err
- }
- if err := o.Validate(args); err != nil {
- return err
- }
- err := o.RunEventsAdapterServer(stopCh, maxRetrievedEvents, sinceMillis)
- return err
- },
- }
- flags := cmd.Flags()
- o.SecureServing.AddFlags(flags)
- o.Authentication.AddFlags(flags)
- o.Authorization.AddFlags(flags)
- o.Features.AddFlags(flags)
-
- flags.StringVar(&o.RemoteKubeConfigFile, "lister-kubeconfig", o.RemoteKubeConfigFile, ""+
- "kubeconfig file pointing at the 'core' kubernetes server with enough rights to list "+
- "any described objets")
- return cmd
-}
-
-// RunEventsAdapterServer runs Events adapter API server
-func (o SampleAdapterServerOptions) RunEventsAdapterServer(stopCh <-chan struct{}, maxRetrievedEvents int, sinceMillis int64) error {
- config, err := o.Config()
- if err != nil {
- return err
- }
- var clientConfig *rest.Config
- if len(o.RemoteKubeConfigFile) > 0 {
- loadingRules := &clientcmd.ClientConfigLoadingRules{ExplicitPath: o.RemoteKubeConfigFile}
- loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
-
- clientConfig, err = loader.ClientConfig()
- } else {
- clientConfig, err = rest.InClusterConfig()
- }
- if err != nil {
- return fmt.Errorf("unable to construct lister client config to initialize provider: %v", err)
- }
- _, err = coreclient.NewForConfig(clientConfig)
- if err != nil {
- return fmt.Errorf("unable to construct lister client to initialize provider: %v", err)
- }
- oauthClient := oauth2.NewClient(oauth2.NoContext, google.ComputeTokenSource(""))
- stackdriverService, err := sd.New(oauthClient)
- if err != nil {
- return fmt.Errorf("Failed to create Stackdriver client: %v", err)
- }
- evProvider := provider.NewStackdriverProvider(stackdriverService, maxRetrievedEvents, sinceMillis)
- server, err := config.Complete().New(evProvider)
- if err != nil {
- return err
- }
- return server.GenericAPIServer.PrepareRun().Run(stopCh)
-}
-
-// SampleAdapterServerOptions contains sample EventsAdapterServerOptions
-type SampleAdapterServerOptions struct {
- *server.EventsAdapterServerOptions
- // RemoteKubeConfigFile is the config used to list pods from the master API server
- RemoteKubeConfigFile string
-}
diff --git a/archived/event-adapter/go.mod b/archived/event-adapter/go.mod
deleted file mode 100644
index fc7c3de99..000000000
--- a/archived/event-adapter/go.mod
+++ /dev/null
@@ -1,123 +0,0 @@
-module github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter
-
-go 1.13
-
-require (
- bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c // indirect
- cloud.google.com/go v0.7.1-0.20170601220109-d59fc17b56f5
- github.com/BurntSushi/toml v0.3.1 // indirect
- github.com/PuerkitoBio/purell v1.0.0 // indirect
- github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2 // indirect
- github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1 // indirect
- github.com/boltdb/bolt v1.3.1 // indirect
- github.com/coreos/etcd v3.0.17+incompatible // indirect
- github.com/coreos/go-semver v0.3.0 // indirect
- github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b // indirect
- github.com/coreos/pkg v0.0.0-20160620232715-fa29b1d70f0b // indirect
- github.com/docker/distribution v2.7.1+incompatible // indirect
- github.com/elazarl/go-bindata-assetfs v0.0.0-20150624150248-3dcc96556217 // indirect
- github.com/emicklei/go-restful v1.1.4-0.20161212084525-09691a3b6378
- github.com/evanphx/json-patch v0.0.0-20170123154800-ba18e35c5c1b // indirect
- github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 // indirect
- github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1 // indirect
- github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9 // indirect
- github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501 // indirect
- github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 // indirect
- github.com/gogo/protobuf v0.0.0-20160718161353-e18d7aa8f8c6 // indirect
- github.com/golang/glog v0.0.0-20141105023935-44145f04b68c // indirect
- github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 // indirect
- github.com/golang/protobuf v0.0.0-20160608215545-8616e8ee5e20 // indirect
- github.com/google/btree v1.0.0 // indirect
- github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367 // indirect
- github.com/grpc-ecosystem/grpc-gateway v1.0.1-0.20160715013742-f52d055dc48a // indirect
- github.com/howeyc/gopass v0.0.0-20160826175423-3ca23474a7c7 // indirect
- github.com/imdario/mergo v0.0.0-20141206190957-6633656539c1 // indirect
- github.com/inconshreveable/mousetrap v1.0.0 // indirect
- github.com/jonboulle/clockwork v0.1.0 // indirect
- github.com/juju/ratelimit v0.0.0-20151125201925-77ed1c8a0121 // indirect
- github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a // indirect
- github.com/matttproud/golang_protobuf_extensions v0.0.0-20150406173934-fc2b8d3a73c4 // indirect
- github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
- github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
- github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
- github.com/pborman/uuid v0.0.0-20150603214016-ca53cad383ca // indirect
- github.com/pkg/errors v0.7.1-0.20160808055540-a22138067af1 // indirect
- github.com/prometheus/client_golang v0.0.0-20151008143247-e51041b3fa41 // indirect
- github.com/prometheus/client_model v0.0.0-20150212101744-fa8ad6fec335 // indirect
- github.com/prometheus/common v0.0.0-20151014055050-ffe929a3f4c4 // indirect
- github.com/prometheus/procfs v0.0.0-20150928173926-454a56f35412 // indirect
- github.com/spf13/cobra v0.0.0-20160722081547-f62e98d28ab7
- github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff // indirect
- github.com/stretchr/testify v1.5.1 // indirect
- github.com/ugorji/go v0.0.0-20170107133203-ded73eae5db7 // indirect
- github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
- golang.org/x/crypto v0.0.0-20161006174701-d172538b2cfc // indirect
- golang.org/x/net v0.0.0-20160715184138-e90d6d0afc4c // indirect
- golang.org/x/oauth2 v0.0.0-20160902055913-3c3a985cb79f
- golang.org/x/sys v0.0.0-20160916181909-8f0908ab3b24 // indirect
- golang.org/x/text v0.0.0-20160726164857-2910a502d2bf // indirect
- google.golang.org/api v0.0.0-20170508220804-e3824ed33c72
- google.golang.org/appengine v0.0.0-20160823001527-4f7eeb5305a4 // indirect
- google.golang.org/grpc v1.0.1-0.20160819002236-231b4cfea0e7 // indirect
- gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
- gopkg.in/inf.v0 v0.9.0 // indirect
- gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7 // indirect
- gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect
- k8s.io/apimachinery v0.0.0-20170331202828-20e10d54608f
- k8s.io/apiserver v0.0.0-20170405203548-dcf548fbe26d
- k8s.io/client-go v0.0.0-20170405202815-dabf37f5df16
-)
-
-replace (
- cloud.google.com/go => cloud.google.com/go v0.7.1-0.20170601220109-d59fc17b56f5
- github.com/PuerkitoBio/purell => github.com/PuerkitoBio/purell v1.0.0
- github.com/PuerkitoBio/urlesc => github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2
- github.com/beorn7/perks => github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1
- github.com/coreos/etcd => github.com/coreos/etcd v3.0.17+incompatible
- github.com/coreos/go-systemd => github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b
- github.com/coreos/pkg => github.com/coreos/pkg v0.0.0-20160620232715-fa29b1d70f0b
- github.com/davecgh/go-spew => github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2
- github.com/elazarl/go-bindata-assetfs => github.com/elazarl/go-bindata-assetfs v0.0.0-20150624150248-3dcc96556217
- github.com/emicklei/go-restful => github.com/emicklei/go-restful v1.1.4-0.20161212084525-09691a3b6378
- github.com/evanphx/json-patch => github.com/evanphx/json-patch v0.0.0-20170123154800-ba18e35c5c1b
- github.com/ghodss/yaml => github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680
- github.com/go-openapi/jsonpointer => github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1
- github.com/go-openapi/jsonreference => github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9
- github.com/go-openapi/spec => github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501
- github.com/go-openapi/swag => github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87
- github.com/gogo/protobuf => github.com/gogo/protobuf v0.0.0-20160718161353-e18d7aa8f8c6
- github.com/golang/glog => github.com/golang/glog v0.0.0-20141105023935-44145f04b68c
- github.com/golang/groupcache => github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903
- github.com/golang/protobuf => github.com/golang/protobuf v0.0.0-20160608215545-8616e8ee5e20
- github.com/google/gofuzz => github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367
- github.com/grpc-ecosystem/grpc-gateway => github.com/grpc-ecosystem/grpc-gateway v1.0.1-0.20160715013742-f52d055dc48a
- github.com/howeyc/gopass => github.com/howeyc/gopass v0.0.0-20160826175423-3ca23474a7c7
- github.com/imdario/mergo => github.com/imdario/mergo v0.0.0-20141206190957-6633656539c1
- github.com/inconshreveable/mousetrap => github.com/inconshreveable/mousetrap v1.0.0
- github.com/juju/ratelimit => github.com/juju/ratelimit v0.0.0-20151125201925-77ed1c8a0121
- github.com/mailru/easyjson => github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a
- github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v0.0.0-20150406173934-fc2b8d3a73c4
- github.com/pborman/uuid => github.com/pborman/uuid v0.0.0-20150603214016-ca53cad383ca
- github.com/pkg/errors => github.com/pkg/errors v0.7.1-0.20160808055540-a22138067af1
- github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.0.0-20151008143247-e51041b3fa41
- github.com/prometheus/client_model => github.com/prometheus/client_model v0.0.0-20150212101744-fa8ad6fec335
- github.com/prometheus/common => github.com/prometheus/common v0.0.0-20151014055050-ffe929a3f4c4
- github.com/prometheus/procfs => github.com/prometheus/procfs v0.0.0-20150928173926-454a56f35412
- github.com/spf13/cobra => github.com/spf13/cobra v0.0.0-20160722081547-f62e98d28ab7
- github.com/spf13/pflag => github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff
- github.com/ugorji/go => github.com/ugorji/go v0.0.0-20170107133203-ded73eae5db7
- golang.org/x/crypto => golang.org/x/crypto v0.0.0-20161006174701-d172538b2cfc
- golang.org/x/net => golang.org/x/net v0.0.0-20160715184138-e90d6d0afc4c
- golang.org/x/oauth2 => golang.org/x/oauth2 v0.0.0-20160902055913-3c3a985cb79f
- golang.org/x/sys => golang.org/x/sys v0.0.0-20160916181909-8f0908ab3b24
- golang.org/x/text => golang.org/x/text v0.0.0-20160726164857-2910a502d2bf
- google.golang.org/api => google.golang.org/api v0.0.0-20170508220804-e3824ed33c72
- google.golang.org/appengine => google.golang.org/appengine v0.0.0-20160823001527-4f7eeb5305a4
- google.golang.org/grpc => google.golang.org/grpc v1.0.1-0.20160819002236-231b4cfea0e7
- gopkg.in/inf.v0 => gopkg.in/inf.v0 v0.9.0
- gopkg.in/natefinch/lumberjack.v2 => gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7
- gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.0.0-20150924142314-53feefa2559f
- k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20170331202828-20e10d54608f
- k8s.io/apiserver => k8s.io/apiserver v0.0.0-20170405203548-dcf548fbe26d
- k8s.io/client-go => k8s.io/client-go v0.0.0-20170405202815-dabf37f5df16
-)
diff --git a/archived/event-adapter/go.sum b/archived/event-adapter/go.sum
deleted file mode 100644
index 865597e48..000000000
--- a/archived/event-adapter/go.sum
+++ /dev/null
@@ -1,136 +0,0 @@
-bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c h1:t+Ra932MCC0eeyD/vigXqMbZTzgZjd4JOfBJWC6VSMI=
-bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c/go.mod h1:1vhO7Mn/FZMgOgDVGLy5X1mE6rq1HbkBdkF/yj8zkcg=
-cloud.google.com/go v0.7.1-0.20170601220109-d59fc17b56f5 h1:DWs6iLLEdgkp3qZFP1QPRs2djjyL7ICBrjHJfeO3ASI=
-cloud.google.com/go v0.7.1-0.20170601220109-d59fc17b56f5/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
-github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/PuerkitoBio/purell v1.0.0 h1:0GoNN3taZV6QI81IXgCbxMyEaJDXMSIjArYBCYzVVvs=
-github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
-github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2 h1:JCHLVE3B+kJde7bIEo5N4J+ZbLhp0J1Fs+ulyRws4gE=
-github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
-github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1 h1:OnJHjoVbY69GG4gclp0ngXfywigLhR6rrgUxmxQRWO4=
-github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
-github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
-github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
-github.com/coreos/etcd v3.0.17+incompatible h1:EgZl12jaaLp5U7afELe3+h2nVcbdQOjqxRDi3sKD0TI=
-github.com/coreos/etcd v3.0.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
-github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
-github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
-github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b h1:+mtZ0WjVZwTX0RVrXMXDwuYVaNeHGvWBW1UwJeMR+2M=
-github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/pkg v0.0.0-20160620232715-fa29b1d70f0b h1:IqgHacj6F3QnV+0H9PXFWAmML5HdxkZakBQgZgfD+FU=
-github.com/coreos/pkg v0.0.0-20160620232715-fa29b1d70f0b/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
-github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2 h1:5zdDAMuB3gvbHB1m2BZT9+t9w+xaBmK3ehb7skDXcwM=
-github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
-github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
-github.com/elazarl/go-bindata-assetfs v0.0.0-20150624150248-3dcc96556217 h1:y2RUuraT/W7WKNBxj2QDThNkJ+dQpNS9kEk3Y75S3mk=
-github.com/elazarl/go-bindata-assetfs v0.0.0-20150624150248-3dcc96556217/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
-github.com/emicklei/go-restful v1.1.4-0.20161212084525-09691a3b6378 h1:06njwgR6pXmS73SB2BRKPCjFO0tVALxlXQUTZD/lzAk=
-github.com/emicklei/go-restful v1.1.4-0.20161212084525-09691a3b6378/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
-github.com/evanphx/json-patch v0.0.0-20170123154800-ba18e35c5c1b h1:zkm+xhf4spLwb17f43Sii3RZDl/lXpC3gcnO37/JiR0=
-github.com/evanphx/json-patch v0.0.0-20170123154800-ba18e35c5c1b/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
-github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM=
-github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
-github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1 h1:wSt/4CYxs70xbATrGXhokKF1i0tZjENLOo1ioIO13zk=
-github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
-github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9 h1:tF+augKRWlWx0J0B7ZyyKSiTyV6E1zZe+7b3qQlcEf8=
-github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
-github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501 h1:C1JKChikHGpXwT5UQDFaryIpDtyyGL/CR6C2kB7F1oc=
-github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
-github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 h1:zP3nY8Tk2E6RTkqGYrarZXuzh+ffyLDljLxCy1iJw80=
-github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
-github.com/gogo/protobuf v0.0.0-20160718161353-e18d7aa8f8c6 h1:ylB52oUmnSohqzSgB2yZgfZM4Xfe0YQx7yWVsOD8wL8=
-github.com/gogo/protobuf v0.0.0-20160718161353-e18d7aa8f8c6/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/golang/glog v0.0.0-20141105023935-44145f04b68c h1:CbdkBQ1/PiAo0FYJhQGwASD8wrgNvTdf01g6+O9tNuA=
-github.com/golang/glog v0.0.0-20141105023935-44145f04b68c/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 h1:LbsanbbD6LieFkXbj9YNNBupiGHJgFeLpO0j0Fza1h8=
-github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
-github.com/golang/protobuf v0.0.0-20160608215545-8616e8ee5e20 h1:JjXLa2agJIe5O/7gydg1V7GI847H1+DTOoFmjKNDE7I=
-github.com/golang/protobuf v0.0.0-20160608215545-8616e8ee5e20/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
-github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
-github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367 h1:ScAXWS+TR6MZKex+7Z8rneuSJH+FSDqd6ocQyl+ZHo4=
-github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
-github.com/grpc-ecosystem/grpc-gateway v1.0.1-0.20160715013742-f52d055dc48a h1:+zxkhDs0tTLWG4TM/OYSbA1TXVHOOLA3KJUiB0aacWc=
-github.com/grpc-ecosystem/grpc-gateway v1.0.1-0.20160715013742-f52d055dc48a/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
-github.com/howeyc/gopass v0.0.0-20160826175423-3ca23474a7c7 h1:LbCYoFXPycb24uJR0m609Jat+Hq0jdrt/jnn9io95Gg=
-github.com/howeyc/gopass v0.0.0-20160826175423-3ca23474a7c7/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
-github.com/imdario/mergo v0.0.0-20141206190957-6633656539c1 h1:FeeCi0I2Fu8kA8IXrdVPtGzym+mW9bzfj9f26EaES9k=
-github.com/imdario/mergo v0.0.0-20141206190957-6633656539c1/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
-github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
-github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
-github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
-github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
-github.com/juju/ratelimit v0.0.0-20151125201925-77ed1c8a0121 h1:tK7/W+/VbVcqFcQzl3qMnrc/z3h/XOBIrJ9e/cv5hx4=
-github.com/juju/ratelimit v0.0.0-20151125201925-77ed1c8a0121/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY=
-github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
-github.com/matttproud/golang_protobuf_extensions v0.0.0-20150406173934-fc2b8d3a73c4 h1:NlK6WXPDxjVVwseTuj5NdNJBDabnoJryx4UqB5i/Lk8=
-github.com/matttproud/golang_protobuf_extensions v0.0.0-20150406173934-fc2b8d3a73c4/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
-github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
-github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
-github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
-github.com/pborman/uuid v0.0.0-20150603214016-ca53cad383ca h1:dKRMHfduZ/ZqOHuYGk/0kkTIUbnyorkAfzLOp6Ts8pU=
-github.com/pborman/uuid v0.0.0-20150603214016-ca53cad383ca/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
-github.com/pkg/errors v0.7.1-0.20160808055540-a22138067af1 h1:VKwwwPzRs1kuf0sQ55ye3ZV3dybDkw4JfI1Ad1eT73o=
-github.com/pkg/errors v0.7.1-0.20160808055540-a22138067af1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v0.0.0-20151008143247-e51041b3fa41 h1:Fui6LEXnO23GkKUMSq3bDYhVBWi44gzONQ72EeBWigM=
-github.com/prometheus/client_golang v0.0.0-20151008143247-e51041b3fa41/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
-github.com/prometheus/client_model v0.0.0-20150212101744-fa8ad6fec335 h1:0E/5GnGmzoDCtmzTycjGDWW33H0UBmAhR0h+FC8hWLs=
-github.com/prometheus/client_model v0.0.0-20150212101744-fa8ad6fec335/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
-github.com/prometheus/common v0.0.0-20151014055050-ffe929a3f4c4 h1:QiQh0+a3s0Wztb8GI9ByuVKwOowcNA7PXBoOk42dZYE=
-github.com/prometheus/common v0.0.0-20151014055050-ffe929a3f4c4/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
-github.com/prometheus/procfs v0.0.0-20150928173926-454a56f35412 h1:3iQrY5Z7SUDniNXBirRXBDkWgZcZ89KuUVh5MsXH4Lw=
-github.com/prometheus/procfs v0.0.0-20150928173926-454a56f35412/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
-github.com/spf13/cobra v0.0.0-20160722081547-f62e98d28ab7 h1:vX79RLf8hJqzYiv0FVgbIqSD76lK4dTIoIN29Kc4MXo=
-github.com/spf13/cobra v0.0.0-20160722081547-f62e98d28ab7/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
-github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff h1:VARhShG49tiji6mdRNp7JTNDtJ0FhuprF93GBQ37xGU=
-github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
-github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
-github.com/ugorji/go v0.0.0-20170107133203-ded73eae5db7 h1:BPPUhSq7uU6E9lFzyb81vjwVOhiWwMXp0EpKL75NX+8=
-github.com/ugorji/go v0.0.0-20170107133203-ded73eae5db7/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
-github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
-github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
-golang.org/x/crypto v0.0.0-20161006174701-d172538b2cfc h1:DfGUWE6VaxsoTkTHNGspjXfDCOroOPdvTIuiYeYpC4o=
-golang.org/x/crypto v0.0.0-20161006174701-d172538b2cfc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/net v0.0.0-20160715184138-e90d6d0afc4c h1:2EAV7IIzPaLTYW+2nvyaXEO2U/6Jg6iMqR7gZ0v0i34=
-golang.org/x/net v0.0.0-20160715184138-e90d6d0afc4c/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/oauth2 v0.0.0-20160902055913-3c3a985cb79f h1:VWt05OS3Al9w09GSPgltoHP90whAHlpik/Bys7HVEDE=
-golang.org/x/oauth2 v0.0.0-20160902055913-3c3a985cb79f/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
-golang.org/x/sys v0.0.0-20160916181909-8f0908ab3b24 h1:BL/wcoHkjubwHn2wDTAD1fehKZ9lf67KOVzucRKWPtM=
-golang.org/x/sys v0.0.0-20160916181909-8f0908ab3b24/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.0.0-20160726164857-2910a502d2bf h1:a1mkutIuyEAoG1fn3Z8Ep7h+O57k45esCFDOqht8HF8=
-golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-google.golang.org/api v0.0.0-20170508220804-e3824ed33c72 h1:nmNkFC1PmKi0e3OMLzDcOjqcVsRov5XtjdZLakSN1nk=
-google.golang.org/api v0.0.0-20170508220804-e3824ed33c72/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
-google.golang.org/appengine v0.0.0-20160823001527-4f7eeb5305a4 h1:WsXqDh29vwFPO3bhLP8QUL8uCcYISVMAMqbzqwaP8L0=
-google.golang.org/appengine v0.0.0-20160823001527-4f7eeb5305a4/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
-google.golang.org/grpc v1.0.1-0.20160819002236-231b4cfea0e7 h1:VtoFDiq5KoIVeqTtwmDDjZsYXsocrlaGiQxukZnYDJ4=
-google.golang.org/grpc v1.0.1-0.20160819002236-231b4cfea0e7/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/inf.v0 v0.9.0 h1:3zYtXIO92bvsdS3ggAdA8Gb4Azj0YU+TVY1uGYNFA8o=
-gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
-gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7 h1:986b60BAz5vO2Vaf48yQaq+wb2bU4JsXxKu1+itW6x8=
-gopkg.in/natefinch/lumberjack.v2 v2.0.0-20150622162204-20b71e5b60d7/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
-gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
-gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
-gopkg.in/yaml.v2 v2.0.0-20150924142314-53feefa2559f h1:sOheF02XWNGQor9t3gRZtN/HlgP6sv3NozSahoTEmiM=
-gopkg.in/yaml.v2 v2.0.0-20150924142314-53feefa2559f/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
-k8s.io/apimachinery v0.0.0-20170331202828-20e10d54608f h1:7+qRKBz8AY+hNYKd1GSu9GAaUn9xANodV+eU/xX967c=
-k8s.io/apimachinery v0.0.0-20170331202828-20e10d54608f/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
-k8s.io/apiserver v0.0.0-20170405203548-dcf548fbe26d h1:XP4TAVUL3T/tgabod5IhtdKw9+c4EA0ohcJRrcJ8Wac=
-k8s.io/apiserver v0.0.0-20170405203548-dcf548fbe26d/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
-k8s.io/client-go v0.0.0-20170405202815-dabf37f5df16 h1:8wXro0xibfQm325zppHuzBYb70JwU2en+SWh63Yriqw=
-k8s.io/client-go v0.0.0-20170405202815-dabf37f5df16/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
diff --git a/archived/event-adapter/pkg/apiserver/apiserver.go b/archived/event-adapter/pkg/apiserver/apiserver.go
deleted file mode 100644
index ef71c28d7..000000000
--- a/archived/event-adapter/pkg/apiserver/apiserver.go
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package apiserver
-
-import (
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/provider"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/types"
- "k8s.io/apimachinery/pkg/apimachinery/announced"
- "k8s.io/apimachinery/pkg/apimachinery/registered"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/version"
- genericapiserver "k8s.io/apiserver/pkg/server"
-)
-
-var (
- groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
- registry = registered.NewOrDie("")
- // Scheme is a new scheme
- Scheme = runtime.NewScheme()
- // Codecs is a new CodecFactory
- Codecs = serializer.NewCodecFactory(Scheme)
-)
-
-func init() {
- types.Install(groupFactoryRegistry, registry, Scheme)
-
- // we need to add the options to empty v1
- // TODO fix the server code to avoid this
- metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
-
- // TODO: keep the generic API server from wanting this
- unversioned := schema.GroupVersion{Group: "", Version: "v1"}
- Scheme.AddUnversionedTypes(unversioned,
- &metav1.Status{},
- &metav1.APIVersions{},
- &metav1.APIGroupList{},
- &metav1.APIGroup{},
- &metav1.APIResourceList{},
- )
-}
-
-// Config contains a configuration for the api server
-type Config struct {
- GenericConfig *genericapiserver.Config
-}
-
-// EventsAdapterServer contains state for a Kubernetes cluster master/api server.
-type EventsAdapterServer struct {
- GenericAPIServer *genericapiserver.GenericAPIServer
- Provider provider.EventsProvider
-}
-
-type completedConfig struct {
- *Config
-}
-
-// Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
-func (c *Config) Complete() completedConfig {
- c.GenericConfig.Complete()
-
- c.GenericConfig.Version = &version.Info{
- Major: "1",
- Minor: "0",
- }
-
- return completedConfig{c}
-}
-
-// SkipComplete provides a way to construct a server instance without config completion.
-func (c *Config) SkipComplete() completedConfig {
- return completedConfig{c}
-}
-
-// New returns a new instance of EventsAdapterServer from the given config.
-func (c completedConfig) New(evProvider provider.EventsProvider) (*EventsAdapterServer, error) {
- genericServer, err := c.Config.GenericConfig.SkipComplete().New() // completion is done in Complete, no need for a second time
- if err != nil {
- return nil, err
- }
-
- s := &EventsAdapterServer{
- GenericAPIServer: genericServer,
- Provider: evProvider,
- }
-
- if err := s.InstallEventsAPI(); err != nil {
- return nil, err
- }
-
- return s, nil
-}
diff --git a/archived/event-adapter/pkg/apiserver/cmapis.go b/archived/event-adapter/pkg/apiserver/cmapis.go
deleted file mode 100644
index 6359faafe..000000000
--- a/archived/event-adapter/pkg/apiserver/cmapis.go
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package apiserver
-
-import (
- specificapi "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/apiserver/installer"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/provider"
- storage "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/registry"
- "k8s.io/apimachinery/pkg/apimachinery"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- genericapi "k8s.io/apiserver/pkg/endpoints"
- genericapiserver "k8s.io/apiserver/pkg/server"
-)
-
-// InstallEventsAPI registers the api server in Kube Aggregator
-func (s *EventsAdapterServer) InstallEventsAPI() error {
-
- groupMeta := registry.GroupOrDie("v1events")
-
- preferredVersionForDiscovery := metav1.GroupVersionForDiscovery{
- GroupVersion: groupMeta.GroupVersion.String(),
- Version: groupMeta.GroupVersion.Version,
- }
- groupVersion := metav1.GroupVersionForDiscovery{
- GroupVersion: groupMeta.GroupVersion.String(),
- Version: groupMeta.GroupVersion.Version,
- }
- apiGroup := metav1.APIGroup{
- Name: groupMeta.GroupVersion.String(),
- Versions: []metav1.GroupVersionForDiscovery{groupVersion},
- PreferredVersion: preferredVersionForDiscovery,
- }
-
- evAPI := s.evAPI(groupMeta, &groupMeta.GroupVersion)
-
- if err := evAPI.InstallREST(s.GenericAPIServer.HandlerContainer.Container); err != nil {
- return err
- }
-
- path := genericapiserver.APIGroupPrefix + "/" + groupMeta.GroupVersion.Group
- s.GenericAPIServer.HandlerContainer.Add(genericapi.NewGroupWebService(s.GenericAPIServer.Serializer, path, apiGroup))
-
- return nil
-}
-
-func (s *EventsAdapterServer) evAPI(groupMeta *apimachinery.GroupMeta, groupVersion *schema.GroupVersion) *specificapi.EventsAPIGroupVersion {
- resourceStorage := storage.NewREST(s.Provider)
-
- return &specificapi.EventsAPIGroupVersion{
- DynamicStorage: resourceStorage,
- APIGroupVersion: &genericapi.APIGroupVersion{
- Root: genericapiserver.APIGroupPrefix,
- GroupVersion: *groupVersion,
-
- ParameterCodec: metav1.ParameterCodec,
- Serializer: Codecs,
- Creater: Scheme,
- Convertor: Scheme,
- UnsafeConvertor: runtime.UnsafeObjectConvertor(Scheme),
- Copier: Scheme,
- Typer: Scheme,
- Linker: groupMeta.SelfLinker,
- Mapper: groupMeta.RESTMapper,
-
- Context: s.GenericAPIServer.RequestContextMapper(),
- MinRequestTimeout: s.GenericAPIServer.MinRequestTimeout(),
- OptionsExternalVersion: &schema.GroupVersion{Version: "v1"},
-
- ResourceLister: provider.NewResourceLister(s.Provider),
- },
- }
-}
diff --git a/archived/event-adapter/pkg/apiserver/installer/apiserver_test.go b/archived/event-adapter/pkg/apiserver/installer/apiserver_test.go
deleted file mode 100644
index fe97a2c47..000000000
--- a/archived/event-adapter/pkg/apiserver/installer/apiserver_test.go
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package installer
-
-import (
- "fmt"
- "github.com/emicklei/go-restful"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "testing"
-
- "k8s.io/apimachinery/pkg/apimachinery"
- "k8s.io/apimachinery/pkg/apimachinery/announced"
- "k8s.io/apimachinery/pkg/apimachinery/registered"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- genericapi "k8s.io/apiserver/pkg/endpoints"
- "k8s.io/apiserver/pkg/endpoints/request"
- genericapiserver "k8s.io/apiserver/pkg/server"
-
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/provider"
- restorage "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/registry"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/types"
- api "k8s.io/client-go/pkg/api/v1"
-)
-
-// defaultAPIServer exposes nested objects for testability.
-type defaultAPIServer struct {
- http.Handler
- container *restful.Container
-}
-
-type NotFoundError struct {
- event string
- namespace string
-}
-
-func (e NotFoundError) Error() string {
- return fmt.Sprintf("Event %s not found in namespace %s", e.event, e.namespace)
-}
-
-func (e NotFoundError) Status() metav1.Status {
- return metav1.Status{
- Code: 404,
- }
-}
-
-var (
- groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
- registry = registered.NewOrDie("")
- Scheme = runtime.NewScheme()
- Codecs = serializer.NewCodecFactory(Scheme)
- prefix = genericapiserver.APIGroupPrefix
- groupVersion schema.GroupVersion
- groupMeta *apimachinery.GroupMeta
-)
-
-func init() {
- types.Install(groupFactoryRegistry, registry, Scheme)
-
- // we need to add the options to empty v1
- // TODO fix the server code to avoid this
- metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
-
- // TODO: keep the generic API server from wanting this
- unversioned := schema.GroupVersion{Group: "", Version: "v1"}
- Scheme.AddUnversionedTypes(unversioned,
- &metav1.Status{},
- &metav1.APIVersions{},
- &metav1.APIGroupList{},
- &metav1.APIGroup{},
- &metav1.APIResourceList{},
- )
-
- groupMeta = registry.GroupOrDie(types.GroupName)
- groupVersion = groupMeta.GroupVersion
-}
-
-func extractBodyString(response *http.Response) (string, error) {
- defer response.Body.Close()
- body, err := ioutil.ReadAll(response.Body)
- if err != nil {
- return "", err
- }
- return string(body), err
-}
-func handle(prov provider.EventsProvider) http.Handler {
- container := restful.NewContainer()
- container.Router(restful.CurlyRouter{})
- mux := container.ServeMux
- resourceStorage := restorage.NewREST(prov)
- group := EventsAPIGroupVersion{
- DynamicStorage: resourceStorage,
- APIGroupVersion: &genericapi.APIGroupVersion{
- Root: prefix,
- GroupVersion: groupVersion,
-
- ParameterCodec: metav1.ParameterCodec,
- Serializer: Codecs,
- Creater: Scheme,
- Convertor: Scheme,
- UnsafeConvertor: runtime.UnsafeObjectConvertor(Scheme),
- Copier: Scheme,
- Typer: Scheme,
- Linker: groupMeta.SelfLinker,
- Mapper: groupMeta.RESTMapper,
-
- Context: request.NewRequestContextMapper(),
- OptionsExternalVersion: &schema.GroupVersion{Version: "v1"},
-
- ResourceLister: provider.NewResourceLister(prov),
- },
- }
- if err := group.InstallREST(container); err != nil {
- panic(fmt.Sprintf("unable to install container %s: %v", group.GroupVersion, err))
- }
- return &defaultAPIServer{mux, container}
-}
-
-type fakeProvider struct{}
-
-func (p *fakeProvider) GetNamespacedEventsByName(namespace, name string) (*api.Event, error) {
- if namespace == "default" && name == "existing_event" {
- return &api.Event{}, nil
- }
-
- err := NotFoundError{
- event: name,
- namespace: namespace,
- }
-
- if namespace == "default" && name == "not_existing_event" {
- return nil, err
- }
-
- if namespace == "foo" && name == "foo" {
- return nil, err
- }
-
- return nil, fmt.Errorf("Namespace : %s, event name: %s", namespace, name)
-}
-
-func (p *fakeProvider) ListAllEventsByNamespace(namespace string) (*api.EventList, error) {
- return &api.EventList{}, nil
-}
-
-func (p *fakeProvider) ListAllEvents() (*api.EventList, error) {
- return &api.EventList{}, nil
-}
-
-func (p *fakeProvider) CreateNewEvent(namespace string) (*api.Event, error) {
- return &api.Event{}, nil
-}
-
-func TestEventsAPI(t *testing.T) {
- type T struct {
- Method string
- Path string
- Status int
- }
-
- group := "v1events/v1alpha1"
- cases := map[string]T{
- "GET list of events ": {"GET", prefix + "/" + group + "/namespaces/foo/events", http.StatusOK},
- "GET list of events wrong path": {"GET", prefix + "/" + group + "/namespaces/default/foo", http.StatusNotFound},
-
- "GET event by name": {"GET", prefix + "/" + group + "/namespaces/default/events/existing_event", http.StatusOK},
- "GET not existing event by name": {"GET", prefix + "/" + group + "/namespaces/default/events/not_existing_event", http.StatusNotFound},
- "GET not existing event and namespace": {"GET", prefix + "/" + group + "/namespaces/foo/events/foo", http.StatusNotFound},
- "GET event by name wrong path": {"GET", prefix + "/" + group + "/namespaces/default/eve/foo", http.StatusNotFound},
-
- "GET event with too long path": {"GET", prefix + "/" + group + "/namespaces/default/events/foo/foo", http.StatusNotFound},
- "GET event only with namespace": {"GET", prefix + "/" + group + "/namespaces/default", http.StatusNotFound},
-
- "GET event with any namespaces": {"GET", prefix + "/" + group + "/events/foo", http.StatusNotFound},
-
- "GET no namespace": {"GET", prefix + "/" + group + "/foo/default/events/foo", http.StatusNotFound},
- "GET wrong prefix": {"GET", "//apis/v1foo/v1alpha1/", http.StatusNotFound},
-
- "GET list all events": {"GET", prefix + "/" + group + "/events", http.StatusOK},
- "GET list all events with typo": {"GET", prefix + "/" + group + "/foo", http.StatusNotFound},
-
- "POST create a new event": {"POST", prefix + "/" + group + "/namespaces/default/events", http.StatusOK},
- "POST create a new event without namespace": {"POST", prefix + "/" + group + "/events", http.StatusMethodNotAllowed},
- "POST create a new event giving name": {"POST", prefix + "/" + group + "/namespaces/default/events/foo", http.StatusMethodNotAllowed},
- "POST prefix": {"POST", prefix + "/" + group, http.StatusMethodNotAllowed},
-
- "POST no namespace": {"POST", prefix + "/" + group + "/foo/default/events", http.StatusNotFound},
- "POST no events": {"POST", prefix + "/" + group + "/namespaces/default/foo", http.StatusNotFound},
- "POST wrong prefix": {"POST", "//apis/v1foo/v1alpha1/", http.StatusNotFound},
- }
-
- prov := &fakeProvider{}
- server := httptest.NewServer(handle(prov))
- defer server.Close()
- client := http.Client{}
-
- for k, v := range cases {
-
- request, err := http.NewRequest(v.Method, server.URL+v.Path, nil)
-
- if err != nil {
- t.Fatalf("unexpected error (%s): %v", k, err)
- }
-
- response, err := client.Do(request)
- if err != nil {
- t.Errorf("unexpected error (%s): %v", k, err)
- continue
- }
-
- if response.StatusCode != v.Status {
- body, err := extractBodyString(response)
- bodyPart := body
- if err != nil {
- bodyPart = fmt.Sprintf("[error extracting body: %v]", err)
- }
- t.Errorf("request: %v", request)
- t.Errorf("Expected %d for %s (%s), Got %#v -- %s", v.Status, v.Method, k, response, bodyPart)
- }
- }
-
-}
diff --git a/archived/event-adapter/pkg/apiserver/installer/context/context.go b/archived/event-adapter/pkg/apiserver/installer/context/context.go
deleted file mode 100644
index c3b8b5e5b..000000000
--- a/archived/event-adapter/pkg/apiserver/installer/context/context.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package context
-
-import (
- "k8s.io/apiserver/pkg/endpoints/request"
-)
-
-// requestInformation holds the resource and method for a request in the context.
-type requestInformation struct {
- resource string
- method string
-}
-
-type requestListInformation struct {
- method string
-}
-
-// contextKey is the type of the keys for the context in this file.
-// It's private to avoid conflicts across packages.
-type contextKey int
-
-const resourceKey contextKey = iota
-
-// WithRequestInformation returns a copy of parent in which the resource and method values are set
-func WithRequestInformation(parent request.Context, resource, method string) request.Context {
- return request.WithValue(parent, resourceKey, requestInformation{resource, method})
-}
-
-// WithRequestListInformation returns a copy of parent in which the method values is set
-func WithRequestListInformation(parent request.Context, method string) request.Context {
- return request.WithValue(parent, resourceKey, requestListInformation{method})
-}
-
-// RequestInformationFrom returns resource and method on the ctx
-func RequestInformationFrom(ctx request.Context) (resource string, method string, ok bool) {
- requestInfo, ok := ctx.Value(resourceKey).(requestInformation)
- if !ok {
- return "", "", ok
- }
- return requestInfo.resource, requestInfo.method, ok
-}
-
-// RequestListInformationFrom returns method on the ctx
-func RequestListInformationFrom(ctx request.Context) (method string, ok bool) {
- requestInfo, ok := ctx.Value(resourceKey).(requestListInformation)
- if !ok {
- return "", ok
- }
- return requestInfo.method, ok
-}
diff --git a/archived/event-adapter/pkg/apiserver/installer/installer.go b/archived/event-adapter/pkg/apiserver/installer/installer.go
deleted file mode 100644
index 8da10d4d0..000000000
--- a/archived/event-adapter/pkg/apiserver/installer/installer.go
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package installer
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "net/url"
- gpath "path"
- "reflect"
- "strings"
- "time"
-
- restful "github.com/emicklei/go-restful"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/conversion"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apiserver/pkg/endpoints"
- "k8s.io/apiserver/pkg/endpoints/handlers"
- "k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
- "k8s.io/apiserver/pkg/endpoints/request"
- "k8s.io/apiserver/pkg/registry/rest"
-
- specificcontext "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/apiserver/installer/context"
-)
-
-// NB: the contents of this file should mostly be a subset of the functionality
-// in "k8s.io/apiserver/pkg/endpoints". It would be nice to eventual figure out
-// a way to not have to recreate/copy a bunch of the structure from the normal API
-// installer, so that this trivially tracks changes to the main installer.
-
-// EventsAPIGroupVersion is similar to "k8s.io/apiserver/pkg/endpoints".APIGroupVersion,
-// except that it installs the metrics REST handlers, which use wildcard resources
-// and subresources.
-//
-// This basically only serves the limitted use case required by the metrics API server --
-// the only verb accepted is GET (and perhaps WATCH in the future).
-type EventsAPIGroupVersion struct {
- DynamicStorage rest.Storage
-
- *endpoints.APIGroupVersion
-}
-
-// InstallREST registers the dynamic REST handlers into a restful Container.
-// It is expected that the provided path root prefix will serve all operations. Root MUST
-// NOT end in a slash. It should mirror InstallREST in the plain APIGroupVersion.
-func (g *EventsAPIGroupVersion) InstallREST(container *restful.Container) error {
- installer := g.newDynamicInstaller()
- ws := installer.NewWebService()
-
- registrationErrors := installer.Install(ws)
- lister := g.ResourceLister
- if lister == nil {
- return fmt.Errorf("must provide a dynamic lister for dynamic API groups")
- }
- endpoints.AddSupportedResourcesWebService(g.Serializer, ws, g.GroupVersion, lister)
- container.Add(ws)
- return utilerrors.NewAggregate(registrationErrors)
-}
-
-// newDynamicInstaller is a helper to create the installer. It mirrors
-// newInstaller in APIGroupVersion.
-func (g *EventsAPIGroupVersion) newDynamicInstaller() *EventsAPIInstaller {
- prefix := gpath.Join(g.Root, g.GroupVersion.Group, g.GroupVersion.Version)
- installer := &EventsAPIInstaller{
- group: g,
- prefix: prefix,
- minRequestTimeout: g.MinRequestTimeout,
- }
-
- return installer
-}
-
-// EventsAPIInstaller is a specialized API installer for the metrics API.
-// It is intended to be fully compliant with the Kubernetes API server conventions,
-// but serves wildcard resource/subresource routes instead of hard-coded resources
-// and subresources.
-type EventsAPIInstaller struct {
- group *EventsAPIGroupVersion
- prefix string // Path prefix where API resources are to be registered.
- minRequestTimeout time.Duration
-
- // TODO: do we want to embed a normal API installer here so we can serve normal
- // endpoints side by side with dynamic ones (from the same API group)?
-}
-
-// Install installs handlers for API resources.
-func (a *EventsAPIInstaller) Install(ws *restful.WebService) (errors []error) {
- errors = make([]error, 0)
-
- err := a.registerResourceHandlers(a.group.DynamicStorage, ws)
- if err != nil {
- errors = append(errors, fmt.Errorf("error in registering the resource: %v", err))
- }
-
- return errors
-}
-
-// NewWebService creates a new restful webservice with the api installer's prefix and version.
-func (a *EventsAPIInstaller) NewWebService() *restful.WebService {
- ws := new(restful.WebService)
- ws.Path(a.prefix)
- // a.prefix contains "prefix/group/version"
- ws.Doc("API at " + a.prefix)
- // Backwards compatibility, we accepted objects with empty content-type at V1.
- // If we stop using go-restful, we can default empty content-type to application/json on an
- // endpoint by endpoint basis
- ws.Consumes("*/*")
- mediaTypes, streamMediaTypes := negotiation.MediaTypesForSerializer(a.group.Serializer)
- ws.Produces(append(mediaTypes, streamMediaTypes...)...)
- ws.ApiVersion(a.group.GroupVersion.String())
-
- return ws
-}
-
-// registerResourceHandlers registers the resource handlers for events.
-// Compared to the normal installer, this plays fast and loose a bit, but should still
-// follow the API conventions.
-func (a *EventsAPIInstaller) registerResourceHandlers(storage rest.Storage, ws *restful.WebService) error {
- context := a.group.Context
-
- optionsExternalVersion := a.group.GroupVersion
- if a.group.OptionsExternalVersion != nil {
- optionsExternalVersion = *a.group.OptionsExternalVersion
- }
-
- mapping, err := a.restMapping()
- if err != nil {
- return err
- }
-
- fqKindToRegister, err := a.getResourceKind(storage)
- if err != nil {
- return err
- }
-
- kind := fqKindToRegister.Kind
-
- lister := storage.(rest.Lister)
- list := lister.NewList()
- listGVKs, _, err := a.group.Typer.ObjectKinds(list)
- if err != nil {
- return err
- }
- versionedListPtr, err := a.group.Creater.New(a.group.GroupVersion.WithKind(listGVKs[0].Kind))
- if err != nil {
- return err
- }
- versionedList := indirectArbitraryPointer(versionedListPtr)
-
- versionedListOptions, err := a.group.Creater.New(optionsExternalVersion.WithKind("ListOptions"))
- if err != nil {
- return err
- }
-
- scope := mapping.Scope
- nameParam := ws.PathParameter("name", "name of the described event").DataType("string")
- namespaceParam := ws.PathParameter(scope.ArgumentName(), scope.ParamDescription()).DataType("string")
-
- namespacedParams := []*restful.Parameter{
- nameParam,
- namespaceParam,
- }
-
- // REGISTER: BY NAME & NAMESPACE
- namespacedPath := scope.ParamName() + "/{" + scope.ArgumentName() + "}/events/{name}"
- mediaTypes, streamMediaTypes := negotiation.MediaTypesForSerializer(a.group.Serializer)
- allMediaTypes := append(mediaTypes, streamMediaTypes...)
- ws.Produces(allMediaTypes...)
- reqScope := handlers.RequestScope{
- Serializer: a.group.Serializer,
- ParameterCodec: a.group.ParameterCodec,
- Creater: a.group.Creater,
- Convertor: a.group.Convertor,
- Copier: a.group.Copier,
- Typer: a.group.Typer,
- UnsafeConvertor: a.group.UnsafeConvertor,
- // TODO: This seems wrong for cross-group subresources. It makes an assumption that a subresource and its parent are in the same group version. Revisit this.
- Resource: a.group.GroupVersion.WithResource("*"),
- Subresource: "*",
- Kind: fqKindToRegister,
- MetaGroupVersion: metav1.SchemeGroupVersion,
- }
- itemPathPrefix := gpath.Join(a.prefix, scope.ParamName()) + "/"
- itemPathMiddle := "/events/"
- itemPathFn := func(name, namespace string) bytes.Buffer {
- var buf bytes.Buffer
- buf.WriteString(itemPathPrefix)
- buf.WriteString(url.QueryEscape(name))
- buf.WriteString(itemPathMiddle)
- buf.WriteString(url.QueryEscape(namespace))
- return buf
- }
- ctxFn := func(req *restful.Request) request.Context {
- var ctx request.Context
- if ctx != nil {
- if existingCtx, ok := context.Get(req.Request); ok {
- ctx = existingCtx
- }
- }
- if ctx == nil {
- ctx = request.NewContext()
- }
- ctx = request.WithUserAgent(ctx, req.HeaderParameter("User-Agent"))
- name := req.PathParameter("name")
- ctx = specificcontext.WithRequestInformation(ctx, name, "GET")
- return ctx
- }
- reqScope.ContextFunc = ctxFn
- if a.group.MetaGroupVersion != nil {
- reqScope.MetaGroupVersion = *a.group.MetaGroupVersion
- }
- // install the namespace-scoped route
- reqScope.Namer = scopeNaming{scope, a.group.Linker, itemPathFn, false}
- namespacedHandler := handlers.ListResource(lister, nil, reqScope, false, a.minRequestTimeout)
- doc := "get event with the given name and namespace"
- namespacedRoute := ws.GET(namespacedPath).To(namespacedHandler).
- Doc(doc).
- Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed.")).
- Operation("listNamespaced"+kind).
- Produces(allMediaTypes...).
- Returns(http.StatusOK, "OK", versionedList).
- Writes(versionedList)
- if err := addObjectParams(ws, namespacedRoute, versionedListOptions); err != nil {
- return err
- }
- addParams(namespacedRoute, namespacedParams)
- ws.Route(namespacedRoute)
-
- //PATH namespaces/{namespace}/events/{eventName}
- namespacedListPath := scope.ParamName() + "/{" + scope.ArgumentName() + "}/events"
- namespacedListParams := []*restful.Parameter{
- namespaceParam,
- }
- docList := map[string]string{
- "GET": "list events with the given namespace",
- "POST": "create an event with the given namepsace",
- }
- itemPathListPrefix := gpath.Join(a.prefix, scope.ParamName()) + "/"
- itemPathListMiddle := "/events"
- itemPathListFn := func(name, namespace string) bytes.Buffer {
- var buf bytes.Buffer
- buf.WriteString(itemPathListPrefix)
- buf.WriteString(url.QueryEscape(namespace))
- buf.WriteString(itemPathListMiddle)
- return buf
- }
- methods := map[string]func(ws *restful.WebService, path string) *restful.RouteBuilder{
- "GET": func(ws *restful.WebService, path string) *restful.RouteBuilder {
- return ws.GET(path)
- },
- "POST": func(ws *restful.WebService, path string) *restful.RouteBuilder {
- return ws.POST(path)
- },
- }
- for k, v := range methods {
- method := k
- namespacedCtxFn := func(req *restful.Request) request.Context {
- var ctx request.Context
- if ctx != nil {
- if existingCtx, ok := context.Get(req.Request); ok {
- ctx = existingCtx
- }
- }
- if ctx == nil {
- ctx = request.NewContext()
- }
-
- ctx = request.WithUserAgent(ctx, req.HeaderParameter("User-Agent"))
- ctx = specificcontext.WithRequestListInformation(ctx, method)
- return ctx
- }
- reqScope.ContextFunc = namespacedCtxFn
- reqScope.Namer = scopeNaming{scope, a.group.Linker, itemPathListFn, false}
- namespacedHandler := handlers.ListResource(lister, nil, reqScope, false, a.minRequestTimeout)
- routeBuilder := v(ws, namespacedListPath)
- namespacedRoute := routeBuilder.To(namespacedHandler).
- Doc(docList[method]).
- Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed.")).
- Produces(allMediaTypes...).
- Returns(http.StatusOK, "OK", versionedList).
- Writes(versionedList)
- if err := addObjectParams(ws, namespacedRoute, versionedListOptions); err != nil {
- return err
- }
- addParams(namespacedRoute, namespacedListParams)
- ws.Route(namespacedRoute)
- }
-
- //LIST ALL EVENTS
- eventsListPath := "events"
- ctxFnList := func(req *restful.Request) request.Context {
- var ctx request.Context
- if ctx != nil {
- if existingCtx, ok := context.Get(req.Request); ok {
- ctx = existingCtx
- }
- }
- if ctx == nil {
- ctx = request.NewContext()
- }
- ctx = request.WithUserAgent(ctx, req.HeaderParameter("User-Agent"))
- ctx = specificcontext.WithRequestListInformation(ctx, "GET")
- return ctx
- }
- reqScope.ContextFunc = ctxFnList
- reqScope.Namer = rootScopeNaming{scope, a.group.Linker, a.prefix, eventsListPath}
- rootScopedHandler := handlers.ListResource(lister, nil, reqScope, false, a.minRequestTimeout)
- doc = "list all the events"
- rootScopedRoute := ws.GET(eventsListPath).To(rootScopedHandler).
- Doc(doc).
- Param(ws.QueryParameter("pretty", "If 'true', then the output is pretty printed.")).
- Operation("listNamespaced"+kind).
- Produces(allMediaTypes...).
- Returns(http.StatusOK, "OK", versionedList).
- Writes(versionedList)
- if err := addObjectParams(ws, rootScopedRoute, versionedListOptions); err != nil {
- return err
- }
- ws.Route(rootScopedRoute)
-
- return nil
-}
-
-// This magic incantation returns *ptrToObject for an arbitrary pointer
-func indirectArbitraryPointer(ptrToObject interface{}) interface{} {
- return reflect.Indirect(reflect.ValueOf(ptrToObject)).Interface()
-}
-
-// getResourceKind returns the external group version kind registered for the given storage object.
-func (a *EventsAPIInstaller) getResourceKind(storage rest.Storage) (schema.GroupVersionKind, error) {
- object := storage.New()
- fqKinds, _, err := a.group.Typer.ObjectKinds(object)
- if err != nil {
- return schema.GroupVersionKind{}, err
- }
-
- // a given go type can have multiple potential fully qualified kinds. Find the one that corresponds with the group
- // we're trying to register here
- fqKindToRegister := schema.GroupVersionKind{}
- for _, fqKind := range fqKinds {
- if fqKind.Group == a.group.GroupVersion.Group {
- fqKindToRegister = a.group.GroupVersion.WithKind(fqKind.Kind)
- break
- }
-
- // TODO: keep rid of extensions api group dependency here
- // This keeps it doing what it was doing before, but it doesn't feel right.
- if fqKind.Group == "extensions" && fqKind.Kind == "ThirdPartyResourceData" {
- fqKindToRegister = a.group.GroupVersion.WithKind(fqKind.Kind)
- }
- }
- if fqKindToRegister.Empty() {
- return schema.GroupVersionKind{}, fmt.Errorf("unable to locate fully qualified kind for %v: found %v when registering for %v", reflect.TypeOf(object), fqKinds, a.group.GroupVersion)
- }
- return fqKindToRegister, nil
-}
-
-// restMapping returns rest mapper for the resource provided by DynamicStorage.
-func (a *EventsAPIInstaller) restMapping() (*meta.RESTMapping, error) {
- // subresources must have parent resources, and follow the namespacing rules of their parent.
- // So get the storage of the resource (which is the parent resource in case of subresources)
- fqKindToRegister, err := a.getResourceKind(a.group.DynamicStorage)
- if err != nil {
- return nil, fmt.Errorf("unable to locate fully qualified kind for mapper resource for dynamic storage: %v", err)
- }
- return a.group.Mapper.RESTMapping(fqKindToRegister.GroupKind(), fqKindToRegister.Version)
-}
-
-func addParams(route *restful.RouteBuilder, params []*restful.Parameter) {
- for _, param := range params {
- route.Param(param)
- }
-}
-
-// addObjectParams converts a runtime.Object into a set of go-restful Param() definitions on the route.
-// The object must be a pointer to a struct; only fields at the top level of the struct that are not
-// themselves interfaces or structs are used; only fields with a json tag that is non empty (the standard
-// Go JSON behavior for omitting a field) become query parameters. The name of the query parameter is
-// the JSON field name. If a description struct tag is set on the field, that description is used on the
-// query parameter. In essence, it converts a standard JSON top level object into a query param schema.
-func addObjectParams(ws *restful.WebService, route *restful.RouteBuilder, obj interface{}) error {
- sv, err := conversion.EnforcePtr(obj)
- if err != nil {
- return err
- }
- st := sv.Type()
- switch st.Kind() {
- case reflect.Struct:
- for i := 0; i < st.NumField(); i++ {
- name := st.Field(i).Name
- sf, ok := st.FieldByName(name)
- if !ok {
- continue
- }
- switch sf.Type.Kind() {
- case reflect.Interface, reflect.Struct:
- case reflect.Ptr:
- // TODO: This is a hack to let metav1.Time through. This needs to be fixed in a more generic way eventually. bug #36191
- if (sf.Type.Elem().Kind() == reflect.Interface || sf.Type.Elem().Kind() == reflect.Struct) && strings.TrimPrefix(sf.Type.String(), "*") != "metav1.Time" {
- continue
- }
- fallthrough
- default:
- jsonTag := sf.Tag.Get("json")
- if len(jsonTag) == 0 {
- continue
- }
- jsonName := strings.SplitN(jsonTag, ",", 2)[0]
- if len(jsonName) == 0 {
- continue
- }
-
- var desc string
- if docable, ok := obj.(documentable); ok {
- desc = docable.SwaggerDoc()[jsonName]
- }
- route.Param(ws.QueryParameter(jsonName, desc).DataType(typeToJSON(sf.Type.String())))
- }
- }
- }
- return nil
-}
-
-// TODO: this is incomplete, expand as needed.
-// Convert the name of a golang type to the name of a JSON type
-func typeToJSON(typeName string) string {
- switch typeName {
- case "bool", "*bool":
- return "boolean"
- case "uint8", "*uint8", "int", "*int", "int32", "*int32", "int64", "*int64", "uint32", "*uint32", "uint64", "*uint64":
- return "integer"
- case "float64", "*float64", "float32", "*float32":
- return "number"
- case "metav1.Time", "*metav1.Time":
- return "string"
- case "byte", "*byte":
- return "string"
- case "v1.DeletionPropagation", "*v1.DeletionPropagation":
- return "string"
-
- // TODO: Fix these when go-restful supports a way to specify an array query param:
- // https://github.com/emicklei/go-restful/issues/225
- case "[]string", "[]*string":
- return "string"
- case "[]int32", "[]*int32":
- return "integer"
-
- default:
- return typeName
- }
-}
-
-// rootScopeNaming reads only names from a request and ignores namespaces. It implements ScopeNamer
-// for root scoped resources.
-type rootScopeNaming struct {
- scope meta.RESTScope
- runtime.SelfLinker
- pathPrefix string
- pathSuffix string
-}
-
-// rootScopeNaming implements ScopeNamer
-var _ handlers.ScopeNamer = rootScopeNaming{}
-
-// Namespace returns an empty string because root scoped objects have no namespace.
-func (n rootScopeNaming) Namespace(req *restful.Request) (namespace string, err error) {
- return "", nil
-}
-
-// Name returns the name from the path and an empty string for namespace, or an error if the
-// name is empty.
-func (n rootScopeNaming) Name(req *restful.Request) (namespace, name string, err error) {
- name = req.PathParameter("name")
- if len(name) == 0 {
- return "", "", errEmptyName
- }
- return "", name, nil
-}
-
-// GenerateLink returns the appropriate path and query to locate an object by its canonical path.
-func (n rootScopeNaming) GenerateLink(req *restful.Request, obj runtime.Object) (uri string, err error) {
- _, name, err := n.ObjectName(obj)
- if err != nil {
- return "", err
- }
- if len(name) == 0 {
- _, name, err = n.Name(req)
- if err != nil {
- return "", err
- }
- }
- return n.pathPrefix + url.QueryEscape(name) + n.pathSuffix, nil
-}
-
-// GenerateListLink returns the appropriate path and query to locate a list by its canonical path.
-func (n rootScopeNaming) GenerateListLink(req *restful.Request) (uri string, err error) {
- if len(req.Request.URL.RawPath) > 0 {
- return req.Request.URL.RawPath, nil
- }
- return req.Request.URL.EscapedPath(), nil
-}
-
-// ObjectName returns the name set on the object, or an error if the
-// name cannot be returned. Namespace is empty
-// TODO: distinguish between objects with name/namespace and without via a specific error.
-func (n rootScopeNaming) ObjectName(obj runtime.Object) (namespace, name string, err error) {
- name, err = n.SelfLinker.Name(obj)
- if err != nil {
- return "", "", err
- }
- if len(name) == 0 {
- return "", "", errEmptyName
- }
- return "", name, nil
-}
-
-// scopeNaming returns naming information from a request. It implements ScopeNamer for
-// namespace scoped resources.
-type scopeNaming struct {
- scope meta.RESTScope
- runtime.SelfLinker
- itemPathFn func(name, namespace string) bytes.Buffer
- allNamespaces bool
-}
-
-// scopeNaming implements ScopeNamer
-var _ handlers.ScopeNamer = scopeNaming{}
-
-// Namespace returns the namespace from the path or the default.
-func (n scopeNaming) Namespace(req *restful.Request) (namespace string, err error) {
- if n.allNamespaces {
- return "", nil
- }
- namespace = req.PathParameter(n.scope.ArgumentName())
- if len(namespace) == 0 {
- // a URL was constructed without the namespace, or this method was invoked
- // on an object without a namespace path parameter.
- return "", fmt.Errorf("no namespace parameter found on request")
- }
- return namespace, nil
-}
-
-// Name returns the name from the path, the namespace (or default), or an error if the
-// name is empty.
-func (n scopeNaming) Name(req *restful.Request) (namespace, name string, err error) {
- namespace, _ = n.Namespace(req)
- name = req.PathParameter("name")
- if len(name) == 0 {
- return "", "", errEmptyName
- }
- return
-}
-
-// GenerateLink returns the appropriate path and query to locate an object by its canonical path.
-func (n scopeNaming) GenerateLink(req *restful.Request, obj runtime.Object) (uri string, err error) {
- namespace, name, err := n.ObjectName(obj)
- if err != nil {
- return "", err
- }
- if len(namespace) == 0 && len(name) == 0 {
- namespace, name, err = n.Name(req)
- if err != nil {
- return "", err
- }
- }
- if len(name) == 0 {
- return "", errEmptyName
- }
- result := n.itemPathFn(name, namespace)
- return result.String(), nil
-}
-
-// GenerateListLink returns the appropriate path and query to locate a list by its canonical path.
-func (n scopeNaming) GenerateListLink(req *restful.Request) (uri string, err error) {
- if len(req.Request.URL.RawPath) > 0 {
- return req.Request.URL.RawPath, nil
- }
- return req.Request.URL.EscapedPath(), nil
-}
-
-// ObjectName returns the name and namespace set on the object, or an error if the
-// name cannot be returned.
-// TODO: distinguish between objects with name/namespace and without via a specific error.
-func (n scopeNaming) ObjectName(obj runtime.Object) (namespace, name string, err error) {
- name, err = n.SelfLinker.Name(obj)
- if err != nil {
- return "", "", err
- }
- namespace, err = n.SelfLinker.Namespace(obj)
- if err != nil {
- return "", "", err
- }
- return namespace, name, err
-}
-
-// An interface to see if an object supports swagger documentation as a method
-type documentable interface {
- SwaggerDoc() map[string]string
-}
-
-// errEmptyName is returned when API requests do not fill the name section of the path.
-var errEmptyName = errors.NewBadRequest("name must be provided")
diff --git a/archived/event-adapter/pkg/apiserver/installer/installer_test.go b/archived/event-adapter/pkg/apiserver/installer/installer_test.go
deleted file mode 100644
index 53ae01ae4..000000000
--- a/archived/event-adapter/pkg/apiserver/installer/installer_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package installer
-
-import (
- "bytes"
- "testing"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/pkg/api"
-
- "github.com/emicklei/go-restful"
-)
-
-type setTestSelfLinker struct {
- t *testing.T
- expectedSet string
- name string
- namespace string
- called bool
- err error
-}
-
-func (s *setTestSelfLinker) Namespace(runtime.Object) (string, error) { return s.namespace, s.err }
-func (s *setTestSelfLinker) Name(runtime.Object) (string, error) { return s.name, s.err }
-func (s *setTestSelfLinker) SelfLink(runtime.Object) (string, error) { return "", s.err }
-func (s *setTestSelfLinker) SetSelfLink(obj runtime.Object, selfLink string) error {
- if e, a := s.expectedSet, selfLink; e != a {
- s.t.Errorf("expected '%v', got '%v'", e, a)
- }
- s.called = true
- return s.err
-}
-
-func TestScopeNamingGenerateLink(t *testing.T) {
- selfLinker := &setTestSelfLinker{
- t: t,
- expectedSet: "/apis/v1events/v1alpha/namespaces/other/events/foo",
- name: "foo",
- namespace: "other",
- }
- s := scopeNaming{
- meta.RESTScopeNamespace,
- selfLinker,
- func(name, namespace string) bytes.Buffer {
- return *bytes.NewBufferString("/api/v1events/v1alpha/namespaces/" + namespace + "/events/" + name)
- },
- true,
- }
- service := &api.Service{
- ObjectMeta: metav1.ObjectMeta{
- Name: "foo",
- Namespace: "other",
- },
- TypeMeta: metav1.TypeMeta{
- Kind: "Service",
- },
- }
- _, err := s.GenerateLink(&restful.Request{}, service)
- if err != nil {
- t.Errorf("Unexpected error %v", err)
- }
-}
diff --git a/archived/event-adapter/pkg/cmd/server/start.go b/archived/event-adapter/pkg/cmd/server/start.go
deleted file mode 100644
index 3bcc0a412..000000000
--- a/archived/event-adapter/pkg/cmd/server/start.go
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package server
-
-import (
- "fmt"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/apiserver"
- "io"
- genericapiserver "k8s.io/apiserver/pkg/server"
- genericoptions "k8s.io/apiserver/pkg/server/options"
- "net"
-)
-
-// EventsAdapterServerOptions stores a configuration for events adapter
-type EventsAdapterServerOptions struct {
- // genericoptions.ReccomendedOptions - EtcdOptions
- SecureServing *genericoptions.SecureServingOptions
- Authentication *genericoptions.DelegatingAuthenticationOptions
- Authorization *genericoptions.DelegatingAuthorizationOptions
- Features *genericoptions.FeatureOptions
-
- StdOut io.Writer
- StdErr io.Writer
-}
-
-// NewEventsAdapterServerOptions creates a EventsAdapterServerOptions for provided output interface
-func NewEventsAdapterServerOptions(out, errOut io.Writer) *EventsAdapterServerOptions {
- o := &EventsAdapterServerOptions{
- SecureServing: genericoptions.NewSecureServingOptions(),
- Authentication: genericoptions.NewDelegatingAuthenticationOptions(),
- Authorization: genericoptions.NewDelegatingAuthorizationOptions(),
- Features: genericoptions.NewFeatureOptions(),
-
- StdOut: out,
- StdErr: errOut,
- }
-
- return o
-}
-
-// Validate validates EventsAdapterServerOptions. Currently all fields are correctly set in
-// NewsAdapterServerOptions, so this is a no-op.
-func (o EventsAdapterServerOptions) Validate(args []string) error {
- return nil
-}
-
-// Complete fills in any fields not set that are required to have valid data. Currently all fields
-// are set by NewEventsAdapterServerOptions, so this is a no-op.
-func (o *EventsAdapterServerOptions) Complete() error {
- return nil
-}
-
-// Config returns apiserver.Config object from EventsAdapterServerOptions.
-func (o EventsAdapterServerOptions) Config() (*apiserver.Config, error) {
- // TODO have a "real" external address (have an AdvertiseAddress?)
- if err := o.SecureServing.MaybeDefaultWithSelfSignedCerts("localhost", nil, []net.IP{net.ParseIP("127.0.0.1")}); err != nil {
- return nil, fmt.Errorf("error creating self-signed certificates: %v", err)
- }
-
- serverConfig := genericapiserver.NewConfig(apiserver.Codecs)
- if err := o.SecureServing.ApplyTo(serverConfig); err != nil {
- return nil, err
- }
-
- if err := o.Authentication.ApplyTo(serverConfig); err != nil {
- return nil, err
- }
- if err := o.Authorization.ApplyTo(serverConfig); err != nil {
- return nil, err
- }
-
- // TODO: we can't currently serve swagger because we don't have a good way to dynamically update it
- // serverConfig.SwaggerConfig = genericapiserver.DefaultSwaggerConfig()
-
- config := &apiserver.Config{
- GenericConfig: serverConfig,
- }
- return config, nil
-}
diff --git a/archived/event-adapter/pkg/provider/interfaces.go b/archived/event-adapter/pkg/provider/interfaces.go
deleted file mode 100644
index f1fca2a95..000000000
--- a/archived/event-adapter/pkg/provider/interfaces.go
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
- "k8s.io/apimachinery/pkg/runtime/schema"
- api "k8s.io/client-go/pkg/api/v1"
-)
-
-// EventInfo contains info relevant for an Event
-type EventInfo struct {
- // GroupResource is the group of the resources
- GroupResource schema.GroupResource
- // Namespaced will be true if the event will be namespaced
- Namespaced bool
- // Event will contain the name of the event
- Event string
-}
-
-// EventsProvider is an interface that contains the methods that will provide info for the given events
-type EventsProvider interface {
- // READ
- GetNamespacedEventsByName(namespace, eventName string) (*api.Event, error)
- ListAllEventsByNamespace(namespace string) (*api.EventList, error)
- ListAllEvents() (*api.EventList, error)
-
- // WRITE
- CreateNewEvent(namespace string) (*api.Event, error)
-}
diff --git a/archived/event-adapter/pkg/provider/resource_lister.go b/archived/event-adapter/pkg/provider/resource_lister.go
deleted file mode 100644
index 74ad9f86f..000000000
--- a/archived/event-adapter/pkg/provider/resource_lister.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apiserver/pkg/endpoints/handlers"
-)
-
-type eventsResourceLister struct {
- provider EventsProvider
-}
-
-// NewResourceLister creates a new APIResourceLister for provided EventsProvider
-func NewResourceLister(provider EventsProvider) handlers.APIResourceLister {
- return &eventsResourceLister{
- provider: provider,
- }
-}
-
-// ListAPIResources lists the supported API paths
-func (l *eventsResourceLister) ListAPIResources() []metav1.APIResource {
- resources := make([]metav1.APIResource, 3)
- resources[0] = metav1.APIResource{
- Name: "namespaces/{namespace}/events/{eventName}",
- Namespaced: true,
- Kind: "Event",
- Verbs: metav1.Verbs{"get"},
- }
-
- resources[1] = metav1.APIResource{
- Name: "namespaces/{namespace}/events",
- Namespaced: true,
- Kind: "EventList",
- Verbs: metav1.Verbs{"get", "post"},
- }
-
- resources[2] = metav1.APIResource{
- Name: "events",
- Namespaced: true,
- Kind: "EventList",
- Verbs: metav1.Verbs{"get"},
- }
-
- return resources
-}
diff --git a/archived/event-adapter/pkg/registry/reststorage.go b/archived/event-adapter/pkg/registry/reststorage.go
deleted file mode 100644
index ae55731a7..000000000
--- a/archived/event-adapter/pkg/registry/reststorage.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package registry
-
-import (
- "fmt"
- specificinstaller "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/apiserver/installer/context"
- "github.com/GoogleCloudPlatform/k8s-stackdriver/event-adapter/pkg/provider"
- metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
- "k8s.io/apimachinery/pkg/runtime"
- genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
- "k8s.io/apiserver/pkg/registry/rest"
- api "k8s.io/client-go/pkg/api/v1"
-)
-
-// REST is a wrapper for EventsProvider that provides implementation for Storage and Lister interfaces
-type REST struct {
- evProvider provider.EventsProvider
-}
-
-var _ rest.Storage = &REST{}
-var _ rest.Lister = &REST{}
-
-// NewREST creates a new REST for the given EventsProvider
-func NewREST(evProvider provider.EventsProvider) *REST {
- return &REST{
- evProvider: evProvider,
- }
-}
-
-// New implements Storage
-func (r *REST) New() runtime.Object {
- return &api.Event{}
-}
-
-// NewList implement Lister
-func (r *REST) NewList() runtime.Object {
- return &api.EventList{}
-}
-
-// List selects the events that match to the selector
-func (r *REST) List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
-
- namespace := genericapirequest.NamespaceValue(ctx)
- if namespace == "" {
- return r.evProvider.ListAllEvents()
- }
-
- eventName, methodSingleEvent, ok := specificinstaller.RequestInformationFrom(ctx)
- methodListEvents, list := specificinstaller.RequestListInformationFrom(ctx)
-
- if methodListEvents == "" && methodSingleEvent == "" {
- return nil, fmt.Errorf("Unable to serve the request: forgiven method")
- }
-
- if list {
- return r.listEventsAPI(namespace, methodListEvents)
- }
-
- if ok {
- return r.singleEventAPI(namespace, eventName, methodSingleEvent)
- }
-
- return nil, fmt.Errorf("Unable to serve the request")
-}
-
-func (r *REST) singleEventAPI(namespace, name, method string) (runtime.Object, error) {
- if method == "GET" {
- return r.evProvider.GetNamespacedEventsByName(namespace, name)
- }
- return nil, fmt.Errorf("Method %s not allowed", method)
-}
-
-func (r *REST) listEventsAPI(namespace, method string) (runtime.Object, error) {
- switch method {
- case "GET":
- return r.evProvider.ListAllEventsByNamespace(namespace)
- case "POST":
- return r.evProvider.CreateNewEvent(namespace)
- }
- return nil, fmt.Errorf("Method %s not allowed", method)
-}
diff --git a/archived/event-adapter/pkg/types/install.go b/archived/event-adapter/pkg/types/install.go
deleted file mode 100644
index 4849df5b3..000000000
--- a/archived/event-adapter/pkg/types/install.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package types
-
-import (
- "k8s.io/apimachinery/pkg/apimachinery/announced"
- "k8s.io/apimachinery/pkg/apimachinery/registered"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/pkg/api"
-)
-
-func init() {
- Install(api.GroupFactoryRegistry, api.Registry, api.Scheme)
-}
-
-// Install registers the API group and adds types to a scheme
-func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
- if err := announced.NewGroupMetaFactory(
- &announced.GroupMetaFactoryArgs{
- GroupName: GroupName,
- VersionPreferenceOrder: []string{SchemeGroupVersion.Version},
- ImportPrefix: "",
- AddInternalObjectsToScheme: AddToScheme,
- },
- announced.VersionToSchemeFunc{
- SchemeGroupVersion.Version: AddToScheme,
- },
- ).Announce(groupFactoryRegistry).RegisterAndEnable(registry, scheme); err != nil {
- panic(err)
- }
-}
diff --git a/archived/event-adapter/pkg/types/register.go b/archived/event-adapter/pkg/types/register.go
deleted file mode 100644
index 6cdaa3b04..000000000
--- a/archived/event-adapter/pkg/types/register.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package types
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- api "k8s.io/client-go/pkg/api/v1"
-)
-
-// GroupName is the group name use in this package
-const GroupName = "v1events"
-
-// SchemeGroupVersion is group version used to register these objects
-var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
-
-// Resource takes an unqualified resource and returns a Group qualified GroupResource
-func Resource(resource string) schema.GroupResource {
- return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-// Kind takes an unqualified kind and returns back a Group qualified GroupKind
-func Kind(kind string) schema.GroupKind {
- return SchemeGroupVersion.WithKind(kind).GroupKind()
-}
-
-var (
- // SchemeBuilder contains the builder scheme
- SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
- // AddToScheme allow to add type to the scheme
- AddToScheme = SchemeBuilder.AddToScheme
-)
-
-func addKnownTypes(scheme *runtime.Scheme) error {
- scheme.AddKnownTypes(SchemeGroupVersion,
- &api.Event{},
- &api.EventList{},
- )
- metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
- return nil
-}
diff --git a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/Makefile b/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/Makefile
deleted file mode 100644
index e33ee1730..000000000
--- a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=bitbucket.org/ww/goautoneg
-GOFILES=autoneg.go
-
-include $(GOROOT)/src/Make.pkg
-
-format:
- gofmt -w *.go
-
-docs:
- gomake clean
- godoc ${TARG} > README.txt
diff --git a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/README.txt b/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/README.txt
deleted file mode 100644
index 7723656d5..000000000
--- a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/README.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-PACKAGE
-
-package goautoneg
-import "bitbucket.org/ww/goautoneg"
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-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 the Open Knowledge Foundation Ltd. 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
-HOLDER 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.
-
-
-FUNCTIONS
-
-func Negotiate(header string, alternatives []string) (content_type string)
-Negotiate the most appropriate content_type given the accept header
-and a list of alternatives.
-
-func ParseAccept(header string) (accept []Accept)
-Parse an Accept Header string returning a sorted list
-of clauses
-
-
-TYPES
-
-type Accept struct {
- Type, SubType string
- Q float32
- Params map[string]string
-}
-Structure to represent a clause in an HTTP Accept Header
-
-
-SUBDIRECTORIES
-
- .hg
diff --git a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/autoneg.go b/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/autoneg.go
deleted file mode 100644
index 648b38cb6..000000000
--- a/archived/event-adapter/vendor/bitbucket.org/ww/goautoneg/autoneg.go
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-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 the Open Knowledge Foundation Ltd. 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
-HOLDER 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.
-
-
-*/
-package goautoneg
-
-import (
- "sort"
- "strconv"
- "strings"
-)
-
-// Structure to represent a clause in an HTTP Accept Header
-type Accept struct {
- Type, SubType string
- Q float64
- Params map[string]string
-}
-
-// For internal use, so that we can use the sort interface
-type accept_slice []Accept
-
-func (accept accept_slice) Len() int {
- slice := []Accept(accept)
- return len(slice)
-}
-
-func (accept accept_slice) Less(i, j int) bool {
- slice := []Accept(accept)
- ai, aj := slice[i], slice[j]
- if ai.Q > aj.Q {
- return true
- }
- if ai.Type != "*" && aj.Type == "*" {
- return true
- }
- if ai.SubType != "*" && aj.SubType == "*" {
- return true
- }
- return false
-}
-
-func (accept accept_slice) Swap(i, j int) {
- slice := []Accept(accept)
- slice[i], slice[j] = slice[j], slice[i]
-}
-
-// Parse an Accept Header string returning a sorted list
-// of clauses
-func ParseAccept(header string) (accept []Accept) {
- parts := strings.Split(header, ",")
- accept = make([]Accept, 0, len(parts))
- for _, part := range parts {
- part := strings.Trim(part, " ")
-
- a := Accept{}
- a.Params = make(map[string]string)
- a.Q = 1.0
-
- mrp := strings.Split(part, ";")
-
- media_range := mrp[0]
- sp := strings.Split(media_range, "/")
- a.Type = strings.Trim(sp[0], " ")
-
- switch {
- case len(sp) == 1 && a.Type == "*":
- a.SubType = "*"
- case len(sp) == 2:
- a.SubType = strings.Trim(sp[1], " ")
- default:
- continue
- }
-
- if len(mrp) == 1 {
- accept = append(accept, a)
- continue
- }
-
- for _, param := range mrp[1:] {
- sp := strings.SplitN(param, "=", 2)
- if len(sp) != 2 {
- continue
- }
- token := strings.Trim(sp[0], " ")
- if token == "q" {
- a.Q, _ = strconv.ParseFloat(sp[1], 32)
- } else {
- a.Params[token] = strings.Trim(sp[1], " ")
- }
- }
-
- accept = append(accept, a)
- }
-
- slice := accept_slice(accept)
- sort.Sort(slice)
-
- return
-}
-
-// Negotiate the most appropriate content_type given the accept header
-// and a list of alternatives.
-func Negotiate(header string, alternatives []string) (content_type string) {
- asp := make([][]string, 0, len(alternatives))
- for _, ctype := range alternatives {
- asp = append(asp, strings.SplitN(ctype, "/", 2))
- }
- for _, clause := range ParseAccept(header) {
- for i, ctsp := range asp {
- if clause.Type == ctsp[0] && clause.SubType == ctsp[1] {
- content_type = alternatives[i]
- return
- }
- if clause.Type == ctsp[0] && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- if clause.Type == "*" && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- }
- }
- return
-}
diff --git a/archived/event-adapter/vendor/cloud.google.com/go/AUTHORS b/archived/event-adapter/vendor/cloud.google.com/go/AUTHORS
deleted file mode 100644
index c364af1da..000000000
--- a/archived/event-adapter/vendor/cloud.google.com/go/AUTHORS
+++ /dev/null
@@ -1,15 +0,0 @@
-# This is the official list of cloud authors for copyright purposes.
-# This file is distinct from the CONTRIBUTORS files.
-# See the latter for an explanation.
-
-# Names should be added to this file as:
-# Name or Organization
-# The email address is not required for organizations.
-
-Filippo Valsorda
-Google Inc.
-Ingo Oeser
-Palm Stone Games, Inc.
-Paweł Knap
-Péter Szilágyi
-Tyler Treat
diff --git a/archived/event-adapter/vendor/cloud.google.com/go/CONTRIBUTORS b/archived/event-adapter/vendor/cloud.google.com/go/CONTRIBUTORS
deleted file mode 100644
index d4b376c7c..000000000
--- a/archived/event-adapter/vendor/cloud.google.com/go/CONTRIBUTORS
+++ /dev/null
@@ -1,37 +0,0 @@
-# People who have agreed to one of the CLAs and can contribute patches.
-# The AUTHORS file lists the copyright holders; this file
-# lists people. For example, Google employees are listed here
-# but not in AUTHORS, because Google holds the copyright.
-#
-# https://developers.google.com/open-source/cla/individual
-# https://developers.google.com/open-source/cla/corporate
-#
-# Names should be added to this file as:
-# Name
-
-# Keep the list alphabetically sorted.
-
-Alexis Hunt
-Andreas Litt
-Andrew Gerrand
-Brad Fitzpatrick
-Burcu Dogan
-Dave Day
-David Sansome
-David Symonds
-Filippo Valsorda
-Glenn Lewis
-Ingo Oeser
-Johan Euphrosine
-Jonathan Amsterdam
-Luna Duclos
-Magnus Hiie
-Michael McGreevy
-Omar Jarjur
-Paweł Knap
-Péter Szilágyi
-Sarah Adams
-Thanatat Tamtan
-Toby Burress
-Tuo Shan
-Tyler Treat
diff --git a/archived/event-adapter/vendor/cloud.google.com/go/LICENSE b/archived/event-adapter/vendor/cloud.google.com/go/LICENSE
deleted file mode 100644
index a4c5efd82..000000000
--- a/archived/event-adapter/vendor/cloud.google.com/go/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2014 Google Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/cloud.google.com/go/compute/metadata/metadata.go b/archived/event-adapter/vendor/cloud.google.com/go/compute/metadata/metadata.go
deleted file mode 100644
index e708c031b..000000000
--- a/archived/event-adapter/vendor/cloud.google.com/go/compute/metadata/metadata.go
+++ /dev/null
@@ -1,437 +0,0 @@
-// Copyright 2014 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package metadata provides access to Google Compute Engine (GCE)
-// metadata and API service accounts.
-//
-// This package is a wrapper around the GCE metadata service,
-// as documented at https://developers.google.com/compute/docs/metadata.
-package metadata // import "cloud.google.com/go/compute/metadata"
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
- "net/url"
- "os"
- "runtime"
- "strings"
- "sync"
- "time"
-
- "golang.org/x/net/context"
- "golang.org/x/net/context/ctxhttp"
-)
-
-const (
- // metadataIP is the documented metadata server IP address.
- metadataIP = "169.254.169.254"
-
- // metadataHostEnv is the environment variable specifying the
- // GCE metadata hostname. If empty, the default value of
- // metadataIP ("169.254.169.254") is used instead.
- // This is variable name is not defined by any spec, as far as
- // I know; it was made up for the Go package.
- metadataHostEnv = "GCE_METADATA_HOST"
-
- userAgent = "gcloud-golang/0.1"
-)
-
-type cachedValue struct {
- k string
- trim bool
- mu sync.Mutex
- v string
-}
-
-var (
- projID = &cachedValue{k: "project/project-id", trim: true}
- projNum = &cachedValue{k: "project/numeric-project-id", trim: true}
- instID = &cachedValue{k: "instance/id", trim: true}
-)
-
-var (
- metaClient = &http.Client{
- Transport: &http.Transport{
- Dial: (&net.Dialer{
- Timeout: 2 * time.Second,
- KeepAlive: 30 * time.Second,
- }).Dial,
- ResponseHeaderTimeout: 2 * time.Second,
- },
- }
- subscribeClient = &http.Client{
- Transport: &http.Transport{
- Dial: (&net.Dialer{
- Timeout: 2 * time.Second,
- KeepAlive: 30 * time.Second,
- }).Dial,
- },
- }
-)
-
-// NotDefinedError is returned when requested metadata is not defined.
-//
-// The underlying string is the suffix after "/computeMetadata/v1/".
-//
-// This error is not returned if the value is defined to be the empty
-// string.
-type NotDefinedError string
-
-func (suffix NotDefinedError) Error() string {
- return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix))
-}
-
-// Get returns a value from the metadata service.
-// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
-//
-// If the GCE_METADATA_HOST environment variable is not defined, a default of
-// 169.254.169.254 will be used instead.
-//
-// If the requested metadata is not defined, the returned error will
-// be of type NotDefinedError.
-func Get(suffix string) (string, error) {
- val, _, err := getETag(metaClient, suffix)
- return val, err
-}
-
-// getETag returns a value from the metadata service as well as the associated
-// ETag using the provided client. This func is otherwise equivalent to Get.
-func getETag(client *http.Client, suffix string) (value, etag string, err error) {
- // Using a fixed IP makes it very difficult to spoof the metadata service in
- // a container, which is an important use-case for local testing of cloud
- // deployments. To enable spoofing of the metadata service, the environment
- // variable GCE_METADATA_HOST is first inspected to decide where metadata
- // requests shall go.
- host := os.Getenv(metadataHostEnv)
- if host == "" {
- // Using 169.254.169.254 instead of "metadata" here because Go
- // binaries built with the "netgo" tag and without cgo won't
- // know the search suffix for "metadata" is
- // ".google.internal", and this IP address is documented as
- // being stable anyway.
- host = metadataIP
- }
- url := "http://" + host + "/computeMetadata/v1/" + suffix
- req, _ := http.NewRequest("GET", url, nil)
- req.Header.Set("Metadata-Flavor", "Google")
- req.Header.Set("User-Agent", userAgent)
- res, err := client.Do(req)
- if err != nil {
- return "", "", err
- }
- defer res.Body.Close()
- if res.StatusCode == http.StatusNotFound {
- return "", "", NotDefinedError(suffix)
- }
- if res.StatusCode != 200 {
- return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
- }
- all, err := ioutil.ReadAll(res.Body)
- if err != nil {
- return "", "", err
- }
- return string(all), res.Header.Get("Etag"), nil
-}
-
-func getTrimmed(suffix string) (s string, err error) {
- s, err = Get(suffix)
- s = strings.TrimSpace(s)
- return
-}
-
-func (c *cachedValue) get() (v string, err error) {
- defer c.mu.Unlock()
- c.mu.Lock()
- if c.v != "" {
- return c.v, nil
- }
- if c.trim {
- v, err = getTrimmed(c.k)
- } else {
- v, err = Get(c.k)
- }
- if err == nil {
- c.v = v
- }
- return
-}
-
-var (
- onGCEOnce sync.Once
- onGCE bool
-)
-
-// OnGCE reports whether this process is running on Google Compute Engine.
-func OnGCE() bool {
- onGCEOnce.Do(initOnGCE)
- return onGCE
-}
-
-func initOnGCE() {
- onGCE = testOnGCE()
-}
-
-func testOnGCE() bool {
- // The user explicitly said they're on GCE, so trust them.
- if os.Getenv(metadataHostEnv) != "" {
- return true
- }
-
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
-
- resc := make(chan bool, 2)
-
- // Try two strategies in parallel.
- // See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194
- go func() {
- req, _ := http.NewRequest("GET", "http://"+metadataIP, nil)
- req.Header.Set("User-Agent", userAgent)
- res, err := ctxhttp.Do(ctx, metaClient, req)
- if err != nil {
- resc <- false
- return
- }
- defer res.Body.Close()
- resc <- res.Header.Get("Metadata-Flavor") == "Google"
- }()
-
- go func() {
- addrs, err := net.LookupHost("metadata.google.internal")
- if err != nil || len(addrs) == 0 {
- resc <- false
- return
- }
- resc <- strsContains(addrs, metadataIP)
- }()
-
- tryHarder := systemInfoSuggestsGCE()
- if tryHarder {
- res := <-resc
- if res {
- // The first strategy succeeded, so let's use it.
- return true
- }
- // Wait for either the DNS or metadata server probe to
- // contradict the other one and say we are running on
- // GCE. Give it a lot of time to do so, since the system
- // info already suggests we're running on a GCE BIOS.
- timer := time.NewTimer(5 * time.Second)
- defer timer.Stop()
- select {
- case res = <-resc:
- return res
- case <-timer.C:
- // Too slow. Who knows what this system is.
- return false
- }
- }
-
- // There's no hint from the system info that we're running on
- // GCE, so use the first probe's result as truth, whether it's
- // true or false. The goal here is to optimize for speed for
- // users who are NOT running on GCE. We can't assume that
- // either a DNS lookup or an HTTP request to a blackholed IP
- // address is fast. Worst case this should return when the
- // metaClient's Transport.ResponseHeaderTimeout or
- // Transport.Dial.Timeout fires (in two seconds).
- return <-resc
-}
-
-// systemInfoSuggestsGCE reports whether the local system (without
-// doing network requests) suggests that we're running on GCE. If this
-// returns true, testOnGCE tries a bit harder to reach its metadata
-// server.
-func systemInfoSuggestsGCE() bool {
- if runtime.GOOS != "linux" {
- // We don't have any non-Linux clues available, at least yet.
- return false
- }
- slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name")
- name := strings.TrimSpace(string(slurp))
- return name == "Google" || name == "Google Compute Engine"
-}
-
-// Subscribe subscribes to a value from the metadata service.
-// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
-// The suffix may contain query parameters.
-//
-// Subscribe calls fn with the latest metadata value indicated by the provided
-// suffix. If the metadata value is deleted, fn is called with the empty string
-// and ok false. Subscribe blocks until fn returns a non-nil error or the value
-// is deleted. Subscribe returns the error value returned from the last call to
-// fn, which may be nil when ok == false.
-func Subscribe(suffix string, fn func(v string, ok bool) error) error {
- const failedSubscribeSleep = time.Second * 5
-
- // First check to see if the metadata value exists at all.
- val, lastETag, err := getETag(subscribeClient, suffix)
- if err != nil {
- return err
- }
-
- if err := fn(val, true); err != nil {
- return err
- }
-
- ok := true
- if strings.ContainsRune(suffix, '?') {
- suffix += "&wait_for_change=true&last_etag="
- } else {
- suffix += "?wait_for_change=true&last_etag="
- }
- for {
- val, etag, err := getETag(subscribeClient, suffix+url.QueryEscape(lastETag))
- if err != nil {
- if _, deleted := err.(NotDefinedError); !deleted {
- time.Sleep(failedSubscribeSleep)
- continue // Retry on other errors.
- }
- ok = false
- }
- lastETag = etag
-
- if err := fn(val, ok); err != nil || !ok {
- return err
- }
- }
-}
-
-// ProjectID returns the current instance's project ID string.
-func ProjectID() (string, error) { return projID.get() }
-
-// NumericProjectID returns the current instance's numeric project ID.
-func NumericProjectID() (string, error) { return projNum.get() }
-
-// InternalIP returns the instance's primary internal IP address.
-func InternalIP() (string, error) {
- return getTrimmed("instance/network-interfaces/0/ip")
-}
-
-// ExternalIP returns the instance's primary external (public) IP address.
-func ExternalIP() (string, error) {
- return getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip")
-}
-
-// Hostname returns the instance's hostname. This will be of the form
-// ".c..internal".
-func Hostname() (string, error) {
- return getTrimmed("instance/hostname")
-}
-
-// InstanceTags returns the list of user-defined instance tags,
-// assigned when initially creating a GCE instance.
-func InstanceTags() ([]string, error) {
- var s []string
- j, err := Get("instance/tags")
- if err != nil {
- return nil, err
- }
- if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil {
- return nil, err
- }
- return s, nil
-}
-
-// InstanceID returns the current VM's numeric instance ID.
-func InstanceID() (string, error) {
- return instID.get()
-}
-
-// InstanceName returns the current VM's instance ID string.
-func InstanceName() (string, error) {
- host, err := Hostname()
- if err != nil {
- return "", err
- }
- return strings.Split(host, ".")[0], nil
-}
-
-// Zone returns the current VM's zone, such as "us-central1-b".
-func Zone() (string, error) {
- zone, err := getTrimmed("instance/zone")
- // zone is of the form "projects//zones/".
- if err != nil {
- return "", err
- }
- return zone[strings.LastIndex(zone, "/")+1:], nil
-}
-
-// InstanceAttributes returns the list of user-defined attributes,
-// assigned when initially creating a GCE VM instance. The value of an
-// attribute can be obtained with InstanceAttributeValue.
-func InstanceAttributes() ([]string, error) { return lines("instance/attributes/") }
-
-// ProjectAttributes returns the list of user-defined attributes
-// applying to the project as a whole, not just this VM. The value of
-// an attribute can be obtained with ProjectAttributeValue.
-func ProjectAttributes() ([]string, error) { return lines("project/attributes/") }
-
-func lines(suffix string) ([]string, error) {
- j, err := Get(suffix)
- if err != nil {
- return nil, err
- }
- s := strings.Split(strings.TrimSpace(j), "\n")
- for i := range s {
- s[i] = strings.TrimSpace(s[i])
- }
- return s, nil
-}
-
-// InstanceAttributeValue returns the value of the provided VM
-// instance attribute.
-//
-// If the requested attribute is not defined, the returned error will
-// be of type NotDefinedError.
-//
-// InstanceAttributeValue may return ("", nil) if the attribute was
-// defined to be the empty string.
-func InstanceAttributeValue(attr string) (string, error) {
- return Get("instance/attributes/" + attr)
-}
-
-// ProjectAttributeValue returns the value of the provided
-// project attribute.
-//
-// If the requested attribute is not defined, the returned error will
-// be of type NotDefinedError.
-//
-// ProjectAttributeValue may return ("", nil) if the attribute was
-// defined to be the empty string.
-func ProjectAttributeValue(attr string) (string, error) {
- return Get("project/attributes/" + attr)
-}
-
-// Scopes returns the service account scopes for the given account.
-// The account may be empty or the string "default" to use the instance's
-// main account.
-func Scopes(serviceAccount string) ([]string, error) {
- if serviceAccount == "" {
- serviceAccount = "default"
- }
- return lines("instance/service-accounts/" + serviceAccount + "/scopes")
-}
-
-func strsContains(ss []string, s string) bool {
- for _, v := range ss {
- if v == s {
- return true
- }
- }
- return false
-}
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.gitignore b/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.gitignore
deleted file mode 100644
index 748e4c807..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.sublime-*
-.DS_Store
-*.swp
-*.swo
-tags
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.travis.yml b/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.travis.yml
deleted file mode 100644
index facfc91c6..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-
-go:
- - 1.4
- - 1.5
- - 1.6
- - tip
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/LICENSE b/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/LICENSE
deleted file mode 100644
index 4b9986dea..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/LICENSE
+++ /dev/null
@@ -1,12 +0,0 @@
-Copyright (c) 2012, Martin Angers
-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 the author 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 HOLDER 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.
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/README.md b/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/README.md
deleted file mode 100644
index a78a3df65..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/README.md
+++ /dev/null
@@ -1,185 +0,0 @@
-# Purell
-
-Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell. Sanitizer and all. Yeah, I know...
-
-Based on the [wikipedia paper][wiki] and the [RFC 3986 document][rfc].
-
-[![build status](https://secure.travis-ci.org/PuerkitoBio/purell.png)](http://travis-ci.org/PuerkitoBio/purell)
-
-## Install
-
-`go get github.com/PuerkitoBio/purell`
-
-## Changelog
-
-* **2016-07-27 (v1.0.0)** : Normalize IDN to ASCII (thanks to @zenovich).
-* **2015-02-08** : Add fix for relative paths issue ([PR #5][pr5]) and add fix for unnecessary encoding of reserved characters ([see issue #7][iss7]).
-* **v0.2.0** : Add benchmarks, Attempt IDN support.
-* **v0.1.0** : Initial release.
-
-## Examples
-
-From `example_test.go` (note that in your code, you would import "github.com/PuerkitoBio/purell", and would prefix references to its methods and constants with "purell."):
-
-```go
-package purell
-
-import (
- "fmt"
- "net/url"
-)
-
-func ExampleNormalizeURLString() {
- if normalized, err := NormalizeURLString("hTTp://someWEBsite.com:80/Amazing%3f/url/",
- FlagLowercaseScheme|FlagLowercaseHost|FlagUppercaseEscapes); err != nil {
- panic(err)
- } else {
- fmt.Print(normalized)
- }
- // Output: http://somewebsite.com:80/Amazing%3F/url/
-}
-
-func ExampleMustNormalizeURLString() {
- normalized := MustNormalizeURLString("hTTpS://someWEBsite.com:443/Amazing%fa/url/",
- FlagsUnsafeGreedy)
- fmt.Print(normalized)
-
- // Output: http://somewebsite.com/Amazing%FA/url
-}
-
-func ExampleNormalizeURL() {
- if u, err := url.Parse("Http://SomeUrl.com:8080/a/b/.././c///g?c=3&a=1&b=9&c=0#target"); err != nil {
- panic(err)
- } else {
- normalized := NormalizeURL(u, FlagsUsuallySafeGreedy|FlagRemoveDuplicateSlashes|FlagRemoveFragment)
- fmt.Print(normalized)
- }
-
- // Output: http://someurl.com:8080/a/c/g?c=3&a=1&b=9&c=0
-}
-```
-
-## API
-
-As seen in the examples above, purell offers three methods, `NormalizeURLString(string, NormalizationFlags) (string, error)`, `MustNormalizeURLString(string, NormalizationFlags) (string)` and `NormalizeURL(*url.URL, NormalizationFlags) (string)`. They all normalize the provided URL based on the specified flags. Here are the available flags:
-
-```go
-const (
- // Safe normalizations
- FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1
- FlagLowercaseHost // http://HOST -> http://host
- FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF
- FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA
- FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$
- FlagRemoveDefaultPort // http://host:80 -> http://host
- FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path
-
- // Usually safe normalizations
- FlagRemoveTrailingSlash // http://host/path/ -> http://host/path
- FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags)
- FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c
-
- // Unsafe normalizations
- FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/
- FlagRemoveFragment // http://host/path#fragment -> http://host/path
- FlagForceHTTP // https://host -> http://host
- FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b
- FlagRemoveWWW // http://www.host/ -> http://host/
- FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags)
- FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3
-
- // Normalizations not in the wikipedia article, required to cover tests cases
- // submitted by jehiah
- FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147
- FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147
- FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147
- FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path
- FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path
-
- // Convenience set of safe normalizations
- FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator
-
- // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags,
- // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix".
-
- // Convenience set of usually safe normalizations (includes FlagsSafe)
- FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments
- FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments
-
- // Convenience set of unsafe normalizations (includes FlagsUsuallySafe)
- FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery
- FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery
-
- // Convenience set of all available flags
- FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
- FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
-)
-```
-
-For convenience, the set of flags `FlagsSafe`, `FlagsUsuallySafe[Greedy|NonGreedy]`, `FlagsUnsafe[Greedy|NonGreedy]` and `FlagsAll[Greedy|NonGreedy]` are provided for the similarly grouped normalizations on [wikipedia's URL normalization page][wiki]. You can add (using the bitwise OR `|` operator) or remove (using the bitwise AND NOT `&^` operator) individual flags from the sets if required, to build your own custom set.
-
-The [full godoc reference is available on gopkgdoc][godoc].
-
-Some things to note:
-
-* `FlagDecodeUnnecessaryEscapes`, `FlagEncodeNecessaryEscapes`, `FlagUppercaseEscapes` and `FlagRemoveEmptyQuerySeparator` are always implicitly set, because internally, the URL string is parsed as an URL object, which automatically decodes unnecessary escapes, uppercases and encodes necessary ones, and removes empty query separators (an unnecessary `?` at the end of the url). So this operation cannot **not** be done. For this reason, `FlagRemoveEmptyQuerySeparator` (as well as the other three) has been included in the `FlagsSafe` convenience set, instead of `FlagsUnsafe`, where Wikipedia puts it.
-
-* The `FlagDecodeUnnecessaryEscapes` decodes the following escapes (*from -> to*):
- - %24 -> $
- - %26 -> &
- - %2B-%3B -> +,-./0123456789:;
- - %3D -> =
- - %40-%5A -> @ABCDEFGHIJKLMNOPQRSTUVWXYZ
- - %5F -> _
- - %61-%7A -> abcdefghijklmnopqrstuvwxyz
- - %7E -> ~
-
-
-* When the `NormalizeURL` function is used (passing an URL object), this source URL object is modified (that is, after the call, the URL object will be modified to reflect the normalization).
-
-* The *replace IP with domain name* normalization (`http://208.77.188.166/ → http://www.example.com/`) is obviously not possible for a library without making some network requests. This is not implemented in purell.
-
-* The *remove unused query string parameters* and *remove default query parameters* are also not implemented, since this is a very case-specific normalization, and it is quite trivial to do with an URL object.
-
-### Safe vs Usually Safe vs Unsafe
-
-Purell allows you to control the level of risk you take while normalizing an URL. You can aggressively normalize, play it totally safe, or anything in between.
-
-Consider the following URL:
-
-`HTTPS://www.RooT.com/toto/t%45%1f///a/./b/../c/?z=3&w=2&a=4&w=1#invalid`
-
-Normalizing with the `FlagsSafe` gives:
-
-`https://www.root.com/toto/tE%1F///a/./b/../c/?z=3&w=2&a=4&w=1#invalid`
-
-With the `FlagsUsuallySafeGreedy`:
-
-`https://www.root.com/toto/tE%1F///a/c?z=3&w=2&a=4&w=1#invalid`
-
-And with `FlagsUnsafeGreedy`:
-
-`http://root.com/toto/tE%1F/a/c?a=4&w=1&w=2&z=3`
-
-## TODOs
-
-* Add a class/default instance to allow specifying custom directory index names? At the moment, removing directory index removes `(^|/)((?:default|index)\.\w{1,4})$`.
-
-## Thanks / Contributions
-
-@rogpeppe
-@jehiah
-@opennota
-@pchristopher1275
-@zenovich
-
-## License
-
-The [BSD 3-Clause license][bsd].
-
-[bsd]: http://opensource.org/licenses/BSD-3-Clause
-[wiki]: http://en.wikipedia.org/wiki/URL_normalization
-[rfc]: http://tools.ietf.org/html/rfc3986#section-6
-[godoc]: http://go.pkgdoc.org/github.com/PuerkitoBio/purell
-[pr5]: https://github.com/PuerkitoBio/purell/pull/5
-[iss7]: https://github.com/PuerkitoBio/purell/issues/7
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/purell.go b/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/purell.go
deleted file mode 100644
index b79da64b3..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/purell/purell.go
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
-Package purell offers URL normalization as described on the wikipedia page:
-http://en.wikipedia.org/wiki/URL_normalization
-*/
-package purell
-
-import (
- "bytes"
- "fmt"
- "net/url"
- "regexp"
- "sort"
- "strconv"
- "strings"
-
- "github.com/PuerkitoBio/urlesc"
- "golang.org/x/net/idna"
- "golang.org/x/text/secure/precis"
- "golang.org/x/text/unicode/norm"
-)
-
-// A set of normalization flags determines how a URL will
-// be normalized.
-type NormalizationFlags uint
-
-const (
- // Safe normalizations
- FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1
- FlagLowercaseHost // http://HOST -> http://host
- FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF
- FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA
- FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$
- FlagRemoveDefaultPort // http://host:80 -> http://host
- FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path
-
- // Usually safe normalizations
- FlagRemoveTrailingSlash // http://host/path/ -> http://host/path
- FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags)
- FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c
-
- // Unsafe normalizations
- FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/
- FlagRemoveFragment // http://host/path#fragment -> http://host/path
- FlagForceHTTP // https://host -> http://host
- FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b
- FlagRemoveWWW // http://www.host/ -> http://host/
- FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags)
- FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3
-
- // Normalizations not in the wikipedia article, required to cover tests cases
- // submitted by jehiah
- FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147
- FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147
- FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147
- FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path
- FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path
-
- // Convenience set of safe normalizations
- FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator
-
- // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags,
- // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix".
-
- // Convenience set of usually safe normalizations (includes FlagsSafe)
- FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments
- FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments
-
- // Convenience set of unsafe normalizations (includes FlagsUsuallySafe)
- FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery
- FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery
-
- // Convenience set of all available flags
- FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
- FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator
-)
-
-const (
- defaultHttpPort = ":80"
- defaultHttpsPort = ":443"
-)
-
-// Regular expressions used by the normalizations
-var rxPort = regexp.MustCompile(`(:\d+)/?$`)
-var rxDirIndex = regexp.MustCompile(`(^|/)((?:default|index)\.\w{1,4})$`)
-var rxDupSlashes = regexp.MustCompile(`/{2,}`)
-var rxDWORDHost = regexp.MustCompile(`^(\d+)((?:\.+)?(?:\:\d*)?)$`)
-var rxOctalHost = regexp.MustCompile(`^(0\d*)\.(0\d*)\.(0\d*)\.(0\d*)((?:\.+)?(?:\:\d*)?)$`)
-var rxHexHost = regexp.MustCompile(`^0x([0-9A-Fa-f]+)((?:\.+)?(?:\:\d*)?)$`)
-var rxHostDots = regexp.MustCompile(`^(.+?)(:\d+)?$`)
-var rxEmptyPort = regexp.MustCompile(`:+$`)
-
-// Map of flags to implementation function.
-// FlagDecodeUnnecessaryEscapes has no action, since it is done automatically
-// by parsing the string as an URL. Same for FlagUppercaseEscapes and FlagRemoveEmptyQuerySeparator.
-
-// Since maps have undefined traversing order, make a slice of ordered keys
-var flagsOrder = []NormalizationFlags{
- FlagLowercaseScheme,
- FlagLowercaseHost,
- FlagRemoveDefaultPort,
- FlagRemoveDirectoryIndex,
- FlagRemoveDotSegments,
- FlagRemoveFragment,
- FlagForceHTTP, // Must be after remove default port (because https=443/http=80)
- FlagRemoveDuplicateSlashes,
- FlagRemoveWWW,
- FlagAddWWW,
- FlagSortQuery,
- FlagDecodeDWORDHost,
- FlagDecodeOctalHost,
- FlagDecodeHexHost,
- FlagRemoveUnnecessaryHostDots,
- FlagRemoveEmptyPortSeparator,
- FlagRemoveTrailingSlash, // These two (add/remove trailing slash) must be last
- FlagAddTrailingSlash,
-}
-
-// ... and then the map, where order is unimportant
-var flags = map[NormalizationFlags]func(*url.URL){
- FlagLowercaseScheme: lowercaseScheme,
- FlagLowercaseHost: lowercaseHost,
- FlagRemoveDefaultPort: removeDefaultPort,
- FlagRemoveDirectoryIndex: removeDirectoryIndex,
- FlagRemoveDotSegments: removeDotSegments,
- FlagRemoveFragment: removeFragment,
- FlagForceHTTP: forceHTTP,
- FlagRemoveDuplicateSlashes: removeDuplicateSlashes,
- FlagRemoveWWW: removeWWW,
- FlagAddWWW: addWWW,
- FlagSortQuery: sortQuery,
- FlagDecodeDWORDHost: decodeDWORDHost,
- FlagDecodeOctalHost: decodeOctalHost,
- FlagDecodeHexHost: decodeHexHost,
- FlagRemoveUnnecessaryHostDots: removeUnncessaryHostDots,
- FlagRemoveEmptyPortSeparator: removeEmptyPortSeparator,
- FlagRemoveTrailingSlash: removeTrailingSlash,
- FlagAddTrailingSlash: addTrailingSlash,
-}
-
-// MustNormalizeURLString returns the normalized string, and panics if an error occurs.
-// It takes an URL string as input, as well as the normalization flags.
-func MustNormalizeURLString(u string, f NormalizationFlags) string {
- result, e := NormalizeURLString(u, f)
- if e != nil {
- panic(e)
- }
- return result
-}
-
-// NormalizeURLString returns the normalized string, or an error if it can't be parsed into an URL object.
-// It takes an URL string as input, as well as the normalization flags.
-func NormalizeURLString(u string, f NormalizationFlags) (string, error) {
- if parsed, e := url.Parse(u); e != nil {
- return "", e
- } else {
- options := make([]precis.Option, 1, 3)
- options[0] = precis.IgnoreCase
- if f&FlagLowercaseHost == FlagLowercaseHost {
- options = append(options, precis.FoldCase())
- }
- options = append(options, precis.Norm(norm.NFC))
- profile := precis.NewFreeform(options...)
- if parsed.Host, e = idna.ToASCII(profile.NewTransformer().String(parsed.Host)); e != nil {
- return "", e
- }
- return NormalizeURL(parsed, f), nil
- }
- panic("Unreachable code.")
-}
-
-// NormalizeURL returns the normalized string.
-// It takes a parsed URL object as input, as well as the normalization flags.
-func NormalizeURL(u *url.URL, f NormalizationFlags) string {
- for _, k := range flagsOrder {
- if f&k == k {
- flags[k](u)
- }
- }
- return urlesc.Escape(u)
-}
-
-func lowercaseScheme(u *url.URL) {
- if len(u.Scheme) > 0 {
- u.Scheme = strings.ToLower(u.Scheme)
- }
-}
-
-func lowercaseHost(u *url.URL) {
- if len(u.Host) > 0 {
- u.Host = strings.ToLower(u.Host)
- }
-}
-
-func removeDefaultPort(u *url.URL) {
- if len(u.Host) > 0 {
- scheme := strings.ToLower(u.Scheme)
- u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
- if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) {
- return ""
- }
- return val
- })
- }
-}
-
-func removeTrailingSlash(u *url.URL) {
- if l := len(u.Path); l > 0 {
- if strings.HasSuffix(u.Path, "/") {
- u.Path = u.Path[:l-1]
- }
- } else if l = len(u.Host); l > 0 {
- if strings.HasSuffix(u.Host, "/") {
- u.Host = u.Host[:l-1]
- }
- }
-}
-
-func addTrailingSlash(u *url.URL) {
- if l := len(u.Path); l > 0 {
- if !strings.HasSuffix(u.Path, "/") {
- u.Path += "/"
- }
- } else if l = len(u.Host); l > 0 {
- if !strings.HasSuffix(u.Host, "/") {
- u.Host += "/"
- }
- }
-}
-
-func removeDotSegments(u *url.URL) {
- if len(u.Path) > 0 {
- var dotFree []string
- var lastIsDot bool
-
- sections := strings.Split(u.Path, "/")
- for _, s := range sections {
- if s == ".." {
- if len(dotFree) > 0 {
- dotFree = dotFree[:len(dotFree)-1]
- }
- } else if s != "." {
- dotFree = append(dotFree, s)
- }
- lastIsDot = (s == "." || s == "..")
- }
- // Special case if host does not end with / and new path does not begin with /
- u.Path = strings.Join(dotFree, "/")
- if u.Host != "" && !strings.HasSuffix(u.Host, "/") && !strings.HasPrefix(u.Path, "/") {
- u.Path = "/" + u.Path
- }
- // Special case if the last segment was a dot, make sure the path ends with a slash
- if lastIsDot && !strings.HasSuffix(u.Path, "/") {
- u.Path += "/"
- }
- }
-}
-
-func removeDirectoryIndex(u *url.URL) {
- if len(u.Path) > 0 {
- u.Path = rxDirIndex.ReplaceAllString(u.Path, "$1")
- }
-}
-
-func removeFragment(u *url.URL) {
- u.Fragment = ""
-}
-
-func forceHTTP(u *url.URL) {
- if strings.ToLower(u.Scheme) == "https" {
- u.Scheme = "http"
- }
-}
-
-func removeDuplicateSlashes(u *url.URL) {
- if len(u.Path) > 0 {
- u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/")
- }
-}
-
-func removeWWW(u *url.URL) {
- if len(u.Host) > 0 && strings.HasPrefix(strings.ToLower(u.Host), "www.") {
- u.Host = u.Host[4:]
- }
-}
-
-func addWWW(u *url.URL) {
- if len(u.Host) > 0 && !strings.HasPrefix(strings.ToLower(u.Host), "www.") {
- u.Host = "www." + u.Host
- }
-}
-
-func sortQuery(u *url.URL) {
- q := u.Query()
-
- if len(q) > 0 {
- arKeys := make([]string, len(q))
- i := 0
- for k, _ := range q {
- arKeys[i] = k
- i++
- }
- sort.Strings(arKeys)
- buf := new(bytes.Buffer)
- for _, k := range arKeys {
- sort.Strings(q[k])
- for _, v := range q[k] {
- if buf.Len() > 0 {
- buf.WriteRune('&')
- }
- buf.WriteString(fmt.Sprintf("%s=%s", k, urlesc.QueryEscape(v)))
- }
- }
-
- // Rebuild the raw query string
- u.RawQuery = buf.String()
- }
-}
-
-func decodeDWORDHost(u *url.URL) {
- if len(u.Host) > 0 {
- if matches := rxDWORDHost.FindStringSubmatch(u.Host); len(matches) > 2 {
- var parts [4]int64
-
- dword, _ := strconv.ParseInt(matches[1], 10, 0)
- for i, shift := range []uint{24, 16, 8, 0} {
- parts[i] = dword >> shift & 0xFF
- }
- u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[2])
- }
- }
-}
-
-func decodeOctalHost(u *url.URL) {
- if len(u.Host) > 0 {
- if matches := rxOctalHost.FindStringSubmatch(u.Host); len(matches) > 5 {
- var parts [4]int64
-
- for i := 1; i <= 4; i++ {
- parts[i-1], _ = strconv.ParseInt(matches[i], 8, 0)
- }
- u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[5])
- }
- }
-}
-
-func decodeHexHost(u *url.URL) {
- if len(u.Host) > 0 {
- if matches := rxHexHost.FindStringSubmatch(u.Host); len(matches) > 2 {
- // Conversion is safe because of regex validation
- parsed, _ := strconv.ParseInt(matches[1], 16, 0)
- // Set host as DWORD (base 10) encoded host
- u.Host = fmt.Sprintf("%d%s", parsed, matches[2])
- // The rest is the same as decoding a DWORD host
- decodeDWORDHost(u)
- }
- }
-}
-
-func removeUnncessaryHostDots(u *url.URL) {
- if len(u.Host) > 0 {
- if matches := rxHostDots.FindStringSubmatch(u.Host); len(matches) > 1 {
- // Trim the leading and trailing dots
- u.Host = strings.Trim(matches[1], ".")
- if len(matches) > 2 {
- u.Host += matches[2]
- }
- }
- }
-}
-
-func removeEmptyPortSeparator(u *url.URL) {
- if len(u.Host) > 0 {
- u.Host = rxEmptyPort.ReplaceAllString(u.Host, "")
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/.travis.yml b/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/.travis.yml
deleted file mode 100644
index 478630e50..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-
-go:
- - 1.4
- - tip
-
-install:
- - go build .
-
-script:
- - go test -v
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/LICENSE b/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/LICENSE
deleted file mode 100644
index 744875676..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/README.md b/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/README.md
deleted file mode 100644
index bebe305e0..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.png?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc)
-======
-
-Package urlesc implements query escaping as per RFC 3986.
-
-It contains some parts of the net/url package, modified so as to allow
-some reserved characters incorrectly escaped by net/url (see [issue 5684](https://github.com/golang/go/issues/5684)).
-
-## Install
-
- go get github.com/PuerkitoBio/urlesc
-
-## License
-
-Go license (BSD-3-Clause)
-
diff --git a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/urlesc.go b/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/urlesc.go
deleted file mode 100644
index 1b8462459..000000000
--- a/archived/event-adapter/vendor/github.com/PuerkitoBio/urlesc/urlesc.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package urlesc implements query escaping as per RFC 3986.
-// It contains some parts of the net/url package, modified so as to allow
-// some reserved characters incorrectly escaped by net/url.
-// See https://github.com/golang/go/issues/5684
-package urlesc
-
-import (
- "bytes"
- "net/url"
- "strings"
-)
-
-type encoding int
-
-const (
- encodePath encoding = 1 + iota
- encodeUserPassword
- encodeQueryComponent
- encodeFragment
-)
-
-// Return true if the specified character should be escaped when
-// appearing in a URL string, according to RFC 3986.
-func shouldEscape(c byte, mode encoding) bool {
- // §2.3 Unreserved characters (alphanum)
- if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' {
- return false
- }
-
- switch c {
- case '-', '.', '_', '~': // §2.3 Unreserved characters (mark)
- return false
-
- // §2.2 Reserved characters (reserved)
- case ':', '/', '?', '#', '[', ']', '@', // gen-delims
- '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims
- // Different sections of the URL allow a few of
- // the reserved characters to appear unescaped.
- switch mode {
- case encodePath: // §3.3
- // The RFC allows sub-delims and : @.
- // '/', '[' and ']' can be used to assign meaning to individual path
- // segments. This package only manipulates the path as a whole,
- // so we allow those as well. That leaves only ? and # to escape.
- return c == '?' || c == '#'
-
- case encodeUserPassword: // §3.2.1
- // The RFC allows : and sub-delims in
- // userinfo. The parsing of userinfo treats ':' as special so we must escape
- // all the gen-delims.
- return c == ':' || c == '/' || c == '?' || c == '#' || c == '[' || c == ']' || c == '@'
-
- case encodeQueryComponent: // §3.4
- // The RFC allows / and ?.
- return c != '/' && c != '?'
-
- case encodeFragment: // §4.1
- // The RFC text is silent but the grammar allows
- // everything, so escape nothing but #
- return c == '#'
- }
- }
-
- // Everything else must be escaped.
- return true
-}
-
-// QueryEscape escapes the string so it can be safely placed
-// inside a URL query.
-func QueryEscape(s string) string {
- return escape(s, encodeQueryComponent)
-}
-
-func escape(s string, mode encoding) string {
- spaceCount, hexCount := 0, 0
- for i := 0; i < len(s); i++ {
- c := s[i]
- if shouldEscape(c, mode) {
- if c == ' ' && mode == encodeQueryComponent {
- spaceCount++
- } else {
- hexCount++
- }
- }
- }
-
- if spaceCount == 0 && hexCount == 0 {
- return s
- }
-
- t := make([]byte, len(s)+2*hexCount)
- j := 0
- for i := 0; i < len(s); i++ {
- switch c := s[i]; {
- case c == ' ' && mode == encodeQueryComponent:
- t[j] = '+'
- j++
- case shouldEscape(c, mode):
- t[j] = '%'
- t[j+1] = "0123456789ABCDEF"[c>>4]
- t[j+2] = "0123456789ABCDEF"[c&15]
- j += 3
- default:
- t[j] = s[i]
- j++
- }
- }
- return string(t)
-}
-
-var uiReplacer = strings.NewReplacer(
- "%21", "!",
- "%27", "'",
- "%28", "(",
- "%29", ")",
- "%2A", "*",
-)
-
-// unescapeUserinfo unescapes some characters that need not to be escaped as per RFC3986.
-func unescapeUserinfo(s string) string {
- return uiReplacer.Replace(s)
-}
-
-// Escape reassembles the URL into a valid URL string.
-// The general form of the result is one of:
-//
-// scheme:opaque
-// scheme://userinfo@host/path?query#fragment
-//
-// If u.Opaque is non-empty, String uses the first form;
-// otherwise it uses the second form.
-//
-// In the second form, the following rules apply:
-// - if u.Scheme is empty, scheme: is omitted.
-// - if u.User is nil, userinfo@ is omitted.
-// - if u.Host is empty, host/ is omitted.
-// - if u.Scheme and u.Host are empty and u.User is nil,
-// the entire scheme://userinfo@host/ is omitted.
-// - if u.Host is non-empty and u.Path begins with a /,
-// the form host/path does not add its own /.
-// - if u.RawQuery is empty, ?query is omitted.
-// - if u.Fragment is empty, #fragment is omitted.
-func Escape(u *url.URL) string {
- var buf bytes.Buffer
- if u.Scheme != "" {
- buf.WriteString(u.Scheme)
- buf.WriteByte(':')
- }
- if u.Opaque != "" {
- buf.WriteString(u.Opaque)
- } else {
- if u.Scheme != "" || u.Host != "" || u.User != nil {
- buf.WriteString("//")
- if ui := u.User; ui != nil {
- buf.WriteString(unescapeUserinfo(ui.String()))
- buf.WriteByte('@')
- }
- if h := u.Host; h != "" {
- buf.WriteString(h)
- }
- }
- if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
- buf.WriteByte('/')
- }
- buf.WriteString(escape(u.Path, encodePath))
- }
- if u.RawQuery != "" {
- buf.WriteByte('?')
- buf.WriteString(u.RawQuery)
- }
- if u.Fragment != "" {
- buf.WriteByte('#')
- buf.WriteString(escape(u.Fragment, encodeFragment))
- }
- return buf.String()
-}
diff --git a/archived/event-adapter/vendor/github.com/beorn7/perks/LICENSE b/archived/event-adapter/vendor/github.com/beorn7/perks/LICENSE
deleted file mode 100644
index 339177be6..000000000
--- a/archived/event-adapter/vendor/github.com/beorn7/perks/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013 Blake Mizerany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/exampledata.txt
deleted file mode 100644
index 1602287d7..000000000
--- a/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/exampledata.txt
+++ /dev/null
@@ -1,2388 +0,0 @@
-8
-5
-26
-12
-5
-235
-13
-6
-28
-30
-3
-3
-3
-3
-5
-2
-33
-7
-2
-4
-7
-12
-14
-5
-8
-3
-10
-4
-5
-3
-6
-6
-209
-20
-3
-10
-14
-3
-4
-6
-8
-5
-11
-7
-3
-2
-3
-3
-212
-5
-222
-4
-10
-10
-5
-6
-3
-8
-3
-10
-254
-220
-2
-3
-5
-24
-5
-4
-222
-7
-3
-3
-223
-8
-15
-12
-14
-14
-3
-2
-2
-3
-13
-3
-11
-4
-4
-6
-5
-7
-13
-5
-3
-5
-2
-5
-3
-5
-2
-7
-15
-17
-14
-3
-6
-6
-3
-17
-5
-4
-7
-6
-4
-4
-8
-6
-8
-3
-9
-3
-6
-3
-4
-5
-3
-3
-660
-4
-6
-10
-3
-6
-3
-2
-5
-13
-2
-4
-4
-10
-4
-8
-4
-3
-7
-9
-9
-3
-10
-37
-3
-13
-4
-12
-3
-6
-10
-8
-5
-21
-2
-3
-8
-3
-2
-3
-3
-4
-12
-2
-4
-8
-8
-4
-3
-2
-20
-1
-6
-32
-2
-11
-6
-18
-3
-8
-11
-3
-212
-3
-4
-2
-6
-7
-12
-11
-3
-2
-16
-10
-6
-4
-6
-3
-2
-7
-3
-2
-2
-2
-2
-5
-6
-4
-3
-10
-3
-4
-6
-5
-3
-4
-4
-5
-6
-4
-3
-4
-4
-5
-7
-5
-5
-3
-2
-7
-2
-4
-12
-4
-5
-6
-2
-4
-4
-8
-4
-15
-13
-7
-16
-5
-3
-23
-5
-5
-7
-3
-2
-9
-8
-7
-5
-8
-11
-4
-10
-76
-4
-47
-4
-3
-2
-7
-4
-2
-3
-37
-10
-4
-2
-20
-5
-4
-4
-10
-10
-4
-3
-7
-23
-240
-7
-13
-5
-5
-3
-3
-2
-5
-4
-2
-8
-7
-19
-2
-23
-8
-7
-2
-5
-3
-8
-3
-8
-13
-5
-5
-5
-2
-3
-23
-4
-9
-8
-4
-3
-3
-5
-220
-2
-3
-4
-6
-14
-3
-53
-6
-2
-5
-18
-6
-3
-219
-6
-5
-2
-5
-3
-6
-5
-15
-4
-3
-17
-3
-2
-4
-7
-2
-3
-3
-4
-4
-3
-2
-664
-6
-3
-23
-5
-5
-16
-5
-8
-2
-4
-2
-24
-12
-3
-2
-3
-5
-8
-3
-5
-4
-3
-14
-3
-5
-8
-2
-3
-7
-9
-4
-2
-3
-6
-8
-4
-3
-4
-6
-5
-3
-3
-6
-3
-19
-4
-4
-6
-3
-6
-3
-5
-22
-5
-4
-4
-3
-8
-11
-4
-9
-7
-6
-13
-4
-4
-4
-6
-17
-9
-3
-3
-3
-4
-3
-221
-5
-11
-3
-4
-2
-12
-6
-3
-5
-7
-5
-7
-4
-9
-7
-14
-37
-19
-217
-16
-3
-5
-2
-2
-7
-19
-7
-6
-7
-4
-24
-5
-11
-4
-7
-7
-9
-13
-3
-4
-3
-6
-28
-4
-4
-5
-5
-2
-5
-6
-4
-4
-6
-10
-5
-4
-3
-2
-3
-3
-6
-5
-5
-4
-3
-2
-3
-7
-4
-6
-18
-16
-8
-16
-4
-5
-8
-6
-9
-13
-1545
-6
-215
-6
-5
-6
-3
-45
-31
-5
-2
-2
-4
-3
-3
-2
-5
-4
-3
-5
-7
-7
-4
-5
-8
-5
-4
-749
-2
-31
-9
-11
-2
-11
-5
-4
-4
-7
-9
-11
-4
-5
-4
-7
-3
-4
-6
-2
-15
-3
-4
-3
-4
-3
-5
-2
-13
-5
-5
-3
-3
-23
-4
-4
-5
-7
-4
-13
-2
-4
-3
-4
-2
-6
-2
-7
-3
-5
-5
-3
-29
-5
-4
-4
-3
-10
-2
-3
-79
-16
-6
-6
-7
-7
-3
-5
-5
-7
-4
-3
-7
-9
-5
-6
-5
-9
-6
-3
-6
-4
-17
-2
-10
-9
-3
-6
-2
-3
-21
-22
-5
-11
-4
-2
-17
-2
-224
-2
-14
-3
-4
-4
-2
-4
-4
-4
-4
-5
-3
-4
-4
-10
-2
-6
-3
-3
-5
-7
-2
-7
-5
-6
-3
-218
-2
-2
-5
-2
-6
-3
-5
-222
-14
-6
-33
-3
-2
-5
-3
-3
-3
-9
-5
-3
-3
-2
-7
-4
-3
-4
-3
-5
-6
-5
-26
-4
-13
-9
-7
-3
-221
-3
-3
-4
-4
-4
-4
-2
-18
-5
-3
-7
-9
-6
-8
-3
-10
-3
-11
-9
-5
-4
-17
-5
-5
-6
-6
-3
-2
-4
-12
-17
-6
-7
-218
-4
-2
-4
-10
-3
-5
-15
-3
-9
-4
-3
-3
-6
-29
-3
-3
-4
-5
-5
-3
-8
-5
-6
-6
-7
-5
-3
-5
-3
-29
-2
-31
-5
-15
-24
-16
-5
-207
-4
-3
-3
-2
-15
-4
-4
-13
-5
-5
-4
-6
-10
-2
-7
-8
-4
-6
-20
-5
-3
-4
-3
-12
-12
-5
-17
-7
-3
-3
-3
-6
-10
-3
-5
-25
-80
-4
-9
-3
-2
-11
-3
-3
-2
-3
-8
-7
-5
-5
-19
-5
-3
-3
-12
-11
-2
-6
-5
-5
-5
-3
-3
-3
-4
-209
-14
-3
-2
-5
-19
-4
-4
-3
-4
-14
-5
-6
-4
-13
-9
-7
-4
-7
-10
-2
-9
-5
-7
-2
-8
-4
-6
-5
-5
-222
-8
-7
-12
-5
-216
-3
-4
-4
-6
-3
-14
-8
-7
-13
-4
-3
-3
-3
-3
-17
-5
-4
-3
-33
-6
-6
-33
-7
-5
-3
-8
-7
-5
-2
-9
-4
-2
-233
-24
-7
-4
-8
-10
-3
-4
-15
-2
-16
-3
-3
-13
-12
-7
-5
-4
-207
-4
-2
-4
-27
-15
-2
-5
-2
-25
-6
-5
-5
-6
-13
-6
-18
-6
-4
-12
-225
-10
-7
-5
-2
-2
-11
-4
-14
-21
-8
-10
-3
-5
-4
-232
-2
-5
-5
-3
-7
-17
-11
-6
-6
-23
-4
-6
-3
-5
-4
-2
-17
-3
-6
-5
-8
-3
-2
-2
-14
-9
-4
-4
-2
-5
-5
-3
-7
-6
-12
-6
-10
-3
-6
-2
-2
-19
-5
-4
-4
-9
-2
-4
-13
-3
-5
-6
-3
-6
-5
-4
-9
-6
-3
-5
-7
-3
-6
-6
-4
-3
-10
-6
-3
-221
-3
-5
-3
-6
-4
-8
-5
-3
-6
-4
-4
-2
-54
-5
-6
-11
-3
-3
-4
-4
-4
-3
-7
-3
-11
-11
-7
-10
-6
-13
-223
-213
-15
-231
-7
-3
-7
-228
-2
-3
-4
-4
-5
-6
-7
-4
-13
-3
-4
-5
-3
-6
-4
-6
-7
-2
-4
-3
-4
-3
-3
-6
-3
-7
-3
-5
-18
-5
-6
-8
-10
-3
-3
-3
-2
-4
-2
-4
-4
-5
-6
-6
-4
-10
-13
-3
-12
-5
-12
-16
-8
-4
-19
-11
-2
-4
-5
-6
-8
-5
-6
-4
-18
-10
-4
-2
-216
-6
-6
-6
-2
-4
-12
-8
-3
-11
-5
-6
-14
-5
-3
-13
-4
-5
-4
-5
-3
-28
-6
-3
-7
-219
-3
-9
-7
-3
-10
-6
-3
-4
-19
-5
-7
-11
-6
-15
-19
-4
-13
-11
-3
-7
-5
-10
-2
-8
-11
-2
-6
-4
-6
-24
-6
-3
-3
-3
-3
-6
-18
-4
-11
-4
-2
-5
-10
-8
-3
-9
-5
-3
-4
-5
-6
-2
-5
-7
-4
-4
-14
-6
-4
-4
-5
-5
-7
-2
-4
-3
-7
-3
-3
-6
-4
-5
-4
-4
-4
-3
-3
-3
-3
-8
-14
-2
-3
-5
-3
-2
-4
-5
-3
-7
-3
-3
-18
-3
-4
-4
-5
-7
-3
-3
-3
-13
-5
-4
-8
-211
-5
-5
-3
-5
-2
-5
-4
-2
-655
-6
-3
-5
-11
-2
-5
-3
-12
-9
-15
-11
-5
-12
-217
-2
-6
-17
-3
-3
-207
-5
-5
-4
-5
-9
-3
-2
-8
-5
-4
-3
-2
-5
-12
-4
-14
-5
-4
-2
-13
-5
-8
-4
-225
-4
-3
-4
-5
-4
-3
-3
-6
-23
-9
-2
-6
-7
-233
-4
-4
-6
-18
-3
-4
-6
-3
-4
-4
-2
-3
-7
-4
-13
-227
-4
-3
-5
-4
-2
-12
-9
-17
-3
-7
-14
-6
-4
-5
-21
-4
-8
-9
-2
-9
-25
-16
-3
-6
-4
-7
-8
-5
-2
-3
-5
-4
-3
-3
-5
-3
-3
-3
-2
-3
-19
-2
-4
-3
-4
-2
-3
-4
-4
-2
-4
-3
-3
-3
-2
-6
-3
-17
-5
-6
-4
-3
-13
-5
-3
-3
-3
-4
-9
-4
-2
-14
-12
-4
-5
-24
-4
-3
-37
-12
-11
-21
-3
-4
-3
-13
-4
-2
-3
-15
-4
-11
-4
-4
-3
-8
-3
-4
-4
-12
-8
-5
-3
-3
-4
-2
-220
-3
-5
-223
-3
-3
-3
-10
-3
-15
-4
-241
-9
-7
-3
-6
-6
-23
-4
-13
-7
-3
-4
-7
-4
-9
-3
-3
-4
-10
-5
-5
-1
-5
-24
-2
-4
-5
-5
-6
-14
-3
-8
-2
-3
-5
-13
-13
-3
-5
-2
-3
-15
-3
-4
-2
-10
-4
-4
-4
-5
-5
-3
-5
-3
-4
-7
-4
-27
-3
-6
-4
-15
-3
-5
-6
-6
-5
-4
-8
-3
-9
-2
-6
-3
-4
-3
-7
-4
-18
-3
-11
-3
-3
-8
-9
-7
-24
-3
-219
-7
-10
-4
-5
-9
-12
-2
-5
-4
-4
-4
-3
-3
-19
-5
-8
-16
-8
-6
-22
-3
-23
-3
-242
-9
-4
-3
-3
-5
-7
-3
-3
-5
-8
-3
-7
-5
-14
-8
-10
-3
-4
-3
-7
-4
-6
-7
-4
-10
-4
-3
-11
-3
-7
-10
-3
-13
-6
-8
-12
-10
-5
-7
-9
-3
-4
-7
-7
-10
-8
-30
-9
-19
-4
-3
-19
-15
-4
-13
-3
-215
-223
-4
-7
-4
-8
-17
-16
-3
-7
-6
-5
-5
-4
-12
-3
-7
-4
-4
-13
-4
-5
-2
-5
-6
-5
-6
-6
-7
-10
-18
-23
-9
-3
-3
-6
-5
-2
-4
-2
-7
-3
-3
-2
-5
-5
-14
-10
-224
-6
-3
-4
-3
-7
-5
-9
-3
-6
-4
-2
-5
-11
-4
-3
-3
-2
-8
-4
-7
-4
-10
-7
-3
-3
-18
-18
-17
-3
-3
-3
-4
-5
-3
-3
-4
-12
-7
-3
-11
-13
-5
-4
-7
-13
-5
-4
-11
-3
-12
-3
-6
-4
-4
-21
-4
-6
-9
-5
-3
-10
-8
-4
-6
-4
-4
-6
-5
-4
-8
-6
-4
-6
-4
-4
-5
-9
-6
-3
-4
-2
-9
-3
-18
-2
-4
-3
-13
-3
-6
-6
-8
-7
-9
-3
-2
-16
-3
-4
-6
-3
-2
-33
-22
-14
-4
-9
-12
-4
-5
-6
-3
-23
-9
-4
-3
-5
-5
-3
-4
-5
-3
-5
-3
-10
-4
-5
-5
-8
-4
-4
-6
-8
-5
-4
-3
-4
-6
-3
-3
-3
-5
-9
-12
-6
-5
-9
-3
-5
-3
-2
-2
-2
-18
-3
-2
-21
-2
-5
-4
-6
-4
-5
-10
-3
-9
-3
-2
-10
-7
-3
-6
-6
-4
-4
-8
-12
-7
-3
-7
-3
-3
-9
-3
-4
-5
-4
-4
-5
-5
-10
-15
-4
-4
-14
-6
-227
-3
-14
-5
-216
-22
-5
-4
-2
-2
-6
-3
-4
-2
-9
-9
-4
-3
-28
-13
-11
-4
-5
-3
-3
-2
-3
-3
-5
-3
-4
-3
-5
-23
-26
-3
-4
-5
-6
-4
-6
-3
-5
-5
-3
-4
-3
-2
-2
-2
-7
-14
-3
-6
-7
-17
-2
-2
-15
-14
-16
-4
-6
-7
-13
-6
-4
-5
-6
-16
-3
-3
-28
-3
-6
-15
-3
-9
-2
-4
-6
-3
-3
-22
-4
-12
-6
-7
-2
-5
-4
-10
-3
-16
-6
-9
-2
-5
-12
-7
-5
-5
-5
-5
-2
-11
-9
-17
-4
-3
-11
-7
-3
-5
-15
-4
-3
-4
-211
-8
-7
-5
-4
-7
-6
-7
-6
-3
-6
-5
-6
-5
-3
-4
-4
-26
-4
-6
-10
-4
-4
-3
-2
-3
-3
-4
-5
-9
-3
-9
-4
-4
-5
-5
-8
-2
-4
-2
-3
-8
-4
-11
-19
-5
-8
-6
-3
-5
-6
-12
-3
-2
-4
-16
-12
-3
-4
-4
-8
-6
-5
-6
-6
-219
-8
-222
-6
-16
-3
-13
-19
-5
-4
-3
-11
-6
-10
-4
-7
-7
-12
-5
-3
-3
-5
-6
-10
-3
-8
-2
-5
-4
-7
-2
-4
-4
-2
-12
-9
-6
-4
-2
-40
-2
-4
-10
-4
-223
-4
-2
-20
-6
-7
-24
-5
-4
-5
-2
-20
-16
-6
-5
-13
-2
-3
-3
-19
-3
-2
-4
-5
-6
-7
-11
-12
-5
-6
-7
-7
-3
-5
-3
-5
-3
-14
-3
-4
-4
-2
-11
-1
-7
-3
-9
-6
-11
-12
-5
-8
-6
-221
-4
-2
-12
-4
-3
-15
-4
-5
-226
-7
-218
-7
-5
-4
-5
-18
-4
-5
-9
-4
-4
-2
-9
-18
-18
-9
-5
-6
-6
-3
-3
-7
-3
-5
-4
-4
-4
-12
-3
-6
-31
-5
-4
-7
-3
-6
-5
-6
-5
-11
-2
-2
-11
-11
-6
-7
-5
-8
-7
-10
-5
-23
-7
-4
-3
-5
-34
-2
-5
-23
-7
-3
-6
-8
-4
-4
-4
-2
-5
-3
-8
-5
-4
-8
-25
-2
-3
-17
-8
-3
-4
-8
-7
-3
-15
-6
-5
-7
-21
-9
-5
-6
-6
-5
-3
-2
-3
-10
-3
-6
-3
-14
-7
-4
-4
-8
-7
-8
-2
-6
-12
-4
-213
-6
-5
-21
-8
-2
-5
-23
-3
-11
-2
-3
-6
-25
-2
-3
-6
-7
-6
-6
-4
-4
-6
-3
-17
-9
-7
-6
-4
-3
-10
-7
-2
-3
-3
-3
-11
-8
-3
-7
-6
-4
-14
-36
-3
-4
-3
-3
-22
-13
-21
-4
-2
-7
-4
-4
-17
-15
-3
-7
-11
-2
-4
-7
-6
-209
-6
-3
-2
-2
-24
-4
-9
-4
-3
-3
-3
-29
-2
-2
-4
-3
-3
-5
-4
-6
-3
-3
-2
-4
diff --git a/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/stream.go b/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/stream.go
deleted file mode 100644
index 587b1fc5b..000000000
--- a/archived/event-adapter/vendor/github.com/beorn7/perks/quantile/stream.go
+++ /dev/null
@@ -1,292 +0,0 @@
-// Package quantile computes approximate quantiles over an unbounded data
-// stream within low memory and CPU bounds.
-//
-// A small amount of accuracy is traded to achieve the above properties.
-//
-// Multiple streams can be merged before calling Query to generate a single set
-// of results. This is meaningful when the streams represent the same type of
-// data. See Merge and Samples.
-//
-// For more detailed information about the algorithm used, see:
-//
-// Effective Computation of Biased Quantiles over Data Streams
-//
-// http://www.cs.rutgers.edu/~muthu/bquant.pdf
-package quantile
-
-import (
- "math"
- "sort"
-)
-
-// Sample holds an observed value and meta information for compression. JSON
-// tags have been added for convenience.
-type Sample struct {
- Value float64 `json:",string"`
- Width float64 `json:",string"`
- Delta float64 `json:",string"`
-}
-
-// Samples represents a slice of samples. It implements sort.Interface.
-type Samples []Sample
-
-func (a Samples) Len() int { return len(a) }
-func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
-func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type invariant func(s *stream, r float64) float64
-
-// NewLowBiased returns an initialized Stream for low-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the lower ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewLowBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * r
- }
- return newStream(ƒ)
-}
-
-// NewHighBiased returns an initialized Stream for high-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the higher ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewHighBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * (s.n - r)
- }
- return newStream(ƒ)
-}
-
-// NewTargeted returns an initialized Stream concerned with a particular set of
-// quantile values that are supplied a priori. Knowing these a priori reduces
-// space and computation time. The targets map maps the desired quantiles to
-// their absolute errors, i.e. the true quantile of a value returned by a query
-// is guaranteed to be within (Quantile±Epsilon).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
-func NewTargeted(targets map[float64]float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- var m = math.MaxFloat64
- var f float64
- for quantile, epsilon := range targets {
- if quantile*s.n <= r {
- f = (2 * epsilon * r) / quantile
- } else {
- f = (2 * epsilon * (s.n - r)) / (1 - quantile)
- }
- if f < m {
- m = f
- }
- }
- return m
- }
- return newStream(ƒ)
-}
-
-// Stream computes quantiles for a stream of float64s. It is not thread-safe by
-// design. Take care when using across multiple goroutines.
-type Stream struct {
- *stream
- b Samples
- sorted bool
-}
-
-func newStream(ƒ invariant) *Stream {
- x := &stream{ƒ: ƒ}
- return &Stream{x, make(Samples, 0, 500), true}
-}
-
-// Insert inserts v into the stream.
-func (s *Stream) Insert(v float64) {
- s.insert(Sample{Value: v, Width: 1})
-}
-
-func (s *Stream) insert(sample Sample) {
- s.b = append(s.b, sample)
- s.sorted = false
- if len(s.b) == cap(s.b) {
- s.flush()
- }
-}
-
-// Query returns the computed qth percentiles value. If s was created with
-// NewTargeted, and q is not in the set of quantiles provided a priori, Query
-// will return an unspecified result.
-func (s *Stream) Query(q float64) float64 {
- if !s.flushed() {
- // Fast path when there hasn't been enough data for a flush;
- // this also yields better accuracy for small sets of data.
- l := len(s.b)
- if l == 0 {
- return 0
- }
- i := int(float64(l) * q)
- if i > 0 {
- i -= 1
- }
- s.maybeSort()
- return s.b[i].Value
- }
- s.flush()
- return s.stream.query(q)
-}
-
-// Merge merges samples into the underlying streams samples. This is handy when
-// merging multiple streams from separate threads, database shards, etc.
-//
-// ATTENTION: This method is broken and does not yield correct results. The
-// underlying algorithm is not capable of merging streams correctly.
-func (s *Stream) Merge(samples Samples) {
- sort.Sort(samples)
- s.stream.merge(samples)
-}
-
-// Reset reinitializes and clears the list reusing the samples buffer memory.
-func (s *Stream) Reset() {
- s.stream.reset()
- s.b = s.b[:0]
-}
-
-// Samples returns stream samples held by s.
-func (s *Stream) Samples() Samples {
- if !s.flushed() {
- return s.b
- }
- s.flush()
- return s.stream.samples()
-}
-
-// Count returns the total number of samples observed in the stream
-// since initialization.
-func (s *Stream) Count() int {
- return len(s.b) + s.stream.count()
-}
-
-func (s *Stream) flush() {
- s.maybeSort()
- s.stream.merge(s.b)
- s.b = s.b[:0]
-}
-
-func (s *Stream) maybeSort() {
- if !s.sorted {
- s.sorted = true
- sort.Sort(s.b)
- }
-}
-
-func (s *Stream) flushed() bool {
- return len(s.stream.l) > 0
-}
-
-type stream struct {
- n float64
- l []Sample
- ƒ invariant
-}
-
-func (s *stream) reset() {
- s.l = s.l[:0]
- s.n = 0
-}
-
-func (s *stream) insert(v float64) {
- s.merge(Samples{{v, 1, 0}})
-}
-
-func (s *stream) merge(samples Samples) {
- // TODO(beorn7): This tries to merge not only individual samples, but
- // whole summaries. The paper doesn't mention merging summaries at
- // all. Unittests show that the merging is inaccurate. Find out how to
- // do merges properly.
- var r float64
- i := 0
- for _, sample := range samples {
- for ; i < len(s.l); i++ {
- c := s.l[i]
- if c.Value > sample.Value {
- // Insert at position i.
- s.l = append(s.l, Sample{})
- copy(s.l[i+1:], s.l[i:])
- s.l[i] = Sample{
- sample.Value,
- sample.Width,
- math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
- // TODO(beorn7): How to calculate delta correctly?
- }
- i++
- goto inserted
- }
- r += c.Width
- }
- s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
- i++
- inserted:
- s.n += sample.Width
- r += sample.Width
- }
- s.compress()
-}
-
-func (s *stream) count() int {
- return int(s.n)
-}
-
-func (s *stream) query(q float64) float64 {
- t := math.Ceil(q * s.n)
- t += math.Ceil(s.ƒ(s, t) / 2)
- p := s.l[0]
- var r float64
- for _, c := range s.l[1:] {
- r += p.Width
- if r+c.Width+c.Delta > t {
- return p.Value
- }
- p = c
- }
- return p.Value
-}
-
-func (s *stream) compress() {
- if len(s.l) < 2 {
- return
- }
- x := s.l[len(s.l)-1]
- xi := len(s.l) - 1
- r := s.n - 1 - x.Width
-
- for i := len(s.l) - 2; i >= 0; i-- {
- c := s.l[i]
- if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
- x.Width += c.Width
- s.l[xi] = x
- // Remove element at i.
- copy(s.l[i:], s.l[i+1:])
- s.l = s.l[:len(s.l)-1]
- xi -= 1
- } else {
- x = c
- xi = i
- }
- r -= c.Width
- }
-}
-
-func (s *stream) samples() Samples {
- samples := make(Samples, len(s.l))
- copy(samples, s.l)
- return samples
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/LICENSE b/archived/event-adapter/vendor/github.com/coreos/etcd/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/NOTICE b/archived/event-adapter/vendor/github.com/coreos/etcd/NOTICE
deleted file mode 100644
index b39ddfa5c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-CoreOS Project
-Copyright 2014 CoreOS, Inc
-
-This product includes software developed at CoreOS, Inc.
-(http://www.coreos.com/).
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go b/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go
deleted file mode 100644
index bafa775d5..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go
+++ /dev/null
@@ -1,820 +0,0 @@
-// Code generated by protoc-gen-gogo.
-// source: auth.proto
-// DO NOT EDIT!
-
-/*
- Package authpb is a generated protocol buffer package.
-
- It is generated from these files:
- auth.proto
-
- It has these top-level messages:
- User
- Permission
- Role
-*/
-package authpb
-
-import (
- "fmt"
-
- proto "github.com/golang/protobuf/proto"
-
- math "math"
-
- io "io"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-const _ = proto.ProtoPackageIsVersion1
-
-type Permission_Type int32
-
-const (
- READ Permission_Type = 0
- WRITE Permission_Type = 1
- READWRITE Permission_Type = 2
-)
-
-var Permission_Type_name = map[int32]string{
- 0: "READ",
- 1: "WRITE",
- 2: "READWRITE",
-}
-var Permission_Type_value = map[string]int32{
- "READ": 0,
- "WRITE": 1,
- "READWRITE": 2,
-}
-
-func (x Permission_Type) String() string {
- return proto.EnumName(Permission_Type_name, int32(x))
-}
-func (Permission_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptorAuth, []int{1, 0} }
-
-// User is a single entry in the bucket authUsers
-type User struct {
- Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
- Roles []string `protobuf:"bytes,3,rep,name=roles" json:"roles,omitempty"`
-}
-
-func (m *User) Reset() { *m = User{} }
-func (m *User) String() string { return proto.CompactTextString(m) }
-func (*User) ProtoMessage() {}
-func (*User) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{0} }
-
-// Permission is a single entity
-type Permission struct {
- PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"`
- Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
- RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
-}
-
-func (m *Permission) Reset() { *m = Permission{} }
-func (m *Permission) String() string { return proto.CompactTextString(m) }
-func (*Permission) ProtoMessage() {}
-func (*Permission) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{1} }
-
-// Role is a single entry in the bucket authRoles
-type Role struct {
- Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission" json:"keyPermission,omitempty"`
-}
-
-func (m *Role) Reset() { *m = Role{} }
-func (m *Role) String() string { return proto.CompactTextString(m) }
-func (*Role) ProtoMessage() {}
-func (*Role) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{2} }
-
-func init() {
- proto.RegisterType((*User)(nil), "authpb.User")
- proto.RegisterType((*Permission)(nil), "authpb.Permission")
- proto.RegisterType((*Role)(nil), "authpb.Role")
- proto.RegisterEnum("authpb.Permission_Type", Permission_Type_name, Permission_Type_value)
-}
-func (m *User) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *User) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintAuth(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Password) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintAuth(data, i, uint64(len(m.Password)))
- i += copy(data[i:], m.Password)
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- data[i] = 0x1a
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *Permission) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Permission) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.PermType != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintAuth(data, i, uint64(m.PermType))
- }
- if len(m.Key) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintAuth(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.RangeEnd) > 0 {
- data[i] = 0x1a
- i++
- i = encodeVarintAuth(data, i, uint64(len(m.RangeEnd)))
- i += copy(data[i:], m.RangeEnd)
- }
- return i, nil
-}
-
-func (m *Role) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Role) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintAuth(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.KeyPermission) > 0 {
- for _, msg := range m.KeyPermission {
- data[i] = 0x12
- i++
- i = encodeVarintAuth(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func encodeFixed64Auth(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32Auth(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintAuth(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
-}
-func (m *User) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovAuth(uint64(l))
- }
- l = len(m.Password)
- if l > 0 {
- n += 1 + l + sovAuth(uint64(l))
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- l = len(s)
- n += 1 + l + sovAuth(uint64(l))
- }
- }
- return n
-}
-
-func (m *Permission) Size() (n int) {
- var l int
- _ = l
- if m.PermType != 0 {
- n += 1 + sovAuth(uint64(m.PermType))
- }
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovAuth(uint64(l))
- }
- l = len(m.RangeEnd)
- if l > 0 {
- n += 1 + l + sovAuth(uint64(l))
- }
- return n
-}
-
-func (m *Role) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovAuth(uint64(l))
- }
- if len(m.KeyPermission) > 0 {
- for _, e := range m.KeyPermission {
- l = e.Size()
- n += 1 + l + sovAuth(uint64(l))
- }
- }
- return n
-}
-
-func sovAuth(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozAuth(x uint64) (n int) {
- return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *User) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: User: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = append(m.Name[:0], data[iNdEx:postIndex]...)
- if m.Name == nil {
- m.Name = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Password = append(m.Password[:0], data[iNdEx:postIndex]...)
- if m.Password == nil {
- m.Password = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Roles = append(m.Roles, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipAuth(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthAuth
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Permission) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Permission: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Permission: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PermType", wireType)
- }
- m.PermType = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.PermType |= (Permission_Type(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.RangeEnd = append(m.RangeEnd[:0], data[iNdEx:postIndex]...)
- if m.RangeEnd == nil {
- m.RangeEnd = []byte{}
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipAuth(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthAuth
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Role) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Role: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Role: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = append(m.Name[:0], data[iNdEx:postIndex]...)
- if m.Name == nil {
- m.Name = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field KeyPermission", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthAuth
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.KeyPermission = append(m.KeyPermission, &Permission{})
- if err := m.KeyPermission[len(m.KeyPermission)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipAuth(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthAuth
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipAuth(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthAuth
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowAuth
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipAuth(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow")
-)
-
-var fileDescriptorAuth = []byte{
- // 288 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc3, 0x30,
- 0x1c, 0xc6, 0x9b, 0xb6, 0x1b, 0xed, 0x5f, 0x27, 0x25, 0x0c, 0x0c, 0x13, 0x42, 0xe9, 0xa9, 0x78,
- 0xa8, 0xb0, 0x5d, 0xbc, 0x2a, 0xf6, 0x20, 0x78, 0x90, 0x50, 0xf1, 0x28, 0x1d, 0x0d, 0x75, 0x6c,
- 0x6d, 0x4a, 0x32, 0x91, 0xbe, 0x89, 0x07, 0x1f, 0x68, 0xc7, 0x3d, 0x82, 0xab, 0x2f, 0x22, 0x4d,
- 0x64, 0x43, 0xdc, 0xed, 0xfb, 0xbe, 0xff, 0x97, 0xe4, 0x97, 0x3f, 0x40, 0xfe, 0xb6, 0x7e, 0x4d,
- 0x1a, 0x29, 0xd6, 0x02, 0x0f, 0x7b, 0xdd, 0xcc, 0x27, 0xe3, 0x52, 0x94, 0x42, 0x47, 0x57, 0xbd,
- 0x32, 0xd3, 0xe8, 0x01, 0xdc, 0x27, 0xc5, 0x25, 0xc6, 0xe0, 0xd6, 0x79, 0xc5, 0x09, 0x0a, 0x51,
- 0x7c, 0xca, 0xb4, 0xc6, 0x13, 0xf0, 0x9a, 0x5c, 0xa9, 0x77, 0x21, 0x0b, 0x62, 0xeb, 0x7c, 0xef,
- 0xf1, 0x18, 0x06, 0x52, 0xac, 0xb8, 0x22, 0x4e, 0xe8, 0xc4, 0x3e, 0x33, 0x26, 0xfa, 0x44, 0x00,
- 0x8f, 0x5c, 0x56, 0x0b, 0xa5, 0x16, 0xa2, 0xc6, 0x33, 0xf0, 0x1a, 0x2e, 0xab, 0xac, 0x6d, 0xcc,
- 0xc5, 0x67, 0xd3, 0xf3, 0xc4, 0xd0, 0x24, 0x87, 0x56, 0xd2, 0x8f, 0xd9, 0xbe, 0x88, 0x03, 0x70,
- 0x96, 0xbc, 0xfd, 0x7d, 0xb0, 0x97, 0xf8, 0x02, 0x7c, 0x99, 0xd7, 0x25, 0x7f, 0xe1, 0x75, 0x41,
- 0x1c, 0x03, 0xa2, 0x83, 0xb4, 0x2e, 0xa2, 0x4b, 0x70, 0xf5, 0x31, 0x0f, 0x5c, 0x96, 0xde, 0xdc,
- 0x05, 0x16, 0xf6, 0x61, 0xf0, 0xcc, 0xee, 0xb3, 0x34, 0x40, 0x78, 0x04, 0x7e, 0x1f, 0x1a, 0x6b,
- 0x47, 0x19, 0xb8, 0x4c, 0xac, 0xf8, 0xd1, 0xcf, 0x5e, 0xc3, 0x68, 0xc9, 0xdb, 0x03, 0x16, 0xb1,
- 0x43, 0x27, 0x3e, 0x99, 0xe2, 0xff, 0xc0, 0xec, 0x6f, 0xf1, 0x96, 0x6c, 0x76, 0xd4, 0xda, 0xee,
- 0xa8, 0xb5, 0xe9, 0x28, 0xda, 0x76, 0x14, 0x7d, 0x75, 0x14, 0x7d, 0x7c, 0x53, 0x6b, 0x3e, 0xd4,
- 0x3b, 0x9e, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x76, 0x8d, 0x4f, 0x8f, 0x01, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.proto b/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.proto
deleted file mode 100644
index 001d33435..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/auth/authpb/auth.proto
+++ /dev/null
@@ -1,37 +0,0 @@
-syntax = "proto3";
-package authpb;
-
-import "gogoproto/gogo.proto";
-
-option (gogoproto.marshaler_all) = true;
-option (gogoproto.sizer_all) = true;
-option (gogoproto.unmarshaler_all) = true;
-option (gogoproto.goproto_getters_all) = false;
-option (gogoproto.goproto_enum_prefix_all) = false;
-
-// User is a single entry in the bucket authUsers
-message User {
- bytes name = 1;
- bytes password = 2;
- repeated string roles = 3;
-}
-
-// Permission is a single entity
-message Permission {
- enum Type {
- READ = 0;
- WRITE = 1;
- READWRITE = 2;
- }
- Type permType = 1;
-
- bytes key = 2;
- bytes range_end = 3;
-}
-
-// Role is a single entry in the bucket authRoles
-message Role {
- bytes name = 1;
-
- repeated Permission keyPermission = 2;
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/README.md b/archived/event-adapter/vendor/github.com/coreos/etcd/client/README.md
deleted file mode 100644
index 0bab9589c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/README.md
+++ /dev/null
@@ -1,117 +0,0 @@
-# etcd/client
-
-etcd/client is the Go client library for etcd.
-
-[![GoDoc](https://godoc.org/github.com/coreos/etcd/client?status.png)](https://godoc.org/github.com/coreos/etcd/client)
-
-etcd uses `cmd/vendor` directory to store external dependencies, which are
-to be compiled into etcd release binaries. `client` can be imported without
-vendoring. For full compatibility, it is recommended to vendor builds using
-etcd's vendored packages, using tools like godep, as in
-[vendor directories](https://golang.org/cmd/go/#hdr-Vendor_Directories).
-For more detail, please read [Go vendor design](https://golang.org/s/go15vendor).
-
-## Install
-
-```bash
-go get github.com/coreos/etcd/client
-```
-
-## Usage
-
-```go
-package main
-
-import (
- "log"
- "time"
-
- "golang.org/x/net/context"
- "github.com/coreos/etcd/client"
-)
-
-func main() {
- cfg := client.Config{
- Endpoints: []string{"http://127.0.0.1:2379"},
- Transport: client.DefaultTransport,
- // set timeout per request to fail fast when the target endpoint is unavailable
- HeaderTimeoutPerRequest: time.Second,
- }
- c, err := client.New(cfg)
- if err != nil {
- log.Fatal(err)
- }
- kapi := client.NewKeysAPI(c)
- // set "/foo" key with "bar" value
- log.Print("Setting '/foo' key with 'bar' value")
- resp, err := kapi.Set(context.Background(), "/foo", "bar", nil)
- if err != nil {
- log.Fatal(err)
- } else {
- // print common key info
- log.Printf("Set is done. Metadata is %q\n", resp)
- }
- // get "/foo" key's value
- log.Print("Getting '/foo' key value")
- resp, err = kapi.Get(context.Background(), "/foo", nil)
- if err != nil {
- log.Fatal(err)
- } else {
- // print common key info
- log.Printf("Get is done. Metadata is %q\n", resp)
- // print value
- log.Printf("%q key has %q value\n", resp.Node.Key, resp.Node.Value)
- }
-}
-```
-
-## Error Handling
-
-etcd client might return three types of errors.
-
-- context error
-
-Each API call has its first parameter as `context`. A context can be canceled or have an attached deadline. If the context is canceled or reaches its deadline, the responding context error will be returned no matter what internal errors the API call has already encountered.
-
-- cluster error
-
-Each API call tries to send request to the cluster endpoints one by one until it successfully gets a response. If a requests to an endpoint fails, due to exceeding per request timeout or connection issues, the error will be added into a list of errors. If all possible endpoints fail, a cluster error that includes all encountered errors will be returned.
-
-- response error
-
-If the response gets from the cluster is invalid, a plain string error will be returned. For example, it might be a invalid JSON error.
-
-Here is the example code to handle client errors:
-
-```go
-cfg := client.Config{Endpoints: []string{"http://etcd1:2379","http://etcd2:2379","http://etcd3:2379"}}
-c, err := client.New(cfg)
-if err != nil {
- log.Fatal(err)
-}
-
-kapi := client.NewKeysAPI(c)
-resp, err := kapi.Set(ctx, "test", "bar", nil)
-if err != nil {
- if err == context.Canceled {
- // ctx is canceled by another routine
- } else if err == context.DeadlineExceeded {
- // ctx is attached with a deadline and it exceeded
- } else if cerr, ok := err.(*client.ClusterError); ok {
- // process (cerr.Errors)
- } else {
- // bad cluster endpoints, which are not etcd servers
- }
-}
-```
-
-
-## Caveat
-
-1. etcd/client prefers to use the same endpoint as long as the endpoint continues to work well. This saves socket resources, and improves efficiency for both client and server side. This preference doesn't remove consistency from the data consumed by the client because data replicated to each etcd member has already passed through the consensus process.
-
-2. etcd/client does round-robin rotation on other available endpoints if the preferred endpoint isn't functioning properly. For example, if the member that etcd/client connects to is hard killed, etcd/client will fail on the first attempt with the killed member, and succeed on the second attempt with another member. If it fails to talk to all available endpoints, it will return all errors happened.
-
-3. Default etcd/client cannot handle the case that the remote server is SIGSTOPed now. TCP keepalive mechanism doesn't help in this scenario because operating system may still send TCP keep-alive packets. Over time we'd like to improve this functionality, but solving this issue isn't high priority because a real-life case in which a server is stopped, but the connection is kept alive, hasn't been brought to our attention.
-
-4. etcd/client cannot detect whether the member in use is healthy when doing read requests. If the member is isolated from the cluster, etcd/client may retrieve outdated data. As a workaround, users could monitor experimental /health endpoint for member healthy information. We are improving it at [#3265](https://github.com/coreos/etcd/issues/3265).
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_role.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_role.go
deleted file mode 100644
index d15e00dd7..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_role.go
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "bytes"
- "encoding/json"
- "net/http"
- "net/url"
-
- "golang.org/x/net/context"
-)
-
-type Role struct {
- Role string `json:"role"`
- Permissions Permissions `json:"permissions"`
- Grant *Permissions `json:"grant,omitempty"`
- Revoke *Permissions `json:"revoke,omitempty"`
-}
-
-type Permissions struct {
- KV rwPermission `json:"kv"`
-}
-
-type rwPermission struct {
- Read []string `json:"read"`
- Write []string `json:"write"`
-}
-
-type PermissionType int
-
-const (
- ReadPermission PermissionType = iota
- WritePermission
- ReadWritePermission
-)
-
-// NewAuthRoleAPI constructs a new AuthRoleAPI that uses HTTP to
-// interact with etcd's role creation and modification features.
-func NewAuthRoleAPI(c Client) AuthRoleAPI {
- return &httpAuthRoleAPI{
- client: c,
- }
-}
-
-type AuthRoleAPI interface {
- // AddRole adds a role.
- AddRole(ctx context.Context, role string) error
-
- // RemoveRole removes a role.
- RemoveRole(ctx context.Context, role string) error
-
- // GetRole retrieves role details.
- GetRole(ctx context.Context, role string) (*Role, error)
-
- // GrantRoleKV grants a role some permission prefixes for the KV store.
- GrantRoleKV(ctx context.Context, role string, prefixes []string, permType PermissionType) (*Role, error)
-
- // RevokeRoleKV revokes some permission prefixes for a role on the KV store.
- RevokeRoleKV(ctx context.Context, role string, prefixes []string, permType PermissionType) (*Role, error)
-
- // ListRoles lists roles.
- ListRoles(ctx context.Context) ([]string, error)
-}
-
-type httpAuthRoleAPI struct {
- client httpClient
-}
-
-type authRoleAPIAction struct {
- verb string
- name string
- role *Role
-}
-
-type authRoleAPIList struct{}
-
-func (list *authRoleAPIList) HTTPRequest(ep url.URL) *http.Request {
- u := v2AuthURL(ep, "roles", "")
- req, _ := http.NewRequest("GET", u.String(), nil)
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-func (l *authRoleAPIAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2AuthURL(ep, "roles", l.name)
- if l.role == nil {
- req, _ := http.NewRequest(l.verb, u.String(), nil)
- return req
- }
- b, err := json.Marshal(l.role)
- if err != nil {
- panic(err)
- }
- body := bytes.NewReader(b)
- req, _ := http.NewRequest(l.verb, u.String(), body)
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-func (r *httpAuthRoleAPI) ListRoles(ctx context.Context) ([]string, error) {
- resp, body, err := r.client.Do(ctx, &authRoleAPIList{})
- if err != nil {
- return nil, err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- return nil, err
- }
- var roleList struct {
- Roles []Role `json:"roles"`
- }
- if err = json.Unmarshal(body, &roleList); err != nil {
- return nil, err
- }
- ret := make([]string, 0, len(roleList.Roles))
- for _, r := range roleList.Roles {
- ret = append(ret, r.Role)
- }
- return ret, nil
-}
-
-func (r *httpAuthRoleAPI) AddRole(ctx context.Context, rolename string) error {
- role := &Role{
- Role: rolename,
- }
- return r.addRemoveRole(ctx, &authRoleAPIAction{
- verb: "PUT",
- name: rolename,
- role: role,
- })
-}
-
-func (r *httpAuthRoleAPI) RemoveRole(ctx context.Context, rolename string) error {
- return r.addRemoveRole(ctx, &authRoleAPIAction{
- verb: "DELETE",
- name: rolename,
- })
-}
-
-func (r *httpAuthRoleAPI) addRemoveRole(ctx context.Context, req *authRoleAPIAction) error {
- resp, body, err := r.client.Do(ctx, req)
- if err != nil {
- return err
- }
- if err := assertStatusCode(resp.StatusCode, http.StatusOK, http.StatusCreated); err != nil {
- var sec authError
- err := json.Unmarshal(body, &sec)
- if err != nil {
- return err
- }
- return sec
- }
- return nil
-}
-
-func (r *httpAuthRoleAPI) GetRole(ctx context.Context, rolename string) (*Role, error) {
- return r.modRole(ctx, &authRoleAPIAction{
- verb: "GET",
- name: rolename,
- })
-}
-
-func buildRWPermission(prefixes []string, permType PermissionType) rwPermission {
- var out rwPermission
- switch permType {
- case ReadPermission:
- out.Read = prefixes
- case WritePermission:
- out.Write = prefixes
- case ReadWritePermission:
- out.Read = prefixes
- out.Write = prefixes
- }
- return out
-}
-
-func (r *httpAuthRoleAPI) GrantRoleKV(ctx context.Context, rolename string, prefixes []string, permType PermissionType) (*Role, error) {
- rwp := buildRWPermission(prefixes, permType)
- role := &Role{
- Role: rolename,
- Grant: &Permissions{
- KV: rwp,
- },
- }
- return r.modRole(ctx, &authRoleAPIAction{
- verb: "PUT",
- name: rolename,
- role: role,
- })
-}
-
-func (r *httpAuthRoleAPI) RevokeRoleKV(ctx context.Context, rolename string, prefixes []string, permType PermissionType) (*Role, error) {
- rwp := buildRWPermission(prefixes, permType)
- role := &Role{
- Role: rolename,
- Revoke: &Permissions{
- KV: rwp,
- },
- }
- return r.modRole(ctx, &authRoleAPIAction{
- verb: "PUT",
- name: rolename,
- role: role,
- })
-}
-
-func (r *httpAuthRoleAPI) modRole(ctx context.Context, req *authRoleAPIAction) (*Role, error) {
- resp, body, err := r.client.Do(ctx, req)
- if err != nil {
- return nil, err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- var sec authError
- err = json.Unmarshal(body, &sec)
- if err != nil {
- return nil, err
- }
- return nil, sec
- }
- var role Role
- if err = json.Unmarshal(body, &role); err != nil {
- return nil, err
- }
- return &role, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_user.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_user.go
deleted file mode 100644
index 97c3f3181..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/auth_user.go
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "bytes"
- "encoding/json"
- "net/http"
- "net/url"
- "path"
-
- "golang.org/x/net/context"
-)
-
-var (
- defaultV2AuthPrefix = "/v2/auth"
-)
-
-type User struct {
- User string `json:"user"`
- Password string `json:"password,omitempty"`
- Roles []string `json:"roles"`
- Grant []string `json:"grant,omitempty"`
- Revoke []string `json:"revoke,omitempty"`
-}
-
-// userListEntry is the user representation given by the server for ListUsers
-type userListEntry struct {
- User string `json:"user"`
- Roles []Role `json:"roles"`
-}
-
-type UserRoles struct {
- User string `json:"user"`
- Roles []Role `json:"roles"`
-}
-
-func v2AuthURL(ep url.URL, action string, name string) *url.URL {
- if name != "" {
- ep.Path = path.Join(ep.Path, defaultV2AuthPrefix, action, name)
- return &ep
- }
- ep.Path = path.Join(ep.Path, defaultV2AuthPrefix, action)
- return &ep
-}
-
-// NewAuthAPI constructs a new AuthAPI that uses HTTP to
-// interact with etcd's general auth features.
-func NewAuthAPI(c Client) AuthAPI {
- return &httpAuthAPI{
- client: c,
- }
-}
-
-type AuthAPI interface {
- // Enable auth.
- Enable(ctx context.Context) error
-
- // Disable auth.
- Disable(ctx context.Context) error
-}
-
-type httpAuthAPI struct {
- client httpClient
-}
-
-func (s *httpAuthAPI) Enable(ctx context.Context) error {
- return s.enableDisable(ctx, &authAPIAction{"PUT"})
-}
-
-func (s *httpAuthAPI) Disable(ctx context.Context) error {
- return s.enableDisable(ctx, &authAPIAction{"DELETE"})
-}
-
-func (s *httpAuthAPI) enableDisable(ctx context.Context, req httpAction) error {
- resp, body, err := s.client.Do(ctx, req)
- if err != nil {
- return err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK, http.StatusCreated); err != nil {
- var sec authError
- err = json.Unmarshal(body, &sec)
- if err != nil {
- return err
- }
- return sec
- }
- return nil
-}
-
-type authAPIAction struct {
- verb string
-}
-
-func (l *authAPIAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2AuthURL(ep, "enable", "")
- req, _ := http.NewRequest(l.verb, u.String(), nil)
- return req
-}
-
-type authError struct {
- Message string `json:"message"`
- Code int `json:"-"`
-}
-
-func (e authError) Error() string {
- return e.Message
-}
-
-// NewAuthUserAPI constructs a new AuthUserAPI that uses HTTP to
-// interact with etcd's user creation and modification features.
-func NewAuthUserAPI(c Client) AuthUserAPI {
- return &httpAuthUserAPI{
- client: c,
- }
-}
-
-type AuthUserAPI interface {
- // AddUser adds a user.
- AddUser(ctx context.Context, username string, password string) error
-
- // RemoveUser removes a user.
- RemoveUser(ctx context.Context, username string) error
-
- // GetUser retrieves user details.
- GetUser(ctx context.Context, username string) (*User, error)
-
- // GrantUser grants a user some permission roles.
- GrantUser(ctx context.Context, username string, roles []string) (*User, error)
-
- // RevokeUser revokes some permission roles from a user.
- RevokeUser(ctx context.Context, username string, roles []string) (*User, error)
-
- // ChangePassword changes the user's password.
- ChangePassword(ctx context.Context, username string, password string) (*User, error)
-
- // ListUsers lists the users.
- ListUsers(ctx context.Context) ([]string, error)
-}
-
-type httpAuthUserAPI struct {
- client httpClient
-}
-
-type authUserAPIAction struct {
- verb string
- username string
- user *User
-}
-
-type authUserAPIList struct{}
-
-func (list *authUserAPIList) HTTPRequest(ep url.URL) *http.Request {
- u := v2AuthURL(ep, "users", "")
- req, _ := http.NewRequest("GET", u.String(), nil)
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-func (l *authUserAPIAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2AuthURL(ep, "users", l.username)
- if l.user == nil {
- req, _ := http.NewRequest(l.verb, u.String(), nil)
- return req
- }
- b, err := json.Marshal(l.user)
- if err != nil {
- panic(err)
- }
- body := bytes.NewReader(b)
- req, _ := http.NewRequest(l.verb, u.String(), body)
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-func (u *httpAuthUserAPI) ListUsers(ctx context.Context) ([]string, error) {
- resp, body, err := u.client.Do(ctx, &authUserAPIList{})
- if err != nil {
- return nil, err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- var sec authError
- err = json.Unmarshal(body, &sec)
- if err != nil {
- return nil, err
- }
- return nil, sec
- }
-
- var userList struct {
- Users []userListEntry `json:"users"`
- }
-
- if err = json.Unmarshal(body, &userList); err != nil {
- return nil, err
- }
-
- ret := make([]string, 0, len(userList.Users))
- for _, u := range userList.Users {
- ret = append(ret, u.User)
- }
- return ret, nil
-}
-
-func (u *httpAuthUserAPI) AddUser(ctx context.Context, username string, password string) error {
- user := &User{
- User: username,
- Password: password,
- }
- return u.addRemoveUser(ctx, &authUserAPIAction{
- verb: "PUT",
- username: username,
- user: user,
- })
-}
-
-func (u *httpAuthUserAPI) RemoveUser(ctx context.Context, username string) error {
- return u.addRemoveUser(ctx, &authUserAPIAction{
- verb: "DELETE",
- username: username,
- })
-}
-
-func (u *httpAuthUserAPI) addRemoveUser(ctx context.Context, req *authUserAPIAction) error {
- resp, body, err := u.client.Do(ctx, req)
- if err != nil {
- return err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK, http.StatusCreated); err != nil {
- var sec authError
- err = json.Unmarshal(body, &sec)
- if err != nil {
- return err
- }
- return sec
- }
- return nil
-}
-
-func (u *httpAuthUserAPI) GetUser(ctx context.Context, username string) (*User, error) {
- return u.modUser(ctx, &authUserAPIAction{
- verb: "GET",
- username: username,
- })
-}
-
-func (u *httpAuthUserAPI) GrantUser(ctx context.Context, username string, roles []string) (*User, error) {
- user := &User{
- User: username,
- Grant: roles,
- }
- return u.modUser(ctx, &authUserAPIAction{
- verb: "PUT",
- username: username,
- user: user,
- })
-}
-
-func (u *httpAuthUserAPI) RevokeUser(ctx context.Context, username string, roles []string) (*User, error) {
- user := &User{
- User: username,
- Revoke: roles,
- }
- return u.modUser(ctx, &authUserAPIAction{
- verb: "PUT",
- username: username,
- user: user,
- })
-}
-
-func (u *httpAuthUserAPI) ChangePassword(ctx context.Context, username string, password string) (*User, error) {
- user := &User{
- User: username,
- Password: password,
- }
- return u.modUser(ctx, &authUserAPIAction{
- verb: "PUT",
- username: username,
- user: user,
- })
-}
-
-func (u *httpAuthUserAPI) modUser(ctx context.Context, req *authUserAPIAction) (*User, error) {
- resp, body, err := u.client.Do(ctx, req)
- if err != nil {
- return nil, err
- }
- if err = assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- var sec authError
- err = json.Unmarshal(body, &sec)
- if err != nil {
- return nil, err
- }
- return nil, sec
- }
- var user User
- if err = json.Unmarshal(body, &user); err != nil {
- var userR UserRoles
- if urerr := json.Unmarshal(body, &userR); urerr != nil {
- return nil, err
- }
- user.User = userR.User
- for _, r := range userR.Roles {
- user.Roles = append(user.Roles, r.Role)
- }
- }
- return &user, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/cancelreq.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/cancelreq.go
deleted file mode 100644
index 76d1f0401..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/cancelreq.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// borrowed from golang/net/context/ctxhttp/cancelreq.go
-
-package client
-
-import "net/http"
-
-func requestCanceler(tr CancelableTransport, req *http.Request) func() {
- ch := make(chan struct{})
- req.Cancel = ch
-
- return func() {
- close(ch)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/client.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/client.go
deleted file mode 100644
index eeeb8b57a..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/client.go
+++ /dev/null
@@ -1,609 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "errors"
- "fmt"
- "io/ioutil"
- "math/rand"
- "net"
- "net/http"
- "net/url"
- "reflect"
- "sort"
- "strconv"
- "sync"
- "time"
-
- "golang.org/x/net/context"
-)
-
-var (
- ErrNoEndpoints = errors.New("client: no endpoints available")
- ErrTooManyRedirects = errors.New("client: too many redirects")
- ErrClusterUnavailable = errors.New("client: etcd cluster is unavailable or misconfigured")
- ErrNoLeaderEndpoint = errors.New("client: no leader endpoint available")
- errTooManyRedirectChecks = errors.New("client: too many redirect checks")
-
- // oneShotCtxValue is set on a context using WithValue(&oneShotValue) so
- // that Do() will not retry a request
- oneShotCtxValue interface{}
-)
-
-var DefaultRequestTimeout = 5 * time.Second
-
-var DefaultTransport CancelableTransport = &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: (&net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- }).Dial,
- TLSHandshakeTimeout: 10 * time.Second,
-}
-
-type EndpointSelectionMode int
-
-const (
- // EndpointSelectionRandom is the default value of the 'SelectionMode'.
- // As the name implies, the client object will pick a node from the members
- // of the cluster in a random fashion. If the cluster has three members, A, B,
- // and C, the client picks any node from its three members as its request
- // destination.
- EndpointSelectionRandom EndpointSelectionMode = iota
-
- // If 'SelectionMode' is set to 'EndpointSelectionPrioritizeLeader',
- // requests are sent directly to the cluster leader. This reduces
- // forwarding roundtrips compared to making requests to etcd followers
- // who then forward them to the cluster leader. In the event of a leader
- // failure, however, clients configured this way cannot prioritize among
- // the remaining etcd followers. Therefore, when a client sets 'SelectionMode'
- // to 'EndpointSelectionPrioritizeLeader', it must use 'client.AutoSync()' to
- // maintain its knowledge of current cluster state.
- //
- // This mode should be used with Client.AutoSync().
- EndpointSelectionPrioritizeLeader
-)
-
-type Config struct {
- // Endpoints defines a set of URLs (schemes, hosts and ports only)
- // that can be used to communicate with a logical etcd cluster. For
- // example, a three-node cluster could be provided like so:
- //
- // Endpoints: []string{
- // "http://node1.example.com:2379",
- // "http://node2.example.com:2379",
- // "http://node3.example.com:2379",
- // }
- //
- // If multiple endpoints are provided, the Client will attempt to
- // use them all in the event that one or more of them are unusable.
- //
- // If Client.Sync is ever called, the Client may cache an alternate
- // set of endpoints to continue operation.
- Endpoints []string
-
- // Transport is used by the Client to drive HTTP requests. If not
- // provided, DefaultTransport will be used.
- Transport CancelableTransport
-
- // CheckRedirect specifies the policy for handling HTTP redirects.
- // If CheckRedirect is not nil, the Client calls it before
- // following an HTTP redirect. The sole argument is the number of
- // requests that have already been made. If CheckRedirect returns
- // an error, Client.Do will not make any further requests and return
- // the error back it to the caller.
- //
- // If CheckRedirect is nil, the Client uses its default policy,
- // which is to stop after 10 consecutive requests.
- CheckRedirect CheckRedirectFunc
-
- // Username specifies the user credential to add as an authorization header
- Username string
-
- // Password is the password for the specified user to add as an authorization header
- // to the request.
- Password string
-
- // HeaderTimeoutPerRequest specifies the time limit to wait for response
- // header in a single request made by the Client. The timeout includes
- // connection time, any redirects, and header wait time.
- //
- // For non-watch GET request, server returns the response body immediately.
- // For PUT/POST/DELETE request, server will attempt to commit request
- // before responding, which is expected to take `100ms + 2 * RTT`.
- // For watch request, server returns the header immediately to notify Client
- // watch start. But if server is behind some kind of proxy, the response
- // header may be cached at proxy, and Client cannot rely on this behavior.
- //
- // Especially, wait request will ignore this timeout.
- //
- // One API call may send multiple requests to different etcd servers until it
- // succeeds. Use context of the API to specify the overall timeout.
- //
- // A HeaderTimeoutPerRequest of zero means no timeout.
- HeaderTimeoutPerRequest time.Duration
-
- // SelectionMode is an EndpointSelectionMode enum that specifies the
- // policy for choosing the etcd cluster node to which requests are sent.
- SelectionMode EndpointSelectionMode
-}
-
-func (cfg *Config) transport() CancelableTransport {
- if cfg.Transport == nil {
- return DefaultTransport
- }
- return cfg.Transport
-}
-
-func (cfg *Config) checkRedirect() CheckRedirectFunc {
- if cfg.CheckRedirect == nil {
- return DefaultCheckRedirect
- }
- return cfg.CheckRedirect
-}
-
-// CancelableTransport mimics net/http.Transport, but requires that
-// the object also support request cancellation.
-type CancelableTransport interface {
- http.RoundTripper
- CancelRequest(req *http.Request)
-}
-
-type CheckRedirectFunc func(via int) error
-
-// DefaultCheckRedirect follows up to 10 redirects, but no more.
-var DefaultCheckRedirect CheckRedirectFunc = func(via int) error {
- if via > 10 {
- return ErrTooManyRedirects
- }
- return nil
-}
-
-type Client interface {
- // Sync updates the internal cache of the etcd cluster's membership.
- Sync(context.Context) error
-
- // AutoSync periodically calls Sync() every given interval.
- // The recommended sync interval is 10 seconds to 1 minute, which does
- // not bring too much overhead to server and makes client catch up the
- // cluster change in time.
- //
- // The example to use it:
- //
- // for {
- // err := client.AutoSync(ctx, 10*time.Second)
- // if err == context.DeadlineExceeded || err == context.Canceled {
- // break
- // }
- // log.Print(err)
- // }
- AutoSync(context.Context, time.Duration) error
-
- // Endpoints returns a copy of the current set of API endpoints used
- // by Client to resolve HTTP requests. If Sync has ever been called,
- // this may differ from the initial Endpoints provided in the Config.
- Endpoints() []string
-
- // SetEndpoints sets the set of API endpoints used by Client to resolve
- // HTTP requests. If the given endpoints are not valid, an error will be
- // returned
- SetEndpoints(eps []string) error
-
- httpClient
-}
-
-func New(cfg Config) (Client, error) {
- c := &httpClusterClient{
- clientFactory: newHTTPClientFactory(cfg.transport(), cfg.checkRedirect(), cfg.HeaderTimeoutPerRequest),
- rand: rand.New(rand.NewSource(int64(time.Now().Nanosecond()))),
- selectionMode: cfg.SelectionMode,
- }
- if cfg.Username != "" {
- c.credentials = &credentials{
- username: cfg.Username,
- password: cfg.Password,
- }
- }
- if err := c.SetEndpoints(cfg.Endpoints); err != nil {
- return nil, err
- }
- return c, nil
-}
-
-type httpClient interface {
- Do(context.Context, httpAction) (*http.Response, []byte, error)
-}
-
-func newHTTPClientFactory(tr CancelableTransport, cr CheckRedirectFunc, headerTimeout time.Duration) httpClientFactory {
- return func(ep url.URL) httpClient {
- return &redirectFollowingHTTPClient{
- checkRedirect: cr,
- client: &simpleHTTPClient{
- transport: tr,
- endpoint: ep,
- headerTimeout: headerTimeout,
- },
- }
- }
-}
-
-type credentials struct {
- username string
- password string
-}
-
-type httpClientFactory func(url.URL) httpClient
-
-type httpAction interface {
- HTTPRequest(url.URL) *http.Request
-}
-
-type httpClusterClient struct {
- clientFactory httpClientFactory
- endpoints []url.URL
- pinned int
- credentials *credentials
- sync.RWMutex
- rand *rand.Rand
- selectionMode EndpointSelectionMode
-}
-
-func (c *httpClusterClient) getLeaderEndpoint() (string, error) {
- mAPI := NewMembersAPI(c)
- leader, err := mAPI.Leader(context.Background())
- if err != nil {
- return "", err
- }
-
- return leader.ClientURLs[0], nil // TODO: how to handle multiple client URLs?
-}
-
-func (c *httpClusterClient) SetEndpoints(eps []string) error {
- if len(eps) == 0 {
- return ErrNoEndpoints
- }
-
- neps := make([]url.URL, len(eps))
- for i, ep := range eps {
- u, err := url.Parse(ep)
- if err != nil {
- return err
- }
- neps[i] = *u
- }
-
- switch c.selectionMode {
- case EndpointSelectionRandom:
- c.endpoints = shuffleEndpoints(c.rand, neps)
- c.pinned = 0
- case EndpointSelectionPrioritizeLeader:
- c.endpoints = neps
- lep, err := c.getLeaderEndpoint()
- if err != nil {
- return ErrNoLeaderEndpoint
- }
-
- for i := range c.endpoints {
- if c.endpoints[i].String() == lep {
- c.pinned = i
- break
- }
- }
- // If endpoints doesn't have the lu, just keep c.pinned = 0.
- // Forwarding between follower and leader would be required but it works.
- default:
- return errors.New(fmt.Sprintf("invalid endpoint selection mode: %d", c.selectionMode))
- }
-
- return nil
-}
-
-func (c *httpClusterClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) {
- action := act
- c.RLock()
- leps := len(c.endpoints)
- eps := make([]url.URL, leps)
- n := copy(eps, c.endpoints)
- pinned := c.pinned
-
- if c.credentials != nil {
- action = &authedAction{
- act: act,
- credentials: *c.credentials,
- }
- }
- c.RUnlock()
-
- if leps == 0 {
- return nil, nil, ErrNoEndpoints
- }
-
- if leps != n {
- return nil, nil, errors.New("unable to pick endpoint: copy failed")
- }
-
- var resp *http.Response
- var body []byte
- var err error
- cerr := &ClusterError{}
- isOneShot := ctx.Value(&oneShotCtxValue) != nil
-
- for i := pinned; i < leps+pinned; i++ {
- k := i % leps
- hc := c.clientFactory(eps[k])
- resp, body, err = hc.Do(ctx, action)
- if err != nil {
- cerr.Errors = append(cerr.Errors, err)
- if err == ctx.Err() {
- return nil, nil, ctx.Err()
- }
- if err == context.Canceled || err == context.DeadlineExceeded {
- return nil, nil, err
- }
- if isOneShot {
- return nil, nil, err
- }
- continue
- }
- if resp.StatusCode/100 == 5 {
- switch resp.StatusCode {
- case http.StatusInternalServerError, http.StatusServiceUnavailable:
- // TODO: make sure this is a no leader response
- cerr.Errors = append(cerr.Errors, fmt.Errorf("client: etcd member %s has no leader", eps[k].String()))
- default:
- cerr.Errors = append(cerr.Errors, fmt.Errorf("client: etcd member %s returns server error [%s]", eps[k].String(), http.StatusText(resp.StatusCode)))
- }
- if isOneShot {
- return nil, nil, cerr.Errors[0]
- }
- continue
- }
- if k != pinned {
- c.Lock()
- c.pinned = k
- c.Unlock()
- }
- return resp, body, nil
- }
-
- return nil, nil, cerr
-}
-
-func (c *httpClusterClient) Endpoints() []string {
- c.RLock()
- defer c.RUnlock()
-
- eps := make([]string, len(c.endpoints))
- for i, ep := range c.endpoints {
- eps[i] = ep.String()
- }
-
- return eps
-}
-
-func (c *httpClusterClient) Sync(ctx context.Context) error {
- mAPI := NewMembersAPI(c)
- ms, err := mAPI.List(ctx)
- if err != nil {
- return err
- }
-
- c.Lock()
- defer c.Unlock()
-
- eps := make([]string, 0)
- for _, m := range ms {
- eps = append(eps, m.ClientURLs...)
- }
- sort.Sort(sort.StringSlice(eps))
-
- ceps := make([]string, len(c.endpoints))
- for i, cep := range c.endpoints {
- ceps[i] = cep.String()
- }
- sort.Sort(sort.StringSlice(ceps))
- // fast path if no change happens
- // this helps client to pin the endpoint when no cluster change
- if reflect.DeepEqual(eps, ceps) {
- return nil
- }
-
- return c.SetEndpoints(eps)
-}
-
-func (c *httpClusterClient) AutoSync(ctx context.Context, interval time.Duration) error {
- ticker := time.NewTicker(interval)
- defer ticker.Stop()
- for {
- err := c.Sync(ctx)
- if err != nil {
- return err
- }
- select {
- case <-ctx.Done():
- return ctx.Err()
- case <-ticker.C:
- }
- }
-}
-
-type roundTripResponse struct {
- resp *http.Response
- err error
-}
-
-type simpleHTTPClient struct {
- transport CancelableTransport
- endpoint url.URL
- headerTimeout time.Duration
-}
-
-func (c *simpleHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) {
- req := act.HTTPRequest(c.endpoint)
-
- if err := printcURL(req); err != nil {
- return nil, nil, err
- }
-
- isWait := false
- if req != nil && req.URL != nil {
- ws := req.URL.Query().Get("wait")
- if len(ws) != 0 {
- var err error
- isWait, err = strconv.ParseBool(ws)
- if err != nil {
- return nil, nil, fmt.Errorf("wrong wait value %s (%v for %+v)", ws, err, req)
- }
- }
- }
-
- var hctx context.Context
- var hcancel context.CancelFunc
- if !isWait && c.headerTimeout > 0 {
- hctx, hcancel = context.WithTimeout(ctx, c.headerTimeout)
- } else {
- hctx, hcancel = context.WithCancel(ctx)
- }
- defer hcancel()
-
- reqcancel := requestCanceler(c.transport, req)
-
- rtchan := make(chan roundTripResponse, 1)
- go func() {
- resp, err := c.transport.RoundTrip(req)
- rtchan <- roundTripResponse{resp: resp, err: err}
- close(rtchan)
- }()
-
- var resp *http.Response
- var err error
-
- select {
- case rtresp := <-rtchan:
- resp, err = rtresp.resp, rtresp.err
- case <-hctx.Done():
- // cancel and wait for request to actually exit before continuing
- reqcancel()
- rtresp := <-rtchan
- resp = rtresp.resp
- switch {
- case ctx.Err() != nil:
- err = ctx.Err()
- case hctx.Err() != nil:
- err = fmt.Errorf("client: endpoint %s exceeded header timeout", c.endpoint.String())
- default:
- panic("failed to get error from context")
- }
- }
-
- // always check for resp nil-ness to deal with possible
- // race conditions between channels above
- defer func() {
- if resp != nil {
- resp.Body.Close()
- }
- }()
-
- if err != nil {
- return nil, nil, err
- }
-
- var body []byte
- done := make(chan struct{})
- go func() {
- body, err = ioutil.ReadAll(resp.Body)
- done <- struct{}{}
- }()
-
- select {
- case <-ctx.Done():
- resp.Body.Close()
- <-done
- return nil, nil, ctx.Err()
- case <-done:
- }
-
- return resp, body, err
-}
-
-type authedAction struct {
- act httpAction
- credentials credentials
-}
-
-func (a *authedAction) HTTPRequest(url url.URL) *http.Request {
- r := a.act.HTTPRequest(url)
- r.SetBasicAuth(a.credentials.username, a.credentials.password)
- return r
-}
-
-type redirectFollowingHTTPClient struct {
- client httpClient
- checkRedirect CheckRedirectFunc
-}
-
-func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) {
- next := act
- for i := 0; i < 100; i++ {
- if i > 0 {
- if err := r.checkRedirect(i); err != nil {
- return nil, nil, err
- }
- }
- resp, body, err := r.client.Do(ctx, next)
- if err != nil {
- return nil, nil, err
- }
- if resp.StatusCode/100 == 3 {
- hdr := resp.Header.Get("Location")
- if hdr == "" {
- return nil, nil, fmt.Errorf("Location header not set")
- }
- loc, err := url.Parse(hdr)
- if err != nil {
- return nil, nil, fmt.Errorf("Location header not valid URL: %s", hdr)
- }
- next = &redirectedHTTPAction{
- action: act,
- location: *loc,
- }
- continue
- }
- return resp, body, nil
- }
-
- return nil, nil, errTooManyRedirectChecks
-}
-
-type redirectedHTTPAction struct {
- action httpAction
- location url.URL
-}
-
-func (r *redirectedHTTPAction) HTTPRequest(ep url.URL) *http.Request {
- orig := r.action.HTTPRequest(ep)
- orig.URL = &r.location
- return orig
-}
-
-func shuffleEndpoints(r *rand.Rand, eps []url.URL) []url.URL {
- p := r.Perm(len(eps))
- neps := make([]url.URL, len(eps))
- for i, k := range p {
- neps[i] = eps[k]
- }
- return neps
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/cluster_error.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/cluster_error.go
deleted file mode 100644
index aef5bf755..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/cluster_error.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import "fmt"
-
-type ClusterError struct {
- Errors []error
-}
-
-func (ce *ClusterError) Error() string {
- return ErrClusterUnavailable.Error()
-}
-
-func (ce *ClusterError) Detail() string {
- s := ""
- for i, e := range ce.Errors {
- s += fmt.Sprintf("error #%d: %s\n", i, e)
- }
- return s
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/curl.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/curl.go
deleted file mode 100644
index c8bc9fba2..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/curl.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "net/http"
- "os"
-)
-
-var (
- cURLDebug = false
-)
-
-func EnablecURLDebug() {
- cURLDebug = true
-}
-
-func DisablecURLDebug() {
- cURLDebug = false
-}
-
-// printcURL prints the cURL equivalent request to stderr.
-// It returns an error if the body of the request cannot
-// be read.
-// The caller MUST cancel the request if there is an error.
-func printcURL(req *http.Request) error {
- if !cURLDebug {
- return nil
- }
- var (
- command string
- b []byte
- err error
- )
-
- if req.URL != nil {
- command = fmt.Sprintf("curl -X %s %s", req.Method, req.URL.String())
- }
-
- if req.Body != nil {
- b, err = ioutil.ReadAll(req.Body)
- if err != nil {
- return err
- }
- command += fmt.Sprintf(" -d %q", string(b))
- }
-
- fmt.Fprintf(os.Stderr, "cURL Command: %s\n", command)
-
- // reset body
- body := bytes.NewBuffer(b)
- req.Body = ioutil.NopCloser(body)
-
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/discover.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/discover.go
deleted file mode 100644
index bfd7aec93..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/discover.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-// Discoverer is an interface that wraps the Discover method.
-type Discoverer interface {
- // Discover looks up the etcd servers for the domain.
- Discover(domain string) ([]string, error)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/doc.go
deleted file mode 100644
index 32fdfb52c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/doc.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*
-Package client provides bindings for the etcd APIs.
-
-Create a Config and exchange it for a Client:
-
- import (
- "net/http"
-
- "github.com/coreos/etcd/client"
- "golang.org/x/net/context"
- )
-
- cfg := client.Config{
- Endpoints: []string{"http://127.0.0.1:2379"},
- Transport: DefaultTransport,
- }
-
- c, err := client.New(cfg)
- if err != nil {
- // handle error
- }
-
-Clients are safe for concurrent use by multiple goroutines.
-
-Create a KeysAPI using the Client, then use it to interact with etcd:
-
- kAPI := client.NewKeysAPI(c)
-
- // create a new key /foo with the value "bar"
- _, err = kAPI.Create(context.Background(), "/foo", "bar")
- if err != nil {
- // handle error
- }
-
- // delete the newly created key only if the value is still "bar"
- _, err = kAPI.Delete(context.Background(), "/foo", &DeleteOptions{PrevValue: "bar"})
- if err != nil {
- // handle error
- }
-
-Use a custom context to set timeouts on your operations:
-
- import "time"
-
- ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
- defer cancel()
-
- // set a new key, ignoring it's previous state
- _, err := kAPI.Set(ctx, "/ping", "pong", nil)
- if err != nil {
- if err == context.DeadlineExceeded {
- // request took longer than 5s
- } else {
- // handle error
- }
- }
-
-*/
-package client
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.generated.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.generated.go
deleted file mode 100644
index 748283aa9..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.generated.go
+++ /dev/null
@@ -1,1000 +0,0 @@
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED BY codecgen.
-// ************************************************************
-
-package client
-
-import (
- "errors"
- "fmt"
- codec1978 "github.com/ugorji/go/codec"
- "reflect"
- "runtime"
- time "time"
-)
-
-const (
- // ----- content types ----
- codecSelferC_UTF81819 = 1
- codecSelferC_RAW1819 = 0
- // ----- value types used ----
- codecSelferValueTypeArray1819 = 10
- codecSelferValueTypeMap1819 = 9
- // ----- containerStateValues ----
- codecSelfer_containerMapKey1819 = 2
- codecSelfer_containerMapValue1819 = 3
- codecSelfer_containerMapEnd1819 = 4
- codecSelfer_containerArrayElem1819 = 6
- codecSelfer_containerArrayEnd1819 = 7
-)
-
-var (
- codecSelferBitsize1819 = uint8(reflect.TypeOf(uint(0)).Bits())
- codecSelferOnlyMapOrArrayEncodeToStructErr1819 = errors.New(`only encoded map or array can be decoded into a struct`)
-)
-
-type codecSelfer1819 struct{}
-
-func init() {
- if codec1978.GenVersion != 5 {
- _, file, _, _ := runtime.Caller(0)
- err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v",
- 5, codec1978.GenVersion, file)
- panic(err)
- }
- if false { // reference the types, but skip this branch at build/run time
- var v0 time.Time
- _ = v0
- }
-}
-
-func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- yym1 := z.EncBinary()
- _ = yym1
- if false {
- } else if z.HasExtensions() && z.EncExt(x) {
- } else {
- yysep2 := !z.EncBinary()
- yy2arr2 := z.EncBasicHandle().StructToArray
- var yyq2 [3]bool
- _, _, _ = yysep2, yyq2, yy2arr2
- const yyr2 bool = false
- var yynn2 int
- if yyr2 || yy2arr2 {
- r.EncodeArrayStart(3)
- } else {
- yynn2 = 3
- for _, b := range yyq2 {
- if b {
- yynn2++
- }
- }
- r.EncodeMapStart(yynn2)
- yynn2 = 0
- }
- if yyr2 || yy2arr2 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- yym4 := z.EncBinary()
- _ = yym4
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Action))
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("action"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym5 := z.EncBinary()
- _ = yym5
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Action))
- }
- }
- if yyr2 || yy2arr2 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if x.Node == nil {
- r.EncodeNil()
- } else {
- x.Node.CodecEncodeSelf(e)
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("node"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- if x.Node == nil {
- r.EncodeNil()
- } else {
- x.Node.CodecEncodeSelf(e)
- }
- }
- if yyr2 || yy2arr2 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if x.PrevNode == nil {
- r.EncodeNil()
- } else {
- x.PrevNode.CodecEncodeSelf(e)
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("prevNode"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- if x.PrevNode == nil {
- r.EncodeNil()
- } else {
- x.PrevNode.CodecEncodeSelf(e)
- }
- }
- if yyr2 || yy2arr2 {
- z.EncSendContainerState(codecSelfer_containerArrayEnd1819)
- } else {
- z.EncSendContainerState(codecSelfer_containerMapEnd1819)
- }
- }
- }
-}
-
-func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- yym8 := z.DecBinary()
- _ = yym8
- if false {
- } else if z.HasExtensions() && z.DecExt(x) {
- } else {
- yyct9 := r.ContainerType()
- if yyct9 == codecSelferValueTypeMap1819 {
- yyl9 := r.ReadMapStart()
- if yyl9 == 0 {
- z.DecSendContainerState(codecSelfer_containerMapEnd1819)
- } else {
- x.codecDecodeSelfFromMap(yyl9, d)
- }
- } else if yyct9 == codecSelferValueTypeArray1819 {
- yyl9 := r.ReadArrayStart()
- if yyl9 == 0 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- } else {
- x.codecDecodeSelfFromArray(yyl9, d)
- }
- } else {
- panic(codecSelferOnlyMapOrArrayEncodeToStructErr1819)
- }
- }
-}
-
-func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yys10Slc = z.DecScratchBuffer() // default slice to decode into
- _ = yys10Slc
- var yyhl10 bool = l >= 0
- for yyj10 := 0; ; yyj10++ {
- if yyhl10 {
- if yyj10 >= l {
- break
- }
- } else {
- if r.CheckBreak() {
- break
- }
- }
- z.DecSendContainerState(codecSelfer_containerMapKey1819)
- yys10Slc = r.DecodeBytes(yys10Slc, true, true)
- yys10 := string(yys10Slc)
- z.DecSendContainerState(codecSelfer_containerMapValue1819)
- switch yys10 {
- case "action":
- if r.TryDecodeAsNil() {
- x.Action = ""
- } else {
- x.Action = string(r.DecodeString())
- }
- case "node":
- if r.TryDecodeAsNil() {
- if x.Node != nil {
- x.Node = nil
- }
- } else {
- if x.Node == nil {
- x.Node = new(Node)
- }
- x.Node.CodecDecodeSelf(d)
- }
- case "prevNode":
- if r.TryDecodeAsNil() {
- if x.PrevNode != nil {
- x.PrevNode = nil
- }
- } else {
- if x.PrevNode == nil {
- x.PrevNode = new(Node)
- }
- x.PrevNode.CodecDecodeSelf(d)
- }
- default:
- z.DecStructFieldNotFound(-1, yys10)
- } // end switch yys10
- } // end for yyj10
- z.DecSendContainerState(codecSelfer_containerMapEnd1819)
-}
-
-func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyj14 int
- var yyb14 bool
- var yyhl14 bool = l >= 0
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
- }
- if yyb14 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.Action = ""
- } else {
- x.Action = string(r.DecodeString())
- }
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
- }
- if yyb14 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- if x.Node != nil {
- x.Node = nil
- }
- } else {
- if x.Node == nil {
- x.Node = new(Node)
- }
- x.Node.CodecDecodeSelf(d)
- }
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
- }
- if yyb14 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- if x.PrevNode != nil {
- x.PrevNode = nil
- }
- } else {
- if x.PrevNode == nil {
- x.PrevNode = new(Node)
- }
- x.PrevNode.CodecDecodeSelf(d)
- }
- for {
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
- }
- if yyb14 {
- break
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- z.DecStructFieldNotFound(yyj14-1, "")
- }
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
-}
-
-func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- yym18 := z.EncBinary()
- _ = yym18
- if false {
- } else if z.HasExtensions() && z.EncExt(x) {
- } else {
- yysep19 := !z.EncBinary()
- yy2arr19 := z.EncBasicHandle().StructToArray
- var yyq19 [8]bool
- _, _, _ = yysep19, yyq19, yy2arr19
- const yyr19 bool = false
- yyq19[1] = x.Dir != false
- yyq19[6] = x.Expiration != nil
- yyq19[7] = x.TTL != 0
- var yynn19 int
- if yyr19 || yy2arr19 {
- r.EncodeArrayStart(8)
- } else {
- yynn19 = 5
- for _, b := range yyq19 {
- if b {
- yynn19++
- }
- }
- r.EncodeMapStart(yynn19)
- yynn19 = 0
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- yym21 := z.EncBinary()
- _ = yym21
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Key))
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("key"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym22 := z.EncBinary()
- _ = yym22
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Key))
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if yyq19[1] {
- yym24 := z.EncBinary()
- _ = yym24
- if false {
- } else {
- r.EncodeBool(bool(x.Dir))
- }
- } else {
- r.EncodeBool(false)
- }
- } else {
- if yyq19[1] {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("dir"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym25 := z.EncBinary()
- _ = yym25
- if false {
- } else {
- r.EncodeBool(bool(x.Dir))
- }
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- yym27 := z.EncBinary()
- _ = yym27
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Value))
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("value"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym28 := z.EncBinary()
- _ = yym28
- if false {
- } else {
- r.EncodeString(codecSelferC_UTF81819, string(x.Value))
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if x.Nodes == nil {
- r.EncodeNil()
- } else {
- x.Nodes.CodecEncodeSelf(e)
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("nodes"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- if x.Nodes == nil {
- r.EncodeNil()
- } else {
- x.Nodes.CodecEncodeSelf(e)
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- yym31 := z.EncBinary()
- _ = yym31
- if false {
- } else {
- r.EncodeUint(uint64(x.CreatedIndex))
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("createdIndex"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym32 := z.EncBinary()
- _ = yym32
- if false {
- } else {
- r.EncodeUint(uint64(x.CreatedIndex))
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- yym34 := z.EncBinary()
- _ = yym34
- if false {
- } else {
- r.EncodeUint(uint64(x.ModifiedIndex))
- }
- } else {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("modifiedIndex"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym35 := z.EncBinary()
- _ = yym35
- if false {
- } else {
- r.EncodeUint(uint64(x.ModifiedIndex))
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if yyq19[6] {
- if x.Expiration == nil {
- r.EncodeNil()
- } else {
- yym37 := z.EncBinary()
- _ = yym37
- if false {
- } else if yym38 := z.TimeRtidIfBinc(); yym38 != 0 {
- r.EncodeBuiltin(yym38, x.Expiration)
- } else if z.HasExtensions() && z.EncExt(x.Expiration) {
- } else if yym37 {
- z.EncBinaryMarshal(x.Expiration)
- } else if !yym37 && z.IsJSONHandle() {
- z.EncJSONMarshal(x.Expiration)
- } else {
- z.EncFallback(x.Expiration)
- }
- }
- } else {
- r.EncodeNil()
- }
- } else {
- if yyq19[6] {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("expiration"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- if x.Expiration == nil {
- r.EncodeNil()
- } else {
- yym39 := z.EncBinary()
- _ = yym39
- if false {
- } else if yym40 := z.TimeRtidIfBinc(); yym40 != 0 {
- r.EncodeBuiltin(yym40, x.Expiration)
- } else if z.HasExtensions() && z.EncExt(x.Expiration) {
- } else if yym39 {
- z.EncBinaryMarshal(x.Expiration)
- } else if !yym39 && z.IsJSONHandle() {
- z.EncJSONMarshal(x.Expiration)
- } else {
- z.EncFallback(x.Expiration)
- }
- }
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if yyq19[7] {
- yym42 := z.EncBinary()
- _ = yym42
- if false {
- } else {
- r.EncodeInt(int64(x.TTL))
- }
- } else {
- r.EncodeInt(0)
- }
- } else {
- if yyq19[7] {
- z.EncSendContainerState(codecSelfer_containerMapKey1819)
- r.EncodeString(codecSelferC_UTF81819, string("ttl"))
- z.EncSendContainerState(codecSelfer_containerMapValue1819)
- yym43 := z.EncBinary()
- _ = yym43
- if false {
- } else {
- r.EncodeInt(int64(x.TTL))
- }
- }
- }
- if yyr19 || yy2arr19 {
- z.EncSendContainerState(codecSelfer_containerArrayEnd1819)
- } else {
- z.EncSendContainerState(codecSelfer_containerMapEnd1819)
- }
- }
- }
-}
-
-func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- yym44 := z.DecBinary()
- _ = yym44
- if false {
- } else if z.HasExtensions() && z.DecExt(x) {
- } else {
- yyct45 := r.ContainerType()
- if yyct45 == codecSelferValueTypeMap1819 {
- yyl45 := r.ReadMapStart()
- if yyl45 == 0 {
- z.DecSendContainerState(codecSelfer_containerMapEnd1819)
- } else {
- x.codecDecodeSelfFromMap(yyl45, d)
- }
- } else if yyct45 == codecSelferValueTypeArray1819 {
- yyl45 := r.ReadArrayStart()
- if yyl45 == 0 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- } else {
- x.codecDecodeSelfFromArray(yyl45, d)
- }
- } else {
- panic(codecSelferOnlyMapOrArrayEncodeToStructErr1819)
- }
- }
-}
-
-func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yys46Slc = z.DecScratchBuffer() // default slice to decode into
- _ = yys46Slc
- var yyhl46 bool = l >= 0
- for yyj46 := 0; ; yyj46++ {
- if yyhl46 {
- if yyj46 >= l {
- break
- }
- } else {
- if r.CheckBreak() {
- break
- }
- }
- z.DecSendContainerState(codecSelfer_containerMapKey1819)
- yys46Slc = r.DecodeBytes(yys46Slc, true, true)
- yys46 := string(yys46Slc)
- z.DecSendContainerState(codecSelfer_containerMapValue1819)
- switch yys46 {
- case "key":
- if r.TryDecodeAsNil() {
- x.Key = ""
- } else {
- x.Key = string(r.DecodeString())
- }
- case "dir":
- if r.TryDecodeAsNil() {
- x.Dir = false
- } else {
- x.Dir = bool(r.DecodeBool())
- }
- case "value":
- if r.TryDecodeAsNil() {
- x.Value = ""
- } else {
- x.Value = string(r.DecodeString())
- }
- case "nodes":
- if r.TryDecodeAsNil() {
- x.Nodes = nil
- } else {
- yyv50 := &x.Nodes
- yyv50.CodecDecodeSelf(d)
- }
- case "createdIndex":
- if r.TryDecodeAsNil() {
- x.CreatedIndex = 0
- } else {
- x.CreatedIndex = uint64(r.DecodeUint(64))
- }
- case "modifiedIndex":
- if r.TryDecodeAsNil() {
- x.ModifiedIndex = 0
- } else {
- x.ModifiedIndex = uint64(r.DecodeUint(64))
- }
- case "expiration":
- if r.TryDecodeAsNil() {
- if x.Expiration != nil {
- x.Expiration = nil
- }
- } else {
- if x.Expiration == nil {
- x.Expiration = new(time.Time)
- }
- yym54 := z.DecBinary()
- _ = yym54
- if false {
- } else if yym55 := z.TimeRtidIfBinc(); yym55 != 0 {
- r.DecodeBuiltin(yym55, x.Expiration)
- } else if z.HasExtensions() && z.DecExt(x.Expiration) {
- } else if yym54 {
- z.DecBinaryUnmarshal(x.Expiration)
- } else if !yym54 && z.IsJSONHandle() {
- z.DecJSONUnmarshal(x.Expiration)
- } else {
- z.DecFallback(x.Expiration, false)
- }
- }
- case "ttl":
- if r.TryDecodeAsNil() {
- x.TTL = 0
- } else {
- x.TTL = int64(r.DecodeInt(64))
- }
- default:
- z.DecStructFieldNotFound(-1, yys46)
- } // end switch yys46
- } // end for yyj46
- z.DecSendContainerState(codecSelfer_containerMapEnd1819)
-}
-
-func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- var yyj57 int
- var yyb57 bool
- var yyhl57 bool = l >= 0
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.Key = ""
- } else {
- x.Key = string(r.DecodeString())
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.Dir = false
- } else {
- x.Dir = bool(r.DecodeBool())
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.Value = ""
- } else {
- x.Value = string(r.DecodeString())
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.Nodes = nil
- } else {
- yyv61 := &x.Nodes
- yyv61.CodecDecodeSelf(d)
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.CreatedIndex = 0
- } else {
- x.CreatedIndex = uint64(r.DecodeUint(64))
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.ModifiedIndex = 0
- } else {
- x.ModifiedIndex = uint64(r.DecodeUint(64))
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- if x.Expiration != nil {
- x.Expiration = nil
- }
- } else {
- if x.Expiration == nil {
- x.Expiration = new(time.Time)
- }
- yym65 := z.DecBinary()
- _ = yym65
- if false {
- } else if yym66 := z.TimeRtidIfBinc(); yym66 != 0 {
- r.DecodeBuiltin(yym66, x.Expiration)
- } else if z.HasExtensions() && z.DecExt(x.Expiration) {
- } else if yym65 {
- z.DecBinaryUnmarshal(x.Expiration)
- } else if !yym65 && z.IsJSONHandle() {
- z.DecJSONUnmarshal(x.Expiration)
- } else {
- z.DecFallback(x.Expiration, false)
- }
- }
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
- return
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- if r.TryDecodeAsNil() {
- x.TTL = 0
- } else {
- x.TTL = int64(r.DecodeInt(64))
- }
- for {
- yyj57++
- if yyhl57 {
- yyb57 = yyj57 > l
- } else {
- yyb57 = r.CheckBreak()
- }
- if yyb57 {
- break
- }
- z.DecSendContainerState(codecSelfer_containerArrayElem1819)
- z.DecStructFieldNotFound(yyj57-1, "")
- }
- z.DecSendContainerState(codecSelfer_containerArrayEnd1819)
-}
-
-func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperEncoder(e)
- _, _, _ = h, z, r
- if x == nil {
- r.EncodeNil()
- } else {
- yym68 := z.EncBinary()
- _ = yym68
- if false {
- } else if z.HasExtensions() && z.EncExt(x) {
- } else {
- h.encNodes((Nodes)(x), e)
- }
- }
-}
-
-func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
- yym69 := z.DecBinary()
- _ = yym69
- if false {
- } else if z.HasExtensions() && z.DecExt(x) {
- } else {
- h.decNodes((*Nodes)(x), d)
- }
-}
-
-func (x codecSelfer1819) encNodes(v Nodes, e *codec1978.Encoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperEncoder(e)
- _, _, _ = h, z, r
- r.EncodeArrayStart(len(v))
- for _, yyv70 := range v {
- z.EncSendContainerState(codecSelfer_containerArrayElem1819)
- if yyv70 == nil {
- r.EncodeNil()
- } else {
- yyv70.CodecEncodeSelf(e)
- }
- }
- z.EncSendContainerState(codecSelfer_containerArrayEnd1819)
-}
-
-func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) {
- var h codecSelfer1819
- z, r := codec1978.GenHelperDecoder(d)
- _, _, _ = h, z, r
-
- yyv71 := *v
- yyh71, yyl71 := z.DecSliceHelperStart()
- var yyc71 bool
- if yyl71 == 0 {
- if yyv71 == nil {
- yyv71 = []*Node{}
- yyc71 = true
- } else if len(yyv71) != 0 {
- yyv71 = yyv71[:0]
- yyc71 = true
- }
- } else if yyl71 > 0 {
- var yyrr71, yyrl71 int
- var yyrt71 bool
- if yyl71 > cap(yyv71) {
-
- yyrg71 := len(yyv71) > 0
- yyv271 := yyv71
- yyrl71, yyrt71 = z.DecInferLen(yyl71, z.DecBasicHandle().MaxInitLen, 8)
- if yyrt71 {
- if yyrl71 <= cap(yyv71) {
- yyv71 = yyv71[:yyrl71]
- } else {
- yyv71 = make([]*Node, yyrl71)
- }
- } else {
- yyv71 = make([]*Node, yyrl71)
- }
- yyc71 = true
- yyrr71 = len(yyv71)
- if yyrg71 {
- copy(yyv71, yyv271)
- }
- } else if yyl71 != len(yyv71) {
- yyv71 = yyv71[:yyl71]
- yyc71 = true
- }
- yyj71 := 0
- for ; yyj71 < yyrr71; yyj71++ {
- yyh71.ElemContainerState(yyj71)
- if r.TryDecodeAsNil() {
- if yyv71[yyj71] != nil {
- *yyv71[yyj71] = Node{}
- }
- } else {
- if yyv71[yyj71] == nil {
- yyv71[yyj71] = new(Node)
- }
- yyw72 := yyv71[yyj71]
- yyw72.CodecDecodeSelf(d)
- }
-
- }
- if yyrt71 {
- for ; yyj71 < yyl71; yyj71++ {
- yyv71 = append(yyv71, nil)
- yyh71.ElemContainerState(yyj71)
- if r.TryDecodeAsNil() {
- if yyv71[yyj71] != nil {
- *yyv71[yyj71] = Node{}
- }
- } else {
- if yyv71[yyj71] == nil {
- yyv71[yyj71] = new(Node)
- }
- yyw73 := yyv71[yyj71]
- yyw73.CodecDecodeSelf(d)
- }
-
- }
- }
-
- } else {
- yyj71 := 0
- for ; !r.CheckBreak(); yyj71++ {
-
- if yyj71 >= len(yyv71) {
- yyv71 = append(yyv71, nil) // var yyz71 *Node
- yyc71 = true
- }
- yyh71.ElemContainerState(yyj71)
- if yyj71 < len(yyv71) {
- if r.TryDecodeAsNil() {
- if yyv71[yyj71] != nil {
- *yyv71[yyj71] = Node{}
- }
- } else {
- if yyv71[yyj71] == nil {
- yyv71[yyj71] = new(Node)
- }
- yyw74 := yyv71[yyj71]
- yyw74.CodecDecodeSelf(d)
- }
-
- } else {
- z.DecSwallow()
- }
-
- }
- if yyj71 < len(yyv71) {
- yyv71 = yyv71[:yyj71]
- yyc71 = true
- } else if yyj71 == 0 && yyv71 == nil {
- yyv71 = []*Node{}
- yyc71 = true
- }
- }
- yyh71.End()
- if yyc71 {
- *v = yyv71
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.go
deleted file mode 100644
index 62d5d506e..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/keys.go
+++ /dev/null
@@ -1,668 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-//go:generate codecgen -d 1819 -r "Node|Response|Nodes" -o keys.generated.go keys.go
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/coreos/etcd/pkg/pathutil"
- "github.com/ugorji/go/codec"
- "golang.org/x/net/context"
-)
-
-const (
- ErrorCodeKeyNotFound = 100
- ErrorCodeTestFailed = 101
- ErrorCodeNotFile = 102
- ErrorCodeNotDir = 104
- ErrorCodeNodeExist = 105
- ErrorCodeRootROnly = 107
- ErrorCodeDirNotEmpty = 108
- ErrorCodeUnauthorized = 110
-
- ErrorCodePrevValueRequired = 201
- ErrorCodeTTLNaN = 202
- ErrorCodeIndexNaN = 203
- ErrorCodeInvalidField = 209
- ErrorCodeInvalidForm = 210
-
- ErrorCodeRaftInternal = 300
- ErrorCodeLeaderElect = 301
-
- ErrorCodeWatcherCleared = 400
- ErrorCodeEventIndexCleared = 401
-)
-
-type Error struct {
- Code int `json:"errorCode"`
- Message string `json:"message"`
- Cause string `json:"cause"`
- Index uint64 `json:"index"`
-}
-
-func (e Error) Error() string {
- return fmt.Sprintf("%v: %v (%v) [%v]", e.Code, e.Message, e.Cause, e.Index)
-}
-
-var (
- ErrInvalidJSON = errors.New("client: response is invalid json. The endpoint is probably not valid etcd cluster endpoint.")
- ErrEmptyBody = errors.New("client: response body is empty")
-)
-
-// PrevExistType is used to define an existence condition when setting
-// or deleting Nodes.
-type PrevExistType string
-
-const (
- PrevIgnore = PrevExistType("")
- PrevExist = PrevExistType("true")
- PrevNoExist = PrevExistType("false")
-)
-
-var (
- defaultV2KeysPrefix = "/v2/keys"
-)
-
-// NewKeysAPI builds a KeysAPI that interacts with etcd's key-value
-// API over HTTP.
-func NewKeysAPI(c Client) KeysAPI {
- return NewKeysAPIWithPrefix(c, defaultV2KeysPrefix)
-}
-
-// NewKeysAPIWithPrefix acts like NewKeysAPI, but allows the caller
-// to provide a custom base URL path. This should only be used in
-// very rare cases.
-func NewKeysAPIWithPrefix(c Client, p string) KeysAPI {
- return &httpKeysAPI{
- client: c,
- prefix: p,
- }
-}
-
-type KeysAPI interface {
- // Get retrieves a set of Nodes from etcd
- Get(ctx context.Context, key string, opts *GetOptions) (*Response, error)
-
- // Set assigns a new value to a Node identified by a given key. The caller
- // may define a set of conditions in the SetOptions. If SetOptions.Dir=true
- // then value is ignored.
- Set(ctx context.Context, key, value string, opts *SetOptions) (*Response, error)
-
- // Delete removes a Node identified by the given key, optionally destroying
- // all of its children as well. The caller may define a set of required
- // conditions in an DeleteOptions object.
- Delete(ctx context.Context, key string, opts *DeleteOptions) (*Response, error)
-
- // Create is an alias for Set w/ PrevExist=false
- Create(ctx context.Context, key, value string) (*Response, error)
-
- // CreateInOrder is used to atomically create in-order keys within the given directory.
- CreateInOrder(ctx context.Context, dir, value string, opts *CreateInOrderOptions) (*Response, error)
-
- // Update is an alias for Set w/ PrevExist=true
- Update(ctx context.Context, key, value string) (*Response, error)
-
- // Watcher builds a new Watcher targeted at a specific Node identified
- // by the given key. The Watcher may be configured at creation time
- // through a WatcherOptions object. The returned Watcher is designed
- // to emit events that happen to a Node, and optionally to its children.
- Watcher(key string, opts *WatcherOptions) Watcher
-}
-
-type WatcherOptions struct {
- // AfterIndex defines the index after-which the Watcher should
- // start emitting events. For example, if a value of 5 is
- // provided, the first event will have an index >= 6.
- //
- // Setting AfterIndex to 0 (default) means that the Watcher
- // should start watching for events starting at the current
- // index, whatever that may be.
- AfterIndex uint64
-
- // Recursive specifies whether or not the Watcher should emit
- // events that occur in children of the given keyspace. If set
- // to false (default), events will be limited to those that
- // occur for the exact key.
- Recursive bool
-}
-
-type CreateInOrderOptions struct {
- // TTL defines a period of time after-which the Node should
- // expire and no longer exist. Values <= 0 are ignored. Given
- // that the zero-value is ignored, TTL cannot be used to set
- // a TTL of 0.
- TTL time.Duration
-}
-
-type SetOptions struct {
- // PrevValue specifies what the current value of the Node must
- // be in order for the Set operation to succeed.
- //
- // Leaving this field empty means that the caller wishes to
- // ignore the current value of the Node. This cannot be used
- // to compare the Node's current value to an empty string.
- //
- // PrevValue is ignored if Dir=true
- PrevValue string
-
- // PrevIndex indicates what the current ModifiedIndex of the
- // Node must be in order for the Set operation to succeed.
- //
- // If PrevIndex is set to 0 (default), no comparison is made.
- PrevIndex uint64
-
- // PrevExist specifies whether the Node must currently exist
- // (PrevExist) or not (PrevNoExist). If the caller does not
- // care about existence, set PrevExist to PrevIgnore, or simply
- // leave it unset.
- PrevExist PrevExistType
-
- // TTL defines a period of time after-which the Node should
- // expire and no longer exist. Values <= 0 are ignored. Given
- // that the zero-value is ignored, TTL cannot be used to set
- // a TTL of 0.
- TTL time.Duration
-
- // Refresh set to true means a TTL value can be updated
- // without firing a watch or changing the node value. A
- // value must not be provided when refreshing a key.
- Refresh bool
-
- // Dir specifies whether or not this Node should be created as a directory.
- Dir bool
-}
-
-type GetOptions struct {
- // Recursive defines whether or not all children of the Node
- // should be returned.
- Recursive bool
-
- // Sort instructs the server whether or not to sort the Nodes.
- // If true, the Nodes are sorted alphabetically by key in
- // ascending order (A to z). If false (default), the Nodes will
- // not be sorted and the ordering used should not be considered
- // predictable.
- Sort bool
-
- // Quorum specifies whether it gets the latest committed value that
- // has been applied in quorum of members, which ensures external
- // consistency (or linearizability).
- Quorum bool
-}
-
-type DeleteOptions struct {
- // PrevValue specifies what the current value of the Node must
- // be in order for the Delete operation to succeed.
- //
- // Leaving this field empty means that the caller wishes to
- // ignore the current value of the Node. This cannot be used
- // to compare the Node's current value to an empty string.
- PrevValue string
-
- // PrevIndex indicates what the current ModifiedIndex of the
- // Node must be in order for the Delete operation to succeed.
- //
- // If PrevIndex is set to 0 (default), no comparison is made.
- PrevIndex uint64
-
- // Recursive defines whether or not all children of the Node
- // should be deleted. If set to true, all children of the Node
- // identified by the given key will be deleted. If left unset
- // or explicitly set to false, only a single Node will be
- // deleted.
- Recursive bool
-
- // Dir specifies whether or not this Node should be removed as a directory.
- Dir bool
-}
-
-type Watcher interface {
- // Next blocks until an etcd event occurs, then returns a Response
- // representing that event. The behavior of Next depends on the
- // WatcherOptions used to construct the Watcher. Next is designed to
- // be called repeatedly, each time blocking until a subsequent event
- // is available.
- //
- // If the provided context is cancelled, Next will return a non-nil
- // error. Any other failures encountered while waiting for the next
- // event (connection issues, deserialization failures, etc) will
- // also result in a non-nil error.
- Next(context.Context) (*Response, error)
-}
-
-type Response struct {
- // Action is the name of the operation that occurred. Possible values
- // include get, set, delete, update, create, compareAndSwap,
- // compareAndDelete and expire.
- Action string `json:"action"`
-
- // Node represents the state of the relevant etcd Node.
- Node *Node `json:"node"`
-
- // PrevNode represents the previous state of the Node. PrevNode is non-nil
- // only if the Node existed before the action occurred and the action
- // caused a change to the Node.
- PrevNode *Node `json:"prevNode"`
-
- // Index holds the cluster-level index at the time the Response was generated.
- // This index is not tied to the Node(s) contained in this Response.
- Index uint64 `json:"-"`
-}
-
-type Node struct {
- // Key represents the unique location of this Node (e.g. "/foo/bar").
- Key string `json:"key"`
-
- // Dir reports whether node describes a directory.
- Dir bool `json:"dir,omitempty"`
-
- // Value is the current data stored on this Node. If this Node
- // is a directory, Value will be empty.
- Value string `json:"value"`
-
- // Nodes holds the children of this Node, only if this Node is a directory.
- // This slice of will be arbitrarily deep (children, grandchildren, great-
- // grandchildren, etc.) if a recursive Get or Watch request were made.
- Nodes Nodes `json:"nodes"`
-
- // CreatedIndex is the etcd index at-which this Node was created.
- CreatedIndex uint64 `json:"createdIndex"`
-
- // ModifiedIndex is the etcd index at-which this Node was last modified.
- ModifiedIndex uint64 `json:"modifiedIndex"`
-
- // Expiration is the server side expiration time of the key.
- Expiration *time.Time `json:"expiration,omitempty"`
-
- // TTL is the time to live of the key in second.
- TTL int64 `json:"ttl,omitempty"`
-}
-
-func (n *Node) String() string {
- return fmt.Sprintf("{Key: %s, CreatedIndex: %d, ModifiedIndex: %d, TTL: %d}", n.Key, n.CreatedIndex, n.ModifiedIndex, n.TTL)
-}
-
-// TTLDuration returns the Node's TTL as a time.Duration object
-func (n *Node) TTLDuration() time.Duration {
- return time.Duration(n.TTL) * time.Second
-}
-
-type Nodes []*Node
-
-// interfaces for sorting
-
-func (ns Nodes) Len() int { return len(ns) }
-func (ns Nodes) Less(i, j int) bool { return ns[i].Key < ns[j].Key }
-func (ns Nodes) Swap(i, j int) { ns[i], ns[j] = ns[j], ns[i] }
-
-type httpKeysAPI struct {
- client httpClient
- prefix string
-}
-
-func (k *httpKeysAPI) Set(ctx context.Context, key, val string, opts *SetOptions) (*Response, error) {
- act := &setAction{
- Prefix: k.prefix,
- Key: key,
- Value: val,
- }
-
- if opts != nil {
- act.PrevValue = opts.PrevValue
- act.PrevIndex = opts.PrevIndex
- act.PrevExist = opts.PrevExist
- act.TTL = opts.TTL
- act.Refresh = opts.Refresh
- act.Dir = opts.Dir
- }
-
- doCtx := ctx
- if act.PrevExist == PrevNoExist {
- doCtx = context.WithValue(doCtx, &oneShotCtxValue, &oneShotCtxValue)
- }
- resp, body, err := k.client.Do(doCtx, act)
- if err != nil {
- return nil, err
- }
-
- return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
-}
-
-func (k *httpKeysAPI) Create(ctx context.Context, key, val string) (*Response, error) {
- return k.Set(ctx, key, val, &SetOptions{PrevExist: PrevNoExist})
-}
-
-func (k *httpKeysAPI) CreateInOrder(ctx context.Context, dir, val string, opts *CreateInOrderOptions) (*Response, error) {
- act := &createInOrderAction{
- Prefix: k.prefix,
- Dir: dir,
- Value: val,
- }
-
- if opts != nil {
- act.TTL = opts.TTL
- }
-
- resp, body, err := k.client.Do(ctx, act)
- if err != nil {
- return nil, err
- }
-
- return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
-}
-
-func (k *httpKeysAPI) Update(ctx context.Context, key, val string) (*Response, error) {
- return k.Set(ctx, key, val, &SetOptions{PrevExist: PrevExist})
-}
-
-func (k *httpKeysAPI) Delete(ctx context.Context, key string, opts *DeleteOptions) (*Response, error) {
- act := &deleteAction{
- Prefix: k.prefix,
- Key: key,
- }
-
- if opts != nil {
- act.PrevValue = opts.PrevValue
- act.PrevIndex = opts.PrevIndex
- act.Dir = opts.Dir
- act.Recursive = opts.Recursive
- }
-
- doCtx := context.WithValue(ctx, &oneShotCtxValue, &oneShotCtxValue)
- resp, body, err := k.client.Do(doCtx, act)
- if err != nil {
- return nil, err
- }
-
- return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
-}
-
-func (k *httpKeysAPI) Get(ctx context.Context, key string, opts *GetOptions) (*Response, error) {
- act := &getAction{
- Prefix: k.prefix,
- Key: key,
- }
-
- if opts != nil {
- act.Recursive = opts.Recursive
- act.Sorted = opts.Sort
- act.Quorum = opts.Quorum
- }
-
- resp, body, err := k.client.Do(ctx, act)
- if err != nil {
- return nil, err
- }
-
- return unmarshalHTTPResponse(resp.StatusCode, resp.Header, body)
-}
-
-func (k *httpKeysAPI) Watcher(key string, opts *WatcherOptions) Watcher {
- act := waitAction{
- Prefix: k.prefix,
- Key: key,
- }
-
- if opts != nil {
- act.Recursive = opts.Recursive
- if opts.AfterIndex > 0 {
- act.WaitIndex = opts.AfterIndex + 1
- }
- }
-
- return &httpWatcher{
- client: k.client,
- nextWait: act,
- }
-}
-
-type httpWatcher struct {
- client httpClient
- nextWait waitAction
-}
-
-func (hw *httpWatcher) Next(ctx context.Context) (*Response, error) {
- for {
- httpresp, body, err := hw.client.Do(ctx, &hw.nextWait)
- if err != nil {
- return nil, err
- }
-
- resp, err := unmarshalHTTPResponse(httpresp.StatusCode, httpresp.Header, body)
- if err != nil {
- if err == ErrEmptyBody {
- continue
- }
- return nil, err
- }
-
- hw.nextWait.WaitIndex = resp.Node.ModifiedIndex + 1
- return resp, nil
- }
-}
-
-// v2KeysURL forms a URL representing the location of a key.
-// The endpoint argument represents the base URL of an etcd
-// server. The prefix is the path needed to route from the
-// provided endpoint's path to the root of the keys API
-// (typically "/v2/keys").
-func v2KeysURL(ep url.URL, prefix, key string) *url.URL {
- // We concatenate all parts together manually. We cannot use
- // path.Join because it does not reserve trailing slash.
- // We call CanonicalURLPath to further cleanup the path.
- if prefix != "" && prefix[0] != '/' {
- prefix = "/" + prefix
- }
- if key != "" && key[0] != '/' {
- key = "/" + key
- }
- ep.Path = pathutil.CanonicalURLPath(ep.Path + prefix + key)
- return &ep
-}
-
-type getAction struct {
- Prefix string
- Key string
- Recursive bool
- Sorted bool
- Quorum bool
-}
-
-func (g *getAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2KeysURL(ep, g.Prefix, g.Key)
-
- params := u.Query()
- params.Set("recursive", strconv.FormatBool(g.Recursive))
- params.Set("sorted", strconv.FormatBool(g.Sorted))
- params.Set("quorum", strconv.FormatBool(g.Quorum))
- u.RawQuery = params.Encode()
-
- req, _ := http.NewRequest("GET", u.String(), nil)
- return req
-}
-
-type waitAction struct {
- Prefix string
- Key string
- WaitIndex uint64
- Recursive bool
-}
-
-func (w *waitAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2KeysURL(ep, w.Prefix, w.Key)
-
- params := u.Query()
- params.Set("wait", "true")
- params.Set("waitIndex", strconv.FormatUint(w.WaitIndex, 10))
- params.Set("recursive", strconv.FormatBool(w.Recursive))
- u.RawQuery = params.Encode()
-
- req, _ := http.NewRequest("GET", u.String(), nil)
- return req
-}
-
-type setAction struct {
- Prefix string
- Key string
- Value string
- PrevValue string
- PrevIndex uint64
- PrevExist PrevExistType
- TTL time.Duration
- Refresh bool
- Dir bool
-}
-
-func (a *setAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2KeysURL(ep, a.Prefix, a.Key)
-
- params := u.Query()
- form := url.Values{}
-
- // we're either creating a directory or setting a key
- if a.Dir {
- params.Set("dir", strconv.FormatBool(a.Dir))
- } else {
- // These options are only valid for setting a key
- if a.PrevValue != "" {
- params.Set("prevValue", a.PrevValue)
- }
- form.Add("value", a.Value)
- }
-
- // Options which apply to both setting a key and creating a dir
- if a.PrevIndex != 0 {
- params.Set("prevIndex", strconv.FormatUint(a.PrevIndex, 10))
- }
- if a.PrevExist != PrevIgnore {
- params.Set("prevExist", string(a.PrevExist))
- }
- if a.TTL > 0 {
- form.Add("ttl", strconv.FormatUint(uint64(a.TTL.Seconds()), 10))
- }
-
- if a.Refresh {
- form.Add("refresh", "true")
- }
-
- u.RawQuery = params.Encode()
- body := strings.NewReader(form.Encode())
-
- req, _ := http.NewRequest("PUT", u.String(), body)
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
-
- return req
-}
-
-type deleteAction struct {
- Prefix string
- Key string
- PrevValue string
- PrevIndex uint64
- Dir bool
- Recursive bool
-}
-
-func (a *deleteAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2KeysURL(ep, a.Prefix, a.Key)
-
- params := u.Query()
- if a.PrevValue != "" {
- params.Set("prevValue", a.PrevValue)
- }
- if a.PrevIndex != 0 {
- params.Set("prevIndex", strconv.FormatUint(a.PrevIndex, 10))
- }
- if a.Dir {
- params.Set("dir", "true")
- }
- if a.Recursive {
- params.Set("recursive", "true")
- }
- u.RawQuery = params.Encode()
-
- req, _ := http.NewRequest("DELETE", u.String(), nil)
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
-
- return req
-}
-
-type createInOrderAction struct {
- Prefix string
- Dir string
- Value string
- TTL time.Duration
-}
-
-func (a *createInOrderAction) HTTPRequest(ep url.URL) *http.Request {
- u := v2KeysURL(ep, a.Prefix, a.Dir)
-
- form := url.Values{}
- form.Add("value", a.Value)
- if a.TTL > 0 {
- form.Add("ttl", strconv.FormatUint(uint64(a.TTL.Seconds()), 10))
- }
- body := strings.NewReader(form.Encode())
-
- req, _ := http.NewRequest("POST", u.String(), body)
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- return req
-}
-
-func unmarshalHTTPResponse(code int, header http.Header, body []byte) (res *Response, err error) {
- switch code {
- case http.StatusOK, http.StatusCreated:
- if len(body) == 0 {
- return nil, ErrEmptyBody
- }
- res, err = unmarshalSuccessfulKeysResponse(header, body)
- default:
- err = unmarshalFailedKeysResponse(body)
- }
-
- return
-}
-
-func unmarshalSuccessfulKeysResponse(header http.Header, body []byte) (*Response, error) {
- var res Response
- err := codec.NewDecoderBytes(body, new(codec.JsonHandle)).Decode(&res)
- if err != nil {
- return nil, ErrInvalidJSON
- }
- if header.Get("X-Etcd-Index") != "" {
- res.Index, err = strconv.ParseUint(header.Get("X-Etcd-Index"), 10, 64)
- if err != nil {
- return nil, err
- }
- }
- return &res, nil
-}
-
-func unmarshalFailedKeysResponse(body []byte) error {
- var etcdErr Error
- if err := json.Unmarshal(body, &etcdErr); err != nil {
- return ErrInvalidJSON
- }
- return etcdErr
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/members.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/members.go
deleted file mode 100644
index 23adf07ad..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/members.go
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "net/http"
- "net/url"
- "path"
-
- "golang.org/x/net/context"
-
- "github.com/coreos/etcd/pkg/types"
-)
-
-var (
- defaultV2MembersPrefix = "/v2/members"
- defaultLeaderSuffix = "/leader"
-)
-
-type Member struct {
- // ID is the unique identifier of this Member.
- ID string `json:"id"`
-
- // Name is a human-readable, non-unique identifier of this Member.
- Name string `json:"name"`
-
- // PeerURLs represents the HTTP(S) endpoints this Member uses to
- // participate in etcd's consensus protocol.
- PeerURLs []string `json:"peerURLs"`
-
- // ClientURLs represents the HTTP(S) endpoints on which this Member
- // serves it's client-facing APIs.
- ClientURLs []string `json:"clientURLs"`
-}
-
-type memberCollection []Member
-
-func (c *memberCollection) UnmarshalJSON(data []byte) error {
- d := struct {
- Members []Member
- }{}
-
- if err := json.Unmarshal(data, &d); err != nil {
- return err
- }
-
- if d.Members == nil {
- *c = make([]Member, 0)
- return nil
- }
-
- *c = d.Members
- return nil
-}
-
-type memberCreateOrUpdateRequest struct {
- PeerURLs types.URLs
-}
-
-func (m *memberCreateOrUpdateRequest) MarshalJSON() ([]byte, error) {
- s := struct {
- PeerURLs []string `json:"peerURLs"`
- }{
- PeerURLs: make([]string, len(m.PeerURLs)),
- }
-
- for i, u := range m.PeerURLs {
- s.PeerURLs[i] = u.String()
- }
-
- return json.Marshal(&s)
-}
-
-// NewMembersAPI constructs a new MembersAPI that uses HTTP to
-// interact with etcd's membership API.
-func NewMembersAPI(c Client) MembersAPI {
- return &httpMembersAPI{
- client: c,
- }
-}
-
-type MembersAPI interface {
- // List enumerates the current cluster membership.
- List(ctx context.Context) ([]Member, error)
-
- // Add instructs etcd to accept a new Member into the cluster.
- Add(ctx context.Context, peerURL string) (*Member, error)
-
- // Remove demotes an existing Member out of the cluster.
- Remove(ctx context.Context, mID string) error
-
- // Update instructs etcd to update an existing Member in the cluster.
- Update(ctx context.Context, mID string, peerURLs []string) error
-
- // Leader gets current leader of the cluster
- Leader(ctx context.Context) (*Member, error)
-}
-
-type httpMembersAPI struct {
- client httpClient
-}
-
-func (m *httpMembersAPI) List(ctx context.Context) ([]Member, error) {
- req := &membersAPIActionList{}
- resp, body, err := m.client.Do(ctx, req)
- if err != nil {
- return nil, err
- }
-
- if err := assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- return nil, err
- }
-
- var mCollection memberCollection
- if err := json.Unmarshal(body, &mCollection); err != nil {
- return nil, err
- }
-
- return []Member(mCollection), nil
-}
-
-func (m *httpMembersAPI) Add(ctx context.Context, peerURL string) (*Member, error) {
- urls, err := types.NewURLs([]string{peerURL})
- if err != nil {
- return nil, err
- }
-
- req := &membersAPIActionAdd{peerURLs: urls}
- resp, body, err := m.client.Do(ctx, req)
- if err != nil {
- return nil, err
- }
-
- if err := assertStatusCode(resp.StatusCode, http.StatusCreated, http.StatusConflict); err != nil {
- return nil, err
- }
-
- if resp.StatusCode != http.StatusCreated {
- var merr membersError
- if err := json.Unmarshal(body, &merr); err != nil {
- return nil, err
- }
- return nil, merr
- }
-
- var memb Member
- if err := json.Unmarshal(body, &memb); err != nil {
- return nil, err
- }
-
- return &memb, nil
-}
-
-func (m *httpMembersAPI) Update(ctx context.Context, memberID string, peerURLs []string) error {
- urls, err := types.NewURLs(peerURLs)
- if err != nil {
- return err
- }
-
- req := &membersAPIActionUpdate{peerURLs: urls, memberID: memberID}
- resp, body, err := m.client.Do(ctx, req)
- if err != nil {
- return err
- }
-
- if err := assertStatusCode(resp.StatusCode, http.StatusNoContent, http.StatusNotFound, http.StatusConflict); err != nil {
- return err
- }
-
- if resp.StatusCode != http.StatusNoContent {
- var merr membersError
- if err := json.Unmarshal(body, &merr); err != nil {
- return err
- }
- return merr
- }
-
- return nil
-}
-
-func (m *httpMembersAPI) Remove(ctx context.Context, memberID string) error {
- req := &membersAPIActionRemove{memberID: memberID}
- resp, _, err := m.client.Do(ctx, req)
- if err != nil {
- return err
- }
-
- return assertStatusCode(resp.StatusCode, http.StatusNoContent, http.StatusGone)
-}
-
-func (m *httpMembersAPI) Leader(ctx context.Context) (*Member, error) {
- req := &membersAPIActionLeader{}
- resp, body, err := m.client.Do(ctx, req)
- if err != nil {
- return nil, err
- }
-
- if err := assertStatusCode(resp.StatusCode, http.StatusOK); err != nil {
- return nil, err
- }
-
- var leader Member
- if err := json.Unmarshal(body, &leader); err != nil {
- return nil, err
- }
-
- return &leader, nil
-}
-
-type membersAPIActionList struct{}
-
-func (l *membersAPIActionList) HTTPRequest(ep url.URL) *http.Request {
- u := v2MembersURL(ep)
- req, _ := http.NewRequest("GET", u.String(), nil)
- return req
-}
-
-type membersAPIActionRemove struct {
- memberID string
-}
-
-func (d *membersAPIActionRemove) HTTPRequest(ep url.URL) *http.Request {
- u := v2MembersURL(ep)
- u.Path = path.Join(u.Path, d.memberID)
- req, _ := http.NewRequest("DELETE", u.String(), nil)
- return req
-}
-
-type membersAPIActionAdd struct {
- peerURLs types.URLs
-}
-
-func (a *membersAPIActionAdd) HTTPRequest(ep url.URL) *http.Request {
- u := v2MembersURL(ep)
- m := memberCreateOrUpdateRequest{PeerURLs: a.peerURLs}
- b, _ := json.Marshal(&m)
- req, _ := http.NewRequest("POST", u.String(), bytes.NewReader(b))
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-type membersAPIActionUpdate struct {
- memberID string
- peerURLs types.URLs
-}
-
-func (a *membersAPIActionUpdate) HTTPRequest(ep url.URL) *http.Request {
- u := v2MembersURL(ep)
- m := memberCreateOrUpdateRequest{PeerURLs: a.peerURLs}
- u.Path = path.Join(u.Path, a.memberID)
- b, _ := json.Marshal(&m)
- req, _ := http.NewRequest("PUT", u.String(), bytes.NewReader(b))
- req.Header.Set("Content-Type", "application/json")
- return req
-}
-
-func assertStatusCode(got int, want ...int) (err error) {
- for _, w := range want {
- if w == got {
- return nil
- }
- }
- return fmt.Errorf("unexpected status code %d", got)
-}
-
-type membersAPIActionLeader struct{}
-
-func (l *membersAPIActionLeader) HTTPRequest(ep url.URL) *http.Request {
- u := v2MembersURL(ep)
- u.Path = path.Join(u.Path, defaultLeaderSuffix)
- req, _ := http.NewRequest("GET", u.String(), nil)
- return req
-}
-
-// v2MembersURL add the necessary path to the provided endpoint
-// to route requests to the default v2 members API.
-func v2MembersURL(ep url.URL) *url.URL {
- ep.Path = path.Join(ep.Path, defaultV2MembersPrefix)
- return &ep
-}
-
-type membersError struct {
- Message string `json:"message"`
- Code int `json:"-"`
-}
-
-func (e membersError) Error() string {
- return e.Message
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/srv.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/srv.go
deleted file mode 100644
index fdfa34359..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/srv.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-import (
- "fmt"
- "net"
- "net/url"
-)
-
-var (
- // indirection for testing
- lookupSRV = net.LookupSRV
-)
-
-type srvDiscover struct{}
-
-// NewSRVDiscover constructs a new Discoverer that uses the stdlib to lookup SRV records.
-func NewSRVDiscover() Discoverer {
- return &srvDiscover{}
-}
-
-// Discover looks up the etcd servers for the domain.
-func (d *srvDiscover) Discover(domain string) ([]string, error) {
- var urls []*url.URL
-
- updateURLs := func(service, scheme string) error {
- _, addrs, err := lookupSRV(service, "tcp", domain)
- if err != nil {
- return err
- }
- for _, srv := range addrs {
- urls = append(urls, &url.URL{
- Scheme: scheme,
- Host: net.JoinHostPort(srv.Target, fmt.Sprintf("%d", srv.Port)),
- })
- }
- return nil
- }
-
- errHTTPS := updateURLs("etcd-client-ssl", "https")
- errHTTP := updateURLs("etcd-client", "http")
-
- if errHTTPS != nil && errHTTP != nil {
- return nil, fmt.Errorf("dns lookup errors: %s and %s", errHTTPS, errHTTP)
- }
-
- endpoints := make([]string, len(urls))
- for i := range urls {
- endpoints[i] = urls[i].String()
- }
- return endpoints, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/client/util.go b/archived/event-adapter/vendor/github.com/coreos/etcd/client/util.go
deleted file mode 100644
index 198bff965..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/client/util.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package client
-
-// IsKeyNotFound returns true if the error code is ErrorCodeKeyNotFound.
-func IsKeyNotFound(err error) bool {
- if cErr, ok := err.(Error); ok {
- return cErr.Code == ErrorCodeKeyNotFound
- }
- return false
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/README.md b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/README.md
deleted file mode 100644
index e434f9994..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/README.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# etcd/clientv3
-
-[![Godoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/coreos/etcd/clientv3)
-
-`etcd/clientv3` is the official Go etcd client for v3.
-
-## Install
-
-```bash
-go get github.com/coreos/etcd/clientv3
-```
-
-## Get started
-
-Create client using `clientv3.New`:
-
-```go
-cli, err := clientv3.New(clientv3.Config{
- Endpoints: []string{"localhost:2379", "localhost:22379", "localhost:32379"},
- DialTimeout: 5 * time.Second,
-})
-if err != nil {
- // handle error!
-}
-defer cli.Close()
-```
-
-etcd v3 uses [`gRPC`](http://www.grpc.io) for remote procedure calls. And `clientv3` uses
-[`grpc-go`](https://github.com/grpc/grpc-go) to connect to etcd. Make sure to close the client after using it.
-If the client is not closed, the connection will have leaky goroutines. To specify client request timeout,
-pass `context.WithTimeout` to APIs:
-
-```go
-ctx, cancel := context.WithTimeout(context.Background(), timeout)
-resp, err := kvc.Put(ctx, "sample_key", "sample_value")
-cancel()
-if err != nil {
- // handle error!
-}
-// use the response
-```
-
-etcd uses `cmd/vendor` directory to store external dependencies, which are
-to be compiled into etcd release binaries. `client` can be imported without
-vendoring. For full compatibility, it is recommended to vendor builds using
-etcd's vendored packages, using tools like godep, as in
-[vendor directories](https://golang.org/cmd/go/#hdr-Vendor_Directories).
-For more detail, please read [Go vendor design](https://golang.org/s/go15vendor).
-
-## Error Handling
-
-etcd client returns 2 types of errors:
-
-1. context error: canceled or deadline exceeded.
-2. gRPC error: see [api/v3rpc/rpctypes](https://godoc.org/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes).
-
-Here is the example code to handle client errors:
-
-```go
-resp, err := kvc.Put(ctx, "", "")
-if err != nil {
- switch err {
- case context.Canceled:
- log.Fatalf("ctx is canceled by another routine: %v", err)
- case context.DeadlineExceeded:
- log.Fatalf("ctx is attached with a deadline is exceeded: %v", err)
- case rpctypes.ErrEmptyKey:
- log.Fatalf("client-side error: %v", err)
- default:
- log.Fatalf("bad cluster endpoints, which are not etcd servers: %v", err)
- }
-}
-```
-
-## Examples
-
-More code examples can be found at [GoDoc](https://godoc.org/github.com/coreos/etcd/clientv3).
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/auth.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/auth.go
deleted file mode 100644
index 8c3c047f4..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/auth.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "fmt"
- "strings"
-
- "github.com/coreos/etcd/auth/authpb"
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type (
- AuthEnableResponse pb.AuthEnableResponse
- AuthDisableResponse pb.AuthDisableResponse
- AuthenticateResponse pb.AuthenticateResponse
- AuthUserAddResponse pb.AuthUserAddResponse
- AuthUserDeleteResponse pb.AuthUserDeleteResponse
- AuthUserChangePasswordResponse pb.AuthUserChangePasswordResponse
- AuthUserGrantRoleResponse pb.AuthUserGrantRoleResponse
- AuthUserGetResponse pb.AuthUserGetResponse
- AuthUserRevokeRoleResponse pb.AuthUserRevokeRoleResponse
- AuthRoleAddResponse pb.AuthRoleAddResponse
- AuthRoleGrantPermissionResponse pb.AuthRoleGrantPermissionResponse
- AuthRoleGetResponse pb.AuthRoleGetResponse
- AuthRoleRevokePermissionResponse pb.AuthRoleRevokePermissionResponse
- AuthRoleDeleteResponse pb.AuthRoleDeleteResponse
- AuthUserListResponse pb.AuthUserListResponse
- AuthRoleListResponse pb.AuthRoleListResponse
-
- PermissionType authpb.Permission_Type
-)
-
-const (
- PermRead = authpb.READ
- PermWrite = authpb.WRITE
- PermReadWrite = authpb.READWRITE
-)
-
-type Auth interface {
- // AuthEnable enables auth of an etcd cluster.
- AuthEnable(ctx context.Context) (*AuthEnableResponse, error)
-
- // AuthDisable disables auth of an etcd cluster.
- AuthDisable(ctx context.Context) (*AuthDisableResponse, error)
-
- // UserAdd adds a new user to an etcd cluster.
- UserAdd(ctx context.Context, name string, password string) (*AuthUserAddResponse, error)
-
- // UserDelete deletes a user from an etcd cluster.
- UserDelete(ctx context.Context, name string) (*AuthUserDeleteResponse, error)
-
- // UserChangePassword changes a password of a user.
- UserChangePassword(ctx context.Context, name string, password string) (*AuthUserChangePasswordResponse, error)
-
- // UserGrantRole grants a role to a user.
- UserGrantRole(ctx context.Context, user string, role string) (*AuthUserGrantRoleResponse, error)
-
- // UserGet gets a detailed information of a user.
- UserGet(ctx context.Context, name string) (*AuthUserGetResponse, error)
-
- // UserList gets a list of all users.
- UserList(ctx context.Context) (*AuthUserListResponse, error)
-
- // UserRevokeRole revokes a role of a user.
- UserRevokeRole(ctx context.Context, name string, role string) (*AuthUserRevokeRoleResponse, error)
-
- // RoleAdd adds a new role to an etcd cluster.
- RoleAdd(ctx context.Context, name string) (*AuthRoleAddResponse, error)
-
- // RoleGrantPermission grants a permission to a role.
- RoleGrantPermission(ctx context.Context, name string, key, rangeEnd string, permType PermissionType) (*AuthRoleGrantPermissionResponse, error)
-
- // RoleGet gets a detailed information of a role.
- RoleGet(ctx context.Context, role string) (*AuthRoleGetResponse, error)
-
- // RoleList gets a list of all roles.
- RoleList(ctx context.Context) (*AuthRoleListResponse, error)
-
- // RoleRevokePermission revokes a permission from a role.
- RoleRevokePermission(ctx context.Context, role string, key, rangeEnd string) (*AuthRoleRevokePermissionResponse, error)
-
- // RoleDelete deletes a role.
- RoleDelete(ctx context.Context, role string) (*AuthRoleDeleteResponse, error)
-}
-
-type auth struct {
- c *Client
-
- conn *grpc.ClientConn // conn in-use
- remote pb.AuthClient
-}
-
-func NewAuth(c *Client) Auth {
- conn := c.ActiveConnection()
- return &auth{
- conn: c.ActiveConnection(),
- remote: pb.NewAuthClient(conn),
- c: c,
- }
-}
-
-func (auth *auth) AuthEnable(ctx context.Context) (*AuthEnableResponse, error) {
- resp, err := auth.remote.AuthEnable(ctx, &pb.AuthEnableRequest{})
- return (*AuthEnableResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) AuthDisable(ctx context.Context) (*AuthDisableResponse, error) {
- resp, err := auth.remote.AuthDisable(ctx, &pb.AuthDisableRequest{})
- return (*AuthDisableResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserAdd(ctx context.Context, name string, password string) (*AuthUserAddResponse, error) {
- resp, err := auth.remote.UserAdd(ctx, &pb.AuthUserAddRequest{Name: name, Password: password})
- return (*AuthUserAddResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserDelete(ctx context.Context, name string) (*AuthUserDeleteResponse, error) {
- resp, err := auth.remote.UserDelete(ctx, &pb.AuthUserDeleteRequest{Name: name})
- return (*AuthUserDeleteResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserChangePassword(ctx context.Context, name string, password string) (*AuthUserChangePasswordResponse, error) {
- resp, err := auth.remote.UserChangePassword(ctx, &pb.AuthUserChangePasswordRequest{Name: name, Password: password})
- return (*AuthUserChangePasswordResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserGrantRole(ctx context.Context, user string, role string) (*AuthUserGrantRoleResponse, error) {
- resp, err := auth.remote.UserGrantRole(ctx, &pb.AuthUserGrantRoleRequest{User: user, Role: role})
- return (*AuthUserGrantRoleResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserGet(ctx context.Context, name string) (*AuthUserGetResponse, error) {
- resp, err := auth.remote.UserGet(ctx, &pb.AuthUserGetRequest{Name: name}, grpc.FailFast(false))
- return (*AuthUserGetResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserList(ctx context.Context) (*AuthUserListResponse, error) {
- resp, err := auth.remote.UserList(ctx, &pb.AuthUserListRequest{}, grpc.FailFast(false))
- return (*AuthUserListResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) UserRevokeRole(ctx context.Context, name string, role string) (*AuthUserRevokeRoleResponse, error) {
- resp, err := auth.remote.UserRevokeRole(ctx, &pb.AuthUserRevokeRoleRequest{Name: name, Role: role})
- return (*AuthUserRevokeRoleResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleAdd(ctx context.Context, name string) (*AuthRoleAddResponse, error) {
- resp, err := auth.remote.RoleAdd(ctx, &pb.AuthRoleAddRequest{Name: name})
- return (*AuthRoleAddResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleGrantPermission(ctx context.Context, name string, key, rangeEnd string, permType PermissionType) (*AuthRoleGrantPermissionResponse, error) {
- perm := &authpb.Permission{
- Key: []byte(key),
- RangeEnd: []byte(rangeEnd),
- PermType: authpb.Permission_Type(permType),
- }
- resp, err := auth.remote.RoleGrantPermission(ctx, &pb.AuthRoleGrantPermissionRequest{Name: name, Perm: perm})
- return (*AuthRoleGrantPermissionResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleGet(ctx context.Context, role string) (*AuthRoleGetResponse, error) {
- resp, err := auth.remote.RoleGet(ctx, &pb.AuthRoleGetRequest{Role: role}, grpc.FailFast(false))
- return (*AuthRoleGetResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleList(ctx context.Context) (*AuthRoleListResponse, error) {
- resp, err := auth.remote.RoleList(ctx, &pb.AuthRoleListRequest{}, grpc.FailFast(false))
- return (*AuthRoleListResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleRevokePermission(ctx context.Context, role string, key, rangeEnd string) (*AuthRoleRevokePermissionResponse, error) {
- resp, err := auth.remote.RoleRevokePermission(ctx, &pb.AuthRoleRevokePermissionRequest{Role: role, Key: key, RangeEnd: rangeEnd})
- return (*AuthRoleRevokePermissionResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *auth) RoleDelete(ctx context.Context, role string) (*AuthRoleDeleteResponse, error) {
- resp, err := auth.remote.RoleDelete(ctx, &pb.AuthRoleDeleteRequest{Role: role})
- return (*AuthRoleDeleteResponse)(resp), toErr(ctx, err)
-}
-
-func StrToPermissionType(s string) (PermissionType, error) {
- val, ok := authpb.Permission_Type_value[strings.ToUpper(s)]
- if ok {
- return PermissionType(val), nil
- }
- return PermissionType(-1), fmt.Errorf("invalid permission type: %s", s)
-}
-
-type authenticator struct {
- conn *grpc.ClientConn // conn in-use
- remote pb.AuthClient
-}
-
-func (auth *authenticator) authenticate(ctx context.Context, name string, password string) (*AuthenticateResponse, error) {
- resp, err := auth.remote.Authenticate(ctx, &pb.AuthenticateRequest{Name: name, Password: password}, grpc.FailFast(false))
- return (*AuthenticateResponse)(resp), toErr(ctx, err)
-}
-
-func (auth *authenticator) close() {
- auth.conn.Close()
-}
-
-func newAuthenticator(endpoint string, opts []grpc.DialOption) (*authenticator, error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return nil, err
- }
-
- return &authenticator{
- conn: conn,
- remote: pb.NewAuthClient(conn),
- }, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/balancer.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/balancer.go
deleted file mode 100644
index 7e8d957f9..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/balancer.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "net/url"
- "strings"
- "sync"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-// simpleBalancer does the bare minimum to expose multiple eps
-// to the grpc reconnection code path
-type simpleBalancer struct {
- // addrs are the client's endpoints for grpc
- addrs []grpc.Address
- // notifyCh notifies grpc of the set of addresses for connecting
- notifyCh chan []grpc.Address
-
- // readyc closes once the first connection is up
- readyc chan struct{}
- readyOnce sync.Once
-
- // mu protects upEps, pinAddr, and connectingAddr
- mu sync.RWMutex
- // upEps holds the current endpoints that have an active connection
- upEps map[string]struct{}
- // upc closes when upEps transitions from empty to non-zero or the balancer closes.
- upc chan struct{}
-
- // pinAddr is the currently pinned address; set to the empty string on
- // intialization and shutdown.
- pinAddr string
-
- closed bool
-}
-
-func newSimpleBalancer(eps []string) *simpleBalancer {
- notifyCh := make(chan []grpc.Address, 1)
- addrs := make([]grpc.Address, len(eps))
- for i := range eps {
- addrs[i].Addr = getHost(eps[i])
- }
- notifyCh <- addrs
- sb := &simpleBalancer{
- addrs: addrs,
- notifyCh: notifyCh,
- readyc: make(chan struct{}),
- upEps: make(map[string]struct{}),
- upc: make(chan struct{}),
- }
- return sb
-}
-
-func (b *simpleBalancer) Start(target string) error { return nil }
-
-func (b *simpleBalancer) ConnectNotify() <-chan struct{} {
- b.mu.Lock()
- defer b.mu.Unlock()
- return b.upc
-}
-
-func (b *simpleBalancer) Up(addr grpc.Address) func(error) {
- b.mu.Lock()
- defer b.mu.Unlock()
-
- // gRPC might call Up after it called Close. We add this check
- // to "fix" it up at application layer. Or our simplerBalancer
- // might panic since b.upc is closed.
- if b.closed {
- return func(err error) {}
- }
-
- if len(b.upEps) == 0 {
- // notify waiting Get()s and pin first connected address
- close(b.upc)
- b.pinAddr = addr.Addr
- }
- b.upEps[addr.Addr] = struct{}{}
-
- // notify client that a connection is up
- b.readyOnce.Do(func() { close(b.readyc) })
-
- return func(err error) {
- b.mu.Lock()
- delete(b.upEps, addr.Addr)
- if len(b.upEps) == 0 && b.pinAddr != "" {
- b.upc = make(chan struct{})
- } else if b.pinAddr == addr.Addr {
- // choose new random up endpoint
- for k := range b.upEps {
- b.pinAddr = k
- break
- }
- }
- b.mu.Unlock()
- }
-}
-
-func (b *simpleBalancer) Get(ctx context.Context, opts grpc.BalancerGetOptions) (grpc.Address, func(), error) {
- var addr string
- for {
- b.mu.RLock()
- ch := b.upc
- b.mu.RUnlock()
- select {
- case <-ch:
- case <-ctx.Done():
- return grpc.Address{Addr: ""}, nil, ctx.Err()
- }
- b.mu.RLock()
- addr = b.pinAddr
- upEps := len(b.upEps)
- b.mu.RUnlock()
- if addr == "" {
- return grpc.Address{Addr: ""}, nil, grpc.ErrClientConnClosing
- }
- if upEps > 0 {
- break
- }
- }
- return grpc.Address{Addr: addr}, func() {}, nil
-}
-
-func (b *simpleBalancer) Notify() <-chan []grpc.Address { return b.notifyCh }
-
-func (b *simpleBalancer) Close() error {
- b.mu.Lock()
- defer b.mu.Unlock()
- // In case gRPC calls close twice. TODO: remove the checking
- // when we are sure that gRPC wont call close twice.
- if b.closed {
- return nil
- }
- b.closed = true
- close(b.notifyCh)
- // terminate all waiting Get()s
- b.pinAddr = ""
- if len(b.upEps) == 0 {
- close(b.upc)
- }
- return nil
-}
-
-func getHost(ep string) string {
- url, uerr := url.Parse(ep)
- if uerr != nil || !strings.Contains(ep, "://") {
- return ep
- }
- return url.Host
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/client.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/client.go
deleted file mode 100644
index e6903fc2f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/client.go
+++ /dev/null
@@ -1,324 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "crypto/tls"
- "errors"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "net/url"
- "strings"
- "time"
-
- "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/credentials"
- "google.golang.org/grpc/metadata"
-)
-
-var (
- ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints")
-)
-
-// Client provides and manages an etcd v3 client session.
-type Client struct {
- Cluster
- KV
- Lease
- Watcher
- Auth
- Maintenance
-
- conn *grpc.ClientConn
- cfg Config
- creds *credentials.TransportCredentials
- balancer *simpleBalancer
- retryWrapper retryRpcFunc
-
- ctx context.Context
- cancel context.CancelFunc
-
- // Username is a username for authentication
- Username string
- // Password is a password for authentication
- Password string
-}
-
-// New creates a new etcdv3 client from a given configuration.
-func New(cfg Config) (*Client, error) {
- if len(cfg.Endpoints) == 0 {
- return nil, ErrNoAvailableEndpoints
- }
-
- return newClient(&cfg)
-}
-
-// NewFromURL creates a new etcdv3 client from a URL.
-func NewFromURL(url string) (*Client, error) {
- return New(Config{Endpoints: []string{url}})
-}
-
-// NewFromConfigFile creates a new etcdv3 client from a configuration file.
-func NewFromConfigFile(path string) (*Client, error) {
- cfg, err := configFromFile(path)
- if err != nil {
- return nil, err
- }
- return New(*cfg)
-}
-
-// Close shuts down the client's etcd connections.
-func (c *Client) Close() error {
- c.cancel()
- return toErr(c.ctx, c.conn.Close())
-}
-
-// Ctx is a context for "out of band" messages (e.g., for sending
-// "clean up" message when another context is canceled). It is
-// canceled on client Close().
-func (c *Client) Ctx() context.Context { return c.ctx }
-
-// Endpoints lists the registered endpoints for the client.
-func (c *Client) Endpoints() []string { return c.cfg.Endpoints }
-
-type authTokenCredential struct {
- token string
-}
-
-func (cred authTokenCredential) RequireTransportSecurity() bool {
- return false
-}
-
-func (cred authTokenCredential) GetRequestMetadata(ctx context.Context, s ...string) (map[string]string, error) {
- return map[string]string{
- "token": cred.token,
- }, nil
-}
-
-func (c *Client) dialTarget(endpoint string) (proto string, host string, creds *credentials.TransportCredentials) {
- proto = "tcp"
- host = endpoint
- creds = c.creds
- url, uerr := url.Parse(endpoint)
- if uerr != nil || !strings.Contains(endpoint, "://") {
- return
- }
- // strip scheme:// prefix since grpc dials by host
- host = url.Host
- switch url.Scheme {
- case "unix":
- proto = "unix"
- case "http":
- creds = nil
- case "https":
- if creds != nil {
- break
- }
- tlsconfig := &tls.Config{}
- emptyCreds := credentials.NewTLS(tlsconfig)
- creds = &emptyCreds
- default:
- return "", "", nil
- }
- return
-}
-
-// dialSetupOpts gives the dial opts prior to any authentication
-func (c *Client) dialSetupOpts(endpoint string, dopts ...grpc.DialOption) (opts []grpc.DialOption) {
- if c.cfg.DialTimeout > 0 {
- opts = []grpc.DialOption{grpc.WithTimeout(c.cfg.DialTimeout)}
- }
- opts = append(opts, dopts...)
-
- // grpc issues TLS cert checks using the string passed into dial so
- // that string must be the host. To recover the full scheme://host URL,
- // have a map from hosts to the original endpoint.
- host2ep := make(map[string]string)
- for i := range c.cfg.Endpoints {
- _, host, _ := c.dialTarget(c.cfg.Endpoints[i])
- host2ep[host] = c.cfg.Endpoints[i]
- }
-
- f := func(host string, t time.Duration) (net.Conn, error) {
- proto, host, _ := c.dialTarget(host2ep[host])
- if proto == "" {
- return nil, fmt.Errorf("unknown scheme for %q", host)
- }
- select {
- case <-c.ctx.Done():
- return nil, c.ctx.Err()
- default:
- }
- return net.DialTimeout(proto, host, t)
- }
- opts = append(opts, grpc.WithDialer(f))
-
- _, _, creds := c.dialTarget(endpoint)
- if creds != nil {
- opts = append(opts, grpc.WithTransportCredentials(*creds))
- } else {
- opts = append(opts, grpc.WithInsecure())
- }
-
- return opts
-}
-
-// Dial connects to a single endpoint using the client's config.
-func (c *Client) Dial(endpoint string) (*grpc.ClientConn, error) {
- return c.dial(endpoint)
-}
-
-func (c *Client) dial(endpoint string, dopts ...grpc.DialOption) (*grpc.ClientConn, error) {
- opts := c.dialSetupOpts(endpoint, dopts...)
- host := getHost(endpoint)
- if c.Username != "" && c.Password != "" {
- // use dial options without dopts to avoid reusing the client balancer
- auth, err := newAuthenticator(host, c.dialSetupOpts(endpoint))
- if err != nil {
- return nil, err
- }
- defer auth.close()
-
- resp, err := auth.authenticate(c.ctx, c.Username, c.Password)
- if err != nil {
- return nil, err
- }
- opts = append(opts, grpc.WithPerRPCCredentials(authTokenCredential{token: resp.Token}))
- }
-
- conn, err := grpc.Dial(host, opts...)
- if err != nil {
- return nil, err
- }
- return conn, nil
-}
-
-// WithRequireLeader requires client requests to only succeed
-// when the cluster has a leader.
-func WithRequireLeader(ctx context.Context) context.Context {
- md := metadata.Pairs(rpctypes.MetadataRequireLeaderKey, rpctypes.MetadataHasLeader)
- return metadata.NewContext(ctx, md)
-}
-
-func newClient(cfg *Config) (*Client, error) {
- if cfg == nil {
- cfg = &Config{}
- }
- var creds *credentials.TransportCredentials
- if cfg.TLS != nil {
- c := credentials.NewTLS(cfg.TLS)
- creds = &c
- }
-
- // use a temporary skeleton client to bootstrap first connection
- ctx, cancel := context.WithCancel(context.TODO())
- client := &Client{
- conn: nil,
- cfg: *cfg,
- creds: creds,
- ctx: ctx,
- cancel: cancel,
- }
- if cfg.Username != "" && cfg.Password != "" {
- client.Username = cfg.Username
- client.Password = cfg.Password
- }
-
- client.balancer = newSimpleBalancer(cfg.Endpoints)
- conn, err := client.dial(cfg.Endpoints[0], grpc.WithBalancer(client.balancer))
- if err != nil {
- return nil, err
- }
- client.conn = conn
- client.retryWrapper = client.newRetryWrapper()
-
- // wait for a connection
- if cfg.DialTimeout > 0 {
- hasConn := false
- waitc := time.After(cfg.DialTimeout)
- select {
- case <-client.balancer.readyc:
- hasConn = true
- case <-ctx.Done():
- case <-waitc:
- }
- if !hasConn {
- client.cancel()
- conn.Close()
- return nil, grpc.ErrClientConnTimeout
- }
- }
-
- client.Cluster = NewCluster(client)
- client.KV = NewKV(client)
- client.Lease = NewLease(client)
- client.Watcher = NewWatcher(client)
- client.Auth = NewAuth(client)
- client.Maintenance = NewMaintenance(client)
- if cfg.Logger != nil {
- logger.Set(cfg.Logger)
- } else {
- // disable client side grpc by default
- logger.Set(log.New(ioutil.Discard, "", 0))
- }
-
- return client, nil
-}
-
-// ActiveConnection returns the current in-use connection
-func (c *Client) ActiveConnection() *grpc.ClientConn { return c.conn }
-
-// isHaltErr returns true if the given error and context indicate no forward
-// progress can be made, even after reconnecting.
-func isHaltErr(ctx context.Context, err error) bool {
- if ctx != nil && ctx.Err() != nil {
- return true
- }
- if err == nil {
- return false
- }
- eErr := rpctypes.Error(err)
- if _, ok := eErr.(rpctypes.EtcdError); ok {
- return eErr != rpctypes.ErrStopped && eErr != rpctypes.ErrNoLeader
- }
- // treat etcdserver errors not recognized by the client as halting
- return isConnClosing(err) || strings.Contains(err.Error(), "etcdserver:")
-}
-
-// isConnClosing returns true if the error matches a grpc client closing error
-func isConnClosing(err error) bool {
- return strings.Contains(err.Error(), grpc.ErrClientConnClosing.Error())
-}
-
-func toErr(ctx context.Context, err error) error {
- if err == nil {
- return nil
- }
- err = rpctypes.Error(err)
- switch {
- case ctx.Err() != nil && strings.Contains(err.Error(), "context"):
- err = ctx.Err()
- case strings.Contains(err.Error(), ErrNoAvailableEndpoints.Error()):
- err = ErrNoAvailableEndpoints
- case strings.Contains(err.Error(), grpc.ErrClientConnClosing.Error()):
- err = grpc.ErrClientConnClosing
- }
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/cluster.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/cluster.go
deleted file mode 100644
index 8b981171b..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/cluster.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type (
- Member pb.Member
- MemberListResponse pb.MemberListResponse
- MemberAddResponse pb.MemberAddResponse
- MemberRemoveResponse pb.MemberRemoveResponse
- MemberUpdateResponse pb.MemberUpdateResponse
-)
-
-type Cluster interface {
- // MemberList lists the current cluster membership.
- MemberList(ctx context.Context) (*MemberListResponse, error)
-
- // MemberAdd adds a new member into the cluster.
- MemberAdd(ctx context.Context, peerAddrs []string) (*MemberAddResponse, error)
-
- // MemberRemove removes an existing member from the cluster.
- MemberRemove(ctx context.Context, id uint64) (*MemberRemoveResponse, error)
-
- // MemberUpdate updates the peer addresses of the member.
- MemberUpdate(ctx context.Context, id uint64, peerAddrs []string) (*MemberUpdateResponse, error)
-}
-
-type cluster struct {
- remote pb.ClusterClient
-}
-
-func NewCluster(c *Client) Cluster {
- return &cluster{remote: RetryClusterClient(c)}
-}
-
-func (c *cluster) MemberAdd(ctx context.Context, peerAddrs []string) (*MemberAddResponse, error) {
- r := &pb.MemberAddRequest{PeerURLs: peerAddrs}
- resp, err := c.remote.MemberAdd(ctx, r)
- if err == nil {
- return (*MemberAddResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- return nil, toErr(ctx, err)
-}
-
-func (c *cluster) MemberRemove(ctx context.Context, id uint64) (*MemberRemoveResponse, error) {
- r := &pb.MemberRemoveRequest{ID: id}
- resp, err := c.remote.MemberRemove(ctx, r)
- if err == nil {
- return (*MemberRemoveResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- return nil, toErr(ctx, err)
-}
-
-func (c *cluster) MemberUpdate(ctx context.Context, id uint64, peerAddrs []string) (*MemberUpdateResponse, error) {
- // it is safe to retry on update.
- for {
- r := &pb.MemberUpdateRequest{ID: id, PeerURLs: peerAddrs}
- resp, err := c.remote.MemberUpdate(ctx, r)
- if err == nil {
- return (*MemberUpdateResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
-
-func (c *cluster) MemberList(ctx context.Context) (*MemberListResponse, error) {
- // it is safe to retry on list.
- for {
- resp, err := c.remote.MemberList(ctx, &pb.MemberListRequest{}, grpc.FailFast(false))
- if err == nil {
- return (*MemberListResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compact_op.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compact_op.go
deleted file mode 100644
index 32d97eb0c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compact_op.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
-)
-
-// CompactOp represents a compact operation.
-type CompactOp struct {
- revision int64
- physical bool
-}
-
-// CompactOption configures compact operation.
-type CompactOption func(*CompactOp)
-
-func (op *CompactOp) applyCompactOpts(opts []CompactOption) {
- for _, opt := range opts {
- opt(op)
- }
-}
-
-// OpCompact wraps slice CompactOption to create a CompactOp.
-func OpCompact(rev int64, opts ...CompactOption) CompactOp {
- ret := CompactOp{revision: rev}
- ret.applyCompactOpts(opts)
- return ret
-}
-
-func (op CompactOp) toRequest() *pb.CompactionRequest {
- return &pb.CompactionRequest{Revision: op.revision, Physical: op.physical}
-}
-
-// WithCompactPhysical makes compact RPC call wait until
-// the compaction is physically applied to the local database
-// such that compacted entries are totally removed from the
-// backend database.
-func WithCompactPhysical() CompactOption {
- return func(op *CompactOp) { op.physical = true }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compare.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compare.go
deleted file mode 100644
index 601349431..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/compare.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
-)
-
-type CompareTarget int
-type CompareResult int
-
-const (
- CompareVersion CompareTarget = iota
- CompareCreated
- CompareModified
- CompareValue
-)
-
-type Cmp pb.Compare
-
-func Compare(cmp Cmp, result string, v interface{}) Cmp {
- var r pb.Compare_CompareResult
-
- switch result {
- case "=":
- r = pb.Compare_EQUAL
- case ">":
- r = pb.Compare_GREATER
- case "<":
- r = pb.Compare_LESS
- default:
- panic("Unknown result op")
- }
-
- cmp.Result = r
- switch cmp.Target {
- case pb.Compare_VALUE:
- val, ok := v.(string)
- if !ok {
- panic("bad compare value")
- }
- cmp.TargetUnion = &pb.Compare_Value{Value: []byte(val)}
- case pb.Compare_VERSION:
- cmp.TargetUnion = &pb.Compare_Version{Version: mustInt64(v)}
- case pb.Compare_CREATE:
- cmp.TargetUnion = &pb.Compare_CreateRevision{CreateRevision: mustInt64(v)}
- case pb.Compare_MOD:
- cmp.TargetUnion = &pb.Compare_ModRevision{ModRevision: mustInt64(v)}
- default:
- panic("Unknown compare type")
- }
- return cmp
-}
-
-func Value(key string) Cmp {
- return Cmp{Key: []byte(key), Target: pb.Compare_VALUE}
-}
-
-func Version(key string) Cmp {
- return Cmp{Key: []byte(key), Target: pb.Compare_VERSION}
-}
-
-func CreateRevision(key string) Cmp {
- return Cmp{Key: []byte(key), Target: pb.Compare_CREATE}
-}
-
-func ModRevision(key string) Cmp {
- return Cmp{Key: []byte(key), Target: pb.Compare_MOD}
-}
-
-func mustInt64(val interface{}) int64 {
- if v, ok := val.(int64); ok {
- return v
- }
- if v, ok := val.(int); ok {
- return int64(v)
- }
- panic("bad value")
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/config.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/config.go
deleted file mode 100644
index 066b41ece..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/config.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "crypto/tls"
- "crypto/x509"
- "io/ioutil"
- "time"
-
- "github.com/coreos/etcd/pkg/tlsutil"
- "github.com/ghodss/yaml"
-)
-
-type Config struct {
- // Endpoints is a list of URLs
- Endpoints []string
-
- // DialTimeout is the timeout for failing to establish a connection.
- DialTimeout time.Duration
-
- // TLS holds the client secure credentials, if any.
- TLS *tls.Config
-
- // Logger is the logger used by client library.
- Logger Logger
-
- // Username is a username for authentication
- Username string
-
- // Password is a password for authentication
- Password string
-}
-
-type yamlConfig struct {
- Endpoints []string `json:"endpoints"`
- DialTimeout time.Duration `json:"dial-timeout"`
- InsecureTransport bool `json:"insecure-transport"`
- InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify"`
- Certfile string `json:"cert-file"`
- Keyfile string `json:"key-file"`
- CAfile string `json:"ca-file"`
-}
-
-func configFromFile(fpath string) (*Config, error) {
- b, err := ioutil.ReadFile(fpath)
- if err != nil {
- return nil, err
- }
-
- yc := &yamlConfig{}
-
- err = yaml.Unmarshal(b, yc)
- if err != nil {
- return nil, err
- }
-
- cfg := &Config{
- Endpoints: yc.Endpoints,
- DialTimeout: yc.DialTimeout,
- }
-
- if yc.InsecureTransport {
- cfg.TLS = nil
- return cfg, nil
- }
-
- var (
- cert *tls.Certificate
- cp *x509.CertPool
- )
-
- if yc.Certfile != "" && yc.Keyfile != "" {
- cert, err = tlsutil.NewCert(yc.Certfile, yc.Keyfile, nil)
- if err != nil {
- return nil, err
- }
- }
-
- if yc.CAfile != "" {
- cp, err = tlsutil.NewCertPool([]string{yc.CAfile})
- if err != nil {
- return nil, err
- }
- }
-
- tlscfg := &tls.Config{
- MinVersion: tls.VersionTLS10,
- InsecureSkipVerify: yc.InsecureSkipTLSVerify,
- RootCAs: cp,
- }
- if cert != nil {
- tlscfg.Certificates = []tls.Certificate{*cert}
- }
- cfg.TLS = tlscfg
-
- return cfg, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/doc.go
deleted file mode 100644
index 9ce84aa57..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/doc.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package clientv3 implements the official Go etcd client for v3.
-//
-// Create client using `clientv3.New`:
-//
-// cli, err := clientv3.New(clientv3.Config{
-// Endpoints: []string{"localhost:2379", "localhost:22379", "localhost:32379"},
-// DialTimeout: 5 * time.Second,
-// })
-// if err != nil {
-// // handle error!
-// }
-// defer cli.Close()
-//
-// Make sure to close the client after using it. If the client is not closed, the
-// connection will have leaky goroutines.
-//
-// To specify client request timeout, pass context.WithTimeout to APIs:
-//
-// ctx, cancel := context.WithTimeout(context.Background(), timeout)
-// resp, err := kvc.Put(ctx, "sample_key", "sample_value")
-// cancel()
-// if err != nil {
-// // handle error!
-// }
-// // use the response
-//
-// The Client has internal state (watchers and leases), so Clients should be reused instead of created as needed.
-// Clients are safe for concurrent use by multiple goroutines.
-//
-// etcd client returns 2 types of errors:
-//
-// 1. context error: canceled or deadline exceeded.
-// 2. gRPC error: see https://github.com/coreos/etcd/blob/master/etcdserver/api/v3rpc/error.go.
-//
-// Here is the example code to handle client errors:
-//
-// resp, err := kvc.Put(ctx, "", "")
-// if err != nil {
-// if err == context.Canceled {
-// // ctx is canceled by another routine
-// } else if err == context.DeadlineExceeded {
-// // ctx is attached with a deadline and it exceeded
-// } else if verr, ok := err.(*v3rpc.ErrEmptyKey); ok {
-// // process (verr.Errors)
-// } else {
-// // bad cluster endpoints, which are not etcd servers
-// }
-// }
-//
-package clientv3
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/kv.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/kv.go
deleted file mode 100644
index 584912985..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/kv.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type (
- CompactResponse pb.CompactionResponse
- PutResponse pb.PutResponse
- GetResponse pb.RangeResponse
- DeleteResponse pb.DeleteRangeResponse
- TxnResponse pb.TxnResponse
-)
-
-type KV interface {
- // Put puts a key-value pair into etcd.
- // Note that key,value can be plain bytes array and string is
- // an immutable representation of that bytes array.
- // To get a string of bytes, do string([]byte(0x10, 0x20)).
- Put(ctx context.Context, key, val string, opts ...OpOption) (*PutResponse, error)
-
- // Get retrieves keys.
- // By default, Get will return the value for "key", if any.
- // When passed WithRange(end), Get will return the keys in the range [key, end).
- // When passed WithFromKey(), Get returns keys greater than or equal to key.
- // When passed WithRev(rev) with rev > 0, Get retrieves keys at the given revision;
- // if the required revision is compacted, the request will fail with ErrCompacted .
- // When passed WithLimit(limit), the number of returned keys is bounded by limit.
- // When passed WithSort(), the keys will be sorted.
- Get(ctx context.Context, key string, opts ...OpOption) (*GetResponse, error)
-
- // Delete deletes a key, or optionally using WithRange(end), [key, end).
- Delete(ctx context.Context, key string, opts ...OpOption) (*DeleteResponse, error)
-
- // Compact compacts etcd KV history before the given rev.
- Compact(ctx context.Context, rev int64, opts ...CompactOption) (*CompactResponse, error)
-
- // Do applies a single Op on KV without a transaction.
- // Do is useful when declaring operations to be issued at a later time
- // whereas Get/Put/Delete are for better suited for when the operation
- // should be immediately issued at time of declaration.
-
- // Do applies a single Op on KV without a transaction.
- // Do is useful when creating arbitrary operations to be issued at a
- // later time; the user can range over the operations, calling Do to
- // execute them. Get/Put/Delete, on the other hand, are best suited
- // for when the operation should be issued at the time of declaration.
- Do(ctx context.Context, op Op) (OpResponse, error)
-
- // Txn creates a transaction.
- Txn(ctx context.Context) Txn
-}
-
-type OpResponse struct {
- put *PutResponse
- get *GetResponse
- del *DeleteResponse
-}
-
-func (op OpResponse) Put() *PutResponse { return op.put }
-func (op OpResponse) Get() *GetResponse { return op.get }
-func (op OpResponse) Del() *DeleteResponse { return op.del }
-
-type kv struct {
- remote pb.KVClient
-}
-
-func NewKV(c *Client) KV {
- return &kv{remote: RetryKVClient(c)}
-}
-
-func (kv *kv) Put(ctx context.Context, key, val string, opts ...OpOption) (*PutResponse, error) {
- r, err := kv.Do(ctx, OpPut(key, val, opts...))
- return r.put, toErr(ctx, err)
-}
-
-func (kv *kv) Get(ctx context.Context, key string, opts ...OpOption) (*GetResponse, error) {
- r, err := kv.Do(ctx, OpGet(key, opts...))
- return r.get, toErr(ctx, err)
-}
-
-func (kv *kv) Delete(ctx context.Context, key string, opts ...OpOption) (*DeleteResponse, error) {
- r, err := kv.Do(ctx, OpDelete(key, opts...))
- return r.del, toErr(ctx, err)
-}
-
-func (kv *kv) Compact(ctx context.Context, rev int64, opts ...CompactOption) (*CompactResponse, error) {
- resp, err := kv.remote.Compact(ctx, OpCompact(rev, opts...).toRequest(), grpc.FailFast(false))
- if err != nil {
- return nil, toErr(ctx, err)
- }
- return (*CompactResponse)(resp), err
-}
-
-func (kv *kv) Txn(ctx context.Context) Txn {
- return &txn{
- kv: kv,
- ctx: ctx,
- }
-}
-
-func (kv *kv) Do(ctx context.Context, op Op) (OpResponse, error) {
- for {
- resp, err := kv.do(ctx, op)
- if err == nil {
- return resp, nil
- }
- if isHaltErr(ctx, err) {
- return resp, toErr(ctx, err)
- }
- // do not retry on modifications
- if op.isWrite() {
- return resp, toErr(ctx, err)
- }
- }
-}
-
-func (kv *kv) do(ctx context.Context, op Op) (OpResponse, error) {
- var err error
- switch op.t {
- // TODO: handle other ops
- case tRange:
- var resp *pb.RangeResponse
- r := &pb.RangeRequest{
- Key: op.key,
- RangeEnd: op.end,
- Limit: op.limit,
- Revision: op.rev,
- Serializable: op.serializable,
- KeysOnly: op.keysOnly,
- CountOnly: op.countOnly,
- }
- if op.sort != nil {
- r.SortOrder = pb.RangeRequest_SortOrder(op.sort.Order)
- r.SortTarget = pb.RangeRequest_SortTarget(op.sort.Target)
- }
-
- resp, err = kv.remote.Range(ctx, r, grpc.FailFast(false))
- if err == nil {
- return OpResponse{get: (*GetResponse)(resp)}, nil
- }
- case tPut:
- var resp *pb.PutResponse
- r := &pb.PutRequest{Key: op.key, Value: op.val, Lease: int64(op.leaseID), PrevKv: op.prevKV}
- resp, err = kv.remote.Put(ctx, r)
- if err == nil {
- return OpResponse{put: (*PutResponse)(resp)}, nil
- }
- case tDeleteRange:
- var resp *pb.DeleteRangeResponse
- r := &pb.DeleteRangeRequest{Key: op.key, RangeEnd: op.end, PrevKv: op.prevKV}
- resp, err = kv.remote.DeleteRange(ctx, r)
- if err == nil {
- return OpResponse{del: (*DeleteResponse)(resp)}, nil
- }
- default:
- panic("Unknown op")
- }
- return OpResponse{}, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/lease.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/lease.go
deleted file mode 100644
index cf7c9ba8b..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/lease.go
+++ /dev/null
@@ -1,439 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "sync"
- "time"
-
- "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type (
- LeaseRevokeResponse pb.LeaseRevokeResponse
- LeaseID int64
-)
-
-// LeaseGrantResponse is used to convert the protobuf grant response.
-type LeaseGrantResponse struct {
- *pb.ResponseHeader
- ID LeaseID
- TTL int64
- Error string
-}
-
-// LeaseKeepAliveResponse is used to convert the protobuf keepalive response.
-type LeaseKeepAliveResponse struct {
- *pb.ResponseHeader
- ID LeaseID
- TTL int64
-}
-
-const (
- // defaultTTL is the assumed lease TTL used for the first keepalive
- // deadline before the actual TTL is known to the client.
- defaultTTL = 5 * time.Second
- // a small buffer to store unsent lease responses.
- leaseResponseChSize = 16
- // NoLease is a lease ID for the absence of a lease.
- NoLease LeaseID = 0
-)
-
-type Lease interface {
- // Grant creates a new lease.
- Grant(ctx context.Context, ttl int64) (*LeaseGrantResponse, error)
-
- // Revoke revokes the given lease.
- Revoke(ctx context.Context, id LeaseID) (*LeaseRevokeResponse, error)
-
- // KeepAlive keeps the given lease alive forever.
- KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error)
-
- // KeepAliveOnce renews the lease once. In most of the cases, Keepalive
- // should be used instead of KeepAliveOnce.
- KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error)
-
- // Close releases all resources Lease keeps for efficient communication
- // with the etcd server.
- Close() error
-}
-
-type lessor struct {
- mu sync.Mutex // guards all fields
-
- // donec is closed when recvKeepAliveLoop stops
- donec chan struct{}
-
- remote pb.LeaseClient
-
- stream pb.Lease_LeaseKeepAliveClient
- streamCancel context.CancelFunc
-
- stopCtx context.Context
- stopCancel context.CancelFunc
-
- keepAlives map[LeaseID]*keepAlive
-
- // firstKeepAliveTimeout is the timeout for the first keepalive request
- // before the actual TTL is known to the lease client
- firstKeepAliveTimeout time.Duration
-}
-
-// keepAlive multiplexes a keepalive for a lease over multiple channels
-type keepAlive struct {
- chs []chan<- *LeaseKeepAliveResponse
- ctxs []context.Context
- // deadline is the time the keep alive channels close if no response
- deadline time.Time
- // nextKeepAlive is when to send the next keep alive message
- nextKeepAlive time.Time
- // donec is closed on lease revoke, expiration, or cancel.
- donec chan struct{}
-}
-
-func NewLease(c *Client) Lease {
- l := &lessor{
- donec: make(chan struct{}),
- keepAlives: make(map[LeaseID]*keepAlive),
- remote: RetryLeaseClient(c),
- firstKeepAliveTimeout: c.cfg.DialTimeout + time.Second,
- }
- if l.firstKeepAliveTimeout == time.Second {
- l.firstKeepAliveTimeout = defaultTTL
- }
-
- l.stopCtx, l.stopCancel = context.WithCancel(context.Background())
- go l.recvKeepAliveLoop()
- go l.deadlineLoop()
- return l
-}
-
-func (l *lessor) Grant(ctx context.Context, ttl int64) (*LeaseGrantResponse, error) {
- cctx, cancel := context.WithCancel(ctx)
- done := cancelWhenStop(cancel, l.stopCtx.Done())
- defer close(done)
-
- for {
- r := &pb.LeaseGrantRequest{TTL: ttl}
- resp, err := l.remote.LeaseGrant(cctx, r)
- if err == nil {
- gresp := &LeaseGrantResponse{
- ResponseHeader: resp.GetHeader(),
- ID: LeaseID(resp.ID),
- TTL: resp.TTL,
- Error: resp.Error,
- }
- return gresp, nil
- }
- if isHaltErr(cctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
-
-func (l *lessor) Revoke(ctx context.Context, id LeaseID) (*LeaseRevokeResponse, error) {
- cctx, cancel := context.WithCancel(ctx)
- done := cancelWhenStop(cancel, l.stopCtx.Done())
- defer close(done)
-
- for {
- r := &pb.LeaseRevokeRequest{ID: int64(id)}
- resp, err := l.remote.LeaseRevoke(cctx, r)
-
- if err == nil {
- return (*LeaseRevokeResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
-
-func (l *lessor) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error) {
- ch := make(chan *LeaseKeepAliveResponse, leaseResponseChSize)
-
- l.mu.Lock()
- ka, ok := l.keepAlives[id]
- if !ok {
- // create fresh keep alive
- ka = &keepAlive{
- chs: []chan<- *LeaseKeepAliveResponse{ch},
- ctxs: []context.Context{ctx},
- deadline: time.Now().Add(l.firstKeepAliveTimeout),
- nextKeepAlive: time.Now(),
- donec: make(chan struct{}),
- }
- l.keepAlives[id] = ka
- } else {
- // add channel and context to existing keep alive
- ka.ctxs = append(ka.ctxs, ctx)
- ka.chs = append(ka.chs, ch)
- }
- l.mu.Unlock()
-
- go l.keepAliveCtxCloser(id, ctx, ka.donec)
-
- return ch, nil
-}
-
-func (l *lessor) KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error) {
- cctx, cancel := context.WithCancel(ctx)
- done := cancelWhenStop(cancel, l.stopCtx.Done())
- defer close(done)
-
- for {
- resp, err := l.keepAliveOnce(cctx, id)
- if err == nil {
- if resp.TTL == 0 {
- err = rpctypes.ErrLeaseNotFound
- }
- return resp, err
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
-
-func (l *lessor) Close() error {
- l.stopCancel()
- <-l.donec
- return nil
-}
-
-func (l *lessor) keepAliveCtxCloser(id LeaseID, ctx context.Context, donec <-chan struct{}) {
- select {
- case <-donec:
- return
- case <-l.donec:
- return
- case <-ctx.Done():
- }
-
- l.mu.Lock()
- defer l.mu.Unlock()
-
- ka, ok := l.keepAlives[id]
- if !ok {
- return
- }
-
- // close channel and remove context if still associated with keep alive
- for i, c := range ka.ctxs {
- if c == ctx {
- close(ka.chs[i])
- ka.ctxs = append(ka.ctxs[:i], ka.ctxs[i+1:]...)
- ka.chs = append(ka.chs[:i], ka.chs[i+1:]...)
- break
- }
- }
- // remove if no one more listeners
- if len(ka.chs) == 0 {
- delete(l.keepAlives, id)
- }
-}
-
-func (l *lessor) keepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error) {
- cctx, cancel := context.WithCancel(ctx)
- defer cancel()
-
- stream, err := l.remote.LeaseKeepAlive(cctx, grpc.FailFast(false))
- if err != nil {
- return nil, toErr(ctx, err)
- }
-
- err = stream.Send(&pb.LeaseKeepAliveRequest{ID: int64(id)})
- if err != nil {
- return nil, toErr(ctx, err)
- }
-
- resp, rerr := stream.Recv()
- if rerr != nil {
- return nil, toErr(ctx, rerr)
- }
-
- karesp := &LeaseKeepAliveResponse{
- ResponseHeader: resp.GetHeader(),
- ID: LeaseID(resp.ID),
- TTL: resp.TTL,
- }
- return karesp, nil
-}
-
-func (l *lessor) recvKeepAliveLoop() {
- defer func() {
- l.mu.Lock()
- close(l.donec)
- for _, ka := range l.keepAlives {
- ka.Close()
- }
- l.keepAlives = make(map[LeaseID]*keepAlive)
- l.mu.Unlock()
- }()
-
- stream, serr := l.resetRecv()
- for serr == nil {
- resp, err := stream.Recv()
- if err != nil {
- if isHaltErr(l.stopCtx, err) {
- return
- }
- stream, serr = l.resetRecv()
- continue
- }
- l.recvKeepAlive(resp)
- }
-}
-
-// resetRecv opens a new lease stream and starts sending LeaseKeepAliveRequests
-func (l *lessor) resetRecv() (pb.Lease_LeaseKeepAliveClient, error) {
- sctx, cancel := context.WithCancel(l.stopCtx)
- stream, err := l.remote.LeaseKeepAlive(sctx, grpc.FailFast(false))
- if err = toErr(sctx, err); err != nil {
- cancel()
- return nil, err
- }
-
- l.mu.Lock()
- defer l.mu.Unlock()
- if l.stream != nil && l.streamCancel != nil {
- l.stream.CloseSend()
- l.streamCancel()
- }
-
- l.streamCancel = cancel
- l.stream = stream
-
- go l.sendKeepAliveLoop(stream)
- return stream, nil
-}
-
-// recvKeepAlive updates a lease based on its LeaseKeepAliveResponse
-func (l *lessor) recvKeepAlive(resp *pb.LeaseKeepAliveResponse) {
- karesp := &LeaseKeepAliveResponse{
- ResponseHeader: resp.GetHeader(),
- ID: LeaseID(resp.ID),
- TTL: resp.TTL,
- }
-
- l.mu.Lock()
- defer l.mu.Unlock()
-
- ka, ok := l.keepAlives[karesp.ID]
- if !ok {
- return
- }
-
- if karesp.TTL <= 0 {
- // lease expired; close all keep alive channels
- delete(l.keepAlives, karesp.ID)
- ka.Close()
- return
- }
-
- // send update to all channels
- nextKeepAlive := time.Now().Add(1 + time.Duration(karesp.TTL/3)*time.Second)
- ka.deadline = time.Now().Add(time.Duration(karesp.TTL) * time.Second)
- for _, ch := range ka.chs {
- select {
- case ch <- karesp:
- ka.nextKeepAlive = nextKeepAlive
- default:
- }
- }
-}
-
-// deadlineLoop reaps any keep alive channels that have not received a response
-// within the lease TTL
-func (l *lessor) deadlineLoop() {
- for {
- select {
- case <-time.After(time.Second):
- case <-l.donec:
- return
- }
- now := time.Now()
- l.mu.Lock()
- for id, ka := range l.keepAlives {
- if ka.deadline.Before(now) {
- // waited too long for response; lease may be expired
- ka.Close()
- delete(l.keepAlives, id)
- }
- }
- l.mu.Unlock()
- }
-}
-
-// sendKeepAliveLoop sends LeaseKeepAliveRequests for the lifetime of a lease stream
-func (l *lessor) sendKeepAliveLoop(stream pb.Lease_LeaseKeepAliveClient) {
- for {
- select {
- case <-time.After(500 * time.Millisecond):
- case <-stream.Context().Done():
- return
- case <-l.donec:
- return
- case <-l.stopCtx.Done():
- return
- }
-
- tosend := make([]LeaseID, 0)
-
- now := time.Now()
- l.mu.Lock()
- for id, ka := range l.keepAlives {
- if ka.nextKeepAlive.Before(now) {
- tosend = append(tosend, id)
- }
- }
- l.mu.Unlock()
-
- for _, id := range tosend {
- r := &pb.LeaseKeepAliveRequest{ID: int64(id)}
- if err := stream.Send(r); err != nil {
- // TODO do something with this error?
- return
- }
- }
- }
-}
-
-func (ka *keepAlive) Close() {
- close(ka.donec)
- for _, ch := range ka.chs {
- close(ch)
- }
-}
-
-// cancelWhenStop calls cancel when the given stopc fires. It returns a done chan. done
-// should be closed when the work is finished. When done fires, cancelWhenStop will release
-// its internal resource.
-func cancelWhenStop(cancel context.CancelFunc, stopc <-chan struct{}) chan<- struct{} {
- done := make(chan struct{}, 1)
-
- go func() {
- select {
- case <-stopc:
- case <-done:
- }
- cancel()
- }()
-
- return done
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/logger.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/logger.go
deleted file mode 100644
index 6e57c4e7c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/logger.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "log"
- "os"
- "sync"
-
- "google.golang.org/grpc/grpclog"
-)
-
-type Logger grpclog.Logger
-
-var (
- logger settableLogger
-)
-
-type settableLogger struct {
- l grpclog.Logger
- mu sync.RWMutex
-}
-
-func init() {
- // use go's standard logger by default like grpc
- logger.mu.Lock()
- logger.l = log.New(os.Stderr, "", log.LstdFlags)
- grpclog.SetLogger(&logger)
- logger.mu.Unlock()
-}
-
-func (s *settableLogger) Set(l Logger) {
- s.mu.Lock()
- logger.l = l
- s.mu.Unlock()
-}
-
-func (s *settableLogger) Get() Logger {
- s.mu.RLock()
- l := logger.l
- s.mu.RUnlock()
- return l
-}
-
-// implement the grpclog.Logger interface
-
-func (s *settableLogger) Fatal(args ...interface{}) { s.Get().Fatal(args...) }
-func (s *settableLogger) Fatalf(format string, args ...interface{}) { s.Get().Fatalf(format, args...) }
-func (s *settableLogger) Fatalln(args ...interface{}) { s.Get().Fatalln(args...) }
-func (s *settableLogger) Print(args ...interface{}) { s.Get().Print(args...) }
-func (s *settableLogger) Printf(format string, args ...interface{}) { s.Get().Printf(format, args...) }
-func (s *settableLogger) Println(args ...interface{}) { s.Get().Println(args...) }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/maintenance.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/maintenance.go
deleted file mode 100644
index 718356250..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/maintenance.go
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "io"
-
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type (
- DefragmentResponse pb.DefragmentResponse
- AlarmResponse pb.AlarmResponse
- AlarmMember pb.AlarmMember
- StatusResponse pb.StatusResponse
-)
-
-type Maintenance interface {
- // AlarmList gets all active alarms.
- AlarmList(ctx context.Context) (*AlarmResponse, error)
-
- // AlarmDisarm disarms a given alarm.
- AlarmDisarm(ctx context.Context, m *AlarmMember) (*AlarmResponse, error)
-
- // Defragment defragments storage backend of the etcd member with given endpoint.
- // Defragment is only needed when deleting a large number of keys and want to reclaim
- // the resources.
- // Defragment is an expensive operation. User should avoid defragmenting multiple members
- // at the same time.
- // To defragment multiple members in the cluster, user need to call defragment multiple
- // times with different endpoints.
- Defragment(ctx context.Context, endpoint string) (*DefragmentResponse, error)
-
- // Status gets the status of the endpoint.
- Status(ctx context.Context, endpoint string) (*StatusResponse, error)
-
- // Snapshot provides a reader for a snapshot of a backend.
- Snapshot(ctx context.Context) (io.ReadCloser, error)
-}
-
-type maintenance struct {
- c *Client
- remote pb.MaintenanceClient
-}
-
-func NewMaintenance(c *Client) Maintenance {
- return &maintenance{c: c, remote: pb.NewMaintenanceClient(c.conn)}
-}
-
-func (m *maintenance) AlarmList(ctx context.Context) (*AlarmResponse, error) {
- req := &pb.AlarmRequest{
- Action: pb.AlarmRequest_GET,
- MemberID: 0, // all
- Alarm: pb.AlarmType_NONE, // all
- }
- for {
- resp, err := m.remote.Alarm(ctx, req, grpc.FailFast(false))
- if err == nil {
- return (*AlarmResponse)(resp), nil
- }
- if isHaltErr(ctx, err) {
- return nil, toErr(ctx, err)
- }
- }
-}
-
-func (m *maintenance) AlarmDisarm(ctx context.Context, am *AlarmMember) (*AlarmResponse, error) {
- req := &pb.AlarmRequest{
- Action: pb.AlarmRequest_DEACTIVATE,
- MemberID: am.MemberID,
- Alarm: am.Alarm,
- }
-
- if req.MemberID == 0 && req.Alarm == pb.AlarmType_NONE {
- ar, err := m.AlarmList(ctx)
- if err != nil {
- return nil, toErr(ctx, err)
- }
- ret := AlarmResponse{}
- for _, am := range ar.Alarms {
- dresp, derr := m.AlarmDisarm(ctx, (*AlarmMember)(am))
- if derr != nil {
- return nil, toErr(ctx, derr)
- }
- ret.Alarms = append(ret.Alarms, dresp.Alarms...)
- }
- return &ret, nil
- }
-
- resp, err := m.remote.Alarm(ctx, req, grpc.FailFast(false))
- if err == nil {
- return (*AlarmResponse)(resp), nil
- }
- return nil, toErr(ctx, err)
-}
-
-func (m *maintenance) Defragment(ctx context.Context, endpoint string) (*DefragmentResponse, error) {
- conn, err := m.c.Dial(endpoint)
- if err != nil {
- return nil, toErr(ctx, err)
- }
- defer conn.Close()
- remote := pb.NewMaintenanceClient(conn)
- resp, err := remote.Defragment(ctx, &pb.DefragmentRequest{}, grpc.FailFast(false))
- if err != nil {
- return nil, toErr(ctx, err)
- }
- return (*DefragmentResponse)(resp), nil
-}
-
-func (m *maintenance) Status(ctx context.Context, endpoint string) (*StatusResponse, error) {
- conn, err := m.c.Dial(endpoint)
- if err != nil {
- return nil, toErr(ctx, err)
- }
- defer conn.Close()
- remote := pb.NewMaintenanceClient(conn)
- resp, err := remote.Status(ctx, &pb.StatusRequest{}, grpc.FailFast(false))
- if err != nil {
- return nil, toErr(ctx, err)
- }
- return (*StatusResponse)(resp), nil
-}
-
-func (m *maintenance) Snapshot(ctx context.Context) (io.ReadCloser, error) {
- ss, err := m.remote.Snapshot(ctx, &pb.SnapshotRequest{}, grpc.FailFast(false))
- if err != nil {
- return nil, toErr(ctx, err)
- }
-
- pr, pw := io.Pipe()
- go func() {
- for {
- resp, err := ss.Recv()
- if err != nil {
- pw.CloseWithError(err)
- return
- }
- if resp == nil && err == nil {
- break
- }
- if _, werr := pw.Write(resp.Blob); werr != nil {
- pw.CloseWithError(werr)
- return
- }
- }
- pw.Close()
- }()
- return pr, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/op.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/op.go
deleted file mode 100644
index d3ed55b62..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/op.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
-)
-
-type opType int
-
-const (
- // A default Op has opType 0, which is invalid.
- tRange opType = iota + 1
- tPut
- tDeleteRange
-)
-
-var (
- noPrefixEnd = []byte{0}
-)
-
-// Op represents an Operation that kv can execute.
-type Op struct {
- t opType
- key []byte
- end []byte
-
- // for range
- limit int64
- sort *SortOption
- serializable bool
- keysOnly bool
- countOnly bool
-
- // for range, watch
- rev int64
-
- // for watch, put, delete
- prevKV bool
-
- // progressNotify is for progress updates.
- progressNotify bool
-
- // for put
- val []byte
- leaseID LeaseID
-}
-
-func (op Op) toRequestOp() *pb.RequestOp {
- switch op.t {
- case tRange:
- r := &pb.RangeRequest{
- Key: op.key,
- RangeEnd: op.end,
- Limit: op.limit,
- Revision: op.rev,
- Serializable: op.serializable,
- KeysOnly: op.keysOnly,
- CountOnly: op.countOnly,
- }
- if op.sort != nil {
- r.SortOrder = pb.RangeRequest_SortOrder(op.sort.Order)
- r.SortTarget = pb.RangeRequest_SortTarget(op.sort.Target)
- }
- return &pb.RequestOp{Request: &pb.RequestOp_RequestRange{RequestRange: r}}
- case tPut:
- r := &pb.PutRequest{Key: op.key, Value: op.val, Lease: int64(op.leaseID), PrevKv: op.prevKV}
- return &pb.RequestOp{Request: &pb.RequestOp_RequestPut{RequestPut: r}}
- case tDeleteRange:
- r := &pb.DeleteRangeRequest{Key: op.key, RangeEnd: op.end, PrevKv: op.prevKV}
- return &pb.RequestOp{Request: &pb.RequestOp_RequestDeleteRange{RequestDeleteRange: r}}
- default:
- panic("Unknown Op")
- }
-}
-
-func (op Op) isWrite() bool {
- return op.t != tRange
-}
-
-func OpGet(key string, opts ...OpOption) Op {
- ret := Op{t: tRange, key: []byte(key)}
- ret.applyOpts(opts)
- return ret
-}
-
-func OpDelete(key string, opts ...OpOption) Op {
- ret := Op{t: tDeleteRange, key: []byte(key)}
- ret.applyOpts(opts)
- switch {
- case ret.leaseID != 0:
- panic("unexpected lease in delete")
- case ret.limit != 0:
- panic("unexpected limit in delete")
- case ret.rev != 0:
- panic("unexpected revision in delete")
- case ret.sort != nil:
- panic("unexpected sort in delete")
- case ret.serializable:
- panic("unexpected serializable in delete")
- case ret.countOnly:
- panic("unexpected countOnly in delete")
- }
- return ret
-}
-
-func OpPut(key, val string, opts ...OpOption) Op {
- ret := Op{t: tPut, key: []byte(key), val: []byte(val)}
- ret.applyOpts(opts)
- switch {
- case ret.end != nil:
- panic("unexpected range in put")
- case ret.limit != 0:
- panic("unexpected limit in put")
- case ret.rev != 0:
- panic("unexpected revision in put")
- case ret.sort != nil:
- panic("unexpected sort in put")
- case ret.serializable:
- panic("unexpected serializable in put")
- case ret.countOnly:
- panic("unexpected countOnly in delete")
- }
- return ret
-}
-
-func opWatch(key string, opts ...OpOption) Op {
- ret := Op{t: tRange, key: []byte(key)}
- ret.applyOpts(opts)
- switch {
- case ret.leaseID != 0:
- panic("unexpected lease in watch")
- case ret.limit != 0:
- panic("unexpected limit in watch")
- case ret.sort != nil:
- panic("unexpected sort in watch")
- case ret.serializable:
- panic("unexpected serializable in watch")
- case ret.countOnly:
- panic("unexpected countOnly in delete")
- }
- return ret
-}
-
-func (op *Op) applyOpts(opts []OpOption) {
- for _, opt := range opts {
- opt(op)
- }
-}
-
-// OpOption configures Operations like Get, Put, Delete.
-type OpOption func(*Op)
-
-// WithLease attaches a lease ID to a key in 'Put' request.
-func WithLease(leaseID LeaseID) OpOption {
- return func(op *Op) { op.leaseID = leaseID }
-}
-
-// WithLimit limits the number of results to return from 'Get' request.
-func WithLimit(n int64) OpOption { return func(op *Op) { op.limit = n } }
-
-// WithRev specifies the store revision for 'Get' request.
-// Or the start revision of 'Watch' request.
-func WithRev(rev int64) OpOption { return func(op *Op) { op.rev = rev } }
-
-// WithSort specifies the ordering in 'Get' request. It requires
-// 'WithRange' and/or 'WithPrefix' to be specified too.
-// 'target' specifies the target to sort by: key, version, revisions, value.
-// 'order' can be either 'SortNone', 'SortAscend', 'SortDescend'.
-func WithSort(target SortTarget, order SortOrder) OpOption {
- return func(op *Op) {
- op.sort = &SortOption{target, order}
- }
-}
-
-// GetPrefixRangeEnd gets the range end of the prefix.
-// 'Get(foo, WithPrefix())' is equal to 'Get(foo, WithRange(GetPrefixRangeEnd(foo))'.
-func GetPrefixRangeEnd(prefix string) string {
- return string(getPrefix([]byte(prefix)))
-}
-
-func getPrefix(key []byte) []byte {
- end := make([]byte, len(key))
- copy(end, key)
- for i := len(end) - 1; i >= 0; i-- {
- if end[i] < 0xff {
- end[i] = end[i] + 1
- end = end[:i+1]
- return end
- }
- }
- // next prefix does not exist (e.g., 0xffff);
- // default to WithFromKey policy
- return noPrefixEnd
-}
-
-// WithPrefix enables 'Get', 'Delete', or 'Watch' requests to operate
-// on the keys with matching prefix. For example, 'Get(foo, WithPrefix())'
-// can return 'foo1', 'foo2', and so on.
-func WithPrefix() OpOption {
- return func(op *Op) {
- op.end = getPrefix(op.key)
- }
-}
-
-// WithRange specifies the range of 'Get', 'Delete', 'Watch' requests.
-// For example, 'Get' requests with 'WithRange(end)' returns
-// the keys in the range [key, end).
-// endKey must be lexicographically greater than start key.
-func WithRange(endKey string) OpOption {
- return func(op *Op) { op.end = []byte(endKey) }
-}
-
-// WithFromKey specifies the range of 'Get', 'Delete', 'Watch' requests
-// to be equal or greater than the key in the argument.
-func WithFromKey() OpOption { return WithRange("\x00") }
-
-// WithSerializable makes 'Get' request serializable. By default,
-// it's linearizable. Serializable requests are better for lower latency
-// requirement.
-func WithSerializable() OpOption {
- return func(op *Op) { op.serializable = true }
-}
-
-// WithKeysOnly makes the 'Get' request return only the keys and the corresponding
-// values will be omitted.
-func WithKeysOnly() OpOption {
- return func(op *Op) { op.keysOnly = true }
-}
-
-// WithCountOnly makes the 'Get' request return only the count of keys.
-func WithCountOnly() OpOption {
- return func(op *Op) { op.countOnly = true }
-}
-
-// WithFirstCreate gets the key with the oldest creation revision in the request range.
-func WithFirstCreate() []OpOption { return withTop(SortByCreateRevision, SortAscend) }
-
-// WithLastCreate gets the key with the latest creation revision in the request range.
-func WithLastCreate() []OpOption { return withTop(SortByCreateRevision, SortDescend) }
-
-// WithFirstKey gets the lexically first key in the request range.
-func WithFirstKey() []OpOption { return withTop(SortByKey, SortAscend) }
-
-// WithLastKey gets the lexically last key in the request range.
-func WithLastKey() []OpOption { return withTop(SortByKey, SortDescend) }
-
-// WithFirstRev gets the key with the oldest modification revision in the request range.
-func WithFirstRev() []OpOption { return withTop(SortByModRevision, SortAscend) }
-
-// WithLastRev gets the key with the latest modification revision in the request range.
-func WithLastRev() []OpOption { return withTop(SortByModRevision, SortDescend) }
-
-// withTop gets the first key over the get's prefix given a sort order
-func withTop(target SortTarget, order SortOrder) []OpOption {
- return []OpOption{WithPrefix(), WithSort(target, order), WithLimit(1)}
-}
-
-// WithProgressNotify makes watch server send periodic progress updates.
-// Progress updates have zero events in WatchResponse.
-func WithProgressNotify() OpOption {
- return func(op *Op) {
- op.progressNotify = true
- }
-}
-
-// WithPrevKV gets the previous key-value pair before the event happens. If the previous KV is already compacted,
-// nothing will be returned.
-func WithPrevKV() OpOption {
- return func(op *Op) {
- op.prevKV = true
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/retry.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/retry.go
deleted file mode 100644
index 3029ed8ea..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/retry.go
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-type rpcFunc func(ctx context.Context) error
-type retryRpcFunc func(context.Context, rpcFunc)
-
-func (c *Client) newRetryWrapper() retryRpcFunc {
- return func(rpcCtx context.Context, f rpcFunc) {
- for {
- err := f(rpcCtx)
- // ignore grpc conn closing on fail-fast calls; they are transient errors
- if err == nil || !isConnClosing(err) {
- return
- }
- select {
- case <-c.balancer.ConnectNotify():
- case <-rpcCtx.Done():
- case <-c.ctx.Done():
- return
- }
- }
- }
-}
-
-type retryKVClient struct {
- pb.KVClient
- retryf retryRpcFunc
-}
-
-// RetryKVClient implements a KVClient that uses the client's FailFast retry policy.
-func RetryKVClient(c *Client) pb.KVClient {
- return &retryKVClient{pb.NewKVClient(c.conn), c.retryWrapper}
-}
-
-func (rkv *retryKVClient) Put(ctx context.Context, in *pb.PutRequest, opts ...grpc.CallOption) (resp *pb.PutResponse, err error) {
- rkv.retryf(ctx, func(rctx context.Context) error {
- resp, err = rkv.KVClient.Put(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rkv *retryKVClient) DeleteRange(ctx context.Context, in *pb.DeleteRangeRequest, opts ...grpc.CallOption) (resp *pb.DeleteRangeResponse, err error) {
- rkv.retryf(ctx, func(rctx context.Context) error {
- resp, err = rkv.KVClient.DeleteRange(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rkv *retryKVClient) Txn(ctx context.Context, in *pb.TxnRequest, opts ...grpc.CallOption) (resp *pb.TxnResponse, err error) {
- rkv.retryf(ctx, func(rctx context.Context) error {
- resp, err = rkv.KVClient.Txn(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rkv *retryKVClient) Compact(ctx context.Context, in *pb.CompactionRequest, opts ...grpc.CallOption) (resp *pb.CompactionResponse, err error) {
- rkv.retryf(ctx, func(rctx context.Context) error {
- resp, err = rkv.KVClient.Compact(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-type retryLeaseClient struct {
- pb.LeaseClient
- retryf retryRpcFunc
-}
-
-// RetryLeaseClient implements a LeaseClient that uses the client's FailFast retry policy.
-func RetryLeaseClient(c *Client) pb.LeaseClient {
- return &retryLeaseClient{pb.NewLeaseClient(c.conn), c.retryWrapper}
-}
-
-func (rlc *retryLeaseClient) LeaseGrant(ctx context.Context, in *pb.LeaseGrantRequest, opts ...grpc.CallOption) (resp *pb.LeaseGrantResponse, err error) {
- rlc.retryf(ctx, func(rctx context.Context) error {
- resp, err = rlc.LeaseClient.LeaseGrant(rctx, in, opts...)
- return err
- })
- return resp, err
-
-}
-
-func (rlc *retryLeaseClient) LeaseRevoke(ctx context.Context, in *pb.LeaseRevokeRequest, opts ...grpc.CallOption) (resp *pb.LeaseRevokeResponse, err error) {
- rlc.retryf(ctx, func(rctx context.Context) error {
- resp, err = rlc.LeaseClient.LeaseRevoke(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-type retryClusterClient struct {
- pb.ClusterClient
- retryf retryRpcFunc
-}
-
-// RetryClusterClient implements a ClusterClient that uses the client's FailFast retry policy.
-func RetryClusterClient(c *Client) pb.ClusterClient {
- return &retryClusterClient{pb.NewClusterClient(c.conn), c.retryWrapper}
-}
-
-func (rcc *retryClusterClient) MemberAdd(ctx context.Context, in *pb.MemberAddRequest, opts ...grpc.CallOption) (resp *pb.MemberAddResponse, err error) {
- rcc.retryf(ctx, func(rctx context.Context) error {
- resp, err = rcc.ClusterClient.MemberAdd(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rcc *retryClusterClient) MemberRemove(ctx context.Context, in *pb.MemberRemoveRequest, opts ...grpc.CallOption) (resp *pb.MemberRemoveResponse, err error) {
- rcc.retryf(ctx, func(rctx context.Context) error {
- resp, err = rcc.ClusterClient.MemberRemove(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rcc *retryClusterClient) MemberUpdate(ctx context.Context, in *pb.MemberUpdateRequest, opts ...grpc.CallOption) (resp *pb.MemberUpdateResponse, err error) {
- rcc.retryf(ctx, func(rctx context.Context) error {
- resp, err = rcc.ClusterClient.MemberUpdate(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-type retryAuthClient struct {
- pb.AuthClient
- retryf retryRpcFunc
-}
-
-// RetryAuthClient implements a AuthClient that uses the client's FailFast retry policy.
-func RetryAuthClient(c *Client) pb.AuthClient {
- return &retryAuthClient{pb.NewAuthClient(c.conn), c.retryWrapper}
-}
-
-func (rac *retryAuthClient) AuthEnable(ctx context.Context, in *pb.AuthEnableRequest, opts ...grpc.CallOption) (resp *pb.AuthEnableResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.AuthEnable(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) AuthDisable(ctx context.Context, in *pb.AuthDisableRequest, opts ...grpc.CallOption) (resp *pb.AuthDisableResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.AuthDisable(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) UserAdd(ctx context.Context, in *pb.AuthUserAddRequest, opts ...grpc.CallOption) (resp *pb.AuthUserAddResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.UserAdd(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) UserDelete(ctx context.Context, in *pb.AuthUserDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthUserDeleteResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.UserDelete(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) UserChangePassword(ctx context.Context, in *pb.AuthUserChangePasswordRequest, opts ...grpc.CallOption) (resp *pb.AuthUserChangePasswordResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.UserChangePassword(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) UserGrantRole(ctx context.Context, in *pb.AuthUserGrantRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGrantRoleResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.UserGrantRole(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) UserRevokeRole(ctx context.Context, in *pb.AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserRevokeRoleResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.UserRevokeRole(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) RoleAdd(ctx context.Context, in *pb.AuthRoleAddRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleAddResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.RoleAdd(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) RoleDelete(ctx context.Context, in *pb.AuthRoleDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleDeleteResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.RoleDelete(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) RoleGrantPermission(ctx context.Context, in *pb.AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGrantPermissionResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.RoleGrantPermission(rctx, in, opts...)
- return err
- })
- return resp, err
-}
-
-func (rac *retryAuthClient) RoleRevokePermission(ctx context.Context, in *pb.AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleRevokePermissionResponse, err error) {
- rac.retryf(ctx, func(rctx context.Context) error {
- resp, err = rac.AuthClient.RoleRevokePermission(rctx, in, opts...)
- return err
- })
- return resp, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/sort.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/sort.go
deleted file mode 100644
index 2bb9d9a13..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/sort.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-type SortTarget int
-type SortOrder int
-
-const (
- SortNone SortOrder = iota
- SortAscend
- SortDescend
-)
-
-const (
- SortByKey SortTarget = iota
- SortByVersion
- SortByCreateRevision
- SortByModRevision
- SortByValue
-)
-
-type SortOption struct {
- Target SortTarget
- Order SortOrder
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/txn.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/txn.go
deleted file mode 100644
index a451e33ac..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/txn.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "sync"
-
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- "golang.org/x/net/context"
-)
-
-// Txn is the interface that wraps mini-transactions.
-//
-// Tx.If(
-// Compare(Value(k1), ">", v1),
-// Compare(Version(k1), "=", 2)
-// ).Then(
-// OpPut(k2,v2), OpPut(k3,v3)
-// ).Else(
-// OpPut(k4,v4), OpPut(k5,v5)
-// ).Commit()
-//
-type Txn interface {
- // If takes a list of comparison. If all comparisons passed in succeed,
- // the operations passed into Then() will be executed. Or the operations
- // passed into Else() will be executed.
- If(cs ...Cmp) Txn
-
- // Then takes a list of operations. The Ops list will be executed, if the
- // comparisons passed in If() succeed.
- Then(ops ...Op) Txn
-
- // Else takes a list of operations. The Ops list will be executed, if the
- // comparisons passed in If() fail.
- Else(ops ...Op) Txn
-
- // Commit tries to commit the transaction.
- Commit() (*TxnResponse, error)
-
- // TODO: add a Do for shortcut the txn without any condition?
-}
-
-type txn struct {
- kv *kv
- ctx context.Context
-
- mu sync.Mutex
- cif bool
- cthen bool
- celse bool
-
- isWrite bool
-
- cmps []*pb.Compare
-
- sus []*pb.RequestOp
- fas []*pb.RequestOp
-}
-
-func (txn *txn) If(cs ...Cmp) Txn {
- txn.mu.Lock()
- defer txn.mu.Unlock()
-
- if txn.cif {
- panic("cannot call If twice!")
- }
-
- if txn.cthen {
- panic("cannot call If after Then!")
- }
-
- if txn.celse {
- panic("cannot call If after Else!")
- }
-
- txn.cif = true
-
- for i := range cs {
- txn.cmps = append(txn.cmps, (*pb.Compare)(&cs[i]))
- }
-
- return txn
-}
-
-func (txn *txn) Then(ops ...Op) Txn {
- txn.mu.Lock()
- defer txn.mu.Unlock()
-
- if txn.cthen {
- panic("cannot call Then twice!")
- }
- if txn.celse {
- panic("cannot call Then after Else!")
- }
-
- txn.cthen = true
-
- for _, op := range ops {
- txn.isWrite = txn.isWrite || op.isWrite()
- txn.sus = append(txn.sus, op.toRequestOp())
- }
-
- return txn
-}
-
-func (txn *txn) Else(ops ...Op) Txn {
- txn.mu.Lock()
- defer txn.mu.Unlock()
-
- if txn.celse {
- panic("cannot call Else twice!")
- }
-
- txn.celse = true
-
- for _, op := range ops {
- txn.isWrite = txn.isWrite || op.isWrite()
- txn.fas = append(txn.fas, op.toRequestOp())
- }
-
- return txn
-}
-
-func (txn *txn) Commit() (*TxnResponse, error) {
- txn.mu.Lock()
- defer txn.mu.Unlock()
- for {
- resp, err := txn.commit()
- if err == nil {
- return resp, err
- }
- if isHaltErr(txn.ctx, err) {
- return nil, toErr(txn.ctx, err)
- }
- if txn.isWrite {
- return nil, toErr(txn.ctx, err)
- }
- }
-}
-
-func (txn *txn) commit() (*TxnResponse, error) {
- r := &pb.TxnRequest{Compare: txn.cmps, Success: txn.sus, Failure: txn.fas}
- resp, err := txn.kv.remote.Txn(txn.ctx, r)
- if err != nil {
- return nil, err
- }
- return (*TxnResponse)(resp), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/watch.go b/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/watch.go
deleted file mode 100644
index f6e45f9bf..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/clientv3/watch.go
+++ /dev/null
@@ -1,726 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package clientv3
-
-import (
- "fmt"
- "sync"
- "time"
-
- v3rpc "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
- pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
- mvccpb "github.com/coreos/etcd/mvcc/mvccpb"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
-)
-
-const (
- EventTypeDelete = mvccpb.DELETE
- EventTypePut = mvccpb.PUT
-
- closeSendErrTimeout = 250 * time.Millisecond
-)
-
-type Event mvccpb.Event
-
-type WatchChan <-chan WatchResponse
-
-type Watcher interface {
- // Watch watches on a key or prefix. The watched events will be returned
- // through the returned channel.
- // If the watch is slow or the required rev is compacted, the watch request
- // might be canceled from the server-side and the chan will be closed.
- // 'opts' can be: 'WithRev' and/or 'WithPrefix'.
- Watch(ctx context.Context, key string, opts ...OpOption) WatchChan
-
- // Close closes the watcher and cancels all watch requests.
- Close() error
-}
-
-type WatchResponse struct {
- Header pb.ResponseHeader
- Events []*Event
-
- // CompactRevision is the minimum revision the watcher may receive.
- CompactRevision int64
-
- // Canceled is used to indicate watch failure.
- // If the watch failed and the stream was about to close, before the channel is closed,
- // the channel sends a final response that has Canceled set to true with a non-nil Err().
- Canceled bool
-
- // created is used to indicate the creation of the watcher.
- created bool
-
- closeErr error
-}
-
-// IsCreate returns true if the event tells that the key is newly created.
-func (e *Event) IsCreate() bool {
- return e.Type == EventTypePut && e.Kv.CreateRevision == e.Kv.ModRevision
-}
-
-// IsModify returns true if the event tells that a new value is put on existing key.
-func (e *Event) IsModify() bool {
- return e.Type == EventTypePut && e.Kv.CreateRevision != e.Kv.ModRevision
-}
-
-// Err is the error value if this WatchResponse holds an error.
-func (wr *WatchResponse) Err() error {
- switch {
- case wr.closeErr != nil:
- return v3rpc.Error(wr.closeErr)
- case wr.CompactRevision != 0:
- return v3rpc.ErrCompacted
- case wr.Canceled:
- return v3rpc.ErrFutureRev
- }
- return nil
-}
-
-// IsProgressNotify returns true if the WatchResponse is progress notification.
-func (wr *WatchResponse) IsProgressNotify() bool {
- return len(wr.Events) == 0 && !wr.Canceled && !wr.created && wr.CompactRevision == 0 && wr.Header.Revision != 0
-}
-
-// watcher implements the Watcher interface
-type watcher struct {
- remote pb.WatchClient
-
- // mu protects the grpc streams map
- mu sync.RWMutex
- // streams holds all the active grpc streams keyed by ctx value.
- streams map[string]*watchGrpcStream
-}
-
-// watchGrpcStream tracks all watch resources attached to a single grpc stream.
-type watchGrpcStream struct {
- owner *watcher
- remote pb.WatchClient
-
- // ctx controls internal remote.Watch requests
- ctx context.Context
- // ctxKey is the key used when looking up this stream's context
- ctxKey string
- cancel context.CancelFunc
-
- // substreams holds all active watchers on this grpc stream
- substreams map[int64]*watcherStream
- // resuming holds all resuming watchers on this grpc stream
- resuming []*watcherStream
-
- // reqc sends a watch request from Watch() to the main goroutine
- reqc chan *watchRequest
- // respc receives data from the watch client
- respc chan *pb.WatchResponse
- // donec closes to broadcast shutdown
- donec chan struct{}
- // errc transmits errors from grpc Recv to the watch stream reconn logic
- errc chan error
- // closingc gets the watcherStream of closing watchers
- closingc chan *watcherStream
-
- // resumec closes to signal that all substreams should begin resuming
- resumec chan struct{}
- // closeErr is the error that closed the watch stream
- closeErr error
-}
-
-// watchRequest is issued by the subscriber to start a new watcher
-type watchRequest struct {
- ctx context.Context
- key string
- end string
- rev int64
- // progressNotify is for progress updates.
- progressNotify bool
- // get the previous key-value pair before the event happens
- prevKV bool
- // retc receives a chan WatchResponse once the watcher is established
- retc chan chan WatchResponse
-}
-
-// watcherStream represents a registered watcher
-type watcherStream struct {
- // initReq is the request that initiated this request
- initReq watchRequest
-
- // outc publishes watch responses to subscriber
- outc chan WatchResponse
- // recvc buffers watch responses before publishing
- recvc chan *WatchResponse
- // donec closes when the watcherStream goroutine stops.
- donec chan struct{}
- // closing is set to true when stream should be scheduled to shutdown.
- closing bool
- // id is the registered watch id on the grpc stream
- id int64
-
- // buf holds all events received from etcd but not yet consumed by the client
- buf []*WatchResponse
-}
-
-func NewWatcher(c *Client) Watcher {
- return &watcher{
- remote: pb.NewWatchClient(c.conn),
- streams: make(map[string]*watchGrpcStream),
- }
-}
-
-// never closes
-var valCtxCh = make(chan struct{})
-var zeroTime = time.Unix(0, 0)
-
-// ctx with only the values; never Done
-type valCtx struct{ context.Context }
-
-func (vc *valCtx) Deadline() (time.Time, bool) { return zeroTime, false }
-func (vc *valCtx) Done() <-chan struct{} { return valCtxCh }
-func (vc *valCtx) Err() error { return nil }
-
-func (w *watcher) newWatcherGrpcStream(inctx context.Context) *watchGrpcStream {
- ctx, cancel := context.WithCancel(&valCtx{inctx})
- wgs := &watchGrpcStream{
- owner: w,
- remote: w.remote,
- ctx: ctx,
- ctxKey: fmt.Sprintf("%v", inctx),
- cancel: cancel,
- substreams: make(map[int64]*watcherStream),
-
- respc: make(chan *pb.WatchResponse),
- reqc: make(chan *watchRequest),
- donec: make(chan struct{}),
- errc: make(chan error, 1),
- closingc: make(chan *watcherStream),
- resumec: make(chan struct{}),
- }
- go wgs.run()
- return wgs
-}
-
-// Watch posts a watch request to run() and waits for a new watcher channel
-func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) WatchChan {
- ow := opWatch(key, opts...)
-
- wr := &watchRequest{
- ctx: ctx,
- key: string(ow.key),
- end: string(ow.end),
- rev: ow.rev,
- progressNotify: ow.progressNotify,
- prevKV: ow.prevKV,
- retc: make(chan chan WatchResponse, 1),
- }
-
- ok := false
- ctxKey := fmt.Sprintf("%v", ctx)
-
- // find or allocate appropriate grpc watch stream
- w.mu.Lock()
- if w.streams == nil {
- // closed
- w.mu.Unlock()
- ch := make(chan WatchResponse)
- close(ch)
- return ch
- }
- wgs := w.streams[ctxKey]
- if wgs == nil {
- wgs = w.newWatcherGrpcStream(ctx)
- w.streams[ctxKey] = wgs
- }
- donec := wgs.donec
- reqc := wgs.reqc
- w.mu.Unlock()
-
- // couldn't create channel; return closed channel
- closeCh := make(chan WatchResponse, 1)
-
- // submit request
- select {
- case reqc <- wr:
- ok = true
- case <-wr.ctx.Done():
- case <-donec:
- if wgs.closeErr != nil {
- closeCh <- WatchResponse{closeErr: wgs.closeErr}
- break
- }
- // retry; may have dropped stream from no ctxs
- return w.Watch(ctx, key, opts...)
- }
-
- // receive channel
- if ok {
- select {
- case ret := <-wr.retc:
- return ret
- case <-ctx.Done():
- case <-donec:
- if wgs.closeErr != nil {
- closeCh <- WatchResponse{closeErr: wgs.closeErr}
- break
- }
- // retry; may have dropped stream from no ctxs
- return w.Watch(ctx, key, opts...)
- }
- }
-
- close(closeCh)
- return closeCh
-}
-
-func (w *watcher) Close() (err error) {
- w.mu.Lock()
- streams := w.streams
- w.streams = nil
- w.mu.Unlock()
- for _, wgs := range streams {
- if werr := wgs.Close(); werr != nil {
- err = werr
- }
- }
- return err
-}
-
-func (w *watchGrpcStream) Close() (err error) {
- w.cancel()
- <-w.donec
- select {
- case err = <-w.errc:
- default:
- }
- return toErr(w.ctx, err)
-}
-
-func (w *watcher) closeStream(wgs *watchGrpcStream) {
- w.mu.Lock()
- close(wgs.donec)
- wgs.cancel()
- if w.streams != nil {
- delete(w.streams, wgs.ctxKey)
- }
- w.mu.Unlock()
-}
-
-func (w *watchGrpcStream) addSubstream(resp *pb.WatchResponse, ws *watcherStream) {
- if resp.WatchId == -1 {
- // failed; no channel
- close(ws.recvc)
- return
- }
- ws.id = resp.WatchId
- w.substreams[ws.id] = ws
-}
-
-func (w *watchGrpcStream) sendCloseSubstream(ws *watcherStream, resp *WatchResponse) {
- select {
- case ws.outc <- *resp:
- case <-ws.initReq.ctx.Done():
- case <-time.After(closeSendErrTimeout):
- }
- close(ws.outc)
-}
-
-func (w *watchGrpcStream) closeSubstream(ws *watcherStream) {
- // send channel response in case stream was never established
- select {
- case ws.initReq.retc <- ws.outc:
- default:
- }
- // close subscriber's channel
- if closeErr := w.closeErr; closeErr != nil && ws.initReq.ctx.Err() == nil {
- go w.sendCloseSubstream(ws, &WatchResponse{closeErr: w.closeErr})
- } else if ws.outc != nil {
- close(ws.outc)
- }
- if ws.id != -1 {
- delete(w.substreams, ws.id)
- return
- }
- for i := range w.resuming {
- if w.resuming[i] == ws {
- w.resuming[i] = nil
- return
- }
- }
-}
-
-// run is the root of the goroutines for managing a watcher client
-func (w *watchGrpcStream) run() {
- var wc pb.Watch_WatchClient
- var closeErr error
-
- // substreams marked to close but goroutine still running; needed for
- // avoiding double-closing recvc on grpc stream teardown
- closing := make(map[*watcherStream]struct{})
-
- defer func() {
- w.closeErr = closeErr
- // shutdown substreams and resuming substreams
- for _, ws := range w.substreams {
- if _, ok := closing[ws]; !ok {
- close(ws.recvc)
- }
- }
- for _, ws := range w.resuming {
- if _, ok := closing[ws]; ws != nil && !ok {
- close(ws.recvc)
- }
- }
- w.joinSubstreams()
- for toClose := len(w.substreams) + len(w.resuming); toClose > 0; toClose-- {
- w.closeSubstream(<-w.closingc)
- }
-
- w.owner.closeStream(w)
- }()
-
- // start a stream with the etcd grpc server
- if wc, closeErr = w.newWatchClient(); closeErr != nil {
- return
- }
-
- cancelSet := make(map[int64]struct{})
-
- for {
- select {
- // Watch() requested
- case wreq := <-w.reqc:
- outc := make(chan WatchResponse, 1)
- ws := &watcherStream{
- initReq: *wreq,
- id: -1,
- outc: outc,
- // unbufffered so resumes won't cause repeat events
- recvc: make(chan *WatchResponse),
- }
-
- ws.donec = make(chan struct{})
- go w.serveSubstream(ws, w.resumec)
-
- // queue up for watcher creation/resume
- w.resuming = append(w.resuming, ws)
- if len(w.resuming) == 1 {
- // head of resume queue, can register a new watcher
- wc.Send(ws.initReq.toPB())
- }
- // New events from the watch client
- case pbresp := <-w.respc:
- switch {
- case pbresp.Created:
- // response to head of queue creation
- if ws := w.resuming[0]; ws != nil {
- w.addSubstream(pbresp, ws)
- w.dispatchEvent(pbresp)
- w.resuming[0] = nil
- }
- if ws := w.nextResume(); ws != nil {
- wc.Send(ws.initReq.toPB())
- }
- case pbresp.Canceled:
- delete(cancelSet, pbresp.WatchId)
- if ws, ok := w.substreams[pbresp.WatchId]; ok {
- // signal to stream goroutine to update closingc
- close(ws.recvc)
- closing[ws] = struct{}{}
- }
- default:
- // dispatch to appropriate watch stream
- if ok := w.dispatchEvent(pbresp); ok {
- break
- }
- // watch response on unexpected watch id; cancel id
- if _, ok := cancelSet[pbresp.WatchId]; ok {
- break
- }
- cancelSet[pbresp.WatchId] = struct{}{}
- cr := &pb.WatchRequest_CancelRequest{
- CancelRequest: &pb.WatchCancelRequest{
- WatchId: pbresp.WatchId,
- },
- }
- req := &pb.WatchRequest{RequestUnion: cr}
- wc.Send(req)
- }
- // watch client failed to recv; spawn another if possible
- case err := <-w.errc:
- if toErr(w.ctx, err) == v3rpc.ErrNoLeader {
- closeErr = err
- return
- }
- if wc, closeErr = w.newWatchClient(); closeErr != nil {
- return
- }
- if ws := w.nextResume(); ws != nil {
- wc.Send(ws.initReq.toPB())
- }
- cancelSet = make(map[int64]struct{})
- case <-w.ctx.Done():
- return
- case ws := <-w.closingc:
- w.closeSubstream(ws)
- delete(closing, ws)
- if len(w.substreams)+len(w.resuming) == 0 {
- // no more watchers on this stream, shutdown
- return
- }
- }
- }
-}
-
-// nextResume chooses the next resuming to register with the grpc stream. Abandoned
-// streams are marked as nil in the queue since the head must wait for its inflight registration.
-func (w *watchGrpcStream) nextResume() *watcherStream {
- for len(w.resuming) != 0 {
- if w.resuming[0] != nil {
- return w.resuming[0]
- }
- w.resuming = w.resuming[1:len(w.resuming)]
- }
- return nil
-}
-
-// dispatchEvent sends a WatchResponse to the appropriate watcher stream
-func (w *watchGrpcStream) dispatchEvent(pbresp *pb.WatchResponse) bool {
- ws, ok := w.substreams[pbresp.WatchId]
- if !ok {
- return false
- }
- events := make([]*Event, len(pbresp.Events))
- for i, ev := range pbresp.Events {
- events[i] = (*Event)(ev)
- }
- wr := &WatchResponse{
- Header: *pbresp.Header,
- Events: events,
- CompactRevision: pbresp.CompactRevision,
- created: pbresp.Created,
- Canceled: pbresp.Canceled,
- }
- select {
- case ws.recvc <- wr:
- case <-ws.donec:
- return false
- }
- return true
-}
-
-// serveWatchClient forwards messages from the grpc stream to run()
-func (w *watchGrpcStream) serveWatchClient(wc pb.Watch_WatchClient) {
- for {
- resp, err := wc.Recv()
- if err != nil {
- select {
- case w.errc <- err:
- case <-w.donec:
- }
- return
- }
- select {
- case w.respc <- resp:
- case <-w.donec:
- return
- }
- }
-}
-
-// serveSubstream forwards watch responses from run() to the subscriber
-func (w *watchGrpcStream) serveSubstream(ws *watcherStream, resumec chan struct{}) {
- if ws.closing {
- panic("created substream goroutine but substream is closing")
- }
-
- // nextRev is the minimum expected next revision
- nextRev := ws.initReq.rev
- resuming := false
- defer func() {
- if !resuming {
- ws.closing = true
- }
- close(ws.donec)
- if !resuming {
- w.closingc <- ws
- }
- }()
-
- emptyWr := &WatchResponse{}
- for {
- curWr := emptyWr
- outc := ws.outc
-
- if len(ws.buf) > 0 && ws.buf[0].created {
- select {
- case ws.initReq.retc <- ws.outc:
- default:
- }
- ws.buf = ws.buf[1:]
- }
-
- if len(ws.buf) > 0 {
- curWr = ws.buf[0]
- } else {
- outc = nil
- }
- select {
- case outc <- *curWr:
- if ws.buf[0].Err() != nil {
- return
- }
- ws.buf[0] = nil
- ws.buf = ws.buf[1:]
- case wr, ok := <-ws.recvc:
- if !ok {
- // shutdown from closeSubstream
- return
- }
- // TODO pause channel if buffer gets too large
- ws.buf = append(ws.buf, wr)
- nextRev = wr.Header.Revision
- if len(wr.Events) > 0 {
- nextRev = wr.Events[len(wr.Events)-1].Kv.ModRevision + 1
- }
- ws.initReq.rev = nextRev
- case <-w.ctx.Done():
- return
- case <-ws.initReq.ctx.Done():
- return
- case <-resumec:
- resuming = true
- return
- }
- }
- // lazily send cancel message if events on missing id
-}
-
-func (w *watchGrpcStream) newWatchClient() (pb.Watch_WatchClient, error) {
- // mark all substreams as resuming
- close(w.resumec)
- w.resumec = make(chan struct{})
- w.joinSubstreams()
- for _, ws := range w.substreams {
- ws.id = -1
- w.resuming = append(w.resuming, ws)
- }
- // strip out nils, if any
- var resuming []*watcherStream
- for _, ws := range w.resuming {
- if ws != nil {
- resuming = append(resuming, ws)
- }
- }
- w.resuming = resuming
- w.substreams = make(map[int64]*watcherStream)
-
- // connect to grpc stream while accepting watcher cancelation
- stopc := make(chan struct{})
- donec := w.waitCancelSubstreams(stopc)
- wc, err := w.openWatchClient()
- close(stopc)
- <-donec
-
- // serve all non-closing streams, even if there's a client error
- // so that the teardown path can shutdown the streams as expected.
- for _, ws := range w.resuming {
- if ws.closing {
- continue
- }
- ws.donec = make(chan struct{})
- go w.serveSubstream(ws, w.resumec)
- }
-
- if err != nil {
- return nil, v3rpc.Error(err)
- }
-
- // receive data from new grpc stream
- go w.serveWatchClient(wc)
- return wc, nil
-}
-
-func (w *watchGrpcStream) waitCancelSubstreams(stopc <-chan struct{}) <-chan struct{} {
- var wg sync.WaitGroup
- wg.Add(len(w.resuming))
- donec := make(chan struct{})
- for i := range w.resuming {
- go func(ws *watcherStream) {
- defer wg.Done()
- if ws.closing {
- return
- }
- select {
- case <-ws.initReq.ctx.Done():
- // closed ws will be removed from resuming
- ws.closing = true
- close(ws.outc)
- ws.outc = nil
- go func() { w.closingc <- ws }()
- case <-stopc:
- }
- }(w.resuming[i])
- }
- go func() {
- defer close(donec)
- wg.Wait()
- }()
- return donec
-}
-
-// joinSubstream waits for all substream goroutines to complete
-func (w *watchGrpcStream) joinSubstreams() {
- for _, ws := range w.substreams {
- <-ws.donec
- }
- for _, ws := range w.resuming {
- if ws != nil {
- <-ws.donec
- }
- }
-}
-
-// openWatchClient retries opening a watchclient until retryConnection fails
-func (w *watchGrpcStream) openWatchClient() (ws pb.Watch_WatchClient, err error) {
- for {
- select {
- case <-w.ctx.Done():
- if err == nil {
- return nil, w.ctx.Err()
- }
- return nil, err
- default:
- }
- if ws, err = w.remote.Watch(w.ctx, grpc.FailFast(false)); ws != nil && err == nil {
- break
- }
- if isHaltErr(w.ctx, err) {
- return nil, v3rpc.Error(err)
- }
- }
- return ws, nil
-}
-
-// toPB converts an internal watch request structure to its protobuf messagefunc (wr *watchRequest)
-func (wr *watchRequest) toPB() *pb.WatchRequest {
- req := &pb.WatchCreateRequest{
- StartRevision: wr.rev,
- Key: []byte(wr.key),
- RangeEnd: []byte(wr.end),
- ProgressNotify: wr.progressNotify,
- PrevKv: wr.prevKV,
- }
- cr := &pb.WatchRequest_CreateRequest{CreateRequest: req}
- return &pb.WatchRequest{RequestUnion: cr}
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/doc.go
deleted file mode 100644
index f72c6a644..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/doc.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction.
-package rpctypes
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go
deleted file mode 100644
index 97c75620e..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package rpctypes
-
-import (
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
-)
-
-var (
- // server-side error
- ErrGRPCEmptyKey = grpc.Errorf(codes.InvalidArgument, "etcdserver: key is not provided")
- ErrGRPCTooManyOps = grpc.Errorf(codes.InvalidArgument, "etcdserver: too many operations in txn request")
- ErrGRPCDuplicateKey = grpc.Errorf(codes.InvalidArgument, "etcdserver: duplicate key given in txn request")
- ErrGRPCCompacted = grpc.Errorf(codes.OutOfRange, "etcdserver: mvcc: required revision has been compacted")
- ErrGRPCFutureRev = grpc.Errorf(codes.OutOfRange, "etcdserver: mvcc: required revision is a future revision")
- ErrGRPCNoSpace = grpc.Errorf(codes.ResourceExhausted, "etcdserver: mvcc: database space exceeded")
-
- ErrGRPCLeaseNotFound = grpc.Errorf(codes.NotFound, "etcdserver: requested lease not found")
- ErrGRPCLeaseExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: lease already exists")
-
- ErrGRPCMemberExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: member ID already exist")
- ErrGRPCPeerURLExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: Peer URLs already exists")
- ErrGRPCMemberBadURLs = grpc.Errorf(codes.InvalidArgument, "etcdserver: given member URLs are invalid")
- ErrGRPCMemberNotFound = grpc.Errorf(codes.NotFound, "etcdserver: member not found")
-
- ErrGRPCRequestTooLarge = grpc.Errorf(codes.InvalidArgument, "etcdserver: request is too large")
-
- ErrGRPCRootUserNotExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: root user does not exist")
- ErrGRPCRootRoleNotExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: root user does not have root role")
- ErrGRPCUserAlreadyExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: user name already exists")
- ErrGRPCUserNotFound = grpc.Errorf(codes.FailedPrecondition, "etcdserver: user name not found")
- ErrGRPCRoleAlreadyExist = grpc.Errorf(codes.FailedPrecondition, "etcdserver: role name already exists")
- ErrGRPCRoleNotFound = grpc.Errorf(codes.FailedPrecondition, "etcdserver: role name not found")
- ErrGRPCAuthFailed = grpc.Errorf(codes.InvalidArgument, "etcdserver: authentication failed, invalid user ID or password")
- ErrGRPCPermissionDenied = grpc.Errorf(codes.FailedPrecondition, "etcdserver: permission denied")
- ErrGRPCRoleNotGranted = grpc.Errorf(codes.FailedPrecondition, "etcdserver: role is not granted to the user")
- ErrGRPCPermissionNotGranted = grpc.Errorf(codes.FailedPrecondition, "etcdserver: permission is not granted to the role")
-
- ErrGRPCNoLeader = grpc.Errorf(codes.Unavailable, "etcdserver: no leader")
- ErrGRPCNotCapable = grpc.Errorf(codes.Unavailable, "etcdserver: not capable")
- ErrGRPCStopped = grpc.Errorf(codes.Unavailable, "etcdserver: server stopped")
- ErrGRPCTimeout = grpc.Errorf(codes.Unavailable, "etcdserver: request timed out")
- ErrGRPCTimeoutDueToLeaderFail = grpc.Errorf(codes.Unavailable, "etcdserver: request timed out, possibly due to previous leader failure")
- ErrGRPCTimeoutDueToConnectionLost = grpc.Errorf(codes.Unavailable, "etcdserver: request timed out, possibly due to connection lost")
- ErrGRPCUnhealthy = grpc.Errorf(codes.Unavailable, "etcdserver: unhealthy cluster")
-
- errStringToError = map[string]error{
- grpc.ErrorDesc(ErrGRPCEmptyKey): ErrGRPCEmptyKey,
- grpc.ErrorDesc(ErrGRPCTooManyOps): ErrGRPCTooManyOps,
- grpc.ErrorDesc(ErrGRPCDuplicateKey): ErrGRPCDuplicateKey,
- grpc.ErrorDesc(ErrGRPCCompacted): ErrGRPCCompacted,
- grpc.ErrorDesc(ErrGRPCFutureRev): ErrGRPCFutureRev,
- grpc.ErrorDesc(ErrGRPCNoSpace): ErrGRPCNoSpace,
-
- grpc.ErrorDesc(ErrGRPCLeaseNotFound): ErrGRPCLeaseNotFound,
- grpc.ErrorDesc(ErrGRPCLeaseExist): ErrGRPCLeaseExist,
-
- grpc.ErrorDesc(ErrGRPCMemberExist): ErrGRPCMemberExist,
- grpc.ErrorDesc(ErrGRPCPeerURLExist): ErrGRPCPeerURLExist,
- grpc.ErrorDesc(ErrGRPCMemberBadURLs): ErrGRPCMemberBadURLs,
- grpc.ErrorDesc(ErrGRPCMemberNotFound): ErrGRPCMemberNotFound,
-
- grpc.ErrorDesc(ErrGRPCRequestTooLarge): ErrGRPCRequestTooLarge,
-
- grpc.ErrorDesc(ErrGRPCRootUserNotExist): ErrGRPCRootUserNotExist,
- grpc.ErrorDesc(ErrGRPCRootRoleNotExist): ErrGRPCRootRoleNotExist,
- grpc.ErrorDesc(ErrGRPCUserAlreadyExist): ErrGRPCUserAlreadyExist,
- grpc.ErrorDesc(ErrGRPCUserNotFound): ErrGRPCUserNotFound,
- grpc.ErrorDesc(ErrGRPCRoleAlreadyExist): ErrGRPCRoleAlreadyExist,
- grpc.ErrorDesc(ErrGRPCRoleNotFound): ErrGRPCRoleNotFound,
- grpc.ErrorDesc(ErrGRPCAuthFailed): ErrGRPCAuthFailed,
- grpc.ErrorDesc(ErrGRPCPermissionDenied): ErrGRPCPermissionDenied,
- grpc.ErrorDesc(ErrGRPCRoleNotGranted): ErrGRPCRoleNotGranted,
- grpc.ErrorDesc(ErrGRPCPermissionNotGranted): ErrGRPCPermissionNotGranted,
-
- grpc.ErrorDesc(ErrGRPCNoLeader): ErrGRPCNoLeader,
- grpc.ErrorDesc(ErrGRPCNotCapable): ErrGRPCNotCapable,
- grpc.ErrorDesc(ErrGRPCStopped): ErrGRPCStopped,
- grpc.ErrorDesc(ErrGRPCTimeout): ErrGRPCTimeout,
- grpc.ErrorDesc(ErrGRPCTimeoutDueToLeaderFail): ErrGRPCTimeoutDueToLeaderFail,
- grpc.ErrorDesc(ErrGRPCTimeoutDueToConnectionLost): ErrGRPCTimeoutDueToConnectionLost,
- grpc.ErrorDesc(ErrGRPCUnhealthy): ErrGRPCUnhealthy,
- }
-
- // client-side error
- ErrEmptyKey = Error(ErrGRPCEmptyKey)
- ErrTooManyOps = Error(ErrGRPCTooManyOps)
- ErrDuplicateKey = Error(ErrGRPCDuplicateKey)
- ErrCompacted = Error(ErrGRPCCompacted)
- ErrFutureRev = Error(ErrGRPCFutureRev)
- ErrNoSpace = Error(ErrGRPCNoSpace)
-
- ErrLeaseNotFound = Error(ErrGRPCLeaseNotFound)
- ErrLeaseExist = Error(ErrGRPCLeaseExist)
-
- ErrMemberExist = Error(ErrGRPCMemberExist)
- ErrPeerURLExist = Error(ErrGRPCPeerURLExist)
- ErrMemberBadURLs = Error(ErrGRPCMemberBadURLs)
- ErrMemberNotFound = Error(ErrGRPCMemberNotFound)
-
- ErrRequestTooLarge = Error(ErrGRPCRequestTooLarge)
-
- ErrRootUserNotExist = Error(ErrGRPCRootUserNotExist)
- ErrRootRoleNotExist = Error(ErrGRPCRootRoleNotExist)
- ErrUserAlreadyExist = Error(ErrGRPCUserAlreadyExist)
- ErrUserNotFound = Error(ErrGRPCUserNotFound)
- ErrRoleAlreadyExist = Error(ErrGRPCRoleAlreadyExist)
- ErrRoleNotFound = Error(ErrGRPCRoleNotFound)
- ErrAuthFailed = Error(ErrGRPCAuthFailed)
- ErrPermissionDenied = Error(ErrGRPCPermissionDenied)
- ErrRoleNotGranted = Error(ErrGRPCRoleNotGranted)
- ErrPermissionNotGranted = Error(ErrGRPCPermissionNotGranted)
-
- ErrNoLeader = Error(ErrGRPCNoLeader)
- ErrNotCapable = Error(ErrGRPCNotCapable)
- ErrStopped = Error(ErrGRPCStopped)
- ErrTimeout = Error(ErrGRPCTimeout)
- ErrTimeoutDueToLeaderFail = Error(ErrGRPCTimeoutDueToLeaderFail)
- ErrTimeoutDueToConnectionLost = Error(ErrGRPCTimeoutDueToConnectionLost)
- ErrUnhealthy = Error(ErrGRPCUnhealthy)
-)
-
-// EtcdError defines gRPC server errors.
-// (https://github.com/grpc/grpc-go/blob/master/rpc_util.go#L319-L323)
-type EtcdError struct {
- code codes.Code
- desc string
-}
-
-// Code returns grpc/codes.Code.
-// TODO: define clientv3/codes.Code.
-func (e EtcdError) Code() codes.Code {
- return e.code
-}
-
-func (e EtcdError) Error() string {
- return e.desc
-}
-
-func Error(err error) error {
- if err == nil {
- return nil
- }
- verr, ok := errStringToError[grpc.ErrorDesc(err)]
- if !ok { // not gRPC error
- return err
- }
- return EtcdError{code: grpc.Code(verr), desc: grpc.ErrorDesc(verr)}
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/md.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/md.go
deleted file mode 100644
index 5c590e1ae..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/md.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package rpctypes
-
-var (
- MetadataRequireLeaderKey = "hasleader"
- MetadataHasLeader = "true"
-)
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go
deleted file mode 100644
index ac4be4f6c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go
+++ /dev/null
@@ -1,1041 +0,0 @@
-// Code generated by protoc-gen-gogo.
-// source: etcdserver.proto
-// DO NOT EDIT!
-
-/*
- Package etcdserverpb is a generated protocol buffer package.
-
- It is generated from these files:
- etcdserver.proto
- raft_internal.proto
- rpc.proto
-
- It has these top-level messages:
- Request
- Metadata
- RequestHeader
- InternalRaftRequest
- EmptyResponse
- InternalAuthenticateRequest
- ResponseHeader
- RangeRequest
- RangeResponse
- PutRequest
- PutResponse
- DeleteRangeRequest
- DeleteRangeResponse
- RequestOp
- ResponseOp
- Compare
- TxnRequest
- TxnResponse
- CompactionRequest
- CompactionResponse
- HashRequest
- HashResponse
- SnapshotRequest
- SnapshotResponse
- WatchRequest
- WatchCreateRequest
- WatchCancelRequest
- WatchResponse
- LeaseGrantRequest
- LeaseGrantResponse
- LeaseRevokeRequest
- LeaseRevokeResponse
- LeaseKeepAliveRequest
- LeaseKeepAliveResponse
- Member
- MemberAddRequest
- MemberAddResponse
- MemberRemoveRequest
- MemberRemoveResponse
- MemberUpdateRequest
- MemberUpdateResponse
- MemberListRequest
- MemberListResponse
- DefragmentRequest
- DefragmentResponse
- AlarmRequest
- AlarmMember
- AlarmResponse
- StatusRequest
- StatusResponse
- AuthEnableRequest
- AuthDisableRequest
- AuthenticateRequest
- AuthUserAddRequest
- AuthUserGetRequest
- AuthUserDeleteRequest
- AuthUserChangePasswordRequest
- AuthUserGrantRoleRequest
- AuthUserRevokeRoleRequest
- AuthRoleAddRequest
- AuthRoleGetRequest
- AuthUserListRequest
- AuthRoleListRequest
- AuthRoleDeleteRequest
- AuthRoleGrantPermissionRequest
- AuthRoleRevokePermissionRequest
- AuthEnableResponse
- AuthDisableResponse
- AuthenticateResponse
- AuthUserAddResponse
- AuthUserGetResponse
- AuthUserDeleteResponse
- AuthUserChangePasswordResponse
- AuthUserGrantRoleResponse
- AuthUserRevokeRoleResponse
- AuthRoleAddResponse
- AuthRoleGetResponse
- AuthRoleListResponse
- AuthUserListResponse
- AuthRoleDeleteResponse
- AuthRoleGrantPermissionResponse
- AuthRoleRevokePermissionResponse
-*/
-package etcdserverpb
-
-import (
- "fmt"
-
- proto "github.com/golang/protobuf/proto"
-
- math "math"
-
- io "io"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-const _ = proto.ProtoPackageIsVersion1
-
-type Request struct {
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD" json:"ID"`
- Method string `protobuf:"bytes,2,opt,name=Method,json=method" json:"Method"`
- Path string `protobuf:"bytes,3,opt,name=Path,json=path" json:"Path"`
- Val string `protobuf:"bytes,4,opt,name=Val,json=val" json:"Val"`
- Dir bool `protobuf:"varint,5,opt,name=Dir,json=dir" json:"Dir"`
- PrevValue string `protobuf:"bytes,6,opt,name=PrevValue,json=prevValue" json:"PrevValue"`
- PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex,json=prevIndex" json:"PrevIndex"`
- PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist,json=prevExist" json:"PrevExist,omitempty"`
- Expiration int64 `protobuf:"varint,9,opt,name=Expiration,json=expiration" json:"Expiration"`
- Wait bool `protobuf:"varint,10,opt,name=Wait,json=wait" json:"Wait"`
- Since uint64 `protobuf:"varint,11,opt,name=Since,json=since" json:"Since"`
- Recursive bool `protobuf:"varint,12,opt,name=Recursive,json=recursive" json:"Recursive"`
- Sorted bool `protobuf:"varint,13,opt,name=Sorted,json=sorted" json:"Sorted"`
- Quorum bool `protobuf:"varint,14,opt,name=Quorum,json=quorum" json:"Quorum"`
- Time int64 `protobuf:"varint,15,opt,name=Time,json=time" json:"Time"`
- Stream bool `protobuf:"varint,16,opt,name=Stream,json=stream" json:"Stream"`
- Refresh *bool `protobuf:"varint,17,opt,name=Refresh,json=refresh" json:"Refresh,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Request) Reset() { *m = Request{} }
-func (m *Request) String() string { return proto.CompactTextString(m) }
-func (*Request) ProtoMessage() {}
-func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{0} }
-
-type Metadata struct {
- NodeID uint64 `protobuf:"varint,1,opt,name=NodeID,json=nodeID" json:"NodeID"`
- ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID,json=clusterID" json:"ClusterID"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Metadata) Reset() { *m = Metadata{} }
-func (m *Metadata) String() string { return proto.CompactTextString(m) }
-func (*Metadata) ProtoMessage() {}
-func (*Metadata) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{1} }
-
-func init() {
- proto.RegisterType((*Request)(nil), "etcdserverpb.Request")
- proto.RegisterType((*Metadata)(nil), "etcdserverpb.Metadata")
-}
-func (m *Request) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Request) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.ID))
- data[i] = 0x12
- i++
- i = encodeVarintEtcdserver(data, i, uint64(len(m.Method)))
- i += copy(data[i:], m.Method)
- data[i] = 0x1a
- i++
- i = encodeVarintEtcdserver(data, i, uint64(len(m.Path)))
- i += copy(data[i:], m.Path)
- data[i] = 0x22
- i++
- i = encodeVarintEtcdserver(data, i, uint64(len(m.Val)))
- i += copy(data[i:], m.Val)
- data[i] = 0x28
- i++
- if m.Dir {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x32
- i++
- i = encodeVarintEtcdserver(data, i, uint64(len(m.PrevValue)))
- i += copy(data[i:], m.PrevValue)
- data[i] = 0x38
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.PrevIndex))
- if m.PrevExist != nil {
- data[i] = 0x40
- i++
- if *m.PrevExist {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- data[i] = 0x48
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.Expiration))
- data[i] = 0x50
- i++
- if m.Wait {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x58
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.Since))
- data[i] = 0x60
- i++
- if m.Recursive {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x68
- i++
- if m.Sorted {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x70
- i++
- if m.Quorum {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- data[i] = 0x78
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.Time))
- data[i] = 0x80
- i++
- data[i] = 0x1
- i++
- if m.Stream {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- if m.Refresh != nil {
- data[i] = 0x88
- i++
- data[i] = 0x1
- i++
- if *m.Refresh {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
-}
-
-func (m *Metadata) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Metadata) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- data[i] = 0x8
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.NodeID))
- data[i] = 0x10
- i++
- i = encodeVarintEtcdserver(data, i, uint64(m.ClusterID))
- if m.XXX_unrecognized != nil {
- i += copy(data[i:], m.XXX_unrecognized)
- }
- return i, nil
-}
-
-func encodeFixed64Etcdserver(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32Etcdserver(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintEtcdserver(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
-}
-func (m *Request) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovEtcdserver(uint64(m.ID))
- l = len(m.Method)
- n += 1 + l + sovEtcdserver(uint64(l))
- l = len(m.Path)
- n += 1 + l + sovEtcdserver(uint64(l))
- l = len(m.Val)
- n += 1 + l + sovEtcdserver(uint64(l))
- n += 2
- l = len(m.PrevValue)
- n += 1 + l + sovEtcdserver(uint64(l))
- n += 1 + sovEtcdserver(uint64(m.PrevIndex))
- if m.PrevExist != nil {
- n += 2
- }
- n += 1 + sovEtcdserver(uint64(m.Expiration))
- n += 2
- n += 1 + sovEtcdserver(uint64(m.Since))
- n += 2
- n += 2
- n += 2
- n += 1 + sovEtcdserver(uint64(m.Time))
- n += 3
- if m.Refresh != nil {
- n += 3
- }
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
-}
-
-func (m *Metadata) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovEtcdserver(uint64(m.NodeID))
- n += 1 + sovEtcdserver(uint64(m.ClusterID))
- if m.XXX_unrecognized != nil {
- n += len(m.XXX_unrecognized)
- }
- return n
-}
-
-func sovEtcdserver(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozEtcdserver(x uint64) (n int) {
- return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *Request) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Request: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthEtcdserver
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Method = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthEtcdserver
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Path = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 4:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Val", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthEtcdserver
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Val = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Dir", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Dir = bool(v != 0)
- case 6:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevValue", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthEtcdserver
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.PrevValue = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 7:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevIndex", wireType)
- }
- m.PrevIndex = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.PrevIndex |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 8:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevExist", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- b := bool(v != 0)
- m.PrevExist = &b
- case 9:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType)
- }
- m.Expiration = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Expiration |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 10:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Wait = bool(v != 0)
- case 11:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Since", wireType)
- }
- m.Since = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Since |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 12:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Recursive", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Recursive = bool(v != 0)
- case 13:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Sorted", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Sorted = bool(v != 0)
- case 14:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Quorum = bool(v != 0)
- case 15:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType)
- }
- m.Time = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Time |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 16:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Stream", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Stream = bool(v != 0)
- case 17:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Refresh", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- b := bool(v != 0)
- m.Refresh = &b
- default:
- iNdEx = preIndex
- skippy, err := skipEtcdserver(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthEtcdserver
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Metadata) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Metadata: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType)
- }
- m.NodeID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.NodeID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ClusterID", wireType)
- }
- m.ClusterID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ClusterID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipEtcdserver(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthEtcdserver
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipEtcdserver(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthEtcdserver
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowEtcdserver
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipEtcdserver(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthEtcdserver = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowEtcdserver = fmt.Errorf("proto: integer overflow")
-)
-
-var fileDescriptorEtcdserver = []byte{
- // 404 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x92, 0x41, 0x6e, 0x13, 0x31,
- 0x14, 0x86, 0xe3, 0xc4, 0x99, 0x64, 0x4c, 0x81, 0x62, 0x45, 0xe8, 0xa9, 0x42, 0x43, 0x14, 0xb1,
- 0xc8, 0x0a, 0xee, 0x50, 0xd2, 0x45, 0x24, 0x8a, 0x4a, 0x8a, 0xca, 0xda, 0x64, 0x1e, 0x8d, 0xa5,
- 0xcc, 0x78, 0x6a, 0xbf, 0x19, 0x72, 0x03, 0xae, 0xc0, 0x91, 0xb2, 0xe4, 0x04, 0x08, 0xc2, 0x45,
- 0x90, 0x3d, 0x9d, 0x60, 0xba, 0xb3, 0xbe, 0xff, 0xf7, 0xef, 0xdf, 0xf6, 0x13, 0xa7, 0x48, 0xeb,
- 0xdc, 0xa1, 0x6d, 0xd0, 0xbe, 0xae, 0xac, 0x21, 0x23, 0x4f, 0xfe, 0x91, 0xea, 0xf3, 0xd9, 0xe4,
- 0xd6, 0xdc, 0x9a, 0x20, 0xbc, 0xf1, 0xab, 0xd6, 0x33, 0xfb, 0xc6, 0xc5, 0x68, 0x85, 0x77, 0x35,
- 0x3a, 0x92, 0x13, 0xd1, 0x5f, 0x2e, 0x80, 0x4d, 0xd9, 0x9c, 0x9f, 0xf3, 0xfd, 0xcf, 0x97, 0xbd,
- 0x55, 0x5f, 0x2f, 0xe4, 0x0b, 0x91, 0x5c, 0x22, 0x6d, 0x4c, 0x0e, 0xfd, 0x29, 0x9b, 0xa7, 0xf7,
- 0x4a, 0x52, 0x04, 0x26, 0x41, 0xf0, 0x2b, 0x45, 0x1b, 0x18, 0x44, 0x1a, 0xaf, 0x14, 0x6d, 0xe4,
- 0x73, 0x31, 0xb8, 0x51, 0x5b, 0xe0, 0x91, 0x30, 0x68, 0xd4, 0xd6, 0xf3, 0x85, 0xb6, 0x30, 0x9c,
- 0xb2, 0xf9, 0xb8, 0xe3, 0xb9, 0xb6, 0x72, 0x26, 0xd2, 0x2b, 0x8b, 0xcd, 0x8d, 0xda, 0xd6, 0x08,
- 0x49, 0xb4, 0x2b, 0xad, 0x3a, 0xdc, 0x79, 0x96, 0x65, 0x8e, 0x3b, 0x18, 0x45, 0x45, 0x83, 0x27,
- 0xe0, 0xce, 0x73, 0xb1, 0xd3, 0x8e, 0x60, 0x7c, 0x3c, 0x85, 0xb5, 0x9e, 0x80, 0xe5, 0x2b, 0x21,
- 0x2e, 0x76, 0x95, 0xb6, 0x8a, 0xb4, 0x29, 0x21, 0x9d, 0xb2, 0xf9, 0xe0, 0x3e, 0x48, 0xe0, 0x91,
- 0xfb, 0xbb, 0x7d, 0x52, 0x9a, 0x40, 0x44, 0x55, 0xf9, 0x57, 0xa5, 0x49, 0x9e, 0x89, 0xe1, 0xb5,
- 0x2e, 0xd7, 0x08, 0x8f, 0xa2, 0x0e, 0x43, 0xe7, 0x91, 0x3f, 0x7f, 0x85, 0xeb, 0xda, 0x3a, 0xdd,
- 0x20, 0x9c, 0x44, 0x5b, 0x53, 0xdb, 0x61, 0xff, 0xa6, 0xd7, 0xc6, 0x12, 0xe6, 0xf0, 0x38, 0x32,
- 0x24, 0x2e, 0x30, 0xaf, 0x7e, 0xa8, 0x8d, 0xad, 0x0b, 0x78, 0x12, 0xab, 0x77, 0x81, 0xf9, 0x56,
- 0x1f, 0x75, 0x81, 0xf0, 0x34, 0x6a, 0xcd, 0x49, 0x17, 0x6d, 0x2a, 0x59, 0x54, 0x05, 0x9c, 0xfe,
- 0x97, 0x1a, 0x98, 0xcc, 0xfc, 0x47, 0x7f, 0xb1, 0xe8, 0x36, 0xf0, 0x2c, 0x7a, 0x95, 0x91, 0x6d,
- 0xe1, 0xec, 0x9d, 0x18, 0x5f, 0x22, 0xa9, 0x5c, 0x91, 0xf2, 0x49, 0xef, 0x4d, 0x8e, 0x0f, 0xa6,
- 0x21, 0x29, 0x03, 0xf3, 0x37, 0x7c, 0xbb, 0xad, 0x1d, 0xa1, 0x5d, 0x2e, 0xc2, 0x50, 0x1c, 0x7f,
- 0x61, 0xdd, 0xe1, 0xf3, 0xc9, 0xfe, 0x77, 0xd6, 0xdb, 0x1f, 0x32, 0xf6, 0xe3, 0x90, 0xb1, 0x5f,
- 0x87, 0x8c, 0x7d, 0xff, 0x93, 0xf5, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x80, 0x62, 0xfc, 0x40,
- 0xa4, 0x02, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto
deleted file mode 100644
index 25e0aca5d..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto
+++ /dev/null
@@ -1,34 +0,0 @@
-syntax = "proto2";
-package etcdserverpb;
-
-import "gogoproto/gogo.proto";
-
-option (gogoproto.marshaler_all) = true;
-option (gogoproto.sizer_all) = true;
-option (gogoproto.unmarshaler_all) = true;
-option (gogoproto.goproto_getters_all) = false;
-
-message Request {
- optional uint64 ID = 1 [(gogoproto.nullable) = false];
- optional string Method = 2 [(gogoproto.nullable) = false];
- optional string Path = 3 [(gogoproto.nullable) = false];
- optional string Val = 4 [(gogoproto.nullable) = false];
- optional bool Dir = 5 [(gogoproto.nullable) = false];
- optional string PrevValue = 6 [(gogoproto.nullable) = false];
- optional uint64 PrevIndex = 7 [(gogoproto.nullable) = false];
- optional bool PrevExist = 8 [(gogoproto.nullable) = true];
- optional int64 Expiration = 9 [(gogoproto.nullable) = false];
- optional bool Wait = 10 [(gogoproto.nullable) = false];
- optional uint64 Since = 11 [(gogoproto.nullable) = false];
- optional bool Recursive = 12 [(gogoproto.nullable) = false];
- optional bool Sorted = 13 [(gogoproto.nullable) = false];
- optional bool Quorum = 14 [(gogoproto.nullable) = false];
- optional int64 Time = 15 [(gogoproto.nullable) = false];
- optional bool Stream = 16 [(gogoproto.nullable) = false];
- optional bool Refresh = 17 [(gogoproto.nullable) = true];
-}
-
-message Metadata {
- optional uint64 NodeID = 1 [(gogoproto.nullable) = false];
- optional uint64 ClusterID = 2 [(gogoproto.nullable) = false];
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go
deleted file mode 100644
index a82e2b235..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go
+++ /dev/null
@@ -1,2062 +0,0 @@
-// Code generated by protoc-gen-gogo.
-// source: raft_internal.proto
-// DO NOT EDIT!
-
-package etcdserverpb
-
-import (
- "fmt"
-
- proto "github.com/golang/protobuf/proto"
-
- math "math"
-
- io "io"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-type RequestHeader struct {
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- // username is a username that is associated with an auth token of gRPC connection
- Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
-}
-
-func (m *RequestHeader) Reset() { *m = RequestHeader{} }
-func (m *RequestHeader) String() string { return proto.CompactTextString(m) }
-func (*RequestHeader) ProtoMessage() {}
-func (*RequestHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{0} }
-
-// An InternalRaftRequest is the union of all requests which can be
-// sent via raft.
-type InternalRaftRequest struct {
- Header *RequestHeader `protobuf:"bytes,100,opt,name=header" json:"header,omitempty"`
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- V2 *Request `protobuf:"bytes,2,opt,name=v2" json:"v2,omitempty"`
- Range *RangeRequest `protobuf:"bytes,3,opt,name=range" json:"range,omitempty"`
- Put *PutRequest `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"`
- DeleteRange *DeleteRangeRequest `protobuf:"bytes,5,opt,name=delete_range,json=deleteRange" json:"delete_range,omitempty"`
- Txn *TxnRequest `protobuf:"bytes,6,opt,name=txn" json:"txn,omitempty"`
- Compaction *CompactionRequest `protobuf:"bytes,7,opt,name=compaction" json:"compaction,omitempty"`
- LeaseGrant *LeaseGrantRequest `protobuf:"bytes,8,opt,name=lease_grant,json=leaseGrant" json:"lease_grant,omitempty"`
- LeaseRevoke *LeaseRevokeRequest `protobuf:"bytes,9,opt,name=lease_revoke,json=leaseRevoke" json:"lease_revoke,omitempty"`
- Alarm *AlarmRequest `protobuf:"bytes,10,opt,name=alarm" json:"alarm,omitempty"`
- AuthEnable *AuthEnableRequest `protobuf:"bytes,1000,opt,name=auth_enable,json=authEnable" json:"auth_enable,omitempty"`
- AuthDisable *AuthDisableRequest `protobuf:"bytes,1011,opt,name=auth_disable,json=authDisable" json:"auth_disable,omitempty"`
- Authenticate *InternalAuthenticateRequest `protobuf:"bytes,1012,opt,name=authenticate" json:"authenticate,omitempty"`
- AuthUserAdd *AuthUserAddRequest `protobuf:"bytes,1100,opt,name=auth_user_add,json=authUserAdd" json:"auth_user_add,omitempty"`
- AuthUserDelete *AuthUserDeleteRequest `protobuf:"bytes,1101,opt,name=auth_user_delete,json=authUserDelete" json:"auth_user_delete,omitempty"`
- AuthUserGet *AuthUserGetRequest `protobuf:"bytes,1102,opt,name=auth_user_get,json=authUserGet" json:"auth_user_get,omitempty"`
- AuthUserChangePassword *AuthUserChangePasswordRequest `protobuf:"bytes,1103,opt,name=auth_user_change_password,json=authUserChangePassword" json:"auth_user_change_password,omitempty"`
- AuthUserGrantRole *AuthUserGrantRoleRequest `protobuf:"bytes,1104,opt,name=auth_user_grant_role,json=authUserGrantRole" json:"auth_user_grant_role,omitempty"`
- AuthUserRevokeRole *AuthUserRevokeRoleRequest `protobuf:"bytes,1105,opt,name=auth_user_revoke_role,json=authUserRevokeRole" json:"auth_user_revoke_role,omitempty"`
- AuthUserList *AuthUserListRequest `protobuf:"bytes,1106,opt,name=auth_user_list,json=authUserList" json:"auth_user_list,omitempty"`
- AuthRoleList *AuthRoleListRequest `protobuf:"bytes,1107,opt,name=auth_role_list,json=authRoleList" json:"auth_role_list,omitempty"`
- AuthRoleAdd *AuthRoleAddRequest `protobuf:"bytes,1200,opt,name=auth_role_add,json=authRoleAdd" json:"auth_role_add,omitempty"`
- AuthRoleDelete *AuthRoleDeleteRequest `protobuf:"bytes,1201,opt,name=auth_role_delete,json=authRoleDelete" json:"auth_role_delete,omitempty"`
- AuthRoleGet *AuthRoleGetRequest `protobuf:"bytes,1202,opt,name=auth_role_get,json=authRoleGet" json:"auth_role_get,omitempty"`
- AuthRoleGrantPermission *AuthRoleGrantPermissionRequest `protobuf:"bytes,1203,opt,name=auth_role_grant_permission,json=authRoleGrantPermission" json:"auth_role_grant_permission,omitempty"`
- AuthRoleRevokePermission *AuthRoleRevokePermissionRequest `protobuf:"bytes,1204,opt,name=auth_role_revoke_permission,json=authRoleRevokePermission" json:"auth_role_revoke_permission,omitempty"`
-}
-
-func (m *InternalRaftRequest) Reset() { *m = InternalRaftRequest{} }
-func (m *InternalRaftRequest) String() string { return proto.CompactTextString(m) }
-func (*InternalRaftRequest) ProtoMessage() {}
-func (*InternalRaftRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{1} }
-
-type EmptyResponse struct {
-}
-
-func (m *EmptyResponse) Reset() { *m = EmptyResponse{} }
-func (m *EmptyResponse) String() string { return proto.CompactTextString(m) }
-func (*EmptyResponse) ProtoMessage() {}
-func (*EmptyResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{2} }
-
-// What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest?
-// InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing.
-// For avoiding misusage the field, we have an internal version of AuthenticateRequest.
-type InternalAuthenticateRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
- // simple_token is generated in API layer (etcdserver/v3_server.go)
- SimpleToken string `protobuf:"bytes,3,opt,name=simple_token,json=simpleToken,proto3" json:"simple_token,omitempty"`
-}
-
-func (m *InternalAuthenticateRequest) Reset() { *m = InternalAuthenticateRequest{} }
-func (m *InternalAuthenticateRequest) String() string { return proto.CompactTextString(m) }
-func (*InternalAuthenticateRequest) ProtoMessage() {}
-func (*InternalAuthenticateRequest) Descriptor() ([]byte, []int) {
- return fileDescriptorRaftInternal, []int{3}
-}
-
-func init() {
- proto.RegisterType((*RequestHeader)(nil), "etcdserverpb.RequestHeader")
- proto.RegisterType((*InternalRaftRequest)(nil), "etcdserverpb.InternalRaftRequest")
- proto.RegisterType((*EmptyResponse)(nil), "etcdserverpb.EmptyResponse")
- proto.RegisterType((*InternalAuthenticateRequest)(nil), "etcdserverpb.InternalAuthenticateRequest")
-}
-func (m *RequestHeader) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *RequestHeader) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.ID))
- }
- if len(m.Username) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRaftInternal(data, i, uint64(len(m.Username)))
- i += copy(data[i:], m.Username)
- }
- return i, nil
-}
-
-func (m *InternalRaftRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *InternalRaftRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.ID))
- }
- if m.V2 != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.V2.Size()))
- n1, err := m.V2.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n1
- }
- if m.Range != nil {
- data[i] = 0x1a
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Range.Size()))
- n2, err := m.Range.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n2
- }
- if m.Put != nil {
- data[i] = 0x22
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Put.Size()))
- n3, err := m.Put.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n3
- }
- if m.DeleteRange != nil {
- data[i] = 0x2a
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.DeleteRange.Size()))
- n4, err := m.DeleteRange.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n4
- }
- if m.Txn != nil {
- data[i] = 0x32
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Txn.Size()))
- n5, err := m.Txn.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n5
- }
- if m.Compaction != nil {
- data[i] = 0x3a
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Compaction.Size()))
- n6, err := m.Compaction.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n6
- }
- if m.LeaseGrant != nil {
- data[i] = 0x42
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.LeaseGrant.Size()))
- n7, err := m.LeaseGrant.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n7
- }
- if m.LeaseRevoke != nil {
- data[i] = 0x4a
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.LeaseRevoke.Size()))
- n8, err := m.LeaseRevoke.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n8
- }
- if m.Alarm != nil {
- data[i] = 0x52
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Alarm.Size()))
- n9, err := m.Alarm.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n9
- }
- if m.Header != nil {
- data[i] = 0xa2
- i++
- data[i] = 0x6
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Header.Size()))
- n10, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n10
- }
- if m.AuthEnable != nil {
- data[i] = 0xc2
- i++
- data[i] = 0x3e
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthEnable.Size()))
- n11, err := m.AuthEnable.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n11
- }
- if m.AuthDisable != nil {
- data[i] = 0x9a
- i++
- data[i] = 0x3f
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthDisable.Size()))
- n12, err := m.AuthDisable.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n12
- }
- if m.Authenticate != nil {
- data[i] = 0xa2
- i++
- data[i] = 0x3f
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.Authenticate.Size()))
- n13, err := m.Authenticate.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n13
- }
- if m.AuthUserAdd != nil {
- data[i] = 0xe2
- i++
- data[i] = 0x44
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserAdd.Size()))
- n14, err := m.AuthUserAdd.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n14
- }
- if m.AuthUserDelete != nil {
- data[i] = 0xea
- i++
- data[i] = 0x44
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserDelete.Size()))
- n15, err := m.AuthUserDelete.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n15
- }
- if m.AuthUserGet != nil {
- data[i] = 0xf2
- i++
- data[i] = 0x44
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserGet.Size()))
- n16, err := m.AuthUserGet.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n16
- }
- if m.AuthUserChangePassword != nil {
- data[i] = 0xfa
- i++
- data[i] = 0x44
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserChangePassword.Size()))
- n17, err := m.AuthUserChangePassword.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n17
- }
- if m.AuthUserGrantRole != nil {
- data[i] = 0x82
- i++
- data[i] = 0x45
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserGrantRole.Size()))
- n18, err := m.AuthUserGrantRole.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n18
- }
- if m.AuthUserRevokeRole != nil {
- data[i] = 0x8a
- i++
- data[i] = 0x45
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserRevokeRole.Size()))
- n19, err := m.AuthUserRevokeRole.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n19
- }
- if m.AuthUserList != nil {
- data[i] = 0x92
- i++
- data[i] = 0x45
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthUserList.Size()))
- n20, err := m.AuthUserList.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n20
- }
- if m.AuthRoleList != nil {
- data[i] = 0x9a
- i++
- data[i] = 0x45
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleList.Size()))
- n21, err := m.AuthRoleList.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n21
- }
- if m.AuthRoleAdd != nil {
- data[i] = 0x82
- i++
- data[i] = 0x4b
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleAdd.Size()))
- n22, err := m.AuthRoleAdd.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n22
- }
- if m.AuthRoleDelete != nil {
- data[i] = 0x8a
- i++
- data[i] = 0x4b
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleDelete.Size()))
- n23, err := m.AuthRoleDelete.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n23
- }
- if m.AuthRoleGet != nil {
- data[i] = 0x92
- i++
- data[i] = 0x4b
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleGet.Size()))
- n24, err := m.AuthRoleGet.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n24
- }
- if m.AuthRoleGrantPermission != nil {
- data[i] = 0x9a
- i++
- data[i] = 0x4b
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleGrantPermission.Size()))
- n25, err := m.AuthRoleGrantPermission.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n25
- }
- if m.AuthRoleRevokePermission != nil {
- data[i] = 0xa2
- i++
- data[i] = 0x4b
- i++
- i = encodeVarintRaftInternal(data, i, uint64(m.AuthRoleRevokePermission.Size()))
- n26, err := m.AuthRoleRevokePermission.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n26
- }
- return i, nil
-}
-
-func (m *EmptyResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *EmptyResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *InternalAuthenticateRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *InternalAuthenticateRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRaftInternal(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Password) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRaftInternal(data, i, uint64(len(m.Password)))
- i += copy(data[i:], m.Password)
- }
- if len(m.SimpleToken) > 0 {
- data[i] = 0x1a
- i++
- i = encodeVarintRaftInternal(data, i, uint64(len(m.SimpleToken)))
- i += copy(data[i:], m.SimpleToken)
- }
- return i, nil
-}
-
-func encodeFixed64RaftInternal(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32RaftInternal(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintRaftInternal(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
-}
-func (m *RequestHeader) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRaftInternal(uint64(m.ID))
- }
- l = len(m.Username)
- if l > 0 {
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- return n
-}
-
-func (m *InternalRaftRequest) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRaftInternal(uint64(m.ID))
- }
- if m.V2 != nil {
- l = m.V2.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Range != nil {
- l = m.Range.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Put != nil {
- l = m.Put.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.DeleteRange != nil {
- l = m.DeleteRange.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Txn != nil {
- l = m.Txn.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Compaction != nil {
- l = m.Compaction.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.LeaseGrant != nil {
- l = m.LeaseGrant.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.LeaseRevoke != nil {
- l = m.LeaseRevoke.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Alarm != nil {
- l = m.Alarm.Size()
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- if m.Header != nil {
- l = m.Header.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthEnable != nil {
- l = m.AuthEnable.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthDisable != nil {
- l = m.AuthDisable.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.Authenticate != nil {
- l = m.Authenticate.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserAdd != nil {
- l = m.AuthUserAdd.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserDelete != nil {
- l = m.AuthUserDelete.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserGet != nil {
- l = m.AuthUserGet.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserChangePassword != nil {
- l = m.AuthUserChangePassword.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserGrantRole != nil {
- l = m.AuthUserGrantRole.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserRevokeRole != nil {
- l = m.AuthUserRevokeRole.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthUserList != nil {
- l = m.AuthUserList.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleList != nil {
- l = m.AuthRoleList.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleAdd != nil {
- l = m.AuthRoleAdd.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleDelete != nil {
- l = m.AuthRoleDelete.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleGet != nil {
- l = m.AuthRoleGet.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleGrantPermission != nil {
- l = m.AuthRoleGrantPermission.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- if m.AuthRoleRevokePermission != nil {
- l = m.AuthRoleRevokePermission.Size()
- n += 2 + l + sovRaftInternal(uint64(l))
- }
- return n
-}
-
-func (m *EmptyResponse) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *InternalAuthenticateRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- l = len(m.Password)
- if l > 0 {
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- l = len(m.SimpleToken)
- if l > 0 {
- n += 1 + l + sovRaftInternal(uint64(l))
- }
- return n
-}
-
-func sovRaftInternal(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozRaftInternal(x uint64) (n int) {
- return sovRaftInternal(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *RequestHeader) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: RequestHeader: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: RequestHeader: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Username = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRaftInternal(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRaftInternal
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *InternalRaftRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: InternalRaftRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: InternalRaftRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field V2", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.V2 == nil {
- m.V2 = &Request{}
- }
- if err := m.V2.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Range == nil {
- m.Range = &RangeRequest{}
- }
- if err := m.Range.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 4:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Put == nil {
- m.Put = &PutRequest{}
- }
- if err := m.Put.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 5:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field DeleteRange", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.DeleteRange == nil {
- m.DeleteRange = &DeleteRangeRequest{}
- }
- if err := m.DeleteRange.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 6:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Txn", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Txn == nil {
- m.Txn = &TxnRequest{}
- }
- if err := m.Txn.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 7:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Compaction", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Compaction == nil {
- m.Compaction = &CompactionRequest{}
- }
- if err := m.Compaction.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 8:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field LeaseGrant", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.LeaseGrant == nil {
- m.LeaseGrant = &LeaseGrantRequest{}
- }
- if err := m.LeaseGrant.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 9:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field LeaseRevoke", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.LeaseRevoke == nil {
- m.LeaseRevoke = &LeaseRevokeRequest{}
- }
- if err := m.LeaseRevoke.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 10:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Alarm == nil {
- m.Alarm = &AlarmRequest{}
- }
- if err := m.Alarm.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 100:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &RequestHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1000:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthEnable", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthEnable == nil {
- m.AuthEnable = &AuthEnableRequest{}
- }
- if err := m.AuthEnable.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1011:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthDisable", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthDisable == nil {
- m.AuthDisable = &AuthDisableRequest{}
- }
- if err := m.AuthDisable.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1012:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Authenticate", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Authenticate == nil {
- m.Authenticate = &InternalAuthenticateRequest{}
- }
- if err := m.Authenticate.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1100:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserAdd", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserAdd == nil {
- m.AuthUserAdd = &AuthUserAddRequest{}
- }
- if err := m.AuthUserAdd.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1101:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserDelete", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserDelete == nil {
- m.AuthUserDelete = &AuthUserDeleteRequest{}
- }
- if err := m.AuthUserDelete.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1102:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserGet", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserGet == nil {
- m.AuthUserGet = &AuthUserGetRequest{}
- }
- if err := m.AuthUserGet.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1103:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserChangePassword", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserChangePassword == nil {
- m.AuthUserChangePassword = &AuthUserChangePasswordRequest{}
- }
- if err := m.AuthUserChangePassword.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1104:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserGrantRole", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserGrantRole == nil {
- m.AuthUserGrantRole = &AuthUserGrantRoleRequest{}
- }
- if err := m.AuthUserGrantRole.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1105:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserRevokeRole", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserRevokeRole == nil {
- m.AuthUserRevokeRole = &AuthUserRevokeRoleRequest{}
- }
- if err := m.AuthUserRevokeRole.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1106:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthUserList", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthUserList == nil {
- m.AuthUserList = &AuthUserListRequest{}
- }
- if err := m.AuthUserList.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1107:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleList", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleList == nil {
- m.AuthRoleList = &AuthRoleListRequest{}
- }
- if err := m.AuthRoleList.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1200:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleAdd", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleAdd == nil {
- m.AuthRoleAdd = &AuthRoleAddRequest{}
- }
- if err := m.AuthRoleAdd.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1201:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleDelete", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleDelete == nil {
- m.AuthRoleDelete = &AuthRoleDeleteRequest{}
- }
- if err := m.AuthRoleDelete.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1202:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleGet", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleGet == nil {
- m.AuthRoleGet = &AuthRoleGetRequest{}
- }
- if err := m.AuthRoleGet.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1203:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleGrantPermission", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleGrantPermission == nil {
- m.AuthRoleGrantPermission = &AuthRoleGrantPermissionRequest{}
- }
- if err := m.AuthRoleGrantPermission.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 1204:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuthRoleRevokePermission", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.AuthRoleRevokePermission == nil {
- m.AuthRoleRevokePermission = &AuthRoleRevokePermissionRequest{}
- }
- if err := m.AuthRoleRevokePermission.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRaftInternal(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRaftInternal
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *EmptyResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: EmptyResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: EmptyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRaftInternal(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRaftInternal
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *InternalAuthenticateRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: InternalAuthenticateRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: InternalAuthenticateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Password = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field SimpleToken", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRaftInternal
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.SimpleToken = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRaftInternal(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRaftInternal
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipRaftInternal(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthRaftInternal
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRaftInternal
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipRaftInternal(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthRaftInternal = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowRaftInternal = fmt.Errorf("proto: integer overflow")
-)
-
-var fileDescriptorRaftInternal = []byte{
- // 824 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x96, 0xdd, 0x4e, 0xdb, 0x48,
- 0x14, 0xc7, 0x49, 0xf8, 0xcc, 0x24, 0x64, 0xd9, 0x01, 0x76, 0x67, 0x83, 0x94, 0x85, 0xac, 0x76,
- 0x97, 0x7e, 0xd1, 0x0a, 0x2e, 0x7b, 0xd1, 0xa6, 0x04, 0x01, 0x12, 0x42, 0xc8, 0xa2, 0x52, 0xa5,
- 0x5e, 0x58, 0x43, 0x7c, 0x48, 0x5c, 0x1c, 0xdb, 0xb5, 0x27, 0x29, 0x7d, 0x93, 0x3e, 0x46, 0xbf,
- 0x1e, 0x82, 0x8b, 0x7e, 0xd0, 0xf6, 0x05, 0x5a, 0x7a, 0xd3, 0xab, 0xde, 0xb4, 0x0f, 0x50, 0xcd,
- 0x87, 0xc7, 0x71, 0x32, 0xe1, 0xce, 0x3e, 0xe7, 0x7f, 0x7e, 0xe7, 0x4c, 0xe6, 0x3f, 0x9e, 0xa0,
- 0xf9, 0x88, 0x1e, 0x33, 0xdb, 0xf5, 0x19, 0x44, 0x3e, 0xf5, 0xd6, 0xc2, 0x28, 0x60, 0x01, 0x2e,
- 0x01, 0x6b, 0x3a, 0x31, 0x44, 0x3d, 0x88, 0xc2, 0xa3, 0xca, 0x42, 0x2b, 0x68, 0x05, 0x22, 0x71,
- 0x93, 0x3f, 0x49, 0x4d, 0x65, 0x2e, 0xd5, 0xa8, 0x48, 0x21, 0x0a, 0x9b, 0xf2, 0xb1, 0x76, 0x1b,
- 0xcd, 0x5a, 0xf0, 0xb8, 0x0b, 0x31, 0xdb, 0x01, 0xea, 0x40, 0x84, 0xcb, 0x28, 0xbf, 0xdb, 0x20,
- 0xb9, 0xe5, 0xdc, 0xea, 0x84, 0x95, 0x77, 0x1b, 0xb8, 0x82, 0x66, 0xba, 0x31, 0x6f, 0xd9, 0x01,
- 0x92, 0x5f, 0xce, 0xad, 0x16, 0x2c, 0xfd, 0x5e, 0xfb, 0x5e, 0x46, 0xf3, 0xbb, 0x6a, 0x20, 0x8b,
- 0x1e, 0x33, 0x45, 0x1a, 0x62, 0xfc, 0x8b, 0xf2, 0xbd, 0x75, 0x51, 0x5d, 0x5c, 0x5f, 0x5c, 0xeb,
- 0x1f, 0x79, 0x4d, 0x95, 0x58, 0xf9, 0xde, 0x3a, 0xbe, 0x85, 0x26, 0x23, 0xea, 0xb7, 0x80, 0x8c,
- 0x0b, 0x65, 0x65, 0x40, 0xc9, 0x53, 0x89, 0x5c, 0x0a, 0xf1, 0x55, 0x34, 0x1e, 0x76, 0x19, 0x99,
- 0x10, 0x7a, 0x92, 0xd5, 0x1f, 0x74, 0x93, 0x79, 0x2c, 0x2e, 0xc2, 0x9b, 0xa8, 0xe4, 0x80, 0x07,
- 0x0c, 0x6c, 0xd9, 0x64, 0x52, 0x14, 0x2d, 0x67, 0x8b, 0x1a, 0x42, 0x91, 0x69, 0x55, 0x74, 0xd2,
- 0x18, 0x6f, 0xc8, 0x4e, 0x7d, 0x32, 0x65, 0x6a, 0x78, 0x78, 0xea, 0xeb, 0x86, 0xec, 0xd4, 0xc7,
- 0x77, 0x10, 0x6a, 0x06, 0x9d, 0x90, 0x36, 0x99, 0x1b, 0xf8, 0x64, 0x5a, 0x94, 0xfc, 0x9d, 0x2d,
- 0xd9, 0xd4, 0xf9, 0xa4, 0xb2, 0xaf, 0x04, 0xdf, 0x45, 0x45, 0x0f, 0x68, 0x0c, 0x76, 0x2b, 0xa2,
- 0x3e, 0x23, 0x33, 0x26, 0xc2, 0x1e, 0x17, 0x6c, 0xf3, 0xbc, 0x26, 0x78, 0x3a, 0xc4, 0xd7, 0x2c,
- 0x09, 0x11, 0xf4, 0x82, 0x13, 0x20, 0x05, 0xd3, 0x9a, 0x05, 0xc2, 0x12, 0x02, 0xbd, 0x66, 0x2f,
- 0x8d, 0xf1, 0x6d, 0xa1, 0x1e, 0x8d, 0x3a, 0x04, 0x99, 0xb6, 0xa5, 0xce, 0x53, 0x7a, 0x5b, 0x84,
- 0x10, 0x6f, 0xa0, 0xa9, 0xb6, 0x70, 0x13, 0x71, 0x44, 0xc9, 0x92, 0x71, 0xcf, 0xa5, 0xe1, 0x2c,
- 0x25, 0xc5, 0x75, 0x54, 0xa4, 0x5d, 0xd6, 0xb6, 0xc1, 0xa7, 0x47, 0x1e, 0x90, 0x6f, 0xc6, 0x1f,
- 0xac, 0xde, 0x65, 0xed, 0x2d, 0x21, 0xd0, 0xcb, 0xa5, 0x3a, 0x84, 0x1b, 0xa8, 0x24, 0x10, 0x8e,
- 0x1b, 0x0b, 0xc6, 0x8f, 0x69, 0xd3, 0x7a, 0x39, 0xa3, 0x21, 0x15, 0x7a, 0xbd, 0x34, 0x8d, 0xe1,
- 0x7d, 0x49, 0x01, 0x9f, 0xb9, 0x4d, 0xca, 0x80, 0xfc, 0x94, 0x94, 0x2b, 0x59, 0x4a, 0xe2, 0xfb,
- 0x7a, 0x9f, 0x34, 0xc1, 0x65, 0xea, 0xf1, 0x16, 0x9a, 0x15, 0x53, 0xf1, 0x63, 0x63, 0x53, 0xc7,
- 0x21, 0x6f, 0x66, 0x46, 0x8d, 0x75, 0x3f, 0x86, 0xa8, 0xee, 0x38, 0x99, 0xb1, 0x54, 0x0c, 0xef,
- 0xa3, 0xb9, 0x14, 0x23, 0x3d, 0x49, 0xde, 0x4a, 0xd2, 0x3f, 0x66, 0x92, 0x32, 0xb3, 0x82, 0x95,
- 0x69, 0x26, 0x9c, 0x1d, 0xab, 0x05, 0x8c, 0xbc, 0xbb, 0x74, 0xac, 0x6d, 0x60, 0x43, 0x63, 0x6d,
- 0x03, 0xc3, 0x2d, 0xf4, 0x57, 0x8a, 0x69, 0xb6, 0xf9, 0x29, 0xb1, 0x43, 0x1a, 0xc7, 0x4f, 0x82,
- 0xc8, 0x21, 0xef, 0x25, 0xf2, 0x9a, 0x19, 0xb9, 0x29, 0xd4, 0x07, 0x4a, 0x9c, 0xd0, 0xff, 0xa0,
- 0xc6, 0x34, 0x7e, 0x80, 0x16, 0xfa, 0xe6, 0xe5, 0xf6, 0xb6, 0xa3, 0xc0, 0x03, 0x72, 0x2e, 0x7b,
- 0xfc, 0x37, 0x62, 0x6c, 0x71, 0x34, 0x82, 0x74, 0xab, 0x7f, 0xa7, 0x83, 0x19, 0xfc, 0x10, 0x2d,
- 0xa6, 0x64, 0x79, 0x52, 0x24, 0xfa, 0x83, 0x44, 0xff, 0x6f, 0x46, 0xab, 0x23, 0xd3, 0xc7, 0xc6,
- 0x74, 0x28, 0x85, 0x77, 0x50, 0x39, 0x85, 0x7b, 0x6e, 0xcc, 0xc8, 0x47, 0x49, 0x5d, 0x31, 0x53,
- 0xf7, 0xdc, 0x98, 0x65, 0x7c, 0x94, 0x04, 0x35, 0x89, 0x8f, 0x26, 0x49, 0x9f, 0x46, 0x92, 0x78,
- 0xeb, 0x21, 0x52, 0x12, 0xd4, 0x5b, 0x2f, 0x48, 0xdc, 0x91, 0xcf, 0x0b, 0xa3, 0xb6, 0x9e, 0xd7,
- 0x0c, 0x3a, 0x52, 0xc5, 0xb4, 0x23, 0x05, 0x46, 0x39, 0xf2, 0x45, 0x61, 0x94, 0x23, 0x79, 0x95,
- 0xc1, 0x91, 0x69, 0x38, 0x3b, 0x16, 0x77, 0xe4, 0xcb, 0x4b, 0xc7, 0x1a, 0x74, 0xa4, 0x8a, 0xe1,
- 0x47, 0xa8, 0xd2, 0x87, 0x11, 0x46, 0x09, 0x21, 0xea, 0xb8, 0x71, 0xcc, 0xbf, 0xc3, 0xaf, 0x24,
- 0xf3, 0xfa, 0x08, 0x26, 0x97, 0x1f, 0x68, 0x75, 0xc2, 0xff, 0x93, 0x9a, 0xf3, 0xb8, 0x83, 0x96,
- 0xd2, 0x5e, 0xca, 0x3a, 0x7d, 0xcd, 0x5e, 0xcb, 0x66, 0x37, 0xcc, 0xcd, 0xa4, 0x4b, 0x86, 0xbb,
- 0x11, 0x3a, 0x42, 0x50, 0xfb, 0x0d, 0xcd, 0x6e, 0x75, 0x42, 0xf6, 0xd4, 0x82, 0x38, 0x0c, 0xfc,
- 0x18, 0x6a, 0x21, 0x5a, 0xba, 0xe4, 0x43, 0x84, 0x31, 0x9a, 0x10, 0x17, 0x77, 0x4e, 0x5c, 0xdc,
- 0xe2, 0x99, 0x5f, 0xe8, 0xfa, 0x7c, 0xaa, 0x0b, 0x3d, 0x79, 0xc7, 0x2b, 0xa8, 0x14, 0xbb, 0x9d,
- 0xd0, 0x03, 0x9b, 0x05, 0x27, 0xe0, 0x8b, 0x8b, 0xb8, 0x60, 0x15, 0x65, 0xec, 0x90, 0x87, 0xee,
- 0x2d, 0x9c, 0x7d, 0xa9, 0x8e, 0x9d, 0x5d, 0x54, 0x73, 0xe7, 0x17, 0xd5, 0xdc, 0xe7, 0x8b, 0x6a,
- 0xee, 0xd9, 0xd7, 0xea, 0xd8, 0xd1, 0x94, 0xf8, 0x37, 0xb1, 0xf1, 0x2b, 0x00, 0x00, 0xff, 0xff,
- 0x54, 0x8c, 0x4a, 0x7f, 0xa5, 0x08, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto
deleted file mode 100644
index 3ad0d1b37..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto
+++ /dev/null
@@ -1,72 +0,0 @@
-syntax = "proto3";
-package etcdserverpb;
-
-import "gogoproto/gogo.proto";
-import "etcdserver.proto";
-import "rpc.proto";
-
-option (gogoproto.marshaler_all) = true;
-option (gogoproto.sizer_all) = true;
-option (gogoproto.unmarshaler_all) = true;
-option (gogoproto.goproto_getters_all) = false;
-
-message RequestHeader {
- uint64 ID = 1;
- // username is a username that is associated with an auth token of gRPC connection
- string username = 2;
-}
-
-// An InternalRaftRequest is the union of all requests which can be
-// sent via raft.
-message InternalRaftRequest {
- RequestHeader header = 100;
- uint64 ID = 1;
-
- Request v2 = 2;
-
- RangeRequest range = 3;
- PutRequest put = 4;
- DeleteRangeRequest delete_range = 5;
- TxnRequest txn = 6;
- CompactionRequest compaction = 7;
-
- LeaseGrantRequest lease_grant = 8;
- LeaseRevokeRequest lease_revoke = 9;
-
- AlarmRequest alarm = 10;
-
- AuthEnableRequest auth_enable = 1000;
- AuthDisableRequest auth_disable = 1011;
-
- InternalAuthenticateRequest authenticate = 1012;
-
- AuthUserAddRequest auth_user_add = 1100;
- AuthUserDeleteRequest auth_user_delete = 1101;
- AuthUserGetRequest auth_user_get = 1102;
- AuthUserChangePasswordRequest auth_user_change_password = 1103;
- AuthUserGrantRoleRequest auth_user_grant_role = 1104;
- AuthUserRevokeRoleRequest auth_user_revoke_role = 1105;
- AuthUserListRequest auth_user_list = 1106;
- AuthRoleListRequest auth_role_list = 1107;
-
- AuthRoleAddRequest auth_role_add = 1200;
- AuthRoleDeleteRequest auth_role_delete = 1201;
- AuthRoleGetRequest auth_role_get = 1202;
- AuthRoleGrantPermissionRequest auth_role_grant_permission = 1203;
- AuthRoleRevokePermissionRequest auth_role_revoke_permission = 1204;
-}
-
-message EmptyResponse {
-}
-
-// What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest?
-// InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing.
-// For avoiding misusage the field, we have an internal version of AuthenticateRequest.
-message InternalAuthenticateRequest {
- string name = 1;
- string password = 2;
-
- // simple_token is generated in API layer (etcdserver/v3_server.go)
- string simple_token = 3;
-}
-
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go
deleted file mode 100644
index 1bc62c2eb..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go
+++ /dev/null
@@ -1,15551 +0,0 @@
-// Code generated by protoc-gen-gogo.
-// source: rpc.proto
-// DO NOT EDIT!
-
-package etcdserverpb
-
-import (
- "fmt"
-
- proto "github.com/golang/protobuf/proto"
-
- math "math"
-
- mvccpb "github.com/coreos/etcd/mvcc/mvccpb"
-
- authpb "github.com/coreos/etcd/auth/authpb"
-
- context "golang.org/x/net/context"
-
- grpc "google.golang.org/grpc"
-
- io "io"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-type AlarmType int32
-
-const (
- AlarmType_NONE AlarmType = 0
- AlarmType_NOSPACE AlarmType = 1
-)
-
-var AlarmType_name = map[int32]string{
- 0: "NONE",
- 1: "NOSPACE",
-}
-var AlarmType_value = map[string]int32{
- "NONE": 0,
- "NOSPACE": 1,
-}
-
-func (x AlarmType) String() string {
- return proto.EnumName(AlarmType_name, int32(x))
-}
-func (AlarmType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{0} }
-
-type RangeRequest_SortOrder int32
-
-const (
- RangeRequest_NONE RangeRequest_SortOrder = 0
- RangeRequest_ASCEND RangeRequest_SortOrder = 1
- RangeRequest_DESCEND RangeRequest_SortOrder = 2
-)
-
-var RangeRequest_SortOrder_name = map[int32]string{
- 0: "NONE",
- 1: "ASCEND",
- 2: "DESCEND",
-}
-var RangeRequest_SortOrder_value = map[string]int32{
- "NONE": 0,
- "ASCEND": 1,
- "DESCEND": 2,
-}
-
-func (x RangeRequest_SortOrder) String() string {
- return proto.EnumName(RangeRequest_SortOrder_name, int32(x))
-}
-func (RangeRequest_SortOrder) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1, 0} }
-
-type RangeRequest_SortTarget int32
-
-const (
- RangeRequest_KEY RangeRequest_SortTarget = 0
- RangeRequest_VERSION RangeRequest_SortTarget = 1
- RangeRequest_CREATE RangeRequest_SortTarget = 2
- RangeRequest_MOD RangeRequest_SortTarget = 3
- RangeRequest_VALUE RangeRequest_SortTarget = 4
-)
-
-var RangeRequest_SortTarget_name = map[int32]string{
- 0: "KEY",
- 1: "VERSION",
- 2: "CREATE",
- 3: "MOD",
- 4: "VALUE",
-}
-var RangeRequest_SortTarget_value = map[string]int32{
- "KEY": 0,
- "VERSION": 1,
- "CREATE": 2,
- "MOD": 3,
- "VALUE": 4,
-}
-
-func (x RangeRequest_SortTarget) String() string {
- return proto.EnumName(RangeRequest_SortTarget_name, int32(x))
-}
-func (RangeRequest_SortTarget) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1, 1} }
-
-type Compare_CompareResult int32
-
-const (
- Compare_EQUAL Compare_CompareResult = 0
- Compare_GREATER Compare_CompareResult = 1
- Compare_LESS Compare_CompareResult = 2
-)
-
-var Compare_CompareResult_name = map[int32]string{
- 0: "EQUAL",
- 1: "GREATER",
- 2: "LESS",
-}
-var Compare_CompareResult_value = map[string]int32{
- "EQUAL": 0,
- "GREATER": 1,
- "LESS": 2,
-}
-
-func (x Compare_CompareResult) String() string {
- return proto.EnumName(Compare_CompareResult_name, int32(x))
-}
-func (Compare_CompareResult) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9, 0} }
-
-type Compare_CompareTarget int32
-
-const (
- Compare_VERSION Compare_CompareTarget = 0
- Compare_CREATE Compare_CompareTarget = 1
- Compare_MOD Compare_CompareTarget = 2
- Compare_VALUE Compare_CompareTarget = 3
-)
-
-var Compare_CompareTarget_name = map[int32]string{
- 0: "VERSION",
- 1: "CREATE",
- 2: "MOD",
- 3: "VALUE",
-}
-var Compare_CompareTarget_value = map[string]int32{
- "VERSION": 0,
- "CREATE": 1,
- "MOD": 2,
- "VALUE": 3,
-}
-
-func (x Compare_CompareTarget) String() string {
- return proto.EnumName(Compare_CompareTarget_name, int32(x))
-}
-func (Compare_CompareTarget) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9, 1} }
-
-type AlarmRequest_AlarmAction int32
-
-const (
- AlarmRequest_GET AlarmRequest_AlarmAction = 0
- AlarmRequest_ACTIVATE AlarmRequest_AlarmAction = 1
- AlarmRequest_DEACTIVATE AlarmRequest_AlarmAction = 2
-)
-
-var AlarmRequest_AlarmAction_name = map[int32]string{
- 0: "GET",
- 1: "ACTIVATE",
- 2: "DEACTIVATE",
-}
-var AlarmRequest_AlarmAction_value = map[string]int32{
- "GET": 0,
- "ACTIVATE": 1,
- "DEACTIVATE": 2,
-}
-
-func (x AlarmRequest_AlarmAction) String() string {
- return proto.EnumName(AlarmRequest_AlarmAction_name, int32(x))
-}
-func (AlarmRequest_AlarmAction) EnumDescriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{39, 0}
-}
-
-type ResponseHeader struct {
- // cluster_id is the ID of the cluster which sent the response.
- ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"`
- // member_id is the ID of the member which sent the response.
- MemberId uint64 `protobuf:"varint,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"`
- // revision is the key-value store revision when the request was applied.
- Revision int64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"`
- // raft_term is the raft term when the request was applied.
- RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"`
-}
-
-func (m *ResponseHeader) Reset() { *m = ResponseHeader{} }
-func (m *ResponseHeader) String() string { return proto.CompactTextString(m) }
-func (*ResponseHeader) ProtoMessage() {}
-func (*ResponseHeader) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{0} }
-
-type RangeRequest struct {
- // key is the first key for the range. If range_end is not given, the request only looks up key.
- Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
- // range_end is the upper bound on the requested range [key, range_end).
- // If range_end is '\0', the range is all keys >= key.
- // If the range_end is one bit larger than the given key,
- // then the range requests get the all keys with the prefix (the given key).
- // If both key and range_end are '\0', then range requests returns all keys.
- RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
- // limit is a limit on the number of keys returned for the request.
- Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
- // revision is the point-in-time of the key-value store to use for the range.
- // If revision is less or equal to zero, the range is over the newest key-value store.
- // If the revision has been compacted, ErrCompacted is returned as a response.
- Revision int64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"`
- // sort_order is the order for returned sorted results.
- SortOrder RangeRequest_SortOrder `protobuf:"varint,5,opt,name=sort_order,json=sortOrder,proto3,enum=etcdserverpb.RangeRequest_SortOrder" json:"sort_order,omitempty"`
- // sort_target is the key-value field to use for sorting.
- SortTarget RangeRequest_SortTarget `protobuf:"varint,6,opt,name=sort_target,json=sortTarget,proto3,enum=etcdserverpb.RangeRequest_SortTarget" json:"sort_target,omitempty"`
- // serializable sets the range request to use serializable member-local reads.
- // Range requests are linearizable by default; linearizable requests have higher
- // latency and lower throughput than serializable requests but reflect the current
- // consensus of the cluster. For better performance, in exchange for possible stale reads,
- // a serializable range request is served locally without needing to reach consensus
- // with other nodes in the cluster.
- Serializable bool `protobuf:"varint,7,opt,name=serializable,proto3" json:"serializable,omitempty"`
- // keys_only when set returns only the keys and not the values.
- KeysOnly bool `protobuf:"varint,8,opt,name=keys_only,json=keysOnly,proto3" json:"keys_only,omitempty"`
- // count_only when set returns only the count of the keys in the range.
- CountOnly bool `protobuf:"varint,9,opt,name=count_only,json=countOnly,proto3" json:"count_only,omitempty"`
-}
-
-func (m *RangeRequest) Reset() { *m = RangeRequest{} }
-func (m *RangeRequest) String() string { return proto.CompactTextString(m) }
-func (*RangeRequest) ProtoMessage() {}
-func (*RangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1} }
-
-type RangeResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // kvs is the list of key-value pairs matched by the range request.
- // kvs is empty when count is requested.
- Kvs []*mvccpb.KeyValue `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"`
- // more indicates if there are more keys to return in the requested range.
- More bool `protobuf:"varint,3,opt,name=more,proto3" json:"more,omitempty"`
- // count is set to the number of keys within the range when requested.
- Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
-}
-
-func (m *RangeResponse) Reset() { *m = RangeResponse{} }
-func (m *RangeResponse) String() string { return proto.CompactTextString(m) }
-func (*RangeResponse) ProtoMessage() {}
-func (*RangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{2} }
-
-func (m *RangeResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *RangeResponse) GetKvs() []*mvccpb.KeyValue {
- if m != nil {
- return m.Kvs
- }
- return nil
-}
-
-type PutRequest struct {
- // key is the key, in bytes, to put into the key-value store.
- Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
- // value is the value, in bytes, to associate with the key in the key-value store.
- Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
- // lease is the lease ID to associate with the key in the key-value store. A lease
- // value of 0 indicates no lease.
- Lease int64 `protobuf:"varint,3,opt,name=lease,proto3" json:"lease,omitempty"`
- // If prev_kv is set, etcd gets the previous key-value pair before changing it.
- // The previous key-value pair will be returned in the put response.
- PrevKv bool `protobuf:"varint,4,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"`
-}
-
-func (m *PutRequest) Reset() { *m = PutRequest{} }
-func (m *PutRequest) String() string { return proto.CompactTextString(m) }
-func (*PutRequest) ProtoMessage() {}
-func (*PutRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{3} }
-
-type PutResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // if prev_kv is set in the request, the previous key-value pair will be returned.
- PrevKv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv" json:"prev_kv,omitempty"`
-}
-
-func (m *PutResponse) Reset() { *m = PutResponse{} }
-func (m *PutResponse) String() string { return proto.CompactTextString(m) }
-func (*PutResponse) ProtoMessage() {}
-func (*PutResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{4} }
-
-func (m *PutResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *PutResponse) GetPrevKv() *mvccpb.KeyValue {
- if m != nil {
- return m.PrevKv
- }
- return nil
-}
-
-type DeleteRangeRequest struct {
- // key is the first key to delete in the range.
- Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
- // range_end is the key following the last key to delete for the range [key, range_end).
- // If range_end is not given, the range is defined to contain only the key argument.
- // If range_end is '\0', the range is all keys greater than or equal to the key argument.
- RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
- // If prev_kv is set, etcd gets the previous key-value pairs before deleting it.
- // The previous key-value pairs will be returned in the delte response.
- PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"`
-}
-
-func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} }
-func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) }
-func (*DeleteRangeRequest) ProtoMessage() {}
-func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{5} }
-
-type DeleteRangeResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // deleted is the number of keys deleted by the delete range request.
- Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"`
- // if prev_kv is set in the request, the previous key-value pairs will be returned.
- PrevKvs []*mvccpb.KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs" json:"prev_kvs,omitempty"`
-}
-
-func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} }
-func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) }
-func (*DeleteRangeResponse) ProtoMessage() {}
-func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{6} }
-
-func (m *DeleteRangeResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *DeleteRangeResponse) GetPrevKvs() []*mvccpb.KeyValue {
- if m != nil {
- return m.PrevKvs
- }
- return nil
-}
-
-type RequestOp struct {
- // request is a union of request types accepted by a transaction.
- //
- // Types that are valid to be assigned to Request:
- // *RequestOp_RequestRange
- // *RequestOp_RequestPut
- // *RequestOp_RequestDeleteRange
- Request isRequestOp_Request `protobuf_oneof:"request"`
-}
-
-func (m *RequestOp) Reset() { *m = RequestOp{} }
-func (m *RequestOp) String() string { return proto.CompactTextString(m) }
-func (*RequestOp) ProtoMessage() {}
-func (*RequestOp) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{7} }
-
-type isRequestOp_Request interface {
- isRequestOp_Request()
- MarshalTo([]byte) (int, error)
- Size() int
-}
-
-type RequestOp_RequestRange struct {
- RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range,json=requestRange,oneof"`
-}
-type RequestOp_RequestPut struct {
- RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put,json=requestPut,oneof"`
-}
-type RequestOp_RequestDeleteRange struct {
- RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range,json=requestDeleteRange,oneof"`
-}
-
-func (*RequestOp_RequestRange) isRequestOp_Request() {}
-func (*RequestOp_RequestPut) isRequestOp_Request() {}
-func (*RequestOp_RequestDeleteRange) isRequestOp_Request() {}
-
-func (m *RequestOp) GetRequest() isRequestOp_Request {
- if m != nil {
- return m.Request
- }
- return nil
-}
-
-func (m *RequestOp) GetRequestRange() *RangeRequest {
- if x, ok := m.GetRequest().(*RequestOp_RequestRange); ok {
- return x.RequestRange
- }
- return nil
-}
-
-func (m *RequestOp) GetRequestPut() *PutRequest {
- if x, ok := m.GetRequest().(*RequestOp_RequestPut); ok {
- return x.RequestPut
- }
- return nil
-}
-
-func (m *RequestOp) GetRequestDeleteRange() *DeleteRangeRequest {
- if x, ok := m.GetRequest().(*RequestOp_RequestDeleteRange); ok {
- return x.RequestDeleteRange
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*RequestOp) 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 _RequestOp_OneofMarshaler, _RequestOp_OneofUnmarshaler, _RequestOp_OneofSizer, []interface{}{
- (*RequestOp_RequestRange)(nil),
- (*RequestOp_RequestPut)(nil),
- (*RequestOp_RequestDeleteRange)(nil),
- }
-}
-
-func _RequestOp_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*RequestOp)
- // request
- switch x := m.Request.(type) {
- case *RequestOp_RequestRange:
- _ = b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.RequestRange); err != nil {
- return err
- }
- case *RequestOp_RequestPut:
- _ = b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.RequestPut); err != nil {
- return err
- }
- case *RequestOp_RequestDeleteRange:
- _ = b.EncodeVarint(3<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.RequestDeleteRange); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("RequestOp.Request has unexpected type %T", x)
- }
- return nil
-}
-
-func _RequestOp_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*RequestOp)
- switch tag {
- case 1: // request.request_range
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(RangeRequest)
- err := b.DecodeMessage(msg)
- m.Request = &RequestOp_RequestRange{msg}
- return true, err
- case 2: // request.request_put
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(PutRequest)
- err := b.DecodeMessage(msg)
- m.Request = &RequestOp_RequestPut{msg}
- return true, err
- case 3: // request.request_delete_range
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(DeleteRangeRequest)
- err := b.DecodeMessage(msg)
- m.Request = &RequestOp_RequestDeleteRange{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _RequestOp_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*RequestOp)
- // request
- switch x := m.Request.(type) {
- case *RequestOp_RequestRange:
- s := proto.Size(x.RequestRange)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *RequestOp_RequestPut:
- s := proto.Size(x.RequestPut)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *RequestOp_RequestDeleteRange:
- s := proto.Size(x.RequestDeleteRange)
- n += proto.SizeVarint(3<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type ResponseOp struct {
- // response is a union of response types returned by a transaction.
- //
- // Types that are valid to be assigned to Response:
- // *ResponseOp_ResponseRange
- // *ResponseOp_ResponsePut
- // *ResponseOp_ResponseDeleteRange
- Response isResponseOp_Response `protobuf_oneof:"response"`
-}
-
-func (m *ResponseOp) Reset() { *m = ResponseOp{} }
-func (m *ResponseOp) String() string { return proto.CompactTextString(m) }
-func (*ResponseOp) ProtoMessage() {}
-func (*ResponseOp) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{8} }
-
-type isResponseOp_Response interface {
- isResponseOp_Response()
- MarshalTo([]byte) (int, error)
- Size() int
-}
-
-type ResponseOp_ResponseRange struct {
- ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range,json=responseRange,oneof"`
-}
-type ResponseOp_ResponsePut struct {
- ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put,json=responsePut,oneof"`
-}
-type ResponseOp_ResponseDeleteRange struct {
- ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range,json=responseDeleteRange,oneof"`
-}
-
-func (*ResponseOp_ResponseRange) isResponseOp_Response() {}
-func (*ResponseOp_ResponsePut) isResponseOp_Response() {}
-func (*ResponseOp_ResponseDeleteRange) isResponseOp_Response() {}
-
-func (m *ResponseOp) GetResponse() isResponseOp_Response {
- if m != nil {
- return m.Response
- }
- return nil
-}
-
-func (m *ResponseOp) GetResponseRange() *RangeResponse {
- if x, ok := m.GetResponse().(*ResponseOp_ResponseRange); ok {
- return x.ResponseRange
- }
- return nil
-}
-
-func (m *ResponseOp) GetResponsePut() *PutResponse {
- if x, ok := m.GetResponse().(*ResponseOp_ResponsePut); ok {
- return x.ResponsePut
- }
- return nil
-}
-
-func (m *ResponseOp) GetResponseDeleteRange() *DeleteRangeResponse {
- if x, ok := m.GetResponse().(*ResponseOp_ResponseDeleteRange); ok {
- return x.ResponseDeleteRange
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*ResponseOp) 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 _ResponseOp_OneofMarshaler, _ResponseOp_OneofUnmarshaler, _ResponseOp_OneofSizer, []interface{}{
- (*ResponseOp_ResponseRange)(nil),
- (*ResponseOp_ResponsePut)(nil),
- (*ResponseOp_ResponseDeleteRange)(nil),
- }
-}
-
-func _ResponseOp_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*ResponseOp)
- // response
- switch x := m.Response.(type) {
- case *ResponseOp_ResponseRange:
- _ = b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.ResponseRange); err != nil {
- return err
- }
- case *ResponseOp_ResponsePut:
- _ = b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.ResponsePut); err != nil {
- return err
- }
- case *ResponseOp_ResponseDeleteRange:
- _ = b.EncodeVarint(3<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.ResponseDeleteRange); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("ResponseOp.Response has unexpected type %T", x)
- }
- return nil
-}
-
-func _ResponseOp_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*ResponseOp)
- switch tag {
- case 1: // response.response_range
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(RangeResponse)
- err := b.DecodeMessage(msg)
- m.Response = &ResponseOp_ResponseRange{msg}
- return true, err
- case 2: // response.response_put
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(PutResponse)
- err := b.DecodeMessage(msg)
- m.Response = &ResponseOp_ResponsePut{msg}
- return true, err
- case 3: // response.response_delete_range
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(DeleteRangeResponse)
- err := b.DecodeMessage(msg)
- m.Response = &ResponseOp_ResponseDeleteRange{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _ResponseOp_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*ResponseOp)
- // response
- switch x := m.Response.(type) {
- case *ResponseOp_ResponseRange:
- s := proto.Size(x.ResponseRange)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *ResponseOp_ResponsePut:
- s := proto.Size(x.ResponsePut)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *ResponseOp_ResponseDeleteRange:
- s := proto.Size(x.ResponseDeleteRange)
- n += proto.SizeVarint(3<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type Compare struct {
- // result is logical comparison operation for this comparison.
- Result Compare_CompareResult `protobuf:"varint,1,opt,name=result,proto3,enum=etcdserverpb.Compare_CompareResult" json:"result,omitempty"`
- // target is the key-value field to inspect for the comparison.
- Target Compare_CompareTarget `protobuf:"varint,2,opt,name=target,proto3,enum=etcdserverpb.Compare_CompareTarget" json:"target,omitempty"`
- // key is the subject key for the comparison operation.
- Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
- // Types that are valid to be assigned to TargetUnion:
- // *Compare_Version
- // *Compare_CreateRevision
- // *Compare_ModRevision
- // *Compare_Value
- TargetUnion isCompare_TargetUnion `protobuf_oneof:"target_union"`
-}
-
-func (m *Compare) Reset() { *m = Compare{} }
-func (m *Compare) String() string { return proto.CompactTextString(m) }
-func (*Compare) ProtoMessage() {}
-func (*Compare) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9} }
-
-type isCompare_TargetUnion interface {
- isCompare_TargetUnion()
- MarshalTo([]byte) (int, error)
- Size() int
-}
-
-type Compare_Version struct {
- Version int64 `protobuf:"varint,4,opt,name=version,proto3,oneof"`
-}
-type Compare_CreateRevision struct {
- CreateRevision int64 `protobuf:"varint,5,opt,name=create_revision,json=createRevision,proto3,oneof"`
-}
-type Compare_ModRevision struct {
- ModRevision int64 `protobuf:"varint,6,opt,name=mod_revision,json=modRevision,proto3,oneof"`
-}
-type Compare_Value struct {
- Value []byte `protobuf:"bytes,7,opt,name=value,proto3,oneof"`
-}
-
-func (*Compare_Version) isCompare_TargetUnion() {}
-func (*Compare_CreateRevision) isCompare_TargetUnion() {}
-func (*Compare_ModRevision) isCompare_TargetUnion() {}
-func (*Compare_Value) isCompare_TargetUnion() {}
-
-func (m *Compare) GetTargetUnion() isCompare_TargetUnion {
- if m != nil {
- return m.TargetUnion
- }
- return nil
-}
-
-func (m *Compare) GetVersion() int64 {
- if x, ok := m.GetTargetUnion().(*Compare_Version); ok {
- return x.Version
- }
- return 0
-}
-
-func (m *Compare) GetCreateRevision() int64 {
- if x, ok := m.GetTargetUnion().(*Compare_CreateRevision); ok {
- return x.CreateRevision
- }
- return 0
-}
-
-func (m *Compare) GetModRevision() int64 {
- if x, ok := m.GetTargetUnion().(*Compare_ModRevision); ok {
- return x.ModRevision
- }
- return 0
-}
-
-func (m *Compare) GetValue() []byte {
- if x, ok := m.GetTargetUnion().(*Compare_Value); ok {
- return x.Value
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*Compare) 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 _Compare_OneofMarshaler, _Compare_OneofUnmarshaler, _Compare_OneofSizer, []interface{}{
- (*Compare_Version)(nil),
- (*Compare_CreateRevision)(nil),
- (*Compare_ModRevision)(nil),
- (*Compare_Value)(nil),
- }
-}
-
-func _Compare_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*Compare)
- // target_union
- switch x := m.TargetUnion.(type) {
- case *Compare_Version:
- _ = b.EncodeVarint(4<<3 | proto.WireVarint)
- _ = b.EncodeVarint(uint64(x.Version))
- case *Compare_CreateRevision:
- _ = b.EncodeVarint(5<<3 | proto.WireVarint)
- _ = b.EncodeVarint(uint64(x.CreateRevision))
- case *Compare_ModRevision:
- _ = b.EncodeVarint(6<<3 | proto.WireVarint)
- _ = b.EncodeVarint(uint64(x.ModRevision))
- case *Compare_Value:
- _ = b.EncodeVarint(7<<3 | proto.WireBytes)
- _ = b.EncodeRawBytes(x.Value)
- case nil:
- default:
- return fmt.Errorf("Compare.TargetUnion has unexpected type %T", x)
- }
- return nil
-}
-
-func _Compare_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*Compare)
- switch tag {
- case 4: // target_union.version
- if wire != proto.WireVarint {
- return true, proto.ErrInternalBadWireType
- }
- x, err := b.DecodeVarint()
- m.TargetUnion = &Compare_Version{int64(x)}
- return true, err
- case 5: // target_union.create_revision
- if wire != proto.WireVarint {
- return true, proto.ErrInternalBadWireType
- }
- x, err := b.DecodeVarint()
- m.TargetUnion = &Compare_CreateRevision{int64(x)}
- return true, err
- case 6: // target_union.mod_revision
- if wire != proto.WireVarint {
- return true, proto.ErrInternalBadWireType
- }
- x, err := b.DecodeVarint()
- m.TargetUnion = &Compare_ModRevision{int64(x)}
- return true, err
- case 7: // target_union.value
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- x, err := b.DecodeRawBytes(true)
- m.TargetUnion = &Compare_Value{x}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _Compare_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*Compare)
- // target_union
- switch x := m.TargetUnion.(type) {
- case *Compare_Version:
- n += proto.SizeVarint(4<<3 | proto.WireVarint)
- n += proto.SizeVarint(uint64(x.Version))
- case *Compare_CreateRevision:
- n += proto.SizeVarint(5<<3 | proto.WireVarint)
- n += proto.SizeVarint(uint64(x.CreateRevision))
- case *Compare_ModRevision:
- n += proto.SizeVarint(6<<3 | proto.WireVarint)
- n += proto.SizeVarint(uint64(x.ModRevision))
- case *Compare_Value:
- n += proto.SizeVarint(7<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(len(x.Value)))
- n += len(x.Value)
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-// From google paxosdb paper:
-// Our implementation hinges around a powerful primitive which we call MultiOp. All other database
-// operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
-// and consists of three components:
-// 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
-// for the absence or presence of a value, or compare with a given value. Two different tests in the guard
-// may apply to the same or different entries in the database. All tests in the guard are applied and
-// MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
-// it executes f op (see item 3 below).
-// 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
-// lookup operation, and applies to a single database entry. Two different operations in the list may apply
-// to the same or different entries in the database. These operations are executed
-// if guard evaluates to
-// true.
-// 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
-type TxnRequest struct {
- // compare is a list of predicates representing a conjunction of terms.
- // If the comparisons succeed, then the success requests will be processed in order,
- // and the response will contain their respective responses in order.
- // If the comparisons fail, then the failure requests will be processed in order,
- // and the response will contain their respective responses in order.
- Compare []*Compare `protobuf:"bytes,1,rep,name=compare" json:"compare,omitempty"`
- // success is a list of requests which will be applied when compare evaluates to true.
- Success []*RequestOp `protobuf:"bytes,2,rep,name=success" json:"success,omitempty"`
- // failure is a list of requests which will be applied when compare evaluates to false.
- Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure" json:"failure,omitempty"`
-}
-
-func (m *TxnRequest) Reset() { *m = TxnRequest{} }
-func (m *TxnRequest) String() string { return proto.CompactTextString(m) }
-func (*TxnRequest) ProtoMessage() {}
-func (*TxnRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{10} }
-
-func (m *TxnRequest) GetCompare() []*Compare {
- if m != nil {
- return m.Compare
- }
- return nil
-}
-
-func (m *TxnRequest) GetSuccess() []*RequestOp {
- if m != nil {
- return m.Success
- }
- return nil
-}
-
-func (m *TxnRequest) GetFailure() []*RequestOp {
- if m != nil {
- return m.Failure
- }
- return nil
-}
-
-type TxnResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // succeeded is set to true if the compare evaluated to true or false otherwise.
- Succeeded bool `protobuf:"varint,2,opt,name=succeeded,proto3" json:"succeeded,omitempty"`
- // responses is a list of responses corresponding to the results from applying
- // success if succeeded is true or failure if succeeded is false.
- Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses" json:"responses,omitempty"`
-}
-
-func (m *TxnResponse) Reset() { *m = TxnResponse{} }
-func (m *TxnResponse) String() string { return proto.CompactTextString(m) }
-func (*TxnResponse) ProtoMessage() {}
-func (*TxnResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{11} }
-
-func (m *TxnResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *TxnResponse) GetResponses() []*ResponseOp {
- if m != nil {
- return m.Responses
- }
- return nil
-}
-
-// CompactionRequest compacts the key-value store up to a given revision. All superseded keys
-// with a revision less than the compaction revision will be removed.
-type CompactionRequest struct {
- // revision is the key-value store revision for the compaction operation.
- Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
- // physical is set so the RPC will wait until the compaction is physically
- // applied to the local database such that compacted entries are totally
- // removed from the backend database.
- Physical bool `protobuf:"varint,2,opt,name=physical,proto3" json:"physical,omitempty"`
-}
-
-func (m *CompactionRequest) Reset() { *m = CompactionRequest{} }
-func (m *CompactionRequest) String() string { return proto.CompactTextString(m) }
-func (*CompactionRequest) ProtoMessage() {}
-func (*CompactionRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{12} }
-
-type CompactionResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *CompactionResponse) Reset() { *m = CompactionResponse{} }
-func (m *CompactionResponse) String() string { return proto.CompactTextString(m) }
-func (*CompactionResponse) ProtoMessage() {}
-func (*CompactionResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{13} }
-
-func (m *CompactionResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type HashRequest struct {
-}
-
-func (m *HashRequest) Reset() { *m = HashRequest{} }
-func (m *HashRequest) String() string { return proto.CompactTextString(m) }
-func (*HashRequest) ProtoMessage() {}
-func (*HashRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{14} }
-
-type HashResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // hash is the hash value computed from the responding member's key-value store.
- Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"`
-}
-
-func (m *HashResponse) Reset() { *m = HashResponse{} }
-func (m *HashResponse) String() string { return proto.CompactTextString(m) }
-func (*HashResponse) ProtoMessage() {}
-func (*HashResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{15} }
-
-func (m *HashResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type SnapshotRequest struct {
-}
-
-func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} }
-func (m *SnapshotRequest) String() string { return proto.CompactTextString(m) }
-func (*SnapshotRequest) ProtoMessage() {}
-func (*SnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{16} }
-
-type SnapshotResponse struct {
- // header has the current key-value store information. The first header in the snapshot
- // stream indicates the point in time of the snapshot.
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // remaining_bytes is the number of blob bytes to be sent after this message
- RemainingBytes uint64 `protobuf:"varint,2,opt,name=remaining_bytes,json=remainingBytes,proto3" json:"remaining_bytes,omitempty"`
- // blob contains the next chunk of the snapshot in the snapshot stream.
- Blob []byte `protobuf:"bytes,3,opt,name=blob,proto3" json:"blob,omitempty"`
-}
-
-func (m *SnapshotResponse) Reset() { *m = SnapshotResponse{} }
-func (m *SnapshotResponse) String() string { return proto.CompactTextString(m) }
-func (*SnapshotResponse) ProtoMessage() {}
-func (*SnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{17} }
-
-func (m *SnapshotResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type WatchRequest struct {
- // request_union is a request to either create a new watcher or cancel an existing watcher.
- //
- // Types that are valid to be assigned to RequestUnion:
- // *WatchRequest_CreateRequest
- // *WatchRequest_CancelRequest
- RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"`
-}
-
-func (m *WatchRequest) Reset() { *m = WatchRequest{} }
-func (m *WatchRequest) String() string { return proto.CompactTextString(m) }
-func (*WatchRequest) ProtoMessage() {}
-func (*WatchRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{18} }
-
-type isWatchRequest_RequestUnion interface {
- isWatchRequest_RequestUnion()
- MarshalTo([]byte) (int, error)
- Size() int
-}
-
-type WatchRequest_CreateRequest struct {
- CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,oneof"`
-}
-type WatchRequest_CancelRequest struct {
- CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,oneof"`
-}
-
-func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {}
-func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {}
-
-func (m *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion {
- if m != nil {
- return m.RequestUnion
- }
- return nil
-}
-
-func (m *WatchRequest) GetCreateRequest() *WatchCreateRequest {
- if x, ok := m.GetRequestUnion().(*WatchRequest_CreateRequest); ok {
- return x.CreateRequest
- }
- return nil
-}
-
-func (m *WatchRequest) GetCancelRequest() *WatchCancelRequest {
- if x, ok := m.GetRequestUnion().(*WatchRequest_CancelRequest); ok {
- return x.CancelRequest
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*WatchRequest) 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 _WatchRequest_OneofMarshaler, _WatchRequest_OneofUnmarshaler, _WatchRequest_OneofSizer, []interface{}{
- (*WatchRequest_CreateRequest)(nil),
- (*WatchRequest_CancelRequest)(nil),
- }
-}
-
-func _WatchRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*WatchRequest)
- // request_union
- switch x := m.RequestUnion.(type) {
- case *WatchRequest_CreateRequest:
- _ = b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.CreateRequest); err != nil {
- return err
- }
- case *WatchRequest_CancelRequest:
- _ = b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.CancelRequest); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("WatchRequest.RequestUnion has unexpected type %T", x)
- }
- return nil
-}
-
-func _WatchRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*WatchRequest)
- switch tag {
- case 1: // request_union.create_request
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(WatchCreateRequest)
- err := b.DecodeMessage(msg)
- m.RequestUnion = &WatchRequest_CreateRequest{msg}
- return true, err
- case 2: // request_union.cancel_request
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(WatchCancelRequest)
- err := b.DecodeMessage(msg)
- m.RequestUnion = &WatchRequest_CancelRequest{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _WatchRequest_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*WatchRequest)
- // request_union
- switch x := m.RequestUnion.(type) {
- case *WatchRequest_CreateRequest:
- s := proto.Size(x.CreateRequest)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *WatchRequest_CancelRequest:
- s := proto.Size(x.CancelRequest)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type WatchCreateRequest struct {
- // key is the key to register for watching.
- Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
- // range_end is the end of the range [key, range_end) to watch. If range_end is not given,
- // only the key argument is watched. If range_end is equal to '\0', all keys greater than
- // or equal to the key argument are watched.
- RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
- // start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
- StartRevision int64 `protobuf:"varint,3,opt,name=start_revision,json=startRevision,proto3" json:"start_revision,omitempty"`
- // progress_notify is set so that the etcd server will periodically send a WatchResponse with
- // no events to the new watcher if there are no recent events. It is useful when clients
- // wish to recover a disconnected watcher starting from a recent known revision.
- // The etcd server may decide how often it will send notifications based on current load.
- ProgressNotify bool `protobuf:"varint,4,opt,name=progress_notify,json=progressNotify,proto3" json:"progress_notify,omitempty"`
- // If prev_kv is set, created watcher gets the previous KV before the event happens.
- // If the previous KV is already compacted, nothing will be returned.
- PrevKv bool `protobuf:"varint,6,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"`
-}
-
-func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} }
-func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) }
-func (*WatchCreateRequest) ProtoMessage() {}
-func (*WatchCreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{19} }
-
-type WatchCancelRequest struct {
- // watch_id is the watcher id to cancel so that no more events are transmitted.
- WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"`
-}
-
-func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} }
-func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) }
-func (*WatchCancelRequest) ProtoMessage() {}
-func (*WatchCancelRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{20} }
-
-type WatchResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // watch_id is the ID of the watcher that corresponds to the response.
- WatchId int64 `protobuf:"varint,2,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"`
- // created is set to true if the response is for a create watch request.
- // The client should record the watch_id and expect to receive events for
- // the created watcher from the same stream.
- // All events sent to the created watcher will attach with the same watch_id.
- Created bool `protobuf:"varint,3,opt,name=created,proto3" json:"created,omitempty"`
- // canceled is set to true if the response is for a cancel watch request.
- // No further events will be sent to the canceled watcher.
- Canceled bool `protobuf:"varint,4,opt,name=canceled,proto3" json:"canceled,omitempty"`
- // compact_revision is set to the minimum index if a watcher tries to watch
- // at a compacted index.
- //
- // This happens when creating a watcher at a compacted revision or the watcher cannot
- // catch up with the progress of the key-value store.
- //
- // The client should treat the watcher as canceled and should not try to create any
- // watcher with the same start_revision again.
- CompactRevision int64 `protobuf:"varint,5,opt,name=compact_revision,json=compactRevision,proto3" json:"compact_revision,omitempty"`
- Events []*mvccpb.Event `protobuf:"bytes,11,rep,name=events" json:"events,omitempty"`
-}
-
-func (m *WatchResponse) Reset() { *m = WatchResponse{} }
-func (m *WatchResponse) String() string { return proto.CompactTextString(m) }
-func (*WatchResponse) ProtoMessage() {}
-func (*WatchResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{21} }
-
-func (m *WatchResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *WatchResponse) GetEvents() []*mvccpb.Event {
- if m != nil {
- return m.Events
- }
- return nil
-}
-
-type LeaseGrantRequest struct {
- // TTL is the advisory time-to-live in seconds.
- TTL int64 `protobuf:"varint,1,opt,name=TTL,json=tTL,proto3" json:"TTL,omitempty"`
- // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
- ID int64 `protobuf:"varint,2,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
-}
-
-func (m *LeaseGrantRequest) Reset() { *m = LeaseGrantRequest{} }
-func (m *LeaseGrantRequest) String() string { return proto.CompactTextString(m) }
-func (*LeaseGrantRequest) ProtoMessage() {}
-func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{22} }
-
-type LeaseGrantResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // ID is the lease ID for the granted lease.
- ID int64 `protobuf:"varint,2,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- // TTL is the server chosen lease time-to-live in seconds.
- TTL int64 `protobuf:"varint,3,opt,name=TTL,json=tTL,proto3" json:"TTL,omitempty"`
- Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
-}
-
-func (m *LeaseGrantResponse) Reset() { *m = LeaseGrantResponse{} }
-func (m *LeaseGrantResponse) String() string { return proto.CompactTextString(m) }
-func (*LeaseGrantResponse) ProtoMessage() {}
-func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{23} }
-
-func (m *LeaseGrantResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type LeaseRevokeRequest struct {
- // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
- ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
-}
-
-func (m *LeaseRevokeRequest) Reset() { *m = LeaseRevokeRequest{} }
-func (m *LeaseRevokeRequest) String() string { return proto.CompactTextString(m) }
-func (*LeaseRevokeRequest) ProtoMessage() {}
-func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{24} }
-
-type LeaseRevokeResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *LeaseRevokeResponse) Reset() { *m = LeaseRevokeResponse{} }
-func (m *LeaseRevokeResponse) String() string { return proto.CompactTextString(m) }
-func (*LeaseRevokeResponse) ProtoMessage() {}
-func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{25} }
-
-func (m *LeaseRevokeResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type LeaseKeepAliveRequest struct {
- // ID is the lease ID for the lease to keep alive.
- ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
-}
-
-func (m *LeaseKeepAliveRequest) Reset() { *m = LeaseKeepAliveRequest{} }
-func (m *LeaseKeepAliveRequest) String() string { return proto.CompactTextString(m) }
-func (*LeaseKeepAliveRequest) ProtoMessage() {}
-func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{26} }
-
-type LeaseKeepAliveResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // ID is the lease ID from the keep alive request.
- ID int64 `protobuf:"varint,2,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- // TTL is the new time-to-live for the lease.
- TTL int64 `protobuf:"varint,3,opt,name=TTL,json=tTL,proto3" json:"TTL,omitempty"`
-}
-
-func (m *LeaseKeepAliveResponse) Reset() { *m = LeaseKeepAliveResponse{} }
-func (m *LeaseKeepAliveResponse) String() string { return proto.CompactTextString(m) }
-func (*LeaseKeepAliveResponse) ProtoMessage() {}
-func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{27} }
-
-func (m *LeaseKeepAliveResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type Member struct {
- // ID is the member ID for this member.
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- // name is the human-readable name of the member. If the member is not started, the name will be an empty string.
- Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
- // peerURLs is the list of URLs the member exposes to the cluster for communication.
- PeerURLs []string `protobuf:"bytes,3,rep,name=peerURLs" json:"peerURLs,omitempty"`
- // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
- ClientURLs []string `protobuf:"bytes,4,rep,name=clientURLs" json:"clientURLs,omitempty"`
-}
-
-func (m *Member) Reset() { *m = Member{} }
-func (m *Member) String() string { return proto.CompactTextString(m) }
-func (*Member) ProtoMessage() {}
-func (*Member) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{28} }
-
-type MemberAddRequest struct {
- // peerURLs is the list of URLs the added member will use to communicate with the cluster.
- PeerURLs []string `protobuf:"bytes,1,rep,name=peerURLs" json:"peerURLs,omitempty"`
-}
-
-func (m *MemberAddRequest) Reset() { *m = MemberAddRequest{} }
-func (m *MemberAddRequest) String() string { return proto.CompactTextString(m) }
-func (*MemberAddRequest) ProtoMessage() {}
-func (*MemberAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{29} }
-
-type MemberAddResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // member is the member information for the added member.
- Member *Member `protobuf:"bytes,2,opt,name=member" json:"member,omitempty"`
-}
-
-func (m *MemberAddResponse) Reset() { *m = MemberAddResponse{} }
-func (m *MemberAddResponse) String() string { return proto.CompactTextString(m) }
-func (*MemberAddResponse) ProtoMessage() {}
-func (*MemberAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{30} }
-
-func (m *MemberAddResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *MemberAddResponse) GetMember() *Member {
- if m != nil {
- return m.Member
- }
- return nil
-}
-
-type MemberRemoveRequest struct {
- // ID is the member ID of the member to remove.
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
-}
-
-func (m *MemberRemoveRequest) Reset() { *m = MemberRemoveRequest{} }
-func (m *MemberRemoveRequest) String() string { return proto.CompactTextString(m) }
-func (*MemberRemoveRequest) ProtoMessage() {}
-func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{31} }
-
-type MemberRemoveResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *MemberRemoveResponse) Reset() { *m = MemberRemoveResponse{} }
-func (m *MemberRemoveResponse) String() string { return proto.CompactTextString(m) }
-func (*MemberRemoveResponse) ProtoMessage() {}
-func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{32} }
-
-func (m *MemberRemoveResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type MemberUpdateRequest struct {
- // ID is the member ID of the member to update.
- ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
- // peerURLs is the new list of URLs the member will use to communicate with the cluster.
- PeerURLs []string `protobuf:"bytes,2,rep,name=peerURLs" json:"peerURLs,omitempty"`
-}
-
-func (m *MemberUpdateRequest) Reset() { *m = MemberUpdateRequest{} }
-func (m *MemberUpdateRequest) String() string { return proto.CompactTextString(m) }
-func (*MemberUpdateRequest) ProtoMessage() {}
-func (*MemberUpdateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{33} }
-
-type MemberUpdateResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *MemberUpdateResponse) Reset() { *m = MemberUpdateResponse{} }
-func (m *MemberUpdateResponse) String() string { return proto.CompactTextString(m) }
-func (*MemberUpdateResponse) ProtoMessage() {}
-func (*MemberUpdateResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{34} }
-
-func (m *MemberUpdateResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type MemberListRequest struct {
-}
-
-func (m *MemberListRequest) Reset() { *m = MemberListRequest{} }
-func (m *MemberListRequest) String() string { return proto.CompactTextString(m) }
-func (*MemberListRequest) ProtoMessage() {}
-func (*MemberListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{35} }
-
-type MemberListResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // members is a list of all members associated with the cluster.
- Members []*Member `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"`
-}
-
-func (m *MemberListResponse) Reset() { *m = MemberListResponse{} }
-func (m *MemberListResponse) String() string { return proto.CompactTextString(m) }
-func (*MemberListResponse) ProtoMessage() {}
-func (*MemberListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{36} }
-
-func (m *MemberListResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *MemberListResponse) GetMembers() []*Member {
- if m != nil {
- return m.Members
- }
- return nil
-}
-
-type DefragmentRequest struct {
-}
-
-func (m *DefragmentRequest) Reset() { *m = DefragmentRequest{} }
-func (m *DefragmentRequest) String() string { return proto.CompactTextString(m) }
-func (*DefragmentRequest) ProtoMessage() {}
-func (*DefragmentRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{37} }
-
-type DefragmentResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *DefragmentResponse) Reset() { *m = DefragmentResponse{} }
-func (m *DefragmentResponse) String() string { return proto.CompactTextString(m) }
-func (*DefragmentResponse) ProtoMessage() {}
-func (*DefragmentResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{38} }
-
-func (m *DefragmentResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AlarmRequest struct {
- // action is the kind of alarm request to issue. The action
- // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
- // raised alarm.
- Action AlarmRequest_AlarmAction `protobuf:"varint,1,opt,name=action,proto3,enum=etcdserverpb.AlarmRequest_AlarmAction" json:"action,omitempty"`
- // memberID is the ID of the member associated with the alarm. If memberID is 0, the
- // alarm request covers all members.
- MemberID uint64 `protobuf:"varint,2,opt,name=memberID,proto3" json:"memberID,omitempty"`
- // alarm is the type of alarm to consider for this request.
- Alarm AlarmType `protobuf:"varint,3,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"`
-}
-
-func (m *AlarmRequest) Reset() { *m = AlarmRequest{} }
-func (m *AlarmRequest) String() string { return proto.CompactTextString(m) }
-func (*AlarmRequest) ProtoMessage() {}
-func (*AlarmRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{39} }
-
-type AlarmMember struct {
- // memberID is the ID of the member associated with the raised alarm.
- MemberID uint64 `protobuf:"varint,1,opt,name=memberID,proto3" json:"memberID,omitempty"`
- // alarm is the type of alarm which has been raised.
- Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"`
-}
-
-func (m *AlarmMember) Reset() { *m = AlarmMember{} }
-func (m *AlarmMember) String() string { return proto.CompactTextString(m) }
-func (*AlarmMember) ProtoMessage() {}
-func (*AlarmMember) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{40} }
-
-type AlarmResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // alarms is a list of alarms associated with the alarm request.
- Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms" json:"alarms,omitempty"`
-}
-
-func (m *AlarmResponse) Reset() { *m = AlarmResponse{} }
-func (m *AlarmResponse) String() string { return proto.CompactTextString(m) }
-func (*AlarmResponse) ProtoMessage() {}
-func (*AlarmResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{41} }
-
-func (m *AlarmResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *AlarmResponse) GetAlarms() []*AlarmMember {
- if m != nil {
- return m.Alarms
- }
- return nil
-}
-
-type StatusRequest struct {
-}
-
-func (m *StatusRequest) Reset() { *m = StatusRequest{} }
-func (m *StatusRequest) String() string { return proto.CompactTextString(m) }
-func (*StatusRequest) ProtoMessage() {}
-func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{42} }
-
-type StatusResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // version is the cluster protocol version used by the responding member.
- Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
- // dbSize is the size of the backend database, in bytes, of the responding member.
- DbSize int64 `protobuf:"varint,3,opt,name=dbSize,proto3" json:"dbSize,omitempty"`
- // leader is the member ID which the responding member believes is the current leader.
- Leader uint64 `protobuf:"varint,4,opt,name=leader,proto3" json:"leader,omitempty"`
- // raftIndex is the current raft index of the responding member.
- RaftIndex uint64 `protobuf:"varint,5,opt,name=raftIndex,proto3" json:"raftIndex,omitempty"`
- // raftTerm is the current raft term of the responding member.
- RaftTerm uint64 `protobuf:"varint,6,opt,name=raftTerm,proto3" json:"raftTerm,omitempty"`
-}
-
-func (m *StatusResponse) Reset() { *m = StatusResponse{} }
-func (m *StatusResponse) String() string { return proto.CompactTextString(m) }
-func (*StatusResponse) ProtoMessage() {}
-func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{43} }
-
-func (m *StatusResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthEnableRequest struct {
-}
-
-func (m *AuthEnableRequest) Reset() { *m = AuthEnableRequest{} }
-func (m *AuthEnableRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthEnableRequest) ProtoMessage() {}
-func (*AuthEnableRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{44} }
-
-type AuthDisableRequest struct {
-}
-
-func (m *AuthDisableRequest) Reset() { *m = AuthDisableRequest{} }
-func (m *AuthDisableRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthDisableRequest) ProtoMessage() {}
-func (*AuthDisableRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{45} }
-
-type AuthenticateRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
-}
-
-func (m *AuthenticateRequest) Reset() { *m = AuthenticateRequest{} }
-func (m *AuthenticateRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthenticateRequest) ProtoMessage() {}
-func (*AuthenticateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{46} }
-
-type AuthUserAddRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
-}
-
-func (m *AuthUserAddRequest) Reset() { *m = AuthUserAddRequest{} }
-func (m *AuthUserAddRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserAddRequest) ProtoMessage() {}
-func (*AuthUserAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{47} }
-
-type AuthUserGetRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-}
-
-func (m *AuthUserGetRequest) Reset() { *m = AuthUserGetRequest{} }
-func (m *AuthUserGetRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserGetRequest) ProtoMessage() {}
-func (*AuthUserGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{48} }
-
-type AuthUserDeleteRequest struct {
- // name is the name of the user to delete.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-}
-
-func (m *AuthUserDeleteRequest) Reset() { *m = AuthUserDeleteRequest{} }
-func (m *AuthUserDeleteRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserDeleteRequest) ProtoMessage() {}
-func (*AuthUserDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{49} }
-
-type AuthUserChangePasswordRequest struct {
- // name is the name of the user whose password is being changed.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // password is the new password for the user.
- Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
-}
-
-func (m *AuthUserChangePasswordRequest) Reset() { *m = AuthUserChangePasswordRequest{} }
-func (m *AuthUserChangePasswordRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserChangePasswordRequest) ProtoMessage() {}
-func (*AuthUserChangePasswordRequest) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{50}
-}
-
-type AuthUserGrantRoleRequest struct {
- // user is the name of the user which should be granted a given role.
- User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
- // role is the name of the role to grant to the user.
- Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
-}
-
-func (m *AuthUserGrantRoleRequest) Reset() { *m = AuthUserGrantRoleRequest{} }
-func (m *AuthUserGrantRoleRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserGrantRoleRequest) ProtoMessage() {}
-func (*AuthUserGrantRoleRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{51} }
-
-type AuthUserRevokeRoleRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
-}
-
-func (m *AuthUserRevokeRoleRequest) Reset() { *m = AuthUserRevokeRoleRequest{} }
-func (m *AuthUserRevokeRoleRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserRevokeRoleRequest) ProtoMessage() {}
-func (*AuthUserRevokeRoleRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{52} }
-
-type AuthRoleAddRequest struct {
- // name is the name of the role to add to the authentication system.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-}
-
-func (m *AuthRoleAddRequest) Reset() { *m = AuthRoleAddRequest{} }
-func (m *AuthRoleAddRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleAddRequest) ProtoMessage() {}
-func (*AuthRoleAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{53} }
-
-type AuthRoleGetRequest struct {
- Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
-}
-
-func (m *AuthRoleGetRequest) Reset() { *m = AuthRoleGetRequest{} }
-func (m *AuthRoleGetRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleGetRequest) ProtoMessage() {}
-func (*AuthRoleGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{54} }
-
-type AuthUserListRequest struct {
-}
-
-func (m *AuthUserListRequest) Reset() { *m = AuthUserListRequest{} }
-func (m *AuthUserListRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthUserListRequest) ProtoMessage() {}
-func (*AuthUserListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{55} }
-
-type AuthRoleListRequest struct {
-}
-
-func (m *AuthRoleListRequest) Reset() { *m = AuthRoleListRequest{} }
-func (m *AuthRoleListRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleListRequest) ProtoMessage() {}
-func (*AuthRoleListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{56} }
-
-type AuthRoleDeleteRequest struct {
- Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
-}
-
-func (m *AuthRoleDeleteRequest) Reset() { *m = AuthRoleDeleteRequest{} }
-func (m *AuthRoleDeleteRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleDeleteRequest) ProtoMessage() {}
-func (*AuthRoleDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{57} }
-
-type AuthRoleGrantPermissionRequest struct {
- // name is the name of the role which will be granted the permission.
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // perm is the permission to grant to the role.
- Perm *authpb.Permission `protobuf:"bytes,2,opt,name=perm" json:"perm,omitempty"`
-}
-
-func (m *AuthRoleGrantPermissionRequest) Reset() { *m = AuthRoleGrantPermissionRequest{} }
-func (m *AuthRoleGrantPermissionRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleGrantPermissionRequest) ProtoMessage() {}
-func (*AuthRoleGrantPermissionRequest) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{58}
-}
-
-func (m *AuthRoleGrantPermissionRequest) GetPerm() *authpb.Permission {
- if m != nil {
- return m.Perm
- }
- return nil
-}
-
-type AuthRoleRevokePermissionRequest struct {
- Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
- Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
- RangeEnd string `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"`
-}
-
-func (m *AuthRoleRevokePermissionRequest) Reset() { *m = AuthRoleRevokePermissionRequest{} }
-func (m *AuthRoleRevokePermissionRequest) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleRevokePermissionRequest) ProtoMessage() {}
-func (*AuthRoleRevokePermissionRequest) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{59}
-}
-
-type AuthEnableResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthEnableResponse) Reset() { *m = AuthEnableResponse{} }
-func (m *AuthEnableResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthEnableResponse) ProtoMessage() {}
-func (*AuthEnableResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{60} }
-
-func (m *AuthEnableResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthDisableResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthDisableResponse) Reset() { *m = AuthDisableResponse{} }
-func (m *AuthDisableResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthDisableResponse) ProtoMessage() {}
-func (*AuthDisableResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{61} }
-
-func (m *AuthDisableResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthenticateResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- // token is an authorized token that can be used in succeeding RPCs
- Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
-}
-
-func (m *AuthenticateResponse) Reset() { *m = AuthenticateResponse{} }
-func (m *AuthenticateResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthenticateResponse) ProtoMessage() {}
-func (*AuthenticateResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{62} }
-
-func (m *AuthenticateResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserAddResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthUserAddResponse) Reset() { *m = AuthUserAddResponse{} }
-func (m *AuthUserAddResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserAddResponse) ProtoMessage() {}
-func (*AuthUserAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{63} }
-
-func (m *AuthUserAddResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserGetResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- Roles []string `protobuf:"bytes,2,rep,name=roles" json:"roles,omitempty"`
-}
-
-func (m *AuthUserGetResponse) Reset() { *m = AuthUserGetResponse{} }
-func (m *AuthUserGetResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserGetResponse) ProtoMessage() {}
-func (*AuthUserGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{64} }
-
-func (m *AuthUserGetResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserDeleteResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthUserDeleteResponse) Reset() { *m = AuthUserDeleteResponse{} }
-func (m *AuthUserDeleteResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserDeleteResponse) ProtoMessage() {}
-func (*AuthUserDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{65} }
-
-func (m *AuthUserDeleteResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserChangePasswordResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthUserChangePasswordResponse) Reset() { *m = AuthUserChangePasswordResponse{} }
-func (m *AuthUserChangePasswordResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserChangePasswordResponse) ProtoMessage() {}
-func (*AuthUserChangePasswordResponse) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{66}
-}
-
-func (m *AuthUserChangePasswordResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserGrantRoleResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthUserGrantRoleResponse) Reset() { *m = AuthUserGrantRoleResponse{} }
-func (m *AuthUserGrantRoleResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserGrantRoleResponse) ProtoMessage() {}
-func (*AuthUserGrantRoleResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{67} }
-
-func (m *AuthUserGrantRoleResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserRevokeRoleResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthUserRevokeRoleResponse) Reset() { *m = AuthUserRevokeRoleResponse{} }
-func (m *AuthUserRevokeRoleResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserRevokeRoleResponse) ProtoMessage() {}
-func (*AuthUserRevokeRoleResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{68} }
-
-func (m *AuthUserRevokeRoleResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthRoleAddResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthRoleAddResponse) Reset() { *m = AuthRoleAddResponse{} }
-func (m *AuthRoleAddResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleAddResponse) ProtoMessage() {}
-func (*AuthRoleAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{69} }
-
-func (m *AuthRoleAddResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthRoleGetResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- Perm []*authpb.Permission `protobuf:"bytes,2,rep,name=perm" json:"perm,omitempty"`
-}
-
-func (m *AuthRoleGetResponse) Reset() { *m = AuthRoleGetResponse{} }
-func (m *AuthRoleGetResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleGetResponse) ProtoMessage() {}
-func (*AuthRoleGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{70} }
-
-func (m *AuthRoleGetResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func (m *AuthRoleGetResponse) GetPerm() []*authpb.Permission {
- if m != nil {
- return m.Perm
- }
- return nil
-}
-
-type AuthRoleListResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- Roles []string `protobuf:"bytes,2,rep,name=roles" json:"roles,omitempty"`
-}
-
-func (m *AuthRoleListResponse) Reset() { *m = AuthRoleListResponse{} }
-func (m *AuthRoleListResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleListResponse) ProtoMessage() {}
-func (*AuthRoleListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{71} }
-
-func (m *AuthRoleListResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthUserListResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
- Users []string `protobuf:"bytes,2,rep,name=users" json:"users,omitempty"`
-}
-
-func (m *AuthUserListResponse) Reset() { *m = AuthUserListResponse{} }
-func (m *AuthUserListResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthUserListResponse) ProtoMessage() {}
-func (*AuthUserListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{72} }
-
-func (m *AuthUserListResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthRoleDeleteResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthRoleDeleteResponse) Reset() { *m = AuthRoleDeleteResponse{} }
-func (m *AuthRoleDeleteResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleDeleteResponse) ProtoMessage() {}
-func (*AuthRoleDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{73} }
-
-func (m *AuthRoleDeleteResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthRoleGrantPermissionResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthRoleGrantPermissionResponse) Reset() { *m = AuthRoleGrantPermissionResponse{} }
-func (m *AuthRoleGrantPermissionResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleGrantPermissionResponse) ProtoMessage() {}
-func (*AuthRoleGrantPermissionResponse) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{74}
-}
-
-func (m *AuthRoleGrantPermissionResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-type AuthRoleRevokePermissionResponse struct {
- Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"`
-}
-
-func (m *AuthRoleRevokePermissionResponse) Reset() { *m = AuthRoleRevokePermissionResponse{} }
-func (m *AuthRoleRevokePermissionResponse) String() string { return proto.CompactTextString(m) }
-func (*AuthRoleRevokePermissionResponse) ProtoMessage() {}
-func (*AuthRoleRevokePermissionResponse) Descriptor() ([]byte, []int) {
- return fileDescriptorRpc, []int{75}
-}
-
-func (m *AuthRoleRevokePermissionResponse) GetHeader() *ResponseHeader {
- if m != nil {
- return m.Header
- }
- return nil
-}
-
-func init() {
- proto.RegisterType((*ResponseHeader)(nil), "etcdserverpb.ResponseHeader")
- proto.RegisterType((*RangeRequest)(nil), "etcdserverpb.RangeRequest")
- proto.RegisterType((*RangeResponse)(nil), "etcdserverpb.RangeResponse")
- proto.RegisterType((*PutRequest)(nil), "etcdserverpb.PutRequest")
- proto.RegisterType((*PutResponse)(nil), "etcdserverpb.PutResponse")
- proto.RegisterType((*DeleteRangeRequest)(nil), "etcdserverpb.DeleteRangeRequest")
- proto.RegisterType((*DeleteRangeResponse)(nil), "etcdserverpb.DeleteRangeResponse")
- proto.RegisterType((*RequestOp)(nil), "etcdserverpb.RequestOp")
- proto.RegisterType((*ResponseOp)(nil), "etcdserverpb.ResponseOp")
- proto.RegisterType((*Compare)(nil), "etcdserverpb.Compare")
- proto.RegisterType((*TxnRequest)(nil), "etcdserverpb.TxnRequest")
- proto.RegisterType((*TxnResponse)(nil), "etcdserverpb.TxnResponse")
- proto.RegisterType((*CompactionRequest)(nil), "etcdserverpb.CompactionRequest")
- proto.RegisterType((*CompactionResponse)(nil), "etcdserverpb.CompactionResponse")
- proto.RegisterType((*HashRequest)(nil), "etcdserverpb.HashRequest")
- proto.RegisterType((*HashResponse)(nil), "etcdserverpb.HashResponse")
- proto.RegisterType((*SnapshotRequest)(nil), "etcdserverpb.SnapshotRequest")
- proto.RegisterType((*SnapshotResponse)(nil), "etcdserverpb.SnapshotResponse")
- proto.RegisterType((*WatchRequest)(nil), "etcdserverpb.WatchRequest")
- proto.RegisterType((*WatchCreateRequest)(nil), "etcdserverpb.WatchCreateRequest")
- proto.RegisterType((*WatchCancelRequest)(nil), "etcdserverpb.WatchCancelRequest")
- proto.RegisterType((*WatchResponse)(nil), "etcdserverpb.WatchResponse")
- proto.RegisterType((*LeaseGrantRequest)(nil), "etcdserverpb.LeaseGrantRequest")
- proto.RegisterType((*LeaseGrantResponse)(nil), "etcdserverpb.LeaseGrantResponse")
- proto.RegisterType((*LeaseRevokeRequest)(nil), "etcdserverpb.LeaseRevokeRequest")
- proto.RegisterType((*LeaseRevokeResponse)(nil), "etcdserverpb.LeaseRevokeResponse")
- proto.RegisterType((*LeaseKeepAliveRequest)(nil), "etcdserverpb.LeaseKeepAliveRequest")
- proto.RegisterType((*LeaseKeepAliveResponse)(nil), "etcdserverpb.LeaseKeepAliveResponse")
- proto.RegisterType((*Member)(nil), "etcdserverpb.Member")
- proto.RegisterType((*MemberAddRequest)(nil), "etcdserverpb.MemberAddRequest")
- proto.RegisterType((*MemberAddResponse)(nil), "etcdserverpb.MemberAddResponse")
- proto.RegisterType((*MemberRemoveRequest)(nil), "etcdserverpb.MemberRemoveRequest")
- proto.RegisterType((*MemberRemoveResponse)(nil), "etcdserverpb.MemberRemoveResponse")
- proto.RegisterType((*MemberUpdateRequest)(nil), "etcdserverpb.MemberUpdateRequest")
- proto.RegisterType((*MemberUpdateResponse)(nil), "etcdserverpb.MemberUpdateResponse")
- proto.RegisterType((*MemberListRequest)(nil), "etcdserverpb.MemberListRequest")
- proto.RegisterType((*MemberListResponse)(nil), "etcdserverpb.MemberListResponse")
- proto.RegisterType((*DefragmentRequest)(nil), "etcdserverpb.DefragmentRequest")
- proto.RegisterType((*DefragmentResponse)(nil), "etcdserverpb.DefragmentResponse")
- proto.RegisterType((*AlarmRequest)(nil), "etcdserverpb.AlarmRequest")
- proto.RegisterType((*AlarmMember)(nil), "etcdserverpb.AlarmMember")
- proto.RegisterType((*AlarmResponse)(nil), "etcdserverpb.AlarmResponse")
- proto.RegisterType((*StatusRequest)(nil), "etcdserverpb.StatusRequest")
- proto.RegisterType((*StatusResponse)(nil), "etcdserverpb.StatusResponse")
- proto.RegisterType((*AuthEnableRequest)(nil), "etcdserverpb.AuthEnableRequest")
- proto.RegisterType((*AuthDisableRequest)(nil), "etcdserverpb.AuthDisableRequest")
- proto.RegisterType((*AuthenticateRequest)(nil), "etcdserverpb.AuthenticateRequest")
- proto.RegisterType((*AuthUserAddRequest)(nil), "etcdserverpb.AuthUserAddRequest")
- proto.RegisterType((*AuthUserGetRequest)(nil), "etcdserverpb.AuthUserGetRequest")
- proto.RegisterType((*AuthUserDeleteRequest)(nil), "etcdserverpb.AuthUserDeleteRequest")
- proto.RegisterType((*AuthUserChangePasswordRequest)(nil), "etcdserverpb.AuthUserChangePasswordRequest")
- proto.RegisterType((*AuthUserGrantRoleRequest)(nil), "etcdserverpb.AuthUserGrantRoleRequest")
- proto.RegisterType((*AuthUserRevokeRoleRequest)(nil), "etcdserverpb.AuthUserRevokeRoleRequest")
- proto.RegisterType((*AuthRoleAddRequest)(nil), "etcdserverpb.AuthRoleAddRequest")
- proto.RegisterType((*AuthRoleGetRequest)(nil), "etcdserverpb.AuthRoleGetRequest")
- proto.RegisterType((*AuthUserListRequest)(nil), "etcdserverpb.AuthUserListRequest")
- proto.RegisterType((*AuthRoleListRequest)(nil), "etcdserverpb.AuthRoleListRequest")
- proto.RegisterType((*AuthRoleDeleteRequest)(nil), "etcdserverpb.AuthRoleDeleteRequest")
- proto.RegisterType((*AuthRoleGrantPermissionRequest)(nil), "etcdserverpb.AuthRoleGrantPermissionRequest")
- proto.RegisterType((*AuthRoleRevokePermissionRequest)(nil), "etcdserverpb.AuthRoleRevokePermissionRequest")
- proto.RegisterType((*AuthEnableResponse)(nil), "etcdserverpb.AuthEnableResponse")
- proto.RegisterType((*AuthDisableResponse)(nil), "etcdserverpb.AuthDisableResponse")
- proto.RegisterType((*AuthenticateResponse)(nil), "etcdserverpb.AuthenticateResponse")
- proto.RegisterType((*AuthUserAddResponse)(nil), "etcdserverpb.AuthUserAddResponse")
- proto.RegisterType((*AuthUserGetResponse)(nil), "etcdserverpb.AuthUserGetResponse")
- proto.RegisterType((*AuthUserDeleteResponse)(nil), "etcdserverpb.AuthUserDeleteResponse")
- proto.RegisterType((*AuthUserChangePasswordResponse)(nil), "etcdserverpb.AuthUserChangePasswordResponse")
- proto.RegisterType((*AuthUserGrantRoleResponse)(nil), "etcdserverpb.AuthUserGrantRoleResponse")
- proto.RegisterType((*AuthUserRevokeRoleResponse)(nil), "etcdserverpb.AuthUserRevokeRoleResponse")
- proto.RegisterType((*AuthRoleAddResponse)(nil), "etcdserverpb.AuthRoleAddResponse")
- proto.RegisterType((*AuthRoleGetResponse)(nil), "etcdserverpb.AuthRoleGetResponse")
- proto.RegisterType((*AuthRoleListResponse)(nil), "etcdserverpb.AuthRoleListResponse")
- proto.RegisterType((*AuthUserListResponse)(nil), "etcdserverpb.AuthUserListResponse")
- proto.RegisterType((*AuthRoleDeleteResponse)(nil), "etcdserverpb.AuthRoleDeleteResponse")
- proto.RegisterType((*AuthRoleGrantPermissionResponse)(nil), "etcdserverpb.AuthRoleGrantPermissionResponse")
- proto.RegisterType((*AuthRoleRevokePermissionResponse)(nil), "etcdserverpb.AuthRoleRevokePermissionResponse")
- proto.RegisterEnum("etcdserverpb.AlarmType", AlarmType_name, AlarmType_value)
- proto.RegisterEnum("etcdserverpb.RangeRequest_SortOrder", RangeRequest_SortOrder_name, RangeRequest_SortOrder_value)
- proto.RegisterEnum("etcdserverpb.RangeRequest_SortTarget", RangeRequest_SortTarget_name, RangeRequest_SortTarget_value)
- proto.RegisterEnum("etcdserverpb.Compare_CompareResult", Compare_CompareResult_name, Compare_CompareResult_value)
- proto.RegisterEnum("etcdserverpb.Compare_CompareTarget", Compare_CompareTarget_name, Compare_CompareTarget_value)
- proto.RegisterEnum("etcdserverpb.AlarmRequest_AlarmAction", AlarmRequest_AlarmAction_name, AlarmRequest_AlarmAction_value)
-}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion3
-
-// Client API for KV service
-
-type KVClient interface {
- // Range gets the keys in the range from the key-value store.
- Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error)
- // Put puts the given key into the key-value store.
- // A put request increments the revision of the key-value store
- // and generates one event in the event history.
- Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
- // DeleteRange deletes the given range from the key-value store.
- // A delete request increments the revision of the key-value store
- // and generates a delete event in the event history for every deleted key.
- DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error)
- // Txn processes multiple requests in a single transaction.
- // A txn request increments the revision of the key-value store
- // and generates events with the same revision for every completed request.
- // It is not allowed to modify the same key several times within one txn.
- Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error)
- // Compact compacts the event history in the etcd key-value store. The key-value
- // store should be periodically compacted or the event history will continue to grow
- // indefinitely.
- Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error)
-}
-
-type kVClient struct {
- cc *grpc.ClientConn
-}
-
-func NewKVClient(cc *grpc.ClientConn) KVClient {
- return &kVClient{cc}
-}
-
-func (c *kVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) {
- out := new(RangeResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.KV/Range", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) {
- out := new(PutResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.KV/Put", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *kVClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) {
- out := new(DeleteRangeResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.KV/DeleteRange", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *kVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) {
- out := new(TxnResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.KV/Txn", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *kVClient) Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) {
- out := new(CompactionResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.KV/Compact", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for KV service
-
-type KVServer interface {
- // Range gets the keys in the range from the key-value store.
- Range(context.Context, *RangeRequest) (*RangeResponse, error)
- // Put puts the given key into the key-value store.
- // A put request increments the revision of the key-value store
- // and generates one event in the event history.
- Put(context.Context, *PutRequest) (*PutResponse, error)
- // DeleteRange deletes the given range from the key-value store.
- // A delete request increments the revision of the key-value store
- // and generates a delete event in the event history for every deleted key.
- DeleteRange(context.Context, *DeleteRangeRequest) (*DeleteRangeResponse, error)
- // Txn processes multiple requests in a single transaction.
- // A txn request increments the revision of the key-value store
- // and generates events with the same revision for every completed request.
- // It is not allowed to modify the same key several times within one txn.
- Txn(context.Context, *TxnRequest) (*TxnResponse, error)
- // Compact compacts the event history in the etcd key-value store. The key-value
- // store should be periodically compacted or the event history will continue to grow
- // indefinitely.
- Compact(context.Context, *CompactionRequest) (*CompactionResponse, error)
-}
-
-func RegisterKVServer(s *grpc.Server, srv KVServer) {
- s.RegisterService(&_KV_serviceDesc, srv)
-}
-
-func _KV_Range_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(RangeRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(KVServer).Range(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.KV/Range",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(KVServer).Range(ctx, req.(*RangeRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _KV_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(PutRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(KVServer).Put(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.KV/Put",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(KVServer).Put(ctx, req.(*PutRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _KV_DeleteRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteRangeRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(KVServer).DeleteRange(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.KV/DeleteRange",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(KVServer).DeleteRange(ctx, req.(*DeleteRangeRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _KV_Txn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(TxnRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(KVServer).Txn(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.KV/Txn",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(KVServer).Txn(ctx, req.(*TxnRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _KV_Compact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CompactionRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(KVServer).Compact(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.KV/Compact",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(KVServer).Compact(ctx, req.(*CompactionRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _KV_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.KV",
- HandlerType: (*KVServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "Range",
- Handler: _KV_Range_Handler,
- },
- {
- MethodName: "Put",
- Handler: _KV_Put_Handler,
- },
- {
- MethodName: "DeleteRange",
- Handler: _KV_DeleteRange_Handler,
- },
- {
- MethodName: "Txn",
- Handler: _KV_Txn_Handler,
- },
- {
- MethodName: "Compact",
- Handler: _KV_Compact_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: fileDescriptorRpc,
-}
-
-// Client API for Watch service
-
-type WatchClient interface {
- // Watch watches for events happening or that have happened. Both input and output
- // are streams; the input stream is for creating and canceling watchers and the output
- // stream sends events. One watch RPC can watch on multiple key ranges, streaming events
- // for several watches at once. The entire event history can be watched starting from the
- // last compaction revision.
- Watch(ctx context.Context, opts ...grpc.CallOption) (Watch_WatchClient, error)
-}
-
-type watchClient struct {
- cc *grpc.ClientConn
-}
-
-func NewWatchClient(cc *grpc.ClientConn) WatchClient {
- return &watchClient{cc}
-}
-
-func (c *watchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (Watch_WatchClient, error) {
- stream, err := grpc.NewClientStream(ctx, &_Watch_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Watch/Watch", opts...)
- if err != nil {
- return nil, err
- }
- x := &watchWatchClient{stream}
- return x, nil
-}
-
-type Watch_WatchClient interface {
- Send(*WatchRequest) error
- Recv() (*WatchResponse, error)
- grpc.ClientStream
-}
-
-type watchWatchClient struct {
- grpc.ClientStream
-}
-
-func (x *watchWatchClient) Send(m *WatchRequest) error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *watchWatchClient) Recv() (*WatchResponse, error) {
- m := new(WatchResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// Server API for Watch service
-
-type WatchServer interface {
- // Watch watches for events happening or that have happened. Both input and output
- // are streams; the input stream is for creating and canceling watchers and the output
- // stream sends events. One watch RPC can watch on multiple key ranges, streaming events
- // for several watches at once. The entire event history can be watched starting from the
- // last compaction revision.
- Watch(Watch_WatchServer) error
-}
-
-func RegisterWatchServer(s *grpc.Server, srv WatchServer) {
- s.RegisterService(&_Watch_serviceDesc, srv)
-}
-
-func _Watch_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(WatchServer).Watch(&watchWatchServer{stream})
-}
-
-type Watch_WatchServer interface {
- Send(*WatchResponse) error
- Recv() (*WatchRequest, error)
- grpc.ServerStream
-}
-
-type watchWatchServer struct {
- grpc.ServerStream
-}
-
-func (x *watchWatchServer) Send(m *WatchResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *watchWatchServer) Recv() (*WatchRequest, error) {
- m := new(WatchRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-var _Watch_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.Watch",
- HandlerType: (*WatchServer)(nil),
- Methods: []grpc.MethodDesc{},
- Streams: []grpc.StreamDesc{
- {
- StreamName: "Watch",
- Handler: _Watch_Watch_Handler,
- ServerStreams: true,
- ClientStreams: true,
- },
- },
- Metadata: fileDescriptorRpc,
-}
-
-// Client API for Lease service
-
-type LeaseClient interface {
- // LeaseGrant creates a lease which expires if the server does not receive a keepAlive
- // within a given time to live period. All keys attached to the lease will be expired and
- // deleted if the lease expires. Each expired key generates a delete event in the event history.
- LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error)
- // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
- LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error)
- // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
- // to the server and streaming keep alive responses from the server to the client.
- LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (Lease_LeaseKeepAliveClient, error)
-}
-
-type leaseClient struct {
- cc *grpc.ClientConn
-}
-
-func NewLeaseClient(cc *grpc.ClientConn) LeaseClient {
- return &leaseClient{cc}
-}
-
-func (c *leaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) {
- out := new(LeaseGrantResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseGrant", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *leaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) {
- out := new(LeaseRevokeResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseRevoke", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *leaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (Lease_LeaseKeepAliveClient, error) {
- stream, err := grpc.NewClientStream(ctx, &_Lease_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Lease/LeaseKeepAlive", opts...)
- if err != nil {
- return nil, err
- }
- x := &leaseLeaseKeepAliveClient{stream}
- return x, nil
-}
-
-type Lease_LeaseKeepAliveClient interface {
- Send(*LeaseKeepAliveRequest) error
- Recv() (*LeaseKeepAliveResponse, error)
- grpc.ClientStream
-}
-
-type leaseLeaseKeepAliveClient struct {
- grpc.ClientStream
-}
-
-func (x *leaseLeaseKeepAliveClient) Send(m *LeaseKeepAliveRequest) error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *leaseLeaseKeepAliveClient) Recv() (*LeaseKeepAliveResponse, error) {
- m := new(LeaseKeepAliveResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// Server API for Lease service
-
-type LeaseServer interface {
- // LeaseGrant creates a lease which expires if the server does not receive a keepAlive
- // within a given time to live period. All keys attached to the lease will be expired and
- // deleted if the lease expires. Each expired key generates a delete event in the event history.
- LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error)
- // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
- LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error)
- // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
- // to the server and streaming keep alive responses from the server to the client.
- LeaseKeepAlive(Lease_LeaseKeepAliveServer) error
-}
-
-func RegisterLeaseServer(s *grpc.Server, srv LeaseServer) {
- s.RegisterService(&_Lease_serviceDesc, srv)
-}
-
-func _Lease_LeaseGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(LeaseGrantRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(LeaseServer).LeaseGrant(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Lease/LeaseGrant",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(LeaseServer).LeaseGrant(ctx, req.(*LeaseGrantRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Lease_LeaseRevoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(LeaseRevokeRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(LeaseServer).LeaseRevoke(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Lease/LeaseRevoke",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(LeaseServer).LeaseRevoke(ctx, req.(*LeaseRevokeRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Lease_LeaseKeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(LeaseServer).LeaseKeepAlive(&leaseLeaseKeepAliveServer{stream})
-}
-
-type Lease_LeaseKeepAliveServer interface {
- Send(*LeaseKeepAliveResponse) error
- Recv() (*LeaseKeepAliveRequest, error)
- grpc.ServerStream
-}
-
-type leaseLeaseKeepAliveServer struct {
- grpc.ServerStream
-}
-
-func (x *leaseLeaseKeepAliveServer) Send(m *LeaseKeepAliveResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *leaseLeaseKeepAliveServer) Recv() (*LeaseKeepAliveRequest, error) {
- m := new(LeaseKeepAliveRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-var _Lease_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.Lease",
- HandlerType: (*LeaseServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "LeaseGrant",
- Handler: _Lease_LeaseGrant_Handler,
- },
- {
- MethodName: "LeaseRevoke",
- Handler: _Lease_LeaseRevoke_Handler,
- },
- },
- Streams: []grpc.StreamDesc{
- {
- StreamName: "LeaseKeepAlive",
- Handler: _Lease_LeaseKeepAlive_Handler,
- ServerStreams: true,
- ClientStreams: true,
- },
- },
- Metadata: fileDescriptorRpc,
-}
-
-// Client API for Cluster service
-
-type ClusterClient interface {
- // MemberAdd adds a member into the cluster.
- MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error)
- // MemberRemove removes an existing member from the cluster.
- MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error)
- // MemberUpdate updates the member configuration.
- MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error)
- // MemberList lists all the members in the cluster.
- MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error)
-}
-
-type clusterClient struct {
- cc *grpc.ClientConn
-}
-
-func NewClusterClient(cc *grpc.ClientConn) ClusterClient {
- return &clusterClient{cc}
-}
-
-func (c *clusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) {
- out := new(MemberAddResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberAdd", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *clusterClient) MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) {
- out := new(MemberRemoveResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberRemove", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *clusterClient) MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) {
- out := new(MemberUpdateResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberUpdate", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *clusterClient) MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) {
- out := new(MemberListResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberList", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for Cluster service
-
-type ClusterServer interface {
- // MemberAdd adds a member into the cluster.
- MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error)
- // MemberRemove removes an existing member from the cluster.
- MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error)
- // MemberUpdate updates the member configuration.
- MemberUpdate(context.Context, *MemberUpdateRequest) (*MemberUpdateResponse, error)
- // MemberList lists all the members in the cluster.
- MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error)
-}
-
-func RegisterClusterServer(s *grpc.Server, srv ClusterServer) {
- s.RegisterService(&_Cluster_serviceDesc, srv)
-}
-
-func _Cluster_MemberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MemberAddRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ClusterServer).MemberAdd(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Cluster/MemberAdd",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ClusterServer).MemberAdd(ctx, req.(*MemberAddRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Cluster_MemberRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MemberRemoveRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ClusterServer).MemberRemove(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Cluster/MemberRemove",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ClusterServer).MemberRemove(ctx, req.(*MemberRemoveRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Cluster_MemberUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MemberUpdateRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ClusterServer).MemberUpdate(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Cluster/MemberUpdate",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ClusterServer).MemberUpdate(ctx, req.(*MemberUpdateRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Cluster_MemberList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MemberListRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ClusterServer).MemberList(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Cluster/MemberList",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ClusterServer).MemberList(ctx, req.(*MemberListRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _Cluster_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.Cluster",
- HandlerType: (*ClusterServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "MemberAdd",
- Handler: _Cluster_MemberAdd_Handler,
- },
- {
- MethodName: "MemberRemove",
- Handler: _Cluster_MemberRemove_Handler,
- },
- {
- MethodName: "MemberUpdate",
- Handler: _Cluster_MemberUpdate_Handler,
- },
- {
- MethodName: "MemberList",
- Handler: _Cluster_MemberList_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: fileDescriptorRpc,
-}
-
-// Client API for Maintenance service
-
-type MaintenanceClient interface {
- // Alarm activates, deactivates, and queries alarms regarding cluster health.
- Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error)
- // Status gets the status of the member.
- Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
- // Defragment defragments a member's backend database to recover storage space.
- Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error)
- // Hash returns the hash of the local KV state for consistency checking purpose.
- // This is designed for testing; do not use this in production when there
- // are ongoing transactions.
- Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error)
- // Snapshot sends a snapshot of the entire backend from a member over a stream to a client.
- Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (Maintenance_SnapshotClient, error)
-}
-
-type maintenanceClient struct {
- cc *grpc.ClientConn
-}
-
-func NewMaintenanceClient(cc *grpc.ClientConn) MaintenanceClient {
- return &maintenanceClient{cc}
-}
-
-func (c *maintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) {
- out := new(AlarmResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Alarm", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *maintenanceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
- out := new(StatusResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Status", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *maintenanceClient) Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) {
- out := new(DefragmentResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Defragment", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *maintenanceClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) {
- out := new(HashResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Hash", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *maintenanceClient) Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (Maintenance_SnapshotClient, error) {
- stream, err := grpc.NewClientStream(ctx, &_Maintenance_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Maintenance/Snapshot", opts...)
- if err != nil {
- return nil, err
- }
- x := &maintenanceSnapshotClient{stream}
- if err := x.ClientStream.SendMsg(in); err != nil {
- return nil, err
- }
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- return x, nil
-}
-
-type Maintenance_SnapshotClient interface {
- Recv() (*SnapshotResponse, error)
- grpc.ClientStream
-}
-
-type maintenanceSnapshotClient struct {
- grpc.ClientStream
-}
-
-func (x *maintenanceSnapshotClient) Recv() (*SnapshotResponse, error) {
- m := new(SnapshotResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// Server API for Maintenance service
-
-type MaintenanceServer interface {
- // Alarm activates, deactivates, and queries alarms regarding cluster health.
- Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error)
- // Status gets the status of the member.
- Status(context.Context, *StatusRequest) (*StatusResponse, error)
- // Defragment defragments a member's backend database to recover storage space.
- Defragment(context.Context, *DefragmentRequest) (*DefragmentResponse, error)
- // Hash returns the hash of the local KV state for consistency checking purpose.
- // This is designed for testing; do not use this in production when there
- // are ongoing transactions.
- Hash(context.Context, *HashRequest) (*HashResponse, error)
- // Snapshot sends a snapshot of the entire backend from a member over a stream to a client.
- Snapshot(*SnapshotRequest, Maintenance_SnapshotServer) error
-}
-
-func RegisterMaintenanceServer(s *grpc.Server, srv MaintenanceServer) {
- s.RegisterService(&_Maintenance_serviceDesc, srv)
-}
-
-func _Maintenance_Alarm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AlarmRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(MaintenanceServer).Alarm(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Maintenance/Alarm",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MaintenanceServer).Alarm(ctx, req.(*AlarmRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Maintenance_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(StatusRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(MaintenanceServer).Status(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Maintenance/Status",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MaintenanceServer).Status(ctx, req.(*StatusRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Maintenance_Defragment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DefragmentRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(MaintenanceServer).Defragment(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Maintenance/Defragment",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MaintenanceServer).Defragment(ctx, req.(*DefragmentRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Maintenance_Hash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(HashRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(MaintenanceServer).Hash(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Maintenance/Hash",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MaintenanceServer).Hash(ctx, req.(*HashRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Maintenance_Snapshot_Handler(srv interface{}, stream grpc.ServerStream) error {
- m := new(SnapshotRequest)
- if err := stream.RecvMsg(m); err != nil {
- return err
- }
- return srv.(MaintenanceServer).Snapshot(m, &maintenanceSnapshotServer{stream})
-}
-
-type Maintenance_SnapshotServer interface {
- Send(*SnapshotResponse) error
- grpc.ServerStream
-}
-
-type maintenanceSnapshotServer struct {
- grpc.ServerStream
-}
-
-func (x *maintenanceSnapshotServer) Send(m *SnapshotResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-var _Maintenance_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.Maintenance",
- HandlerType: (*MaintenanceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "Alarm",
- Handler: _Maintenance_Alarm_Handler,
- },
- {
- MethodName: "Status",
- Handler: _Maintenance_Status_Handler,
- },
- {
- MethodName: "Defragment",
- Handler: _Maintenance_Defragment_Handler,
- },
- {
- MethodName: "Hash",
- Handler: _Maintenance_Hash_Handler,
- },
- },
- Streams: []grpc.StreamDesc{
- {
- StreamName: "Snapshot",
- Handler: _Maintenance_Snapshot_Handler,
- ServerStreams: true,
- },
- },
- Metadata: fileDescriptorRpc,
-}
-
-// Client API for Auth service
-
-type AuthClient interface {
- // AuthEnable enables authentication.
- AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error)
- // AuthDisable disables authentication.
- AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error)
- // Authenticate processes an authenticate request.
- Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error)
- // UserAdd adds a new user.
- UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error)
- // UserGet gets detailed user information.
- UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error)
- // UserList gets a list of all users.
- UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error)
- // UserDelete deletes a specified user.
- UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error)
- // UserChangePassword changes the password of a specified user.
- UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error)
- // UserGrant grants a role to a specified user.
- UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error)
- // UserRevokeRole revokes a role of specified user.
- UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error)
- // RoleAdd adds a new role.
- RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error)
- // RoleGet gets detailed role information.
- RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error)
- // RoleList gets lists of all roles.
- RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error)
- // RoleDelete deletes a specified role.
- RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error)
- // RoleGrantPermission grants a permission of a specified key or range to a specified role.
- RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error)
- // RoleRevokePermission revokes a key or range permission of a specified role.
- RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error)
-}
-
-type authClient struct {
- cc *grpc.ClientConn
-}
-
-func NewAuthClient(cc *grpc.ClientConn) AuthClient {
- return &authClient{cc}
-}
-
-func (c *authClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) {
- out := new(AuthEnableResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/AuthEnable", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) {
- out := new(AuthDisableResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/AuthDisable", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) {
- out := new(AuthenticateResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/Authenticate", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) {
- out := new(AuthUserAddResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserAdd", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) {
- out := new(AuthUserGetResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserGet", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) {
- out := new(AuthUserListResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserList", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) {
- out := new(AuthUserDeleteResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserDelete", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) {
- out := new(AuthUserChangePasswordResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserChangePassword", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) {
- out := new(AuthUserGrantRoleResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserGrantRole", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) {
- out := new(AuthUserRevokeRoleResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserRevokeRole", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) {
- out := new(AuthRoleAddResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleAdd", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) {
- out := new(AuthRoleGetResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleGet", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) {
- out := new(AuthRoleListResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleList", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) {
- out := new(AuthRoleDeleteResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleDelete", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) {
- out := new(AuthRoleGrantPermissionResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleGrantPermission", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *authClient) RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) {
- out := new(AuthRoleRevokePermissionResponse)
- err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleRevokePermission", in, out, c.cc, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// Server API for Auth service
-
-type AuthServer interface {
- // AuthEnable enables authentication.
- AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error)
- // AuthDisable disables authentication.
- AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error)
- // Authenticate processes an authenticate request.
- Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
- // UserAdd adds a new user.
- UserAdd(context.Context, *AuthUserAddRequest) (*AuthUserAddResponse, error)
- // UserGet gets detailed user information.
- UserGet(context.Context, *AuthUserGetRequest) (*AuthUserGetResponse, error)
- // UserList gets a list of all users.
- UserList(context.Context, *AuthUserListRequest) (*AuthUserListResponse, error)
- // UserDelete deletes a specified user.
- UserDelete(context.Context, *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error)
- // UserChangePassword changes the password of a specified user.
- UserChangePassword(context.Context, *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error)
- // UserGrant grants a role to a specified user.
- UserGrantRole(context.Context, *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error)
- // UserRevokeRole revokes a role of specified user.
- UserRevokeRole(context.Context, *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error)
- // RoleAdd adds a new role.
- RoleAdd(context.Context, *AuthRoleAddRequest) (*AuthRoleAddResponse, error)
- // RoleGet gets detailed role information.
- RoleGet(context.Context, *AuthRoleGetRequest) (*AuthRoleGetResponse, error)
- // RoleList gets lists of all roles.
- RoleList(context.Context, *AuthRoleListRequest) (*AuthRoleListResponse, error)
- // RoleDelete deletes a specified role.
- RoleDelete(context.Context, *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error)
- // RoleGrantPermission grants a permission of a specified key or range to a specified role.
- RoleGrantPermission(context.Context, *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error)
- // RoleRevokePermission revokes a key or range permission of a specified role.
- RoleRevokePermission(context.Context, *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error)
-}
-
-func RegisterAuthServer(s *grpc.Server, srv AuthServer) {
- s.RegisterService(&_Auth_serviceDesc, srv)
-}
-
-func _Auth_AuthEnable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthEnableRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).AuthEnable(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/AuthEnable",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).AuthEnable(ctx, req.(*AuthEnableRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_AuthDisable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthDisableRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).AuthDisable(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/AuthDisable",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).AuthDisable(ctx, req.(*AuthDisableRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthenticateRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).Authenticate(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/Authenticate",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).Authenticate(ctx, req.(*AuthenticateRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserAddRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserAdd(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserAdd",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserAdd(ctx, req.(*AuthUserAddRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserGetRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserGet(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserGet",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserGet(ctx, req.(*AuthUserGetRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserListRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserList(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserList",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserList(ctx, req.(*AuthUserListRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserDeleteRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserDelete(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserDelete",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserDelete(ctx, req.(*AuthUserDeleteRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserChangePasswordRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserChangePassword(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserChangePassword",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserChangePassword(ctx, req.(*AuthUserChangePasswordRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserGrantRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserGrantRoleRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserGrantRole(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserGrantRole",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserGrantRole(ctx, req.(*AuthUserGrantRoleRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_UserRevokeRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthUserRevokeRoleRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).UserRevokeRole(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/UserRevokeRole",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).UserRevokeRole(ctx, req.(*AuthUserRevokeRoleRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleAddRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleAdd(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleAdd",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleAdd(ctx, req.(*AuthRoleAddRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleGetRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleGet(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleGet",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleGet(ctx, req.(*AuthRoleGetRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleListRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleList(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleList",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleList(ctx, req.(*AuthRoleListRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleDeleteRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleDelete(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleDelete",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleDelete(ctx, req.(*AuthRoleDeleteRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleGrantPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleGrantPermissionRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleGrantPermission(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleGrantPermission",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleGrantPermission(ctx, req.(*AuthRoleGrantPermissionRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Auth_RoleRevokePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(AuthRoleRevokePermissionRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(AuthServer).RoleRevokePermission(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/etcdserverpb.Auth/RoleRevokePermission",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(AuthServer).RoleRevokePermission(ctx, req.(*AuthRoleRevokePermissionRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _Auth_serviceDesc = grpc.ServiceDesc{
- ServiceName: "etcdserverpb.Auth",
- HandlerType: (*AuthServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "AuthEnable",
- Handler: _Auth_AuthEnable_Handler,
- },
- {
- MethodName: "AuthDisable",
- Handler: _Auth_AuthDisable_Handler,
- },
- {
- MethodName: "Authenticate",
- Handler: _Auth_Authenticate_Handler,
- },
- {
- MethodName: "UserAdd",
- Handler: _Auth_UserAdd_Handler,
- },
- {
- MethodName: "UserGet",
- Handler: _Auth_UserGet_Handler,
- },
- {
- MethodName: "UserList",
- Handler: _Auth_UserList_Handler,
- },
- {
- MethodName: "UserDelete",
- Handler: _Auth_UserDelete_Handler,
- },
- {
- MethodName: "UserChangePassword",
- Handler: _Auth_UserChangePassword_Handler,
- },
- {
- MethodName: "UserGrantRole",
- Handler: _Auth_UserGrantRole_Handler,
- },
- {
- MethodName: "UserRevokeRole",
- Handler: _Auth_UserRevokeRole_Handler,
- },
- {
- MethodName: "RoleAdd",
- Handler: _Auth_RoleAdd_Handler,
- },
- {
- MethodName: "RoleGet",
- Handler: _Auth_RoleGet_Handler,
- },
- {
- MethodName: "RoleList",
- Handler: _Auth_RoleList_Handler,
- },
- {
- MethodName: "RoleDelete",
- Handler: _Auth_RoleDelete_Handler,
- },
- {
- MethodName: "RoleGrantPermission",
- Handler: _Auth_RoleGrantPermission_Handler,
- },
- {
- MethodName: "RoleRevokePermission",
- Handler: _Auth_RoleRevokePermission_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: fileDescriptorRpc,
-}
-
-func (m *ResponseHeader) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *ResponseHeader) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ClusterId != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ClusterId))
- }
- if m.MemberId != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.MemberId))
- }
- if m.Revision != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.Revision))
- }
- if m.RaftTerm != 0 {
- data[i] = 0x20
- i++
- i = encodeVarintRpc(data, i, uint64(m.RaftTerm))
- }
- return i, nil
-}
-
-func (m *RangeRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *RangeRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Key) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.RangeEnd) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
- i += copy(data[i:], m.RangeEnd)
- }
- if m.Limit != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.Limit))
- }
- if m.Revision != 0 {
- data[i] = 0x20
- i++
- i = encodeVarintRpc(data, i, uint64(m.Revision))
- }
- if m.SortOrder != 0 {
- data[i] = 0x28
- i++
- i = encodeVarintRpc(data, i, uint64(m.SortOrder))
- }
- if m.SortTarget != 0 {
- data[i] = 0x30
- i++
- i = encodeVarintRpc(data, i, uint64(m.SortTarget))
- }
- if m.Serializable {
- data[i] = 0x38
- i++
- if m.Serializable {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.KeysOnly {
- data[i] = 0x40
- i++
- if m.KeysOnly {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.CountOnly {
- data[i] = 0x48
- i++
- if m.CountOnly {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- return i, nil
-}
-
-func (m *RangeResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *RangeResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n1, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n1
- }
- if len(m.Kvs) > 0 {
- for _, msg := range m.Kvs {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- if m.More {
- data[i] = 0x18
- i++
- if m.More {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.Count != 0 {
- data[i] = 0x20
- i++
- i = encodeVarintRpc(data, i, uint64(m.Count))
- }
- return i, nil
-}
-
-func (m *PutRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *PutRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Key) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.Value) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Value)))
- i += copy(data[i:], m.Value)
- }
- if m.Lease != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.Lease))
- }
- if m.PrevKv {
- data[i] = 0x20
- i++
- if m.PrevKv {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- return i, nil
-}
-
-func (m *PutResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *PutResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n2, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n2
- }
- if m.PrevKv != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.PrevKv.Size()))
- n3, err := m.PrevKv.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n3
- }
- return i, nil
-}
-
-func (m *DeleteRangeRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *DeleteRangeRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Key) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.RangeEnd) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
- i += copy(data[i:], m.RangeEnd)
- }
- if m.PrevKv {
- data[i] = 0x18
- i++
- if m.PrevKv {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- return i, nil
-}
-
-func (m *DeleteRangeResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *DeleteRangeResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n4, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n4
- }
- if m.Deleted != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.Deleted))
- }
- if len(m.PrevKvs) > 0 {
- for _, msg := range m.PrevKvs {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *RequestOp) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *RequestOp) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Request != nil {
- nn5, err := m.Request.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += nn5
- }
- return i, nil
-}
-
-func (m *RequestOp_RequestRange) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.RequestRange != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.RequestRange.Size()))
- n6, err := m.RequestRange.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n6
- }
- return i, nil
-}
-func (m *RequestOp_RequestPut) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.RequestPut != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.RequestPut.Size()))
- n7, err := m.RequestPut.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n7
- }
- return i, nil
-}
-func (m *RequestOp_RequestDeleteRange) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.RequestDeleteRange != nil {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(m.RequestDeleteRange.Size()))
- n8, err := m.RequestDeleteRange.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n8
- }
- return i, nil
-}
-func (m *ResponseOp) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *ResponseOp) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Response != nil {
- nn9, err := m.Response.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += nn9
- }
- return i, nil
-}
-
-func (m *ResponseOp_ResponseRange) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.ResponseRange != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.ResponseRange.Size()))
- n10, err := m.ResponseRange.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n10
- }
- return i, nil
-}
-func (m *ResponseOp_ResponsePut) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.ResponsePut != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.ResponsePut.Size()))
- n11, err := m.ResponsePut.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n11
- }
- return i, nil
-}
-func (m *ResponseOp_ResponseDeleteRange) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.ResponseDeleteRange != nil {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(m.ResponseDeleteRange.Size()))
- n12, err := m.ResponseDeleteRange.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n12
- }
- return i, nil
-}
-func (m *Compare) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Compare) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Result != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.Result))
- }
- if m.Target != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.Target))
- }
- if len(m.Key) > 0 {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if m.TargetUnion != nil {
- nn13, err := m.TargetUnion.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += nn13
- }
- return i, nil
-}
-
-func (m *Compare_Version) MarshalTo(data []byte) (int, error) {
- i := 0
- data[i] = 0x20
- i++
- i = encodeVarintRpc(data, i, uint64(m.Version))
- return i, nil
-}
-func (m *Compare_CreateRevision) MarshalTo(data []byte) (int, error) {
- i := 0
- data[i] = 0x28
- i++
- i = encodeVarintRpc(data, i, uint64(m.CreateRevision))
- return i, nil
-}
-func (m *Compare_ModRevision) MarshalTo(data []byte) (int, error) {
- i := 0
- data[i] = 0x30
- i++
- i = encodeVarintRpc(data, i, uint64(m.ModRevision))
- return i, nil
-}
-func (m *Compare_Value) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.Value != nil {
- data[i] = 0x3a
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Value)))
- i += copy(data[i:], m.Value)
- }
- return i, nil
-}
-func (m *TxnRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *TxnRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Compare) > 0 {
- for _, msg := range m.Compare {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- if len(m.Success) > 0 {
- for _, msg := range m.Success {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- if len(m.Failure) > 0 {
- for _, msg := range m.Failure {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *TxnResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *TxnResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n14, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n14
- }
- if m.Succeeded {
- data[i] = 0x10
- i++
- if m.Succeeded {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if len(m.Responses) > 0 {
- for _, msg := range m.Responses {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *CompactionRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *CompactionRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Revision != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.Revision))
- }
- if m.Physical {
- data[i] = 0x10
- i++
- if m.Physical {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- return i, nil
-}
-
-func (m *CompactionResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *CompactionResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n15, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n15
- }
- return i, nil
-}
-
-func (m *HashRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *HashRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *HashResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *HashResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n16, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n16
- }
- if m.Hash != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.Hash))
- }
- return i, nil
-}
-
-func (m *SnapshotRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *SnapshotRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *SnapshotResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *SnapshotResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n17, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n17
- }
- if m.RemainingBytes != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.RemainingBytes))
- }
- if len(m.Blob) > 0 {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Blob)))
- i += copy(data[i:], m.Blob)
- }
- return i, nil
-}
-
-func (m *WatchRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *WatchRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.RequestUnion != nil {
- nn18, err := m.RequestUnion.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += nn18
- }
- return i, nil
-}
-
-func (m *WatchRequest_CreateRequest) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.CreateRequest != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.CreateRequest.Size()))
- n19, err := m.CreateRequest.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n19
- }
- return i, nil
-}
-func (m *WatchRequest_CancelRequest) MarshalTo(data []byte) (int, error) {
- i := 0
- if m.CancelRequest != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.CancelRequest.Size()))
- n20, err := m.CancelRequest.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n20
- }
- return i, nil
-}
-func (m *WatchCreateRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *WatchCreateRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Key) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.RangeEnd) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
- i += copy(data[i:], m.RangeEnd)
- }
- if m.StartRevision != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.StartRevision))
- }
- if m.ProgressNotify {
- data[i] = 0x20
- i++
- if m.ProgressNotify {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.PrevKv {
- data[i] = 0x30
- i++
- if m.PrevKv {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- return i, nil
-}
-
-func (m *WatchCancelRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *WatchCancelRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.WatchId != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.WatchId))
- }
- return i, nil
-}
-
-func (m *WatchResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *WatchResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n21, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n21
- }
- if m.WatchId != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.WatchId))
- }
- if m.Created {
- data[i] = 0x18
- i++
- if m.Created {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.Canceled {
- data[i] = 0x20
- i++
- if m.Canceled {
- data[i] = 1
- } else {
- data[i] = 0
- }
- i++
- }
- if m.CompactRevision != 0 {
- data[i] = 0x28
- i++
- i = encodeVarintRpc(data, i, uint64(m.CompactRevision))
- }
- if len(m.Events) > 0 {
- for _, msg := range m.Events {
- data[i] = 0x5a
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *LeaseGrantRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseGrantRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.TTL != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.TTL))
- }
- if m.ID != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- return i, nil
-}
-
-func (m *LeaseGrantResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseGrantResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n22, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n22
- }
- if m.ID != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- if m.TTL != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.TTL))
- }
- if len(m.Error) > 0 {
- data[i] = 0x22
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Error)))
- i += copy(data[i:], m.Error)
- }
- return i, nil
-}
-
-func (m *LeaseRevokeRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseRevokeRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- return i, nil
-}
-
-func (m *LeaseRevokeResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseRevokeResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n23, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n23
- }
- return i, nil
-}
-
-func (m *LeaseKeepAliveRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseKeepAliveRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- return i, nil
-}
-
-func (m *LeaseKeepAliveResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *LeaseKeepAliveResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n24, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n24
- }
- if m.ID != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- if m.TTL != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.TTL))
- }
- return i, nil
-}
-
-func (m *Member) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Member) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- if len(m.Name) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- data[i] = 0x1a
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- if len(m.ClientURLs) > 0 {
- for _, s := range m.ClientURLs {
- data[i] = 0x22
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *MemberAddRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberAddRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- data[i] = 0xa
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *MemberAddResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberAddResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n25, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n25
- }
- if m.Member != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.Member.Size()))
- n26, err := m.Member.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n26
- }
- return i, nil
-}
-
-func (m *MemberRemoveRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberRemoveRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- return i, nil
-}
-
-func (m *MemberRemoveResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberRemoveResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n27, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n27
- }
- return i, nil
-}
-
-func (m *MemberUpdateRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberUpdateRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.ID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.ID))
- }
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- data[i] = 0x12
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *MemberUpdateResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberUpdateResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n28, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n28
- }
- return i, nil
-}
-
-func (m *MemberListRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberListRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *MemberListResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *MemberListResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n29, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n29
- }
- if len(m.Members) > 0 {
- for _, msg := range m.Members {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *DefragmentRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *DefragmentRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *DefragmentResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *DefragmentResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n30, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n30
- }
- return i, nil
-}
-
-func (m *AlarmRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AlarmRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Action != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.Action))
- }
- if m.MemberID != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.MemberID))
- }
- if m.Alarm != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.Alarm))
- }
- return i, nil
-}
-
-func (m *AlarmMember) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AlarmMember) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.MemberID != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintRpc(data, i, uint64(m.MemberID))
- }
- if m.Alarm != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintRpc(data, i, uint64(m.Alarm))
- }
- return i, nil
-}
-
-func (m *AlarmResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AlarmResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n31, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n31
- }
- if len(m.Alarms) > 0 {
- for _, msg := range m.Alarms {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *StatusRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *StatusRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *StatusResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *StatusResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n32, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n32
- }
- if len(m.Version) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Version)))
- i += copy(data[i:], m.Version)
- }
- if m.DbSize != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintRpc(data, i, uint64(m.DbSize))
- }
- if m.Leader != 0 {
- data[i] = 0x20
- i++
- i = encodeVarintRpc(data, i, uint64(m.Leader))
- }
- if m.RaftIndex != 0 {
- data[i] = 0x28
- i++
- i = encodeVarintRpc(data, i, uint64(m.RaftIndex))
- }
- if m.RaftTerm != 0 {
- data[i] = 0x30
- i++
- i = encodeVarintRpc(data, i, uint64(m.RaftTerm))
- }
- return i, nil
-}
-
-func (m *AuthEnableRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthEnableRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *AuthDisableRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthDisableRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *AuthenticateRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthenticateRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Password) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Password)))
- i += copy(data[i:], m.Password)
- }
- return i, nil
-}
-
-func (m *AuthUserAddRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserAddRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Password) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Password)))
- i += copy(data[i:], m.Password)
- }
- return i, nil
-}
-
-func (m *AuthUserGetRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserGetRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- return i, nil
-}
-
-func (m *AuthUserDeleteRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserDeleteRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- return i, nil
-}
-
-func (m *AuthUserChangePasswordRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserChangePasswordRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Password) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Password)))
- i += copy(data[i:], m.Password)
- }
- return i, nil
-}
-
-func (m *AuthUserGrantRoleRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserGrantRoleRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.User) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.User)))
- i += copy(data[i:], m.User)
- }
- if len(m.Role) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Role)))
- i += copy(data[i:], m.Role)
- }
- return i, nil
-}
-
-func (m *AuthUserRevokeRoleRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserRevokeRoleRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if len(m.Role) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Role)))
- i += copy(data[i:], m.Role)
- }
- return i, nil
-}
-
-func (m *AuthRoleAddRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleAddRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- return i, nil
-}
-
-func (m *AuthRoleGetRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleGetRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Role) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Role)))
- i += copy(data[i:], m.Role)
- }
- return i, nil
-}
-
-func (m *AuthUserListRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserListRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *AuthRoleListRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleListRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- return i, nil
-}
-
-func (m *AuthRoleDeleteRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleDeleteRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Role) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Role)))
- i += copy(data[i:], m.Role)
- }
- return i, nil
-}
-
-func (m *AuthRoleGrantPermissionRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleGrantPermissionRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Name) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Name)))
- i += copy(data[i:], m.Name)
- }
- if m.Perm != nil {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(m.Perm.Size()))
- n33, err := m.Perm.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n33
- }
- return i, nil
-}
-
-func (m *AuthRoleRevokePermissionRequest) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleRevokePermissionRequest) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Role) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Role)))
- i += copy(data[i:], m.Role)
- }
- if len(m.Key) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if len(m.RangeEnd) > 0 {
- data[i] = 0x1a
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.RangeEnd)))
- i += copy(data[i:], m.RangeEnd)
- }
- return i, nil
-}
-
-func (m *AuthEnableResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthEnableResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n34, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n34
- }
- return i, nil
-}
-
-func (m *AuthDisableResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthDisableResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n35, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n35
- }
- return i, nil
-}
-
-func (m *AuthenticateResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthenticateResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n36, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n36
- }
- if len(m.Token) > 0 {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(len(m.Token)))
- i += copy(data[i:], m.Token)
- }
- return i, nil
-}
-
-func (m *AuthUserAddResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserAddResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n37, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n37
- }
- return i, nil
-}
-
-func (m *AuthUserGetResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserGetResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n38, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n38
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- data[i] = 0x12
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *AuthUserDeleteResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserDeleteResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n39, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n39
- }
- return i, nil
-}
-
-func (m *AuthUserChangePasswordResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserChangePasswordResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n40, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n40
- }
- return i, nil
-}
-
-func (m *AuthUserGrantRoleResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserGrantRoleResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n41, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n41
- }
- return i, nil
-}
-
-func (m *AuthUserRevokeRoleResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserRevokeRoleResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n42, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n42
- }
- return i, nil
-}
-
-func (m *AuthRoleAddResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleAddResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n43, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n43
- }
- return i, nil
-}
-
-func (m *AuthRoleGetResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleGetResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n44, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n44
- }
- if len(m.Perm) > 0 {
- for _, msg := range m.Perm {
- data[i] = 0x12
- i++
- i = encodeVarintRpc(data, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- return i, nil
-}
-
-func (m *AuthRoleListResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleListResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n45, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n45
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- data[i] = 0x12
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *AuthUserListResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthUserListResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n46, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n46
- }
- if len(m.Users) > 0 {
- for _, s := range m.Users {
- data[i] = 0x12
- i++
- l = len(s)
- for l >= 1<<7 {
- data[i] = uint8(uint64(l)&0x7f | 0x80)
- l >>= 7
- i++
- }
- data[i] = uint8(l)
- i++
- i += copy(data[i:], s)
- }
- }
- return i, nil
-}
-
-func (m *AuthRoleDeleteResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleDeleteResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n47, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n47
- }
- return i, nil
-}
-
-func (m *AuthRoleGrantPermissionResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleGrantPermissionResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n48, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n48
- }
- return i, nil
-}
-
-func (m *AuthRoleRevokePermissionResponse) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *AuthRoleRevokePermissionResponse) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Header != nil {
- data[i] = 0xa
- i++
- i = encodeVarintRpc(data, i, uint64(m.Header.Size()))
- n49, err := m.Header.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n49
- }
- return i, nil
-}
-
-func encodeFixed64Rpc(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32Rpc(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintRpc(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
-}
-func (m *ResponseHeader) Size() (n int) {
- var l int
- _ = l
- if m.ClusterId != 0 {
- n += 1 + sovRpc(uint64(m.ClusterId))
- }
- if m.MemberId != 0 {
- n += 1 + sovRpc(uint64(m.MemberId))
- }
- if m.Revision != 0 {
- n += 1 + sovRpc(uint64(m.Revision))
- }
- if m.RaftTerm != 0 {
- n += 1 + sovRpc(uint64(m.RaftTerm))
- }
- return n
-}
-
-func (m *RangeRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.RangeEnd)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Limit != 0 {
- n += 1 + sovRpc(uint64(m.Limit))
- }
- if m.Revision != 0 {
- n += 1 + sovRpc(uint64(m.Revision))
- }
- if m.SortOrder != 0 {
- n += 1 + sovRpc(uint64(m.SortOrder))
- }
- if m.SortTarget != 0 {
- n += 1 + sovRpc(uint64(m.SortTarget))
- }
- if m.Serializable {
- n += 2
- }
- if m.KeysOnly {
- n += 2
- }
- if m.CountOnly {
- n += 2
- }
- return n
-}
-
-func (m *RangeResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Kvs) > 0 {
- for _, e := range m.Kvs {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- if m.More {
- n += 2
- }
- if m.Count != 0 {
- n += 1 + sovRpc(uint64(m.Count))
- }
- return n
-}
-
-func (m *PutRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Value)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Lease != 0 {
- n += 1 + sovRpc(uint64(m.Lease))
- }
- if m.PrevKv {
- n += 2
- }
- return n
-}
-
-func (m *PutResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.PrevKv != nil {
- l = m.PrevKv.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *DeleteRangeRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.RangeEnd)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.PrevKv {
- n += 2
- }
- return n
-}
-
-func (m *DeleteRangeResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Deleted != 0 {
- n += 1 + sovRpc(uint64(m.Deleted))
- }
- if len(m.PrevKvs) > 0 {
- for _, e := range m.PrevKvs {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *RequestOp) Size() (n int) {
- var l int
- _ = l
- if m.Request != nil {
- n += m.Request.Size()
- }
- return n
-}
-
-func (m *RequestOp_RequestRange) Size() (n int) {
- var l int
- _ = l
- if m.RequestRange != nil {
- l = m.RequestRange.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *RequestOp_RequestPut) Size() (n int) {
- var l int
- _ = l
- if m.RequestPut != nil {
- l = m.RequestPut.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *RequestOp_RequestDeleteRange) Size() (n int) {
- var l int
- _ = l
- if m.RequestDeleteRange != nil {
- l = m.RequestDeleteRange.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *ResponseOp) Size() (n int) {
- var l int
- _ = l
- if m.Response != nil {
- n += m.Response.Size()
- }
- return n
-}
-
-func (m *ResponseOp_ResponseRange) Size() (n int) {
- var l int
- _ = l
- if m.ResponseRange != nil {
- l = m.ResponseRange.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *ResponseOp_ResponsePut) Size() (n int) {
- var l int
- _ = l
- if m.ResponsePut != nil {
- l = m.ResponsePut.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *ResponseOp_ResponseDeleteRange) Size() (n int) {
- var l int
- _ = l
- if m.ResponseDeleteRange != nil {
- l = m.ResponseDeleteRange.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *Compare) Size() (n int) {
- var l int
- _ = l
- if m.Result != 0 {
- n += 1 + sovRpc(uint64(m.Result))
- }
- if m.Target != 0 {
- n += 1 + sovRpc(uint64(m.Target))
- }
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.TargetUnion != nil {
- n += m.TargetUnion.Size()
- }
- return n
-}
-
-func (m *Compare_Version) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovRpc(uint64(m.Version))
- return n
-}
-func (m *Compare_CreateRevision) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovRpc(uint64(m.CreateRevision))
- return n
-}
-func (m *Compare_ModRevision) Size() (n int) {
- var l int
- _ = l
- n += 1 + sovRpc(uint64(m.ModRevision))
- return n
-}
-func (m *Compare_Value) Size() (n int) {
- var l int
- _ = l
- if m.Value != nil {
- l = len(m.Value)
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *TxnRequest) Size() (n int) {
- var l int
- _ = l
- if len(m.Compare) > 0 {
- for _, e := range m.Compare {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- if len(m.Success) > 0 {
- for _, e := range m.Success {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- if len(m.Failure) > 0 {
- for _, e := range m.Failure {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *TxnResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Succeeded {
- n += 2
- }
- if len(m.Responses) > 0 {
- for _, e := range m.Responses {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *CompactionRequest) Size() (n int) {
- var l int
- _ = l
- if m.Revision != 0 {
- n += 1 + sovRpc(uint64(m.Revision))
- }
- if m.Physical {
- n += 2
- }
- return n
-}
-
-func (m *CompactionResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *HashRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *HashResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Hash != 0 {
- n += 1 + sovRpc(uint64(m.Hash))
- }
- return n
-}
-
-func (m *SnapshotRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *SnapshotResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.RemainingBytes != 0 {
- n += 1 + sovRpc(uint64(m.RemainingBytes))
- }
- l = len(m.Blob)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *WatchRequest) Size() (n int) {
- var l int
- _ = l
- if m.RequestUnion != nil {
- n += m.RequestUnion.Size()
- }
- return n
-}
-
-func (m *WatchRequest_CreateRequest) Size() (n int) {
- var l int
- _ = l
- if m.CreateRequest != nil {
- l = m.CreateRequest.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *WatchRequest_CancelRequest) Size() (n int) {
- var l int
- _ = l
- if m.CancelRequest != nil {
- l = m.CancelRequest.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-func (m *WatchCreateRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.RangeEnd)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.StartRevision != 0 {
- n += 1 + sovRpc(uint64(m.StartRevision))
- }
- if m.ProgressNotify {
- n += 2
- }
- if m.PrevKv {
- n += 2
- }
- return n
-}
-
-func (m *WatchCancelRequest) Size() (n int) {
- var l int
- _ = l
- if m.WatchId != 0 {
- n += 1 + sovRpc(uint64(m.WatchId))
- }
- return n
-}
-
-func (m *WatchResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.WatchId != 0 {
- n += 1 + sovRpc(uint64(m.WatchId))
- }
- if m.Created {
- n += 2
- }
- if m.Canceled {
- n += 2
- }
- if m.CompactRevision != 0 {
- n += 1 + sovRpc(uint64(m.CompactRevision))
- }
- if len(m.Events) > 0 {
- for _, e := range m.Events {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *LeaseGrantRequest) Size() (n int) {
- var l int
- _ = l
- if m.TTL != 0 {
- n += 1 + sovRpc(uint64(m.TTL))
- }
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- return n
-}
-
-func (m *LeaseGrantResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- if m.TTL != 0 {
- n += 1 + sovRpc(uint64(m.TTL))
- }
- l = len(m.Error)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *LeaseRevokeRequest) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- return n
-}
-
-func (m *LeaseRevokeResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *LeaseKeepAliveRequest) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- return n
-}
-
-func (m *LeaseKeepAliveResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- if m.TTL != 0 {
- n += 1 + sovRpc(uint64(m.TTL))
- }
- return n
-}
-
-func (m *Member) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- if len(m.ClientURLs) > 0 {
- for _, s := range m.ClientURLs {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *MemberAddRequest) Size() (n int) {
- var l int
- _ = l
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *MemberAddResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Member != nil {
- l = m.Member.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *MemberRemoveRequest) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- return n
-}
-
-func (m *MemberRemoveResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *MemberUpdateRequest) Size() (n int) {
- var l int
- _ = l
- if m.ID != 0 {
- n += 1 + sovRpc(uint64(m.ID))
- }
- if len(m.PeerURLs) > 0 {
- for _, s := range m.PeerURLs {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *MemberUpdateResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *MemberListRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *MemberListResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Members) > 0 {
- for _, e := range m.Members {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *DefragmentRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *DefragmentResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AlarmRequest) Size() (n int) {
- var l int
- _ = l
- if m.Action != 0 {
- n += 1 + sovRpc(uint64(m.Action))
- }
- if m.MemberID != 0 {
- n += 1 + sovRpc(uint64(m.MemberID))
- }
- if m.Alarm != 0 {
- n += 1 + sovRpc(uint64(m.Alarm))
- }
- return n
-}
-
-func (m *AlarmMember) Size() (n int) {
- var l int
- _ = l
- if m.MemberID != 0 {
- n += 1 + sovRpc(uint64(m.MemberID))
- }
- if m.Alarm != 0 {
- n += 1 + sovRpc(uint64(m.Alarm))
- }
- return n
-}
-
-func (m *AlarmResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Alarms) > 0 {
- for _, e := range m.Alarms {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *StatusRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *StatusResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Version)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.DbSize != 0 {
- n += 1 + sovRpc(uint64(m.DbSize))
- }
- if m.Leader != 0 {
- n += 1 + sovRpc(uint64(m.Leader))
- }
- if m.RaftIndex != 0 {
- n += 1 + sovRpc(uint64(m.RaftIndex))
- }
- if m.RaftTerm != 0 {
- n += 1 + sovRpc(uint64(m.RaftTerm))
- }
- return n
-}
-
-func (m *AuthEnableRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *AuthDisableRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *AuthenticateRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Password)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserAddRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Password)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserGetRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserDeleteRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserChangePasswordRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Password)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserGrantRoleRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.User)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Role)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserRevokeRoleRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Role)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleAddRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleGetRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Role)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserListRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *AuthRoleListRequest) Size() (n int) {
- var l int
- _ = l
- return n
-}
-
-func (m *AuthRoleDeleteRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Role)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleGrantPermissionRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Name)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- if m.Perm != nil {
- l = m.Perm.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleRevokePermissionRequest) Size() (n int) {
- var l int
- _ = l
- l = len(m.Role)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.RangeEnd)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthEnableResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthDisableResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthenticateResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- l = len(m.Token)
- if l > 0 {
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserAddResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserGetResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *AuthUserDeleteResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserChangePasswordResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserGrantRoleResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthUserRevokeRoleResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleAddResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleGetResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Perm) > 0 {
- for _, e := range m.Perm {
- l = e.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *AuthRoleListResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Roles) > 0 {
- for _, s := range m.Roles {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *AuthUserListResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- if len(m.Users) > 0 {
- for _, s := range m.Users {
- l = len(s)
- n += 1 + l + sovRpc(uint64(l))
- }
- }
- return n
-}
-
-func (m *AuthRoleDeleteResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleGrantPermissionResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func (m *AuthRoleRevokePermissionResponse) Size() (n int) {
- var l int
- _ = l
- if m.Header != nil {
- l = m.Header.Size()
- n += 1 + l + sovRpc(uint64(l))
- }
- return n
-}
-
-func sovRpc(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozRpc(x uint64) (n int) {
- return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *ResponseHeader) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ResponseHeader: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ResponseHeader: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType)
- }
- m.ClusterId = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ClusterId |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field MemberId", wireType)
- }
- m.MemberId = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.MemberId |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType)
- }
- m.Revision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Revision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field RaftTerm", wireType)
- }
- m.RaftTerm = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.RaftTerm |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *RangeRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: RangeRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: RangeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.RangeEnd = append(m.RangeEnd[:0], data[iNdEx:postIndex]...)
- if m.RangeEnd == nil {
- m.RangeEnd = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType)
- }
- m.Limit = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Limit |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType)
- }
- m.Revision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Revision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field SortOrder", wireType)
- }
- m.SortOrder = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.SortOrder |= (RangeRequest_SortOrder(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 6:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field SortTarget", wireType)
- }
- m.SortTarget = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.SortTarget |= (RangeRequest_SortTarget(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 7:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Serializable", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Serializable = bool(v != 0)
- case 8:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field KeysOnly", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.KeysOnly = bool(v != 0)
- case 9:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field CountOnly", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.CountOnly = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *RangeResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: RangeResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: RangeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Kvs", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Kvs = append(m.Kvs, &mvccpb.KeyValue{})
- if err := m.Kvs[len(m.Kvs)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field More", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.More = bool(v != 0)
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType)
- }
- m.Count = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Count |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *PutRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: PutRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Value = append(m.Value[:0], data[iNdEx:postIndex]...)
- if m.Value == nil {
- m.Value = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
- }
- m.Lease = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Lease |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.PrevKv = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *PutResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: PutResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.PrevKv == nil {
- m.PrevKv = &mvccpb.KeyValue{}
- }
- if err := m.PrevKv.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *DeleteRangeRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.RangeEnd = append(m.RangeEnd[:0], data[iNdEx:postIndex]...)
- if m.RangeEnd == nil {
- m.RangeEnd = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.PrevKv = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *DeleteRangeResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Deleted", wireType)
- }
- m.Deleted = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Deleted |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKvs", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.PrevKvs = append(m.PrevKvs, &mvccpb.KeyValue{})
- if err := m.PrevKvs[len(m.PrevKvs)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *RequestOp) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: RequestOp: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: RequestOp: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RequestRange", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &RangeRequest{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Request = &RequestOp_RequestRange{v}
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RequestPut", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &PutRequest{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Request = &RequestOp_RequestPut{v}
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RequestDeleteRange", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &DeleteRangeRequest{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Request = &RequestOp_RequestDeleteRange{v}
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *ResponseOp) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ResponseOp: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ResponseOp: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ResponseRange", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &RangeResponse{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Response = &ResponseOp_ResponseRange{v}
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ResponsePut", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &PutResponse{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Response = &ResponseOp_ResponsePut{v}
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ResponseDeleteRange", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &DeleteRangeResponse{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.Response = &ResponseOp_ResponseDeleteRange{v}
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Compare) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Compare: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Compare: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
- }
- m.Result = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Result |= (Compare_CompareResult(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType)
- }
- m.Target = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Target |= (Compare_CompareTarget(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
- }
- var v int64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.TargetUnion = &Compare_Version{v}
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
- }
- var v int64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.TargetUnion = &Compare_CreateRevision{v}
- case 6:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
- }
- var v int64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.TargetUnion = &Compare_ModRevision{v}
- case 7:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := make([]byte, postIndex-iNdEx)
- copy(v, data[iNdEx:postIndex])
- m.TargetUnion = &Compare_Value{v}
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *TxnRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: TxnRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: TxnRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Compare", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Compare = append(m.Compare, &Compare{})
- if err := m.Compare[len(m.Compare)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Success = append(m.Success, &RequestOp{})
- if err := m.Success[len(m.Success)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Failure", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Failure = append(m.Failure, &RequestOp{})
- if err := m.Failure[len(m.Failure)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *TxnResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: TxnResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: TxnResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Succeeded", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Succeeded = bool(v != 0)
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Responses = append(m.Responses, &ResponseOp{})
- if err := m.Responses[len(m.Responses)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *CompactionRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: CompactionRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: CompactionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType)
- }
- m.Revision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Revision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Physical", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Physical = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *CompactionResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: CompactionResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: CompactionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *HashRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: HashRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: HashRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *HashResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: HashResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: HashResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
- }
- m.Hash = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Hash |= (uint32(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *SnapshotRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: SnapshotRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: SnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *SnapshotResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: SnapshotResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: SnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field RemainingBytes", wireType)
- }
- m.RemainingBytes = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.RemainingBytes |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Blob", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Blob = append(m.Blob[:0], data[iNdEx:postIndex]...)
- if m.Blob == nil {
- m.Blob = []byte{}
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *WatchRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: WatchRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: WatchRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field CreateRequest", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &WatchCreateRequest{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.RequestUnion = &WatchRequest_CreateRequest{v}
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field CancelRequest", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- v := &WatchCancelRequest{}
- if err := v.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- m.RequestUnion = &WatchRequest_CancelRequest{v}
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *WatchCreateRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: WatchCreateRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: WatchCreateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.RangeEnd = append(m.RangeEnd[:0], data[iNdEx:postIndex]...)
- if m.RangeEnd == nil {
- m.RangeEnd = []byte{}
- }
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field StartRevision", wireType)
- }
- m.StartRevision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.StartRevision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ProgressNotify", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.ProgressNotify = bool(v != 0)
- case 6:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.PrevKv = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *WatchCancelRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: WatchCancelRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: WatchCancelRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType)
- }
- m.WatchId = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.WatchId |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *WatchResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: WatchResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: WatchResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType)
- }
- m.WatchId = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.WatchId |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Created", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Created = bool(v != 0)
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Canceled", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Canceled = bool(v != 0)
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field CompactRevision", wireType)
- }
- m.CompactRevision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.CompactRevision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 11:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Events = append(m.Events, &mvccpb.Event{})
- if err := m.Events[len(m.Events)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseGrantRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseGrantRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseGrantRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
- }
- m.TTL = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.TTL |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseGrantResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseGrantResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseGrantResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
- }
- m.TTL = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.TTL |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Error = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseRevokeRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseRevokeRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseRevokeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseRevokeResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseRevokeResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseRevokeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseKeepAliveRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseKeepAliveRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseKeepAliveRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *LeaseKeepAliveResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: LeaseKeepAliveResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: LeaseKeepAliveResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType)
- }
- m.TTL = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.TTL |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Member) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Member: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Member: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.PeerURLs = append(m.PeerURLs, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- case 4:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ClientURLs", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.ClientURLs = append(m.ClientURLs, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberAddRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberAddRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberAddRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.PeerURLs = append(m.PeerURLs, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberAddResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberAddResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberAddResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Member", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Member == nil {
- m.Member = &Member{}
- }
- if err := m.Member.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberRemoveRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberRemoveRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberRemoveRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberRemoveResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberRemoveResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberRemoveResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberUpdateRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberUpdateRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
- }
- m.ID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.PeerURLs = append(m.PeerURLs, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberUpdateResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberUpdateResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberListRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberListRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberListRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MemberListResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MemberListResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MemberListResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Members = append(m.Members, &Member{})
- if err := m.Members[len(m.Members)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *DefragmentRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: DefragmentRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: DefragmentRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *DefragmentResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: DefragmentResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: DefragmentResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AlarmRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AlarmRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AlarmRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType)
- }
- m.Action = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Action |= (AlarmRequest_AlarmAction(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field MemberID", wireType)
- }
- m.MemberID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.MemberID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType)
- }
- m.Alarm = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Alarm |= (AlarmType(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AlarmMember) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AlarmMember: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AlarmMember: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field MemberID", wireType)
- }
- m.MemberID = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.MemberID |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Alarm", wireType)
- }
- m.Alarm = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Alarm |= (AlarmType(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AlarmResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AlarmResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AlarmResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Alarms", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Alarms = append(m.Alarms, &AlarmMember{})
- if err := m.Alarms[len(m.Alarms)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *StatusRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *StatusResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: StatusResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: StatusResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Version = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field DbSize", wireType)
- }
- m.DbSize = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.DbSize |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType)
- }
- m.Leader = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Leader |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 5:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field RaftIndex", wireType)
- }
- m.RaftIndex = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.RaftIndex |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 6:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field RaftTerm", wireType)
- }
- m.RaftTerm = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.RaftTerm |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthEnableRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthEnableRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthEnableRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthDisableRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthDisableRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthDisableRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthenticateRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthenticateRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthenticateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Password = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserAddRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserAddRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserAddRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Password = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserGetRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserGetRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserGetRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserDeleteRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserDeleteRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserChangePasswordRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserChangePasswordRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserChangePasswordRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Password = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserGrantRoleRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserGrantRoleRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserGrantRoleRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field User", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.User = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Role = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserRevokeRoleRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserRevokeRoleRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserRevokeRoleRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Role = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleAddRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleAddRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleAddRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleGetRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleGetRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleGetRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Role = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserListRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserListRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserListRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleListRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleListRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleListRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleDeleteRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleDeleteRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Role = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleGrantPermissionRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleGrantPermissionRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleGrantPermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Name = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Perm", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Perm == nil {
- m.Perm = &authpb.Permission{}
- }
- if err := m.Perm.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleRevokePermissionRequest) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleRevokePermissionRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleRevokePermissionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Role = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RangeEnd", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.RangeEnd = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthEnableResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthEnableResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthEnableResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthDisableResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthDisableResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthDisableResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthenticateResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthenticateResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthenticateResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Token = string(data[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserAddResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserAddResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserAddResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserGetResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserGetResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserGetResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Roles = append(m.Roles, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserDeleteResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserDeleteResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserChangePasswordResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserChangePasswordResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserChangePasswordResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserGrantRoleResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserGrantRoleResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserGrantRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserRevokeRoleResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserRevokeRoleResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserRevokeRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleAddResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleAddResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleAddResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleGetResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleGetResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleGetResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Perm", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Perm = append(m.Perm, &authpb.Permission{})
- if err := m.Perm[len(m.Perm)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleListResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleListResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleListResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Roles = append(m.Roles, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthUserListResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthUserListResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthUserListResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Users", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Users = append(m.Users, string(data[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleDeleteResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleDeleteResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleGrantPermissionResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleGrantPermissionResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleGrantPermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *AuthRoleRevokePermissionResponse) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: AuthRoleRevokePermissionResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: AuthRoleRevokePermissionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthRpc
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Header == nil {
- m.Header = &ResponseHeader{}
- }
- if err := m.Header.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipRpc(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthRpc
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipRpc(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthRpc
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowRpc
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipRpc(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow")
-)
-
-var fileDescriptorRpc = []byte{
- // 3206 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x5a, 0xcd, 0x73, 0x1b, 0xc7,
- 0xb1, 0xe7, 0x02, 0x20, 0x3e, 0x1a, 0x20, 0x08, 0x0d, 0x29, 0x19, 0x5c, 0x49, 0x14, 0x35, 0xfa,
- 0xa2, 0x64, 0x9b, 0xb0, 0x69, 0xbf, 0x77, 0xd0, 0x7b, 0xe5, 0x2a, 0x8a, 0xc4, 0x13, 0xf9, 0x48,
- 0x93, 0xf2, 0x92, 0xa2, 0x9d, 0x2a, 0x57, 0x58, 0x4b, 0x60, 0x04, 0xa0, 0x08, 0xec, 0xc2, 0xbb,
- 0x0b, 0x48, 0x74, 0x92, 0xaa, 0x94, 0x2b, 0x3e, 0x24, 0xc7, 0xf8, 0x90, 0xaf, 0x63, 0xae, 0xb9,
- 0xe6, 0x96, 0x3f, 0x20, 0x95, 0x4b, 0x5c, 0x95, 0x7f, 0x20, 0xe5, 0xe4, 0x90, 0x43, 0xee, 0xa9,
- 0x1c, 0x52, 0x49, 0xcd, 0xd7, 0xee, 0xec, 0x62, 0x17, 0xa4, 0xb3, 0xf1, 0x85, 0xdc, 0xe9, 0xe9,
- 0xe9, 0x5f, 0x77, 0xcf, 0x74, 0x6f, 0x4f, 0x2f, 0xa0, 0xe4, 0x0c, 0x5b, 0x6b, 0x43, 0xc7, 0xf6,
- 0x6c, 0x54, 0x21, 0x5e, 0xab, 0xed, 0x12, 0x67, 0x4c, 0x9c, 0xe1, 0xa9, 0xbe, 0xd8, 0xb1, 0x3b,
- 0x36, 0x9b, 0x68, 0xd0, 0x27, 0xce, 0xa3, 0x2f, 0x51, 0x9e, 0xc6, 0x60, 0xdc, 0x6a, 0xb1, 0x3f,
- 0xc3, 0xd3, 0xc6, 0xd9, 0x58, 0x4c, 0x5d, 0x67, 0x53, 0xe6, 0xc8, 0xeb, 0xb2, 0x3f, 0xc3, 0x53,
- 0xf6, 0x4f, 0x4c, 0xde, 0xe8, 0xd8, 0x76, 0xa7, 0x4f, 0x1a, 0xe6, 0xb0, 0xd7, 0x30, 0x2d, 0xcb,
- 0xf6, 0x4c, 0xaf, 0x67, 0x5b, 0x2e, 0x9f, 0xc5, 0x9f, 0x6b, 0x50, 0x35, 0x88, 0x3b, 0xb4, 0x2d,
- 0x97, 0x6c, 0x13, 0xb3, 0x4d, 0x1c, 0x74, 0x13, 0xa0, 0xd5, 0x1f, 0xb9, 0x1e, 0x71, 0x4e, 0x7a,
- 0xed, 0xba, 0xb6, 0xa2, 0xad, 0xe6, 0x8c, 0x92, 0xa0, 0xec, 0xb4, 0xd1, 0x75, 0x28, 0x0d, 0xc8,
- 0xe0, 0x94, 0xcf, 0x66, 0xd8, 0x6c, 0x91, 0x13, 0x76, 0xda, 0x48, 0x87, 0xa2, 0x43, 0xc6, 0x3d,
- 0xb7, 0x67, 0x5b, 0xf5, 0xec, 0x8a, 0xb6, 0x9a, 0x35, 0xfc, 0x31, 0x5d, 0xe8, 0x98, 0x2f, 0xbc,
- 0x13, 0x8f, 0x38, 0x83, 0x7a, 0x8e, 0x2f, 0xa4, 0x84, 0x23, 0xe2, 0x0c, 0xf0, 0x97, 0x59, 0xa8,
- 0x18, 0xa6, 0xd5, 0x21, 0x06, 0xf9, 0x64, 0x44, 0x5c, 0x0f, 0xd5, 0x20, 0x7b, 0x46, 0xce, 0x19,
- 0x7c, 0xc5, 0xa0, 0x8f, 0x7c, 0xbd, 0xd5, 0x21, 0x27, 0xc4, 0xe2, 0xc0, 0x15, 0xba, 0xde, 0xea,
- 0x90, 0xa6, 0xd5, 0x46, 0x8b, 0x30, 0xdb, 0xef, 0x0d, 0x7a, 0x9e, 0x40, 0xe5, 0x83, 0x90, 0x3a,
- 0xb9, 0x88, 0x3a, 0x9b, 0x00, 0xae, 0xed, 0x78, 0x27, 0xb6, 0xd3, 0x26, 0x4e, 0x7d, 0x76, 0x45,
- 0x5b, 0xad, 0xae, 0xdf, 0x5d, 0x53, 0x37, 0x62, 0x4d, 0x55, 0x68, 0xed, 0xd0, 0x76, 0xbc, 0x03,
- 0xca, 0x6b, 0x94, 0x5c, 0xf9, 0x88, 0xfe, 0x0f, 0xca, 0x4c, 0x88, 0x67, 0x3a, 0x1d, 0xe2, 0xd5,
- 0xf3, 0x4c, 0xca, 0xbd, 0x0b, 0xa4, 0x1c, 0x31, 0x66, 0x83, 0xc1, 0xf3, 0x67, 0x84, 0xa1, 0xe2,
- 0x12, 0xa7, 0x67, 0xf6, 0x7b, 0x9f, 0x9a, 0xa7, 0x7d, 0x52, 0x2f, 0xac, 0x68, 0xab, 0x45, 0x23,
- 0x44, 0xa3, 0xf6, 0x9f, 0x91, 0x73, 0xf7, 0xc4, 0xb6, 0xfa, 0xe7, 0xf5, 0x22, 0x63, 0x28, 0x52,
- 0xc2, 0x81, 0xd5, 0x3f, 0x67, 0x9b, 0x66, 0x8f, 0x2c, 0x8f, 0xcf, 0x96, 0xd8, 0x6c, 0x89, 0x51,
- 0xe8, 0x34, 0x5e, 0x83, 0x92, 0xaf, 0x3f, 0x2a, 0x42, 0x6e, 0xff, 0x60, 0xbf, 0x59, 0x9b, 0x41,
- 0x00, 0xf9, 0x8d, 0xc3, 0xcd, 0xe6, 0xfe, 0x56, 0x4d, 0x43, 0x65, 0x28, 0x6c, 0x35, 0xf9, 0x20,
- 0x83, 0x9f, 0x00, 0x04, 0x9a, 0xa2, 0x02, 0x64, 0x77, 0x9b, 0xdf, 0xaa, 0xcd, 0x50, 0x9e, 0xe3,
- 0xa6, 0x71, 0xb8, 0x73, 0xb0, 0x5f, 0xd3, 0xe8, 0xe2, 0x4d, 0xa3, 0xb9, 0x71, 0xd4, 0xac, 0x65,
- 0x28, 0xc7, 0xfb, 0x07, 0x5b, 0xb5, 0x2c, 0x2a, 0xc1, 0xec, 0xf1, 0xc6, 0xde, 0xf3, 0x66, 0x2d,
- 0x87, 0xbf, 0xd0, 0x60, 0x4e, 0xd8, 0xce, 0xcf, 0x17, 0x7a, 0x17, 0xf2, 0x5d, 0x76, 0xc6, 0xd8,
- 0xb6, 0x96, 0xd7, 0x6f, 0x44, 0x1c, 0x15, 0x3a, 0x87, 0x86, 0xe0, 0x45, 0x18, 0xb2, 0x67, 0x63,
- 0xb7, 0x9e, 0x59, 0xc9, 0xae, 0x96, 0xd7, 0x6b, 0x6b, 0xfc, 0xf0, 0xaf, 0xed, 0x92, 0xf3, 0x63,
- 0xb3, 0x3f, 0x22, 0x06, 0x9d, 0x44, 0x08, 0x72, 0x03, 0xdb, 0x21, 0x6c, 0xf7, 0x8b, 0x06, 0x7b,
- 0xa6, 0x47, 0x82, 0x39, 0x40, 0xec, 0x3c, 0x1f, 0xe0, 0x16, 0xc0, 0xb3, 0x91, 0x97, 0x7c, 0xca,
- 0x16, 0x61, 0x76, 0x4c, 0xe5, 0x8a, 0x13, 0xc6, 0x07, 0xec, 0x78, 0x11, 0xd3, 0x25, 0xfe, 0xf1,
- 0xa2, 0x03, 0xf4, 0x1a, 0x14, 0x86, 0x0e, 0x19, 0x9f, 0x9c, 0x8d, 0x19, 0x46, 0xd1, 0xc8, 0xd3,
- 0xe1, 0xee, 0x18, 0x5b, 0x50, 0x66, 0x20, 0xa9, 0xec, 0x7e, 0x18, 0x48, 0xcf, 0xb0, 0x65, 0x93,
- 0xb6, 0x4b, 0xbc, 0x8f, 0x01, 0x6d, 0x91, 0x3e, 0xf1, 0x48, 0x9a, 0x10, 0x52, 0xac, 0xc9, 0x86,
- 0xac, 0xf9, 0xb1, 0x06, 0x0b, 0x21, 0xf1, 0xa9, 0xcc, 0xaa, 0x43, 0xa1, 0xcd, 0x84, 0x71, 0x0d,
- 0xb2, 0x86, 0x1c, 0xa2, 0xd7, 0xa1, 0x28, 0x14, 0x70, 0xeb, 0xd9, 0x84, 0xdd, 0x2e, 0x70, 0x9d,
- 0x5c, 0xfc, 0x57, 0x0d, 0x4a, 0xc2, 0xd0, 0x83, 0x21, 0xda, 0x80, 0x39, 0x87, 0x0f, 0x4e, 0x98,
- 0x3d, 0x42, 0x23, 0x3d, 0x39, 0x12, 0xb7, 0x67, 0x8c, 0x8a, 0x58, 0xc2, 0xc8, 0xe8, 0x7f, 0xa0,
- 0x2c, 0x45, 0x0c, 0x47, 0x9e, 0x70, 0x79, 0x3d, 0x2c, 0x20, 0x38, 0x39, 0xdb, 0x33, 0x06, 0x08,
- 0xf6, 0x67, 0x23, 0x0f, 0x1d, 0xc1, 0xa2, 0x5c, 0xcc, 0xad, 0x11, 0x6a, 0x64, 0x99, 0x94, 0x95,
- 0xb0, 0x94, 0xc9, 0xad, 0xda, 0x9e, 0x31, 0x90, 0x58, 0xaf, 0x4c, 0x3e, 0x29, 0x41, 0x41, 0x50,
- 0xf1, 0xdf, 0x34, 0x00, 0xe9, 0xd0, 0x83, 0x21, 0xda, 0x82, 0xaa, 0x23, 0x46, 0x21, 0x83, 0xaf,
- 0xc7, 0x1a, 0x2c, 0xf6, 0x61, 0xc6, 0x98, 0x93, 0x8b, 0xb8, 0xc9, 0xef, 0x41, 0xc5, 0x97, 0x12,
- 0xd8, 0xbc, 0x14, 0x63, 0xb3, 0x2f, 0xa1, 0x2c, 0x17, 0x50, 0xab, 0x3f, 0x84, 0xab, 0xfe, 0xfa,
- 0x18, 0xb3, 0x6f, 0x4f, 0x31, 0xdb, 0x17, 0xb8, 0x20, 0x25, 0xa8, 0x86, 0x03, 0xcd, 0xdb, 0x9c,
- 0x8c, 0x7f, 0x9e, 0x85, 0xc2, 0xa6, 0x3d, 0x18, 0x9a, 0x0e, 0xdd, 0xa3, 0xbc, 0x43, 0xdc, 0x51,
- 0xdf, 0x63, 0xe6, 0x56, 0xd7, 0xef, 0x84, 0x11, 0x04, 0x9b, 0xfc, 0x6f, 0x30, 0x56, 0x43, 0x2c,
- 0xa1, 0x8b, 0x45, 0x9a, 0xce, 0x5c, 0x62, 0xb1, 0x48, 0xd2, 0x62, 0x89, 0x8c, 0xa5, 0x6c, 0x10,
- 0x4b, 0x3a, 0x14, 0xc6, 0xc4, 0x09, 0x5e, 0x2d, 0xdb, 0x33, 0x86, 0x24, 0xa0, 0x87, 0x30, 0xdf,
- 0x72, 0x88, 0x49, 0xfd, 0x21, 0x5f, 0x3f, 0xb3, 0x82, 0xa7, 0xca, 0x27, 0x0c, 0xf9, 0x1a, 0xba,
- 0x03, 0x95, 0x81, 0xdd, 0x0e, 0xf8, 0xf2, 0x82, 0xaf, 0x3c, 0xb0, 0xdb, 0x3e, 0xd3, 0x35, 0x99,
- 0x94, 0xe8, 0x7b, 0xa1, 0xb2, 0x3d, 0x23, 0xd2, 0x12, 0x7e, 0x1b, 0xe6, 0x42, 0xb6, 0xd2, 0xf4,
- 0xdb, 0xfc, 0xe0, 0xf9, 0xc6, 0x1e, 0xcf, 0xd5, 0x4f, 0x59, 0x7a, 0x36, 0x6a, 0x1a, 0x4d, 0xf9,
- 0x7b, 0xcd, 0xc3, 0xc3, 0x5a, 0x06, 0xff, 0xaf, 0xbf, 0x44, 0x24, 0x77, 0x25, 0xa7, 0xcf, 0x28,
- 0x39, 0x5d, 0x93, 0x39, 0x3d, 0x13, 0xe4, 0xf4, 0xec, 0x93, 0x2a, 0x54, 0xb8, 0x43, 0x4e, 0x46,
- 0x56, 0xcf, 0xb6, 0xf0, 0x2f, 0x35, 0x80, 0xa3, 0x57, 0x96, 0xcc, 0x38, 0x0d, 0x28, 0xb4, 0xb8,
- 0xf0, 0xba, 0xc6, 0x02, 0xf8, 0x6a, 0xac, 0x8f, 0x0d, 0xc9, 0x85, 0xde, 0x86, 0x82, 0x3b, 0x6a,
- 0xb5, 0x88, 0x2b, 0xf3, 0xfb, 0x6b, 0xd1, 0x1c, 0x22, 0x22, 0xdc, 0x90, 0x7c, 0x74, 0xc9, 0x0b,
- 0xb3, 0xd7, 0x1f, 0xb1, 0x6c, 0x3f, 0x7d, 0x89, 0xe0, 0xc3, 0x3f, 0xd3, 0xa0, 0xcc, 0xb4, 0x4c,
- 0x95, 0xb8, 0x6e, 0x40, 0x89, 0xe9, 0x40, 0xda, 0x22, 0x75, 0x15, 0x8d, 0x80, 0x80, 0xfe, 0x1b,
- 0x4a, 0xf2, 0xc8, 0xca, 0xec, 0x55, 0x8f, 0x17, 0x7b, 0x30, 0x34, 0x02, 0x56, 0xbc, 0x0b, 0x57,
- 0x98, 0x57, 0x5a, 0xb4, 0x2a, 0x93, 0x7e, 0x54, 0xeb, 0x16, 0x2d, 0x52, 0xb7, 0xe8, 0x50, 0x1c,
- 0x76, 0xcf, 0xdd, 0x5e, 0xcb, 0xec, 0x0b, 0x2d, 0xfc, 0x31, 0xfe, 0x7f, 0x40, 0xaa, 0xb0, 0x34,
- 0xe6, 0xe2, 0x39, 0x28, 0x6f, 0x9b, 0x6e, 0x57, 0xa8, 0x84, 0x3f, 0x82, 0x0a, 0x1f, 0xa6, 0xf2,
- 0x21, 0x82, 0x5c, 0xd7, 0x74, 0xbb, 0x4c, 0xf1, 0x39, 0x83, 0x3d, 0xe3, 0x2b, 0x30, 0x7f, 0x68,
- 0x99, 0x43, 0xb7, 0x6b, 0xcb, 0xe4, 0x4a, 0xab, 0xd2, 0x5a, 0x40, 0x4b, 0x85, 0xf8, 0x00, 0xe6,
- 0x1d, 0x32, 0x30, 0x7b, 0x56, 0xcf, 0xea, 0x9c, 0x9c, 0x9e, 0x7b, 0xc4, 0x15, 0x45, 0x6b, 0xd5,
- 0x27, 0x3f, 0xa1, 0x54, 0xaa, 0xda, 0x69, 0xdf, 0x3e, 0x15, 0x21, 0xce, 0x9e, 0xf1, 0xaf, 0x35,
- 0xa8, 0x7c, 0x68, 0x7a, 0x2d, 0xe9, 0x05, 0xb4, 0x03, 0x55, 0x3f, 0xb0, 0x19, 0x45, 0xe8, 0x12,
- 0xc9, 0xf0, 0x6c, 0xcd, 0xa6, 0x08, 0x74, 0x99, 0xe1, 0xe7, 0x5a, 0x2a, 0x81, 0x89, 0x32, 0xad,
- 0x16, 0xe9, 0xfb, 0xa2, 0x32, 0xc9, 0xa2, 0x18, 0xa3, 0x2a, 0x4a, 0x25, 0x3c, 0x99, 0x0f, 0xde,
- 0x7e, 0x3c, 0x2c, 0x7f, 0xa5, 0x01, 0x9a, 0xd4, 0xe1, 0xeb, 0x16, 0x04, 0xf7, 0xa0, 0xea, 0x7a,
- 0xa6, 0xe3, 0x9d, 0x44, 0x4a, 0xfa, 0x39, 0x46, 0xf5, 0x93, 0xd3, 0x03, 0x98, 0x1f, 0x3a, 0x76,
- 0xc7, 0x21, 0xae, 0x7b, 0x62, 0xd9, 0x5e, 0xef, 0xc5, 0xb9, 0xa8, 0x86, 0xaa, 0x92, 0xbc, 0xcf,
- 0xa8, 0x6a, 0x81, 0x91, 0x0f, 0x15, 0x18, 0x0d, 0xa9, 0xad, 0x6a, 0x15, 0x5a, 0x82, 0xe2, 0x4b,
- 0x4a, 0x95, 0xb7, 0x90, 0xac, 0x51, 0x60, 0xe3, 0x9d, 0x36, 0xfe, 0x8b, 0x06, 0x73, 0x62, 0x5f,
- 0x52, 0x1d, 0x0e, 0x15, 0x22, 0x13, 0x82, 0xa0, 0x65, 0x0a, 0xdf, 0xaf, 0xb6, 0xa8, 0x86, 0xe4,
- 0x90, 0x06, 0x20, 0x77, 0x3f, 0x69, 0x0b, 0x43, 0xfd, 0x31, 0x7a, 0x08, 0xb5, 0x16, 0x0f, 0xc0,
- 0x48, 0xe6, 0x37, 0xe6, 0x05, 0xdd, 0x77, 0xdb, 0x3d, 0xc8, 0x93, 0x31, 0xb1, 0x3c, 0xb7, 0x5e,
- 0x66, 0xd9, 0x62, 0x4e, 0xd6, 0x3a, 0x4d, 0x4a, 0x35, 0xc4, 0x24, 0xfe, 0x2f, 0xb8, 0xb2, 0x47,
- 0x8b, 0xcd, 0xa7, 0x8e, 0x69, 0xa9, 0x65, 0xeb, 0xd1, 0xd1, 0x9e, 0xf0, 0x4a, 0xd6, 0x3b, 0xda,
- 0x43, 0x55, 0xc8, 0xec, 0x6c, 0x09, 0x1b, 0x32, 0xbd, 0x2d, 0xfc, 0x99, 0x06, 0x48, 0x5d, 0x97,
- 0xca, 0x4d, 0x11, 0xe1, 0x12, 0x3e, 0x1b, 0xc0, 0x2f, 0xc2, 0x2c, 0x71, 0x1c, 0xdb, 0x61, 0x0e,
- 0x29, 0x19, 0x7c, 0x80, 0xef, 0x0a, 0x1d, 0x0c, 0x32, 0xb6, 0xcf, 0xfc, 0x53, 0xc8, 0xa5, 0x69,
- 0xbe, 0xaa, 0xbb, 0xb0, 0x10, 0xe2, 0x4a, 0x95, 0xb5, 0x1e, 0xc0, 0x55, 0x26, 0x6c, 0x97, 0x90,
- 0xe1, 0x46, 0xbf, 0x37, 0x4e, 0x44, 0x1d, 0xc2, 0xb5, 0x28, 0xe3, 0x37, 0xeb, 0x23, 0xdc, 0x85,
- 0xfc, 0xfb, 0xec, 0x9e, 0xac, 0xe8, 0x92, 0x63, 0xbc, 0x08, 0x72, 0x96, 0x39, 0xe0, 0x57, 0x8e,
- 0x92, 0xc1, 0x9e, 0x59, 0x9a, 0x27, 0xc4, 0x79, 0x6e, 0xec, 0xf1, 0xd7, 0x49, 0xc9, 0xf0, 0xc7,
- 0x68, 0x99, 0xde, 0xd0, 0x7b, 0xc4, 0xf2, 0xd8, 0x6c, 0x8e, 0xcd, 0x2a, 0x14, 0xbc, 0x06, 0x35,
- 0x8e, 0xb4, 0xd1, 0x6e, 0x2b, 0xaf, 0x14, 0x5f, 0x9e, 0x16, 0x96, 0x87, 0x5f, 0xc2, 0x15, 0x85,
- 0x3f, 0x95, 0x1b, 0xde, 0x80, 0x3c, 0x6f, 0x06, 0x88, 0x6c, 0xb6, 0x18, 0x5e, 0xc5, 0x61, 0x0c,
- 0xc1, 0x83, 0xef, 0xc1, 0x82, 0xa0, 0x90, 0x81, 0x1d, 0xb7, 0x57, 0xcc, 0x3f, 0x78, 0x0f, 0x16,
- 0xc3, 0x6c, 0xa9, 0x8e, 0xc8, 0x86, 0x04, 0x7d, 0x3e, 0x6c, 0x2b, 0xc9, 0x31, 0xba, 0x29, 0xaa,
- 0xc3, 0x32, 0x11, 0x87, 0xf9, 0x0a, 0x49, 0x11, 0xa9, 0x14, 0x5a, 0x90, 0xee, 0xdf, 0xeb, 0xb9,
- 0xfe, 0x2b, 0xf0, 0x53, 0x40, 0x2a, 0x31, 0xd5, 0xa6, 0xac, 0x41, 0x81, 0x3b, 0x5c, 0x56, 0x59,
- 0xf1, 0xbb, 0x22, 0x99, 0xa8, 0x42, 0x5b, 0xe4, 0x85, 0x63, 0x76, 0x06, 0xc4, 0xcf, 0x39, 0xb4,
- 0xb6, 0x50, 0x89, 0xa9, 0x2c, 0xfe, 0xbd, 0x06, 0x95, 0x8d, 0xbe, 0xe9, 0x0c, 0xa4, 0xf3, 0xdf,
- 0x83, 0x3c, 0x2f, 0x5a, 0x44, 0x61, 0x7f, 0x3f, 0x2c, 0x46, 0xe5, 0xe5, 0x83, 0x0d, 0x5e, 0xe2,
- 0x88, 0x55, 0x74, 0xb3, 0x44, 0x0f, 0x6a, 0x2b, 0xd2, 0x93, 0xda, 0x42, 0x6f, 0xc2, 0xac, 0x49,
- 0x97, 0xb0, 0x58, 0xac, 0x46, 0xcb, 0x45, 0x26, 0xed, 0xe8, 0x7c, 0x48, 0x0c, 0xce, 0x85, 0xdf,
- 0x85, 0xb2, 0x82, 0x40, 0xab, 0xe0, 0xa7, 0xcd, 0xa3, 0xda, 0x0c, 0xaa, 0x40, 0x71, 0x63, 0xf3,
- 0x68, 0xe7, 0x98, 0x17, 0xc7, 0x55, 0x80, 0xad, 0xa6, 0x3f, 0xce, 0xe0, 0x8f, 0xc4, 0x2a, 0x11,
- 0xe1, 0xaa, 0x3e, 0x5a, 0x92, 0x3e, 0x99, 0x4b, 0xe9, 0xf3, 0x0a, 0xe6, 0x84, 0xf9, 0xa9, 0xce,
- 0xc0, 0xdb, 0x90, 0x67, 0xf2, 0xe4, 0x11, 0x58, 0x8a, 0x81, 0x95, 0xd1, 0xc9, 0x19, 0xf1, 0x3c,
- 0xcc, 0x1d, 0x7a, 0xa6, 0x37, 0x72, 0xe5, 0x11, 0xf8, 0x9d, 0x06, 0x55, 0x49, 0x49, 0xdb, 0x03,
- 0x90, 0x77, 0x27, 0x9e, 0xf3, 0xfc, 0x9b, 0xd3, 0x35, 0xc8, 0xb7, 0x4f, 0x0f, 0x7b, 0x9f, 0xca,
- 0x4e, 0x8b, 0x18, 0x51, 0x7a, 0x9f, 0xe3, 0xf0, 0xce, 0xa1, 0x18, 0xd1, 0xa2, 0xdc, 0x31, 0x5f,
- 0x78, 0x3b, 0x56, 0x9b, 0xbc, 0x62, 0x6f, 0xda, 0x9c, 0x11, 0x10, 0x58, 0x1d, 0x2d, 0x3a, 0x8c,
- 0xac, 0xe4, 0x50, 0x3b, 0x8e, 0x0b, 0x70, 0x65, 0x63, 0xe4, 0x75, 0x9b, 0x96, 0x79, 0xda, 0x97,
- 0x49, 0x00, 0x2f, 0x02, 0xa2, 0xc4, 0xad, 0x9e, 0xab, 0x52, 0x9b, 0xb0, 0x40, 0xa9, 0xc4, 0xf2,
- 0x7a, 0x2d, 0x25, 0x63, 0xc8, 0xb4, 0xad, 0x45, 0xd2, 0xb6, 0xe9, 0xba, 0x2f, 0x6d, 0xa7, 0x2d,
- 0x4c, 0xf3, 0xc7, 0x78, 0x8b, 0x0b, 0x7f, 0xee, 0x86, 0x12, 0xf3, 0xd7, 0x95, 0xb2, 0x1a, 0x48,
- 0x79, 0x4a, 0xbc, 0x29, 0x52, 0xf0, 0xeb, 0x70, 0x55, 0x72, 0x8a, 0xcb, 0xf5, 0x14, 0xe6, 0x03,
- 0xb8, 0x29, 0x99, 0x37, 0xbb, 0xb4, 0x02, 0x7c, 0x26, 0x00, 0xff, 0x5d, 0x3d, 0x9f, 0x40, 0xdd,
- 0xd7, 0x93, 0xd5, 0x20, 0x76, 0x5f, 0x55, 0x60, 0xe4, 0x8a, 0x33, 0x53, 0x32, 0xd8, 0x33, 0xa5,
- 0x39, 0x76, 0xdf, 0x7f, 0x09, 0xd2, 0x67, 0xbc, 0x09, 0x4b, 0x52, 0x86, 0xa8, 0x0e, 0xc2, 0x42,
- 0x26, 0x14, 0x8a, 0x13, 0x22, 0x1c, 0x46, 0x97, 0x4e, 0x77, 0xbb, 0xca, 0x19, 0x76, 0x2d, 0x93,
- 0xa9, 0x29, 0x32, 0xaf, 0xf2, 0x13, 0x41, 0x15, 0x53, 0x93, 0xb6, 0x20, 0x53, 0x01, 0x2a, 0x59,
- 0x6c, 0x04, 0x25, 0x4f, 0x6c, 0xc4, 0x84, 0xe8, 0x8f, 0x61, 0xd9, 0x57, 0x82, 0xfa, 0xed, 0x19,
- 0x71, 0x06, 0x3d, 0xd7, 0x55, 0x6e, 0x87, 0x71, 0x86, 0xdf, 0x87, 0xdc, 0x90, 0x88, 0x9c, 0x52,
- 0x5e, 0x47, 0x6b, 0xfc, 0x3b, 0xc0, 0x9a, 0xb2, 0x98, 0xcd, 0xe3, 0x36, 0xdc, 0x92, 0xd2, 0xb9,
- 0x47, 0x63, 0xc5, 0x47, 0x95, 0x92, 0x37, 0x07, 0xee, 0xd6, 0xc9, 0x9b, 0x43, 0x96, 0xef, 0xbd,
- 0xbc, 0x39, 0xd0, 0x77, 0x85, 0x1a, 0x5b, 0xa9, 0xde, 0x15, 0xbb, 0xdc, 0xa7, 0x7e, 0x48, 0xa6,
- 0x12, 0x76, 0x0a, 0x8b, 0xe1, 0x48, 0x4e, 0x95, 0xc6, 0x16, 0x61, 0xd6, 0xb3, 0xcf, 0x88, 0x4c,
- 0x62, 0x7c, 0x20, 0x15, 0xf6, 0xc3, 0x3c, 0x95, 0xc2, 0x66, 0x20, 0x8c, 0x1d, 0xc9, 0xb4, 0xfa,
- 0xd2, 0xdd, 0x94, 0xf5, 0x0c, 0x1f, 0xe0, 0x7d, 0xb8, 0x16, 0x4d, 0x13, 0xa9, 0x54, 0x3e, 0xe6,
- 0x07, 0x38, 0x2e, 0x93, 0xa4, 0x92, 0xfb, 0x41, 0x90, 0x0c, 0x94, 0x84, 0x92, 0x4a, 0xa4, 0x01,
- 0x7a, 0x5c, 0x7e, 0xf9, 0x4f, 0x9c, 0x57, 0x3f, 0xdd, 0xa4, 0x12, 0xe6, 0x06, 0xc2, 0xd2, 0x6f,
- 0x7f, 0x90, 0x23, 0xb2, 0x53, 0x73, 0x84, 0x08, 0x92, 0x20, 0x8b, 0x7d, 0x03, 0x87, 0x4e, 0x60,
- 0x04, 0x09, 0x34, 0x2d, 0x06, 0x7d, 0x87, 0xf8, 0x18, 0x6c, 0x20, 0x0f, 0xb6, 0x9a, 0x76, 0x53,
- 0x6d, 0xc6, 0x87, 0x41, 0xee, 0x9c, 0xc8, 0xcc, 0xa9, 0x04, 0x7f, 0x04, 0x2b, 0xc9, 0x49, 0x39,
- 0x8d, 0xe4, 0x47, 0x18, 0x4a, 0x7e, 0x41, 0xa9, 0x7c, 0xf7, 0x2b, 0x43, 0x61, 0xff, 0xe0, 0xf0,
- 0xd9, 0xc6, 0x66, 0xb3, 0xa6, 0xad, 0xff, 0x23, 0x0b, 0x99, 0xdd, 0x63, 0xf4, 0x6d, 0x98, 0xe5,
- 0x5f, 0x05, 0xa6, 0x7c, 0x34, 0xd1, 0xa7, 0x7d, 0x5f, 0xc0, 0x37, 0x3e, 0xfb, 0xc3, 0x9f, 0xbf,
- 0xc8, 0x5c, 0xc3, 0x57, 0x1a, 0xe3, 0x77, 0xcc, 0xfe, 0xb0, 0x6b, 0x36, 0xce, 0xc6, 0x0d, 0xf6,
- 0x4e, 0x78, 0xac, 0x3d, 0x42, 0xc7, 0x90, 0x7d, 0x36, 0xf2, 0x50, 0xe2, 0x17, 0x15, 0x3d, 0xf9,
- 0xbb, 0x03, 0xd6, 0x99, 0xe4, 0x45, 0x3c, 0xaf, 0x4a, 0x1e, 0x8e, 0x3c, 0x2a, 0x77, 0x0c, 0x65,
- 0xe5, 0xd3, 0x01, 0xba, 0xf0, 0x5b, 0x8b, 0x7e, 0xf1, 0x67, 0x09, 0x8c, 0x19, 0xde, 0x0d, 0xfc,
- 0x9a, 0x8a, 0xc7, 0xbf, 0x70, 0xa8, 0xf6, 0x1c, 0xbd, 0xb2, 0xa2, 0xf6, 0x04, 0xcd, 0xf0, 0xa8,
- 0x3d, 0x4a, 0x03, 0x3a, 0xde, 0x1e, 0xef, 0x95, 0x45, 0xe5, 0xda, 0xe2, 0x73, 0x47, 0xcb, 0x43,
- 0xb7, 0x62, 0xba, 0xe7, 0x6a, 0x9f, 0x58, 0x5f, 0x49, 0x66, 0x10, 0x48, 0xb7, 0x19, 0xd2, 0x75,
- 0x7c, 0x4d, 0x45, 0x6a, 0xf9, 0x7c, 0x8f, 0xb5, 0x47, 0xeb, 0x5d, 0x98, 0x65, 0xbd, 0x34, 0x74,
- 0x22, 0x1f, 0xf4, 0x98, 0x16, 0x64, 0xc2, 0x09, 0x08, 0x75, 0xe1, 0xf0, 0x12, 0x43, 0x5b, 0xc0,
- 0x55, 0x1f, 0x8d, 0xb5, 0xd3, 0x1e, 0x6b, 0x8f, 0x56, 0xb5, 0xb7, 0xb4, 0xf5, 0xbf, 0x67, 0x60,
- 0x96, 0x35, 0x5d, 0xd0, 0x10, 0x20, 0xe8, 0x4e, 0x45, 0xed, 0x9c, 0xe8, 0x77, 0x45, 0xed, 0x9c,
- 0x6c, 0x6c, 0xe1, 0x5b, 0x0c, 0x79, 0x09, 0x2f, 0xfa, 0xc8, 0xec, 0x13, 0x6d, 0xa3, 0x43, 0xb9,
- 0xa8, 0x5b, 0x5f, 0x42, 0x59, 0xe9, 0x32, 0xa1, 0x38, 0x89, 0xa1, 0x36, 0x55, 0xf4, 0x98, 0xc4,
- 0xb4, 0xa8, 0xf0, 0x1d, 0x06, 0x7a, 0x13, 0xd7, 0x55, 0xe7, 0x72, 0x5c, 0x87, 0x71, 0x52, 0xe0,
- 0x1f, 0x68, 0x50, 0x0d, 0x77, 0x9a, 0xd0, 0x9d, 0x18, 0xd1, 0xd1, 0x86, 0x95, 0x7e, 0x77, 0x3a,
- 0x53, 0xa2, 0x0a, 0x1c, 0xff, 0x8c, 0x90, 0xa1, 0x49, 0x39, 0xa5, 0xef, 0xff, 0x99, 0x85, 0xc2,
- 0x26, 0xff, 0x11, 0x07, 0xf2, 0xa0, 0xe4, 0xf7, 0x7b, 0xd0, 0x72, 0x5c, 0x2f, 0x20, 0x28, 0x94,
- 0xf5, 0x5b, 0x89, 0xf3, 0x42, 0x85, 0xfb, 0x4c, 0x85, 0x15, 0x7c, 0xdd, 0x57, 0x41, 0xfc, 0x58,
- 0xa4, 0xc1, 0xaf, 0xbc, 0x0d, 0xb3, 0xdd, 0xa6, 0x8e, 0xf8, 0xbe, 0x06, 0x15, 0xb5, 0x8d, 0x83,
- 0x6e, 0xc7, 0x76, 0x21, 0xd4, 0x4e, 0x90, 0x8e, 0xa7, 0xb1, 0x08, 0xfc, 0x87, 0x0c, 0xff, 0x0e,
- 0x5e, 0x4e, 0xc2, 0x77, 0x18, 0x7f, 0x58, 0x05, 0xde, 0xb8, 0x89, 0x57, 0x21, 0xd4, 0x17, 0x8a,
- 0x57, 0x21, 0xdc, 0xf7, 0xb9, 0x58, 0x85, 0x11, 0xe3, 0xa7, 0x2a, 0xbc, 0x02, 0x08, 0xfa, 0x3a,
- 0x28, 0xd6, 0xb9, 0xca, 0xd5, 0x21, 0x7a, 0xf2, 0x27, 0x5b, 0x42, 0xf8, 0x01, 0xc3, 0xbe, 0x8d,
- 0x6f, 0x24, 0x61, 0xf7, 0x7b, 0x2e, 0x8d, 0x80, 0xf5, 0xdf, 0xe4, 0xa0, 0xfc, 0xbe, 0xd9, 0xb3,
- 0x3c, 0x62, 0x99, 0x56, 0x8b, 0xa0, 0x0e, 0xcc, 0xb2, 0x77, 0x43, 0x34, 0xdc, 0xd5, 0x66, 0x4b,
- 0x34, 0xdc, 0x43, 0x9d, 0x08, 0x7c, 0x8f, 0x41, 0xdf, 0xc2, 0xba, 0x0f, 0x3d, 0x08, 0xe4, 0x37,
- 0x58, 0x17, 0x81, 0x9a, 0x7c, 0x06, 0x79, 0xde, 0x35, 0x40, 0x11, 0x69, 0xa1, 0xee, 0x82, 0x7e,
- 0x23, 0x7e, 0x32, 0xf1, 0x94, 0xa9, 0x58, 0x2e, 0x63, 0xa6, 0x60, 0xdf, 0x01, 0x08, 0xda, 0x54,
- 0x51, 0xff, 0x4e, 0x74, 0xb5, 0xf4, 0x95, 0x64, 0x06, 0x01, 0xfc, 0x88, 0x01, 0xdf, 0xc5, 0xb7,
- 0x62, 0x81, 0xdb, 0xfe, 0x02, 0x0a, 0xde, 0x82, 0xdc, 0xb6, 0xe9, 0x76, 0x51, 0x24, 0xf5, 0x2b,
- 0xdf, 0xd1, 0x74, 0x3d, 0x6e, 0x4a, 0x40, 0xdd, 0x65, 0x50, 0xcb, 0x78, 0x29, 0x16, 0xaa, 0x6b,
- 0xba, 0x34, 0x93, 0xa2, 0x11, 0x14, 0xe5, 0xb7, 0x31, 0x74, 0x33, 0xe2, 0xb3, 0xf0, 0x77, 0x34,
- 0x7d, 0x39, 0x69, 0x5a, 0x00, 0xae, 0x32, 0x40, 0x8c, 0x6f, 0xc6, 0x3b, 0x55, 0xb0, 0x3f, 0xd6,
- 0x1e, 0xbd, 0xa5, 0xad, 0xff, 0xa8, 0x06, 0x39, 0x5a, 0xa5, 0xd0, 0xdc, 0x1d, 0x5c, 0xee, 0xa2,
- 0x1e, 0x9e, 0x68, 0xa9, 0x44, 0x3d, 0x3c, 0x79, 0x2f, 0x8c, 0xc9, 0xdd, 0xec, 0xa7, 0x6c, 0x84,
- 0x71, 0x51, 0x8b, 0x3d, 0x28, 0x2b, 0x57, 0x40, 0x14, 0x23, 0x31, 0xdc, 0xb0, 0x89, 0xe6, 0xee,
- 0x98, 0xfb, 0x23, 0x5e, 0x61, 0xa0, 0x3a, 0xbe, 0x1a, 0x06, 0x6d, 0x73, 0x36, 0x8a, 0xfa, 0x5d,
- 0xa8, 0xa8, 0x77, 0x45, 0x14, 0x23, 0x34, 0xd2, 0x11, 0x8a, 0xe6, 0x8a, 0xb8, 0xab, 0x66, 0x4c,
- 0xd0, 0xf8, 0x3f, 0xdc, 0x93, 0xbc, 0x14, 0xfd, 0x13, 0x28, 0x88, 0x1b, 0x64, 0x9c, 0xbd, 0xe1,
- 0x1e, 0x52, 0x9c, 0xbd, 0x91, 0xeb, 0x67, 0x4c, 0x21, 0xc0, 0x60, 0x69, 0xa5, 0x2c, 0x13, 0xb4,
- 0x80, 0x7c, 0x4a, 0xbc, 0x24, 0xc8, 0xa0, 0x2b, 0x92, 0x04, 0xa9, 0xdc, 0x52, 0xa6, 0x42, 0x76,
- 0x88, 0x27, 0xce, 0xb2, 0xbc, 0x02, 0xa0, 0x04, 0x89, 0x6a, 0x36, 0xc4, 0xd3, 0x58, 0x12, 0x6b,
- 0xb7, 0x00, 0x55, 0xa4, 0x42, 0xf4, 0x3d, 0x80, 0xe0, 0xba, 0x1b, 0x7d, 0x1d, 0xc7, 0xf6, 0xcc,
- 0xa2, 0xaf, 0xe3, 0xf8, 0x1b, 0x73, 0x4c, 0x04, 0x07, 0xe0, 0xbc, 0x7e, 0xa4, 0xf0, 0x3f, 0xd1,
- 0x00, 0x4d, 0x5e, 0x8f, 0xd1, 0xeb, 0xf1, 0x10, 0xb1, 0xed, 0x38, 0xfd, 0x8d, 0xcb, 0x31, 0x27,
- 0x66, 0xcf, 0x40, 0xaf, 0x16, 0x5b, 0x32, 0x7c, 0x49, 0x35, 0xfb, 0x5c, 0x83, 0xb9, 0xd0, 0x05,
- 0x1b, 0xdd, 0x4f, 0xd8, 0xe7, 0x48, 0x4b, 0x4f, 0x7f, 0x70, 0x21, 0x5f, 0x62, 0xc5, 0xa2, 0x9c,
- 0x0a, 0x59, 0xad, 0xfd, 0x50, 0x83, 0x6a, 0xf8, 0x56, 0x8e, 0x12, 0x00, 0x26, 0xfa, 0x82, 0xfa,
- 0xea, 0xc5, 0x8c, 0x97, 0xd8, 0xad, 0xa0, 0x80, 0xfb, 0x04, 0x0a, 0xe2, 0x32, 0x1f, 0x17, 0x16,
- 0xe1, 0xb6, 0x62, 0x5c, 0x58, 0x44, 0x3a, 0x01, 0x49, 0x61, 0x41, 0xef, 0xc5, 0x4a, 0x24, 0x8a,
- 0x2b, 0x7f, 0x12, 0xe4, 0xf4, 0x48, 0x8c, 0xf4, 0x0b, 0xa6, 0x42, 0x06, 0x91, 0x28, 0x2f, 0xfc,
- 0x28, 0x41, 0xe2, 0x05, 0x91, 0x18, 0xed, 0x17, 0x24, 0x45, 0x22, 0x43, 0x55, 0x22, 0x31, 0xb8,
- 0x9f, 0xc7, 0x45, 0xe2, 0x44, 0xd3, 0x34, 0x2e, 0x12, 0x27, 0xaf, 0xf8, 0x49, 0x7b, 0xcb, 0xc0,
- 0x43, 0x91, 0xb8, 0x10, 0x73, 0x9f, 0x47, 0x6f, 0x24, 0xf8, 0x34, 0xb6, 0x21, 0xab, 0xbf, 0x79,
- 0x49, 0xee, 0xe9, 0x11, 0xc0, 0x77, 0x43, 0x46, 0xc0, 0x2f, 0x34, 0x58, 0x8c, 0x6b, 0x08, 0xa0,
- 0x04, 0xb0, 0x84, 0x6e, 0xae, 0xbe, 0x76, 0x59, 0xf6, 0x4b, 0xf8, 0xcd, 0x8f, 0x89, 0x27, 0xb5,
- 0xdf, 0x7e, 0xb5, 0xac, 0x7d, 0xf9, 0xd5, 0xb2, 0xf6, 0xc7, 0xaf, 0x96, 0xb5, 0x9f, 0xfe, 0x69,
- 0x79, 0xe6, 0x34, 0xcf, 0x7e, 0x4f, 0xfe, 0xce, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x72,
- 0x99, 0x38, 0xd6, 0x2e, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.gw.go b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.gw.go
deleted file mode 100644
index a2efbcd98..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.gw.go
+++ /dev/null
@@ -1,1866 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway
-// source: etcdserver/etcdserverpb/rpc.proto
-// DO NOT EDIT!
-
-/*
-Package etcdserverpb is a reverse proxy.
-
-It translates gRPC into RESTful JSON APIs.
-*/
-package etcdserverpb
-
-import (
- "io"
- "net/http"
-
- "github.com/golang/protobuf/proto"
- "github.com/grpc-ecosystem/grpc-gateway/runtime"
- "github.com/grpc-ecosystem/grpc-gateway/utilities"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
-)
-
-var _ codes.Code
-var _ io.Reader
-var _ = runtime.String
-var _ = utilities.NewDoubleArray
-
-func request_KV_Range_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq RangeRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Range(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_KV_Put_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq PutRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_KV_DeleteRange_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DeleteRangeRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.DeleteRange(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_KV_Txn_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq TxnRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Txn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_KV_Compact_0(ctx context.Context, marshaler runtime.Marshaler, client KVClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq CompactionRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Compact(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Watch_Watch_0(ctx context.Context, marshaler runtime.Marshaler, client WatchClient, req *http.Request, pathParams map[string]string) (Watch_WatchClient, runtime.ServerMetadata, error) {
- var metadata runtime.ServerMetadata
- stream, err := client.Watch(ctx)
- if err != nil {
- grpclog.Printf("Failed to start streaming: %v", err)
- return nil, metadata, err
- }
- dec := marshaler.NewDecoder(req.Body)
- handleSend := func() error {
- var protoReq WatchRequest
- err = dec.Decode(&protoReq)
- if err == io.EOF {
- return err
- }
- if err != nil {
- grpclog.Printf("Failed to decode request: %v", err)
- return err
- }
- if err = stream.Send(&protoReq); err != nil {
- grpclog.Printf("Failed to send request: %v", err)
- return err
- }
- return nil
- }
- if err := handleSend(); err != nil {
- if cerr := stream.CloseSend(); cerr != nil {
- grpclog.Printf("Failed to terminate client stream: %v", cerr)
- }
- if err == io.EOF {
- return stream, metadata, nil
- }
- return nil, metadata, err
- }
- go func() {
- for {
- if err := handleSend(); err != nil {
- break
- }
- }
- if err := stream.CloseSend(); err != nil {
- grpclog.Printf("Failed to terminate client stream: %v", err)
- }
- }()
- header, err := stream.Header()
- if err != nil {
- grpclog.Printf("Failed to get header from client: %v", err)
- return nil, metadata, err
- }
- metadata.HeaderMD = header
- return stream, metadata, nil
-}
-
-func request_Lease_LeaseGrant_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq LeaseGrantRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.LeaseGrant(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Lease_LeaseRevoke_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq LeaseRevokeRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.LeaseRevoke(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Lease_LeaseKeepAlive_0(ctx context.Context, marshaler runtime.Marshaler, client LeaseClient, req *http.Request, pathParams map[string]string) (Lease_LeaseKeepAliveClient, runtime.ServerMetadata, error) {
- var metadata runtime.ServerMetadata
- stream, err := client.LeaseKeepAlive(ctx)
- if err != nil {
- grpclog.Printf("Failed to start streaming: %v", err)
- return nil, metadata, err
- }
- dec := marshaler.NewDecoder(req.Body)
- handleSend := func() error {
- var protoReq LeaseKeepAliveRequest
- err = dec.Decode(&protoReq)
- if err == io.EOF {
- return err
- }
- if err != nil {
- grpclog.Printf("Failed to decode request: %v", err)
- return err
- }
- if err = stream.Send(&protoReq); err != nil {
- grpclog.Printf("Failed to send request: %v", err)
- return err
- }
- return nil
- }
- if err := handleSend(); err != nil {
- if cerr := stream.CloseSend(); cerr != nil {
- grpclog.Printf("Failed to terminate client stream: %v", cerr)
- }
- if err == io.EOF {
- return stream, metadata, nil
- }
- return nil, metadata, err
- }
- go func() {
- for {
- if err := handleSend(); err != nil {
- break
- }
- }
- if err := stream.CloseSend(); err != nil {
- grpclog.Printf("Failed to terminate client stream: %v", err)
- }
- }()
- header, err := stream.Header()
- if err != nil {
- grpclog.Printf("Failed to get header from client: %v", err)
- return nil, metadata, err
- }
- metadata.HeaderMD = header
- return stream, metadata, nil
-}
-
-func request_Cluster_MemberAdd_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq MemberAddRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.MemberAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Cluster_MemberRemove_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq MemberRemoveRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.MemberRemove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Cluster_MemberUpdate_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq MemberUpdateRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.MemberUpdate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Cluster_MemberList_0(ctx context.Context, marshaler runtime.Marshaler, client ClusterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq MemberListRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.MemberList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Maintenance_Alarm_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AlarmRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Alarm(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Maintenance_Status_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq StatusRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Status(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Maintenance_Defragment_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq DefragmentRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Defragment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Maintenance_Hash_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq HashRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Hash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Maintenance_Snapshot_0(ctx context.Context, marshaler runtime.Marshaler, client MaintenanceClient, req *http.Request, pathParams map[string]string) (Maintenance_SnapshotClient, runtime.ServerMetadata, error) {
- var protoReq SnapshotRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- stream, err := client.Snapshot(ctx, &protoReq)
- if err != nil {
- return nil, metadata, err
- }
- header, err := stream.Header()
- if err != nil {
- return nil, metadata, err
- }
- metadata.HeaderMD = header
- return stream, metadata, nil
-
-}
-
-func request_Auth_AuthEnable_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthEnableRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.AuthEnable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_AuthDisable_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthDisableRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.AuthDisable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_Authenticate_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthenticateRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.Authenticate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserAdd_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserAddRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserGet_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserGetRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserList_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserListRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserDelete_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserDeleteRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserChangePassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserChangePasswordRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserChangePassword(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserGrantRole_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserGrantRoleRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserGrantRole(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_UserRevokeRole_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthUserRevokeRoleRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.UserRevokeRole(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleAdd_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleAddRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleGet_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleGetRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleGet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleList_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleListRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleDelete_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleDeleteRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleGrantPermission_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleGrantPermissionRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleGrantPermission(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func request_Auth_RoleRevokePermission_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq AuthRoleRevokePermissionRequest
- var metadata runtime.ServerMetadata
-
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
- return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
- }
-
- msg, err := client.RoleRevokePermission(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-// RegisterKVHandlerFromEndpoint is same as RegisterKVHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterKVHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterKVHandler(ctx, mux, conn)
-}
-
-// RegisterKVHandler registers the http handlers for service KV to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterKVHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewKVClient(conn)
-
- mux.Handle("POST", pattern_KV_Range_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_KV_Range_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_KV_Range_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_KV_Put_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_KV_Put_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_KV_Put_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_KV_DeleteRange_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_KV_DeleteRange_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_KV_DeleteRange_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_KV_Txn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_KV_Txn_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_KV_Txn_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_KV_Compact_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_KV_Compact_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_KV_Compact_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_KV_Range_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "range"}, ""))
-
- pattern_KV_Put_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "put"}, ""))
-
- pattern_KV_DeleteRange_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "deleterange"}, ""))
-
- pattern_KV_Txn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "txn"}, ""))
-
- pattern_KV_Compact_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "kv", "compaction"}, ""))
-)
-
-var (
- forward_KV_Range_0 = runtime.ForwardResponseMessage
-
- forward_KV_Put_0 = runtime.ForwardResponseMessage
-
- forward_KV_DeleteRange_0 = runtime.ForwardResponseMessage
-
- forward_KV_Txn_0 = runtime.ForwardResponseMessage
-
- forward_KV_Compact_0 = runtime.ForwardResponseMessage
-)
-
-// RegisterWatchHandlerFromEndpoint is same as RegisterWatchHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterWatchHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterWatchHandler(ctx, mux, conn)
-}
-
-// RegisterWatchHandler registers the http handlers for service Watch to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterWatchHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewWatchClient(conn)
-
- mux.Handle("POST", pattern_Watch_Watch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Watch_Watch_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Watch_Watch_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_Watch_Watch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v3alpha", "watch"}, ""))
-)
-
-var (
- forward_Watch_Watch_0 = runtime.ForwardResponseStream
-)
-
-// RegisterLeaseHandlerFromEndpoint is same as RegisterLeaseHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterLeaseHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterLeaseHandler(ctx, mux, conn)
-}
-
-// RegisterLeaseHandler registers the http handlers for service Lease to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterLeaseHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewLeaseClient(conn)
-
- mux.Handle("POST", pattern_Lease_LeaseGrant_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Lease_LeaseGrant_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Lease_LeaseGrant_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Lease_LeaseRevoke_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Lease_LeaseRevoke_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Lease_LeaseRevoke_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Lease_LeaseKeepAlive_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Lease_LeaseKeepAlive_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Lease_LeaseKeepAlive_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_Lease_LeaseGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "lease", "grant"}, ""))
-
- pattern_Lease_LeaseRevoke_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "kv", "lease", "revoke"}, ""))
-
- pattern_Lease_LeaseKeepAlive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "lease", "keepalive"}, ""))
-)
-
-var (
- forward_Lease_LeaseGrant_0 = runtime.ForwardResponseMessage
-
- forward_Lease_LeaseRevoke_0 = runtime.ForwardResponseMessage
-
- forward_Lease_LeaseKeepAlive_0 = runtime.ForwardResponseStream
-)
-
-// RegisterClusterHandlerFromEndpoint is same as RegisterClusterHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterClusterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterClusterHandler(ctx, mux, conn)
-}
-
-// RegisterClusterHandler registers the http handlers for service Cluster to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterClusterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewClusterClient(conn)
-
- mux.Handle("POST", pattern_Cluster_MemberAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Cluster_MemberAdd_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Cluster_MemberAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Cluster_MemberRemove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Cluster_MemberRemove_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Cluster_MemberRemove_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Cluster_MemberUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Cluster_MemberUpdate_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Cluster_MemberUpdate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Cluster_MemberList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Cluster_MemberList_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Cluster_MemberList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_Cluster_MemberAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "add"}, ""))
-
- pattern_Cluster_MemberRemove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "remove"}, ""))
-
- pattern_Cluster_MemberUpdate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "update"}, ""))
-
- pattern_Cluster_MemberList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "cluster", "member", "list"}, ""))
-)
-
-var (
- forward_Cluster_MemberAdd_0 = runtime.ForwardResponseMessage
-
- forward_Cluster_MemberRemove_0 = runtime.ForwardResponseMessage
-
- forward_Cluster_MemberUpdate_0 = runtime.ForwardResponseMessage
-
- forward_Cluster_MemberList_0 = runtime.ForwardResponseMessage
-)
-
-// RegisterMaintenanceHandlerFromEndpoint is same as RegisterMaintenanceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterMaintenanceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterMaintenanceHandler(ctx, mux, conn)
-}
-
-// RegisterMaintenanceHandler registers the http handlers for service Maintenance to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterMaintenanceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewMaintenanceClient(conn)
-
- mux.Handle("POST", pattern_Maintenance_Alarm_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Maintenance_Alarm_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Maintenance_Alarm_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Maintenance_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Maintenance_Status_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Maintenance_Status_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Maintenance_Defragment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Maintenance_Defragment_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Maintenance_Defragment_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Maintenance_Hash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Maintenance_Hash_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Maintenance_Hash_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Maintenance_Snapshot_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Maintenance_Snapshot_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Maintenance_Snapshot_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_Maintenance_Alarm_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "alarm"}, ""))
-
- pattern_Maintenance_Status_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "status"}, ""))
-
- pattern_Maintenance_Defragment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "defragment"}, ""))
-
- pattern_Maintenance_Hash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "hash"}, ""))
-
- pattern_Maintenance_Snapshot_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "maintenance", "snapshot"}, ""))
-)
-
-var (
- forward_Maintenance_Alarm_0 = runtime.ForwardResponseMessage
-
- forward_Maintenance_Status_0 = runtime.ForwardResponseMessage
-
- forward_Maintenance_Defragment_0 = runtime.ForwardResponseMessage
-
- forward_Maintenance_Hash_0 = runtime.ForwardResponseMessage
-
- forward_Maintenance_Snapshot_0 = runtime.ForwardResponseStream
-)
-
-// RegisterAuthHandlerFromEndpoint is same as RegisterAuthHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterAuthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
-
- return RegisterAuthHandler(ctx, mux, conn)
-}
-
-// RegisterAuthHandler registers the http handlers for service Auth to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterAuthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- client := NewAuthClient(conn)
-
- mux.Handle("POST", pattern_Auth_AuthEnable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_AuthEnable_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_AuthEnable_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_AuthDisable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_AuthDisable_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_AuthDisable_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_Authenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_Authenticate_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_Authenticate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserAdd_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserGet_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserGet_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserList_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserDelete_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserDelete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserChangePassword_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserChangePassword_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserGrantRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserGrantRole_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserGrantRole_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_UserRevokeRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_UserRevokeRole_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_UserRevokeRole_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleAdd_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleAdd_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleGet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleGet_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleGet_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleList_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleDelete_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleDelete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleGrantPermission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleGrantPermission_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleGrantPermission_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("POST", pattern_Auth_RoleRevokePermission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(ctx)
- defer cancel()
- if cn, ok := w.(http.CloseNotifier); ok {
- go func(done <-chan struct{}, closed <-chan bool) {
- select {
- case <-done:
- case <-closed:
- cancel()
- }
- }(ctx.Done(), cn.CloseNotify())
- }
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- rctx, err := runtime.AnnotateContext(ctx, req)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- }
- resp, md, err := request_Auth_RoleRevokePermission_0(rctx, inboundMarshaler, client, req, pathParams)
- ctx = runtime.NewServerMetadataContext(ctx, md)
- if err != nil {
- runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
- return
- }
-
- forward_Auth_RoleRevokePermission_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_Auth_AuthEnable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "enable"}, ""))
-
- pattern_Auth_AuthDisable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "disable"}, ""))
-
- pattern_Auth_Authenticate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v3alpha", "auth", "authenticate"}, ""))
-
- pattern_Auth_UserAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "add"}, ""))
-
- pattern_Auth_UserGet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "get"}, ""))
-
- pattern_Auth_UserList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "list"}, ""))
-
- pattern_Auth_UserDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "delete"}, ""))
-
- pattern_Auth_UserChangePassword_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "changepw"}, ""))
-
- pattern_Auth_UserGrantRole_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "grant"}, ""))
-
- pattern_Auth_UserRevokeRole_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "user", "revoke"}, ""))
-
- pattern_Auth_RoleAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "add"}, ""))
-
- pattern_Auth_RoleGet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "get"}, ""))
-
- pattern_Auth_RoleList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "list"}, ""))
-
- pattern_Auth_RoleDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "delete"}, ""))
-
- pattern_Auth_RoleGrantPermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "grant"}, ""))
-
- pattern_Auth_RoleRevokePermission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v3alpha", "auth", "role", "revoke"}, ""))
-)
-
-var (
- forward_Auth_AuthEnable_0 = runtime.ForwardResponseMessage
-
- forward_Auth_AuthDisable_0 = runtime.ForwardResponseMessage
-
- forward_Auth_Authenticate_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserAdd_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserGet_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserList_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserDelete_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserChangePassword_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserGrantRole_0 = runtime.ForwardResponseMessage
-
- forward_Auth_UserRevokeRole_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleAdd_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleGet_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleList_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleDelete_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleGrantPermission_0 = runtime.ForwardResponseMessage
-
- forward_Auth_RoleRevokePermission_0 = runtime.ForwardResponseMessage
-)
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto b/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto
deleted file mode 100644
index 5c04ccb8e..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto
+++ /dev/null
@@ -1,908 +0,0 @@
-syntax = "proto3";
-package etcdserverpb;
-
-import "gogoproto/gogo.proto";
-import "etcd/mvcc/mvccpb/kv.proto";
-import "etcd/auth/authpb/auth.proto";
-
-// for grpc-gateway
-import "google/api/annotations.proto";
-
-option (gogoproto.marshaler_all) = true;
-option (gogoproto.unmarshaler_all) = true;
-
-service KV {
- // Range gets the keys in the range from the key-value store.
- rpc Range(RangeRequest) returns (RangeResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/range"
- body: "*"
- };
- }
-
- // Put puts the given key into the key-value store.
- // A put request increments the revision of the key-value store
- // and generates one event in the event history.
- rpc Put(PutRequest) returns (PutResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/put"
- body: "*"
- };
- }
-
- // DeleteRange deletes the given range from the key-value store.
- // A delete request increments the revision of the key-value store
- // and generates a delete event in the event history for every deleted key.
- rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/deleterange"
- body: "*"
- };
- }
-
- // Txn processes multiple requests in a single transaction.
- // A txn request increments the revision of the key-value store
- // and generates events with the same revision for every completed request.
- // It is not allowed to modify the same key several times within one txn.
- rpc Txn(TxnRequest) returns (TxnResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/txn"
- body: "*"
- };
- }
-
- // Compact compacts the event history in the etcd key-value store. The key-value
- // store should be periodically compacted or the event history will continue to grow
- // indefinitely.
- rpc Compact(CompactionRequest) returns (CompactionResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/compaction"
- body: "*"
- };
- }
-}
-
-service Watch {
- // Watch watches for events happening or that have happened. Both input and output
- // are streams; the input stream is for creating and canceling watchers and the output
- // stream sends events. One watch RPC can watch on multiple key ranges, streaming events
- // for several watches at once. The entire event history can be watched starting from the
- // last compaction revision.
- rpc Watch(stream WatchRequest) returns (stream WatchResponse) {
- option (google.api.http) = {
- post: "/v3alpha/watch"
- body: "*"
- };
- }
-}
-
-service Lease {
- // LeaseGrant creates a lease which expires if the server does not receive a keepAlive
- // within a given time to live period. All keys attached to the lease will be expired and
- // deleted if the lease expires. Each expired key generates a delete event in the event history.
- rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse) {
- option (google.api.http) = {
- post: "/v3alpha/lease/grant"
- body: "*"
- };
- }
-
- // LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
- rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse) {
- option (google.api.http) = {
- post: "/v3alpha/kv/lease/revoke"
- body: "*"
- };
- }
-
- // LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
- // to the server and streaming keep alive responses from the server to the client.
- rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse) {
- option (google.api.http) = {
- post: "/v3alpha/lease/keepalive"
- body: "*"
- };
- }
-
- // TODO(xiangli) List all existing Leases?
- // TODO(xiangli) Get details information (expirations, leased keys, etc.) of a lease?
-}
-
-service Cluster {
- // MemberAdd adds a member into the cluster.
- rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse) {
- option (google.api.http) = {
- post: "/v3alpha/cluster/member/add"
- body: "*"
- };
- }
-
- // MemberRemove removes an existing member from the cluster.
- rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse) {
- option (google.api.http) = {
- post: "/v3alpha/cluster/member/remove"
- body: "*"
- };
- }
-
- // MemberUpdate updates the member configuration.
- rpc MemberUpdate(MemberUpdateRequest) returns (MemberUpdateResponse) {
- option (google.api.http) = {
- post: "/v3alpha/cluster/member/update"
- body: "*"
- };
- }
-
- // MemberList lists all the members in the cluster.
- rpc MemberList(MemberListRequest) returns (MemberListResponse) {
- option (google.api.http) = {
- post: "/v3alpha/cluster/member/list"
- body: "*"
- };
- }
-}
-
-service Maintenance {
- // Alarm activates, deactivates, and queries alarms regarding cluster health.
- rpc Alarm(AlarmRequest) returns (AlarmResponse) {
- option (google.api.http) = {
- post: "/v3alpha/maintenance/alarm"
- body: "*"
- };
- }
-
- // Status gets the status of the member.
- rpc Status(StatusRequest) returns (StatusResponse) {
- option (google.api.http) = {
- post: "/v3alpha/maintenance/status"
- body: "*"
- };
- }
-
- // Defragment defragments a member's backend database to recover storage space.
- rpc Defragment(DefragmentRequest) returns (DefragmentResponse) {
- option (google.api.http) = {
- post: "/v3alpha/maintenance/defragment"
- body: "*"
- };
- }
-
- // Hash returns the hash of the local KV state for consistency checking purpose.
- // This is designed for testing; do not use this in production when there
- // are ongoing transactions.
- rpc Hash(HashRequest) returns (HashResponse) {
- option (google.api.http) = {
- post: "/v3alpha/maintenance/hash"
- body: "*"
- };
- }
-
- // Snapshot sends a snapshot of the entire backend from a member over a stream to a client.
- rpc Snapshot(SnapshotRequest) returns (stream SnapshotResponse) {
- option (google.api.http) = {
- post: "/v3alpha/maintenance/snapshot"
- body: "*"
- };
- }
-}
-
-service Auth {
- // AuthEnable enables authentication.
- rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/enable"
- body: "*"
- };
- }
-
- // AuthDisable disables authentication.
- rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/disable"
- body: "*"
- };
- }
-
- // Authenticate processes an authenticate request.
- rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/authenticate"
- body: "*"
- };
- }
-
- // UserAdd adds a new user.
- rpc UserAdd(AuthUserAddRequest) returns (AuthUserAddResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/add"
- body: "*"
- };
- }
-
- // UserGet gets detailed user information.
- rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/get"
- body: "*"
- };
- }
-
- // UserList gets a list of all users.
- rpc UserList(AuthUserListRequest) returns (AuthUserListResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/list"
- body: "*"
- };
- }
-
- // UserDelete deletes a specified user.
- rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/delete"
- body: "*"
- };
- }
-
- // UserChangePassword changes the password of a specified user.
- rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/changepw"
- body: "*"
- };
- }
-
- // UserGrant grants a role to a specified user.
- rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/grant"
- body: "*"
- };
- }
-
- // UserRevokeRole revokes a role of specified user.
- rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/user/revoke"
- body: "*"
- };
- }
-
- // RoleAdd adds a new role.
- rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/add"
- body: "*"
- };
- }
-
- // RoleGet gets detailed role information.
- rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/get"
- body: "*"
- };
- }
-
- // RoleList gets lists of all roles.
- rpc RoleList(AuthRoleListRequest) returns (AuthRoleListResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/list"
- body: "*"
- };
- }
-
- // RoleDelete deletes a specified role.
- rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/delete"
- body: "*"
- };
- }
-
- // RoleGrantPermission grants a permission of a specified key or range to a specified role.
- rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/grant"
- body: "*"
- };
- }
-
- // RoleRevokePermission revokes a key or range permission of a specified role.
- rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) {
- option (google.api.http) = {
- post: "/v3alpha/auth/role/revoke"
- body: "*"
- };
- }
-}
-
-message ResponseHeader {
- // cluster_id is the ID of the cluster which sent the response.
- uint64 cluster_id = 1;
- // member_id is the ID of the member which sent the response.
- uint64 member_id = 2;
- // revision is the key-value store revision when the request was applied.
- int64 revision = 3;
- // raft_term is the raft term when the request was applied.
- uint64 raft_term = 4;
-}
-
-message RangeRequest {
- enum SortOrder {
- NONE = 0; // default, no sorting
- ASCEND = 1; // lowest target value first
- DESCEND = 2; // highest target value first
- }
- enum SortTarget {
- KEY = 0;
- VERSION = 1;
- CREATE = 2;
- MOD = 3;
- VALUE = 4;
- }
-
- // key is the first key for the range. If range_end is not given, the request only looks up key.
- bytes key = 1;
- // range_end is the upper bound on the requested range [key, range_end).
- // If range_end is '\0', the range is all keys >= key.
- // If the range_end is one bit larger than the given key,
- // then the range requests get the all keys with the prefix (the given key).
- // If both key and range_end are '\0', then range requests returns all keys.
- bytes range_end = 2;
- // limit is a limit on the number of keys returned for the request.
- int64 limit = 3;
- // revision is the point-in-time of the key-value store to use for the range.
- // If revision is less or equal to zero, the range is over the newest key-value store.
- // If the revision has been compacted, ErrCompacted is returned as a response.
- int64 revision = 4;
-
- // sort_order is the order for returned sorted results.
- SortOrder sort_order = 5;
-
- // sort_target is the key-value field to use for sorting.
- SortTarget sort_target = 6;
-
- // serializable sets the range request to use serializable member-local reads.
- // Range requests are linearizable by default; linearizable requests have higher
- // latency and lower throughput than serializable requests but reflect the current
- // consensus of the cluster. For better performance, in exchange for possible stale reads,
- // a serializable range request is served locally without needing to reach consensus
- // with other nodes in the cluster.
- bool serializable = 7;
-
- // keys_only when set returns only the keys and not the values.
- bool keys_only = 8;
-
- // count_only when set returns only the count of the keys in the range.
- bool count_only = 9;
-}
-
-message RangeResponse {
- ResponseHeader header = 1;
- // kvs is the list of key-value pairs matched by the range request.
- // kvs is empty when count is requested.
- repeated mvccpb.KeyValue kvs = 2;
- // more indicates if there are more keys to return in the requested range.
- bool more = 3;
- // count is set to the number of keys within the range when requested.
- int64 count = 4;
-}
-
-message PutRequest {
- // key is the key, in bytes, to put into the key-value store.
- bytes key = 1;
- // value is the value, in bytes, to associate with the key in the key-value store.
- bytes value = 2;
- // lease is the lease ID to associate with the key in the key-value store. A lease
- // value of 0 indicates no lease.
- int64 lease = 3;
-
- // If prev_kv is set, etcd gets the previous key-value pair before changing it.
- // The previous key-value pair will be returned in the put response.
- bool prev_kv = 4;
-}
-
-message PutResponse {
- ResponseHeader header = 1;
- // if prev_kv is set in the request, the previous key-value pair will be returned.
- mvccpb.KeyValue prev_kv = 2;
-}
-
-message DeleteRangeRequest {
- // key is the first key to delete in the range.
- bytes key = 1;
- // range_end is the key following the last key to delete for the range [key, range_end).
- // If range_end is not given, the range is defined to contain only the key argument.
- // If range_end is '\0', the range is all keys greater than or equal to the key argument.
- bytes range_end = 2;
- // If prev_kv is set, etcd gets the previous key-value pairs before deleting it.
- // The previous key-value pairs will be returned in the delte response.
- bool prev_kv = 3;
-}
-
-message DeleteRangeResponse {
- ResponseHeader header = 1;
- // deleted is the number of keys deleted by the delete range request.
- int64 deleted = 2;
- // if prev_kv is set in the request, the previous key-value pairs will be returned.
- repeated mvccpb.KeyValue prev_kvs = 3;
-}
-
-message RequestOp {
- // request is a union of request types accepted by a transaction.
- oneof request {
- RangeRequest request_range = 1;
- PutRequest request_put = 2;
- DeleteRangeRequest request_delete_range = 3;
- }
-}
-
-message ResponseOp {
- // response is a union of response types returned by a transaction.
- oneof response {
- RangeResponse response_range = 1;
- PutResponse response_put = 2;
- DeleteRangeResponse response_delete_range = 3;
- }
-}
-
-message Compare {
- enum CompareResult {
- EQUAL = 0;
- GREATER = 1;
- LESS = 2;
- }
- enum CompareTarget {
- VERSION = 0;
- CREATE = 1;
- MOD = 2;
- VALUE= 3;
- }
- // result is logical comparison operation for this comparison.
- CompareResult result = 1;
- // target is the key-value field to inspect for the comparison.
- CompareTarget target = 2;
- // key is the subject key for the comparison operation.
- bytes key = 3;
- oneof target_union {
- // version is the version of the given key
- int64 version = 4;
- // create_revision is the creation revision of the given key
- int64 create_revision = 5;
- // mod_revision is the last modified revision of the given key.
- int64 mod_revision = 6;
- // value is the value of the given key, in bytes.
- bytes value = 7;
- }
-}
-
-// From google paxosdb paper:
-// Our implementation hinges around a powerful primitive which we call MultiOp. All other database
-// operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
-// and consists of three components:
-// 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
-// for the absence or presence of a value, or compare with a given value. Two different tests in the guard
-// may apply to the same or different entries in the database. All tests in the guard are applied and
-// MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
-// it executes f op (see item 3 below).
-// 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
-// lookup operation, and applies to a single database entry. Two different operations in the list may apply
-// to the same or different entries in the database. These operations are executed
-// if guard evaluates to
-// true.
-// 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
-message TxnRequest {
- // compare is a list of predicates representing a conjunction of terms.
- // If the comparisons succeed, then the success requests will be processed in order,
- // and the response will contain their respective responses in order.
- // If the comparisons fail, then the failure requests will be processed in order,
- // and the response will contain their respective responses in order.
- repeated Compare compare = 1;
- // success is a list of requests which will be applied when compare evaluates to true.
- repeated RequestOp success = 2;
- // failure is a list of requests which will be applied when compare evaluates to false.
- repeated RequestOp failure = 3;
-}
-
-message TxnResponse {
- ResponseHeader header = 1;
- // succeeded is set to true if the compare evaluated to true or false otherwise.
- bool succeeded = 2;
- // responses is a list of responses corresponding to the results from applying
- // success if succeeded is true or failure if succeeded is false.
- repeated ResponseOp responses = 3;
-}
-
-// CompactionRequest compacts the key-value store up to a given revision. All superseded keys
-// with a revision less than the compaction revision will be removed.
-message CompactionRequest {
- // revision is the key-value store revision for the compaction operation.
- int64 revision = 1;
- // physical is set so the RPC will wait until the compaction is physically
- // applied to the local database such that compacted entries are totally
- // removed from the backend database.
- bool physical = 2;
-}
-
-message CompactionResponse {
- ResponseHeader header = 1;
-}
-
-message HashRequest {
-}
-
-message HashResponse {
- ResponseHeader header = 1;
- // hash is the hash value computed from the responding member's key-value store.
- uint32 hash = 2;
-}
-
-message SnapshotRequest {
-}
-
-message SnapshotResponse {
- // header has the current key-value store information. The first header in the snapshot
- // stream indicates the point in time of the snapshot.
- ResponseHeader header = 1;
-
- // remaining_bytes is the number of blob bytes to be sent after this message
- uint64 remaining_bytes = 2;
-
- // blob contains the next chunk of the snapshot in the snapshot stream.
- bytes blob = 3;
-}
-
-message WatchRequest {
- // request_union is a request to either create a new watcher or cancel an existing watcher.
- oneof request_union {
- WatchCreateRequest create_request = 1;
- WatchCancelRequest cancel_request = 2;
- }
-}
-
-message WatchCreateRequest {
- // key is the key to register for watching.
- bytes key = 1;
- // range_end is the end of the range [key, range_end) to watch. If range_end is not given,
- // only the key argument is watched. If range_end is equal to '\0', all keys greater than
- // or equal to the key argument are watched.
- bytes range_end = 2;
- // start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
- int64 start_revision = 3;
- // progress_notify is set so that the etcd server will periodically send a WatchResponse with
- // no events to the new watcher if there are no recent events. It is useful when clients
- // wish to recover a disconnected watcher starting from a recent known revision.
- // The etcd server may decide how often it will send notifications based on current load.
- bool progress_notify = 4;
- // If prev_kv is set, created watcher gets the previous KV before the event happens.
- // If the previous KV is already compacted, nothing will be returned.
- bool prev_kv = 6;
-}
-
-message WatchCancelRequest {
- // watch_id is the watcher id to cancel so that no more events are transmitted.
- int64 watch_id = 1;
-}
-
-message WatchResponse {
- ResponseHeader header = 1;
- // watch_id is the ID of the watcher that corresponds to the response.
- int64 watch_id = 2;
- // created is set to true if the response is for a create watch request.
- // The client should record the watch_id and expect to receive events for
- // the created watcher from the same stream.
- // All events sent to the created watcher will attach with the same watch_id.
- bool created = 3;
- // canceled is set to true if the response is for a cancel watch request.
- // No further events will be sent to the canceled watcher.
- bool canceled = 4;
- // compact_revision is set to the minimum index if a watcher tries to watch
- // at a compacted index.
- //
- // This happens when creating a watcher at a compacted revision or the watcher cannot
- // catch up with the progress of the key-value store.
- //
- // The client should treat the watcher as canceled and should not try to create any
- // watcher with the same start_revision again.
- int64 compact_revision = 5;
-
- repeated mvccpb.Event events = 11;
-}
-
-message LeaseGrantRequest {
- // TTL is the advisory time-to-live in seconds.
- int64 TTL = 1;
- // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
- int64 ID = 2;
-}
-
-message LeaseGrantResponse {
- ResponseHeader header = 1;
- // ID is the lease ID for the granted lease.
- int64 ID = 2;
- // TTL is the server chosen lease time-to-live in seconds.
- int64 TTL = 3;
- string error = 4;
-}
-
-message LeaseRevokeRequest {
- // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
- int64 ID = 1;
-}
-
-message LeaseRevokeResponse {
- ResponseHeader header = 1;
-}
-
-message LeaseKeepAliveRequest {
- // ID is the lease ID for the lease to keep alive.
- int64 ID = 1;
-}
-
-message LeaseKeepAliveResponse {
- ResponseHeader header = 1;
- // ID is the lease ID from the keep alive request.
- int64 ID = 2;
- // TTL is the new time-to-live for the lease.
- int64 TTL = 3;
-}
-
-message Member {
- // ID is the member ID for this member.
- uint64 ID = 1;
- // name is the human-readable name of the member. If the member is not started, the name will be an empty string.
- string name = 2;
- // peerURLs is the list of URLs the member exposes to the cluster for communication.
- repeated string peerURLs = 3;
- // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
- repeated string clientURLs = 4;
-}
-
-message MemberAddRequest {
- // peerURLs is the list of URLs the added member will use to communicate with the cluster.
- repeated string peerURLs = 1;
-}
-
-message MemberAddResponse {
- ResponseHeader header = 1;
- // member is the member information for the added member.
- Member member = 2;
-}
-
-message MemberRemoveRequest {
- // ID is the member ID of the member to remove.
- uint64 ID = 1;
-}
-
-message MemberRemoveResponse {
- ResponseHeader header = 1;
-}
-
-message MemberUpdateRequest {
- // ID is the member ID of the member to update.
- uint64 ID = 1;
- // peerURLs is the new list of URLs the member will use to communicate with the cluster.
- repeated string peerURLs = 2;
-}
-
-message MemberUpdateResponse{
- ResponseHeader header = 1;
-}
-
-message MemberListRequest {
-}
-
-message MemberListResponse {
- ResponseHeader header = 1;
- // members is a list of all members associated with the cluster.
- repeated Member members = 2;
-}
-
-message DefragmentRequest {
-}
-
-message DefragmentResponse {
- ResponseHeader header = 1;
-}
-
-enum AlarmType {
- NONE = 0; // default, used to query if any alarm is active
- NOSPACE = 1; // space quota is exhausted
-}
-
-message AlarmRequest {
- enum AlarmAction {
- GET = 0;
- ACTIVATE = 1;
- DEACTIVATE = 2;
- }
- // action is the kind of alarm request to issue. The action
- // may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
- // raised alarm.
- AlarmAction action = 1;
- // memberID is the ID of the member associated with the alarm. If memberID is 0, the
- // alarm request covers all members.
- uint64 memberID = 2;
- // alarm is the type of alarm to consider for this request.
- AlarmType alarm = 3;
-}
-
-message AlarmMember {
- // memberID is the ID of the member associated with the raised alarm.
- uint64 memberID = 1;
- // alarm is the type of alarm which has been raised.
- AlarmType alarm = 2;
-}
-
-message AlarmResponse {
- ResponseHeader header = 1;
- // alarms is a list of alarms associated with the alarm request.
- repeated AlarmMember alarms = 2;
-}
-
-message StatusRequest {
-}
-
-message StatusResponse {
- ResponseHeader header = 1;
- // version is the cluster protocol version used by the responding member.
- string version = 2;
- // dbSize is the size of the backend database, in bytes, of the responding member.
- int64 dbSize = 3;
- // leader is the member ID which the responding member believes is the current leader.
- uint64 leader = 4;
- // raftIndex is the current raft index of the responding member.
- uint64 raftIndex = 5;
- // raftTerm is the current raft term of the responding member.
- uint64 raftTerm = 6;
-}
-
-message AuthEnableRequest {
-}
-
-message AuthDisableRequest {
-}
-
-message AuthenticateRequest {
- string name = 1;
- string password = 2;
-}
-
-message AuthUserAddRequest {
- string name = 1;
- string password = 2;
-}
-
-message AuthUserGetRequest {
- string name = 1;
-}
-
-message AuthUserDeleteRequest {
- // name is the name of the user to delete.
- string name = 1;
-}
-
-message AuthUserChangePasswordRequest {
- // name is the name of the user whose password is being changed.
- string name = 1;
- // password is the new password for the user.
- string password = 2;
-}
-
-message AuthUserGrantRoleRequest {
- // user is the name of the user which should be granted a given role.
- string user = 1;
- // role is the name of the role to grant to the user.
- string role = 2;
-}
-
-message AuthUserRevokeRoleRequest {
- string name = 1;
- string role = 2;
-}
-
-message AuthRoleAddRequest {
- // name is the name of the role to add to the authentication system.
- string name = 1;
-}
-
-message AuthRoleGetRequest {
- string role = 1;
-}
-
-message AuthUserListRequest {
-}
-
-message AuthRoleListRequest {
-}
-
-message AuthRoleDeleteRequest {
- string role = 1;
-}
-
-message AuthRoleGrantPermissionRequest {
- // name is the name of the role which will be granted the permission.
- string name = 1;
- // perm is the permission to grant to the role.
- authpb.Permission perm = 2;
-}
-
-message AuthRoleRevokePermissionRequest {
- string role = 1;
- string key = 2;
- string range_end = 3;
-}
-
-message AuthEnableResponse {
- ResponseHeader header = 1;
-}
-
-message AuthDisableResponse {
- ResponseHeader header = 1;
-}
-
-message AuthenticateResponse {
- ResponseHeader header = 1;
- // token is an authorized token that can be used in succeeding RPCs
- string token = 2;
-}
-
-message AuthUserAddResponse {
- ResponseHeader header = 1;
-}
-
-message AuthUserGetResponse {
- ResponseHeader header = 1;
-
- repeated string roles = 2;
-}
-
-message AuthUserDeleteResponse {
- ResponseHeader header = 1;
-}
-
-message AuthUserChangePasswordResponse {
- ResponseHeader header = 1;
-}
-
-message AuthUserGrantRoleResponse {
- ResponseHeader header = 1;
-}
-
-message AuthUserRevokeRoleResponse {
- ResponseHeader header = 1;
-}
-
-message AuthRoleAddResponse {
- ResponseHeader header = 1;
-}
-
-message AuthRoleGetResponse {
- ResponseHeader header = 1;
-
- repeated authpb.Permission perm = 2;
-}
-
-message AuthRoleListResponse {
- ResponseHeader header = 1;
-
- repeated string roles = 2;
-}
-
-message AuthUserListResponse {
- ResponseHeader header = 1;
-
- repeated string users = 2;
-}
-
-message AuthRoleDeleteResponse {
- ResponseHeader header = 1;
-}
-
-message AuthRoleGrantPermissionResponse {
- ResponseHeader header = 1;
-}
-
-message AuthRoleRevokePermissionResponse {
- ResponseHeader header = 1;
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go b/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go
deleted file mode 100644
index 12c038328..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go
+++ /dev/null
@@ -1,731 +0,0 @@
-// Code generated by protoc-gen-gogo.
-// source: kv.proto
-// DO NOT EDIT!
-
-/*
- Package mvccpb is a generated protocol buffer package.
-
- It is generated from these files:
- kv.proto
-
- It has these top-level messages:
- KeyValue
- Event
-*/
-package mvccpb
-
-import (
- "fmt"
-
- proto "github.com/golang/protobuf/proto"
-
- math "math"
-
- io "io"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-const _ = proto.ProtoPackageIsVersion1
-
-type Event_EventType int32
-
-const (
- PUT Event_EventType = 0
- DELETE Event_EventType = 1
-)
-
-var Event_EventType_name = map[int32]string{
- 0: "PUT",
- 1: "DELETE",
-}
-var Event_EventType_value = map[string]int32{
- "PUT": 0,
- "DELETE": 1,
-}
-
-func (x Event_EventType) String() string {
- return proto.EnumName(Event_EventType_name, int32(x))
-}
-func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorKv, []int{1, 0} }
-
-type KeyValue struct {
- // key is the key in bytes. An empty key is not allowed.
- Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
- // create_revision is the revision of last creation on this key.
- CreateRevision int64 `protobuf:"varint,2,opt,name=create_revision,json=createRevision,proto3" json:"create_revision,omitempty"`
- // mod_revision is the revision of last modification on this key.
- ModRevision int64 `protobuf:"varint,3,opt,name=mod_revision,json=modRevision,proto3" json:"mod_revision,omitempty"`
- // version is the version of the key. A deletion resets
- // the version to zero and any modification of the key
- // increases its version.
- Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
- // value is the value held by the key, in bytes.
- Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
- // lease is the ID of the lease that attached to key.
- // When the attached lease expires, the key will be deleted.
- // If lease is 0, then no lease is attached to the key.
- Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"`
-}
-
-func (m *KeyValue) Reset() { *m = KeyValue{} }
-func (m *KeyValue) String() string { return proto.CompactTextString(m) }
-func (*KeyValue) ProtoMessage() {}
-func (*KeyValue) Descriptor() ([]byte, []int) { return fileDescriptorKv, []int{0} }
-
-type Event struct {
- // type is the kind of event. If type is a PUT, it indicates
- // new data has been stored to the key. If type is a DELETE,
- // it indicates the key was deleted.
- Type Event_EventType `protobuf:"varint,1,opt,name=type,proto3,enum=mvccpb.Event_EventType" json:"type,omitempty"`
- // kv holds the KeyValue for the event.
- // A PUT event contains current kv pair.
- // A PUT event with kv.Version=1 indicates the creation of a key.
- // A DELETE/EXPIRE event contains the deleted key with
- // its modification revision set to the revision of deletion.
- Kv *KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv,omitempty"`
- // prev_kv holds the key-value pair before the event happens.
- PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv" json:"prev_kv,omitempty"`
-}
-
-func (m *Event) Reset() { *m = Event{} }
-func (m *Event) String() string { return proto.CompactTextString(m) }
-func (*Event) ProtoMessage() {}
-func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorKv, []int{1} }
-
-func init() {
- proto.RegisterType((*KeyValue)(nil), "mvccpb.KeyValue")
- proto.RegisterType((*Event)(nil), "mvccpb.Event")
- proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value)
-}
-func (m *KeyValue) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *KeyValue) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Key) > 0 {
- data[i] = 0xa
- i++
- i = encodeVarintKv(data, i, uint64(len(m.Key)))
- i += copy(data[i:], m.Key)
- }
- if m.CreateRevision != 0 {
- data[i] = 0x10
- i++
- i = encodeVarintKv(data, i, uint64(m.CreateRevision))
- }
- if m.ModRevision != 0 {
- data[i] = 0x18
- i++
- i = encodeVarintKv(data, i, uint64(m.ModRevision))
- }
- if m.Version != 0 {
- data[i] = 0x20
- i++
- i = encodeVarintKv(data, i, uint64(m.Version))
- }
- if len(m.Value) > 0 {
- data[i] = 0x2a
- i++
- i = encodeVarintKv(data, i, uint64(len(m.Value)))
- i += copy(data[i:], m.Value)
- }
- if m.Lease != 0 {
- data[i] = 0x30
- i++
- i = encodeVarintKv(data, i, uint64(m.Lease))
- }
- return i, nil
-}
-
-func (m *Event) Marshal() (data []byte, err error) {
- size := m.Size()
- data = make([]byte, size)
- n, err := m.MarshalTo(data)
- if err != nil {
- return nil, err
- }
- return data[:n], nil
-}
-
-func (m *Event) MarshalTo(data []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if m.Type != 0 {
- data[i] = 0x8
- i++
- i = encodeVarintKv(data, i, uint64(m.Type))
- }
- if m.Kv != nil {
- data[i] = 0x12
- i++
- i = encodeVarintKv(data, i, uint64(m.Kv.Size()))
- n1, err := m.Kv.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n1
- }
- if m.PrevKv != nil {
- data[i] = 0x1a
- i++
- i = encodeVarintKv(data, i, uint64(m.PrevKv.Size()))
- n2, err := m.PrevKv.MarshalTo(data[i:])
- if err != nil {
- return 0, err
- }
- i += n2
- }
- return i, nil
-}
-
-func encodeFixed64Kv(data []byte, offset int, v uint64) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- data[offset+4] = uint8(v >> 32)
- data[offset+5] = uint8(v >> 40)
- data[offset+6] = uint8(v >> 48)
- data[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32Kv(data []byte, offset int, v uint32) int {
- data[offset] = uint8(v)
- data[offset+1] = uint8(v >> 8)
- data[offset+2] = uint8(v >> 16)
- data[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintKv(data []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- data[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- data[offset] = uint8(v)
- return offset + 1
-}
-func (m *KeyValue) Size() (n int) {
- var l int
- _ = l
- l = len(m.Key)
- if l > 0 {
- n += 1 + l + sovKv(uint64(l))
- }
- if m.CreateRevision != 0 {
- n += 1 + sovKv(uint64(m.CreateRevision))
- }
- if m.ModRevision != 0 {
- n += 1 + sovKv(uint64(m.ModRevision))
- }
- if m.Version != 0 {
- n += 1 + sovKv(uint64(m.Version))
- }
- l = len(m.Value)
- if l > 0 {
- n += 1 + l + sovKv(uint64(l))
- }
- if m.Lease != 0 {
- n += 1 + sovKv(uint64(m.Lease))
- }
- return n
-}
-
-func (m *Event) Size() (n int) {
- var l int
- _ = l
- if m.Type != 0 {
- n += 1 + sovKv(uint64(m.Type))
- }
- if m.Kv != nil {
- l = m.Kv.Size()
- n += 1 + l + sovKv(uint64(l))
- }
- if m.PrevKv != nil {
- l = m.PrevKv.Size()
- n += 1 + l + sovKv(uint64(l))
- }
- return n
-}
-
-func sovKv(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozKv(x uint64) (n int) {
- return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *KeyValue) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: KeyValue: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthKv
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Key = append(m.Key[:0], data[iNdEx:postIndex]...)
- if m.Key == nil {
- m.Key = []byte{}
- }
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field CreateRevision", wireType)
- }
- m.CreateRevision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.CreateRevision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ModRevision", wireType)
- }
- m.ModRevision = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.ModRevision |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
- }
- m.Version = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Version |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 5:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
- }
- var byteLen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- byteLen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if byteLen < 0 {
- return ErrInvalidLengthKv
- }
- postIndex := iNdEx + byteLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Value = append(m.Value[:0], data[iNdEx:postIndex]...)
- if m.Value == nil {
- m.Value = []byte{}
- }
- iNdEx = postIndex
- case 6:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType)
- }
- m.Lease = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Lease |= (int64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- default:
- iNdEx = preIndex
- skippy, err := skipKv(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthKv
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *Event) Unmarshal(data []byte) error {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Event: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
- }
- m.Type = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- m.Type |= (Event_EventType(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Kv", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthKv
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.Kv == nil {
- m.Kv = &KeyValue{}
- }
- if err := m.Kv.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PrevKv", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowKv
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthKv
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if m.PrevKv == nil {
- m.PrevKv = &KeyValue{}
- }
- if err := m.PrevKv.Unmarshal(data[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipKv(data[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthKv
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipKv(data []byte) (n int, err error) {
- l := len(data)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowKv
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowKv
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if data[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowKv
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthKv
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowKv
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipKv(data[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowKv = fmt.Errorf("proto: integer overflow")
-)
-
-var fileDescriptorKv = []byte{
- // 303 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4e, 0xc2, 0x40,
- 0x14, 0x86, 0x3b, 0x14, 0x0a, 0x3e, 0x08, 0x36, 0x13, 0x12, 0x27, 0x2e, 0x26, 0x95, 0x8d, 0x18,
- 0x13, 0x4c, 0xf0, 0x06, 0xc6, 0xae, 0x70, 0x61, 0x1a, 0x74, 0x4b, 0x4a, 0x79, 0x21, 0xa4, 0x94,
- 0x69, 0x4a, 0x9d, 0xa4, 0x37, 0x71, 0xef, 0xde, 0x73, 0xb0, 0xe4, 0x08, 0x52, 0x2f, 0x62, 0xfa,
- 0xc6, 0xe2, 0xc6, 0xcd, 0xe4, 0xfd, 0xff, 0xff, 0x65, 0xe6, 0x7f, 0x03, 0x9d, 0x58, 0x8f, 0xd3,
- 0x4c, 0xe5, 0x8a, 0x3b, 0x89, 0x8e, 0xa2, 0x74, 0x71, 0x39, 0x58, 0xa9, 0x95, 0x22, 0xeb, 0xae,
- 0x9a, 0x4c, 0x3a, 0xfc, 0x64, 0xd0, 0x99, 0x62, 0xf1, 0x1a, 0x6e, 0xde, 0x90, 0xbb, 0x60, 0xc7,
- 0x58, 0x08, 0xe6, 0xb1, 0x51, 0x2f, 0xa8, 0x46, 0x7e, 0x0d, 0xe7, 0x51, 0x86, 0x61, 0x8e, 0xf3,
- 0x0c, 0xf5, 0x7a, 0xb7, 0x56, 0x5b, 0xd1, 0xf0, 0xd8, 0xc8, 0x0e, 0xfa, 0xc6, 0x0e, 0x7e, 0x5d,
- 0x7e, 0x05, 0xbd, 0x44, 0x2d, 0xff, 0x28, 0x9b, 0xa8, 0x6e, 0xa2, 0x96, 0x27, 0x44, 0x40, 0x5b,
- 0x63, 0x46, 0x69, 0x93, 0xd2, 0x5a, 0xf2, 0x01, 0xb4, 0x74, 0x55, 0x40, 0xb4, 0xe8, 0x65, 0x23,
- 0x2a, 0x77, 0x83, 0xe1, 0x0e, 0x85, 0x43, 0xb4, 0x11, 0xc3, 0x0f, 0x06, 0x2d, 0x5f, 0xe3, 0x36,
- 0xe7, 0xb7, 0xd0, 0xcc, 0x8b, 0x14, 0xa9, 0x6e, 0x7f, 0x72, 0x31, 0x36, 0x7b, 0x8e, 0x29, 0x34,
- 0xe7, 0xac, 0x48, 0x31, 0x20, 0x88, 0x7b, 0xd0, 0x88, 0x35, 0x75, 0xef, 0x4e, 0xdc, 0x1a, 0xad,
- 0x17, 0x0f, 0x1a, 0xb1, 0xe6, 0x37, 0xd0, 0x4e, 0x33, 0xd4, 0xf3, 0x58, 0x53, 0xf9, 0xff, 0x30,
- 0xa7, 0x02, 0xa6, 0x7a, 0xe8, 0xc1, 0xd9, 0xe9, 0x7e, 0xde, 0x06, 0xfb, 0xf9, 0x65, 0xe6, 0x5a,
- 0x1c, 0xc0, 0x79, 0xf4, 0x9f, 0xfc, 0x99, 0xef, 0xb2, 0x07, 0xb1, 0x3f, 0x4a, 0xeb, 0x70, 0x94,
- 0xd6, 0xbe, 0x94, 0xec, 0x50, 0x4a, 0xf6, 0x55, 0x4a, 0xf6, 0xfe, 0x2d, 0xad, 0x85, 0x43, 0xff,
- 0x7e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x45, 0x92, 0x5d, 0xa1, 0x01, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto b/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto
deleted file mode 100644
index f150d26c7..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-syntax = "proto3";
-package mvccpb;
-
-import "gogoproto/gogo.proto";
-
-option (gogoproto.marshaler_all) = true;
-option (gogoproto.sizer_all) = true;
-option (gogoproto.unmarshaler_all) = true;
-option (gogoproto.goproto_getters_all) = false;
-option (gogoproto.goproto_enum_prefix_all) = false;
-
-message KeyValue {
- // key is the key in bytes. An empty key is not allowed.
- bytes key = 1;
- // create_revision is the revision of last creation on this key.
- int64 create_revision = 2;
- // mod_revision is the revision of last modification on this key.
- int64 mod_revision = 3;
- // version is the version of the key. A deletion resets
- // the version to zero and any modification of the key
- // increases its version.
- int64 version = 4;
- // value is the value held by the key, in bytes.
- bytes value = 5;
- // lease is the ID of the lease that attached to key.
- // When the attached lease expires, the key will be deleted.
- // If lease is 0, then no lease is attached to the key.
- int64 lease = 6;
-}
-
-message Event {
- enum EventType {
- PUT = 0;
- DELETE = 1;
- }
- // type is the kind of event. If type is a PUT, it indicates
- // new data has been stored to the key. If type is a DELETE,
- // it indicates the key was deleted.
- EventType type = 1;
- // kv holds the KeyValue for the event.
- // A PUT event contains current kv pair.
- // A PUT event with kv.Version=1 indicates the creation of a key.
- // A DELETE/EXPIRE event contains the deleted key with
- // its modification revision set to the revision of deletion.
- KeyValue kv = 2;
- // prev_kv holds the key-value pair before the event happens.
- KeyValue prev_kv = 3;
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go
deleted file mode 100644
index 58a77dfc1..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_unix.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows
-
-package fileutil
-
-import "os"
-
-// OpenDir opens a directory for syncing.
-func OpenDir(path string) (*os.File, error) { return os.Open(path) }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go
deleted file mode 100644
index c123395c0..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/dir_windows.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build windows
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-// OpenDir opens a directory in windows with write access for syncing.
-func OpenDir(path string) (*os.File, error) {
- fd, err := openDir(path)
- if err != nil {
- return nil, err
- }
- return os.NewFile(uintptr(fd), path), nil
-}
-
-func openDir(path string) (fd syscall.Handle, err error) {
- if len(path) == 0 {
- return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND
- }
- pathp, err := syscall.UTF16PtrFromString(path)
- if err != nil {
- return syscall.InvalidHandle, err
- }
- access := uint32(syscall.GENERIC_READ | syscall.GENERIC_WRITE)
- sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE)
- createmode := uint32(syscall.OPEN_EXISTING)
- fl := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS)
- return syscall.CreateFile(pathp, access, sharemode, nil, createmode, fl, 0)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go
deleted file mode 100644
index 8d9e725f0..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/fileutil.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package fileutil implements utility functions related to files and paths.
-package fileutil
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "path"
- "sort"
-
- "github.com/coreos/pkg/capnslog"
-)
-
-const (
- // PrivateFileMode grants owner to read/write a file.
- PrivateFileMode = 0600
- // PrivateDirMode grants owner to make/remove files inside the directory.
- PrivateDirMode = 0700
-)
-
-var (
- plog = capnslog.NewPackageLogger("github.com/coreos/etcd/pkg", "fileutil")
-)
-
-// IsDirWriteable checks if dir is writable by writing and removing a file
-// to dir. It returns nil if dir is writable.
-func IsDirWriteable(dir string) error {
- f := path.Join(dir, ".touch")
- if err := ioutil.WriteFile(f, []byte(""), PrivateFileMode); err != nil {
- return err
- }
- return os.Remove(f)
-}
-
-// ReadDir returns the filenames in the given directory in sorted order.
-func ReadDir(dirpath string) ([]string, error) {
- dir, err := os.Open(dirpath)
- if err != nil {
- return nil, err
- }
- defer dir.Close()
- names, err := dir.Readdirnames(-1)
- if err != nil {
- return nil, err
- }
- sort.Strings(names)
- return names, nil
-}
-
-// TouchDirAll is similar to os.MkdirAll. It creates directories with 0700 permission if any directory
-// does not exists. TouchDirAll also ensures the given directory is writable.
-func TouchDirAll(dir string) error {
- // If path is already a directory, MkdirAll does nothing
- // and returns nil.
- err := os.MkdirAll(dir, PrivateDirMode)
- if err != nil {
- // if mkdirAll("a/text") and "text" is not
- // a directory, this will return syscall.ENOTDIR
- return err
- }
- return IsDirWriteable(dir)
-}
-
-// CreateDirAll is similar to TouchDirAll but returns error
-// if the deepest directory was not empty.
-func CreateDirAll(dir string) error {
- err := TouchDirAll(dir)
- if err == nil {
- var ns []string
- ns, err = ReadDir(dir)
- if err != nil {
- return err
- }
- if len(ns) != 0 {
- err = fmt.Errorf("expected %q to be empty, got %q", dir, ns)
- }
- }
- return err
-}
-
-func Exist(name string) bool {
- _, err := os.Stat(name)
- return err == nil
-}
-
-// ZeroToEnd zeros a file starting from SEEK_CUR to its SEEK_END. May temporarily
-// shorten the length of the file.
-func ZeroToEnd(f *os.File) error {
- // TODO: support FALLOC_FL_ZERO_RANGE
- off, err := f.Seek(0, os.SEEK_CUR)
- if err != nil {
- return err
- }
- lenf, lerr := f.Seek(0, os.SEEK_END)
- if lerr != nil {
- return lerr
- }
- if err = f.Truncate(off); err != nil {
- return err
- }
- // make sure blocks remain allocated
- if err = Preallocate(f, lenf, true); err != nil {
- return err
- }
- _, err = f.Seek(off, os.SEEK_SET)
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go
deleted file mode 100644
index 338627f43..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fileutil
-
-import (
- "errors"
- "os"
-)
-
-var (
- ErrLocked = errors.New("fileutil: file already locked")
-)
-
-type LockedFile struct{ *os.File }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go
deleted file mode 100644
index 542550bc8..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_flock.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows,!plan9,!solaris
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-func flockTryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil {
- f.Close()
- if err == syscall.EWOULDBLOCK {
- err = ErrLocked
- }
- return nil, err
- }
- return &LockedFile{f}, nil
-}
-
-func flockLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil {
- f.Close()
- return nil, err
- }
- return &LockedFile{f}, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go
deleted file mode 100644
index dec25a1af..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_linux.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build linux
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-// This used to call syscall.Flock() but that call fails with EBADF on NFS.
-// An alternative is lockf() which works on NFS but that call lets a process lock
-// the same file twice. Instead, use Linux's non-standard open file descriptor
-// locks which will block if the process already holds the file lock.
-//
-// constants from /usr/include/bits/fcntl-linux.h
-const (
- F_OFD_GETLK = 37
- F_OFD_SETLK = 37
- F_OFD_SETLKW = 38
-)
-
-var (
- wrlck = syscall.Flock_t{
- Type: syscall.F_WRLCK,
- Whence: int16(os.SEEK_SET),
- Start: 0,
- Len: 0,
- }
-
- linuxTryLockFile = flockTryLockFile
- linuxLockFile = flockLockFile
-)
-
-func init() {
- // use open file descriptor locks if the system supports it
- getlk := syscall.Flock_t{Type: syscall.F_RDLCK}
- if err := syscall.FcntlFlock(0, F_OFD_GETLK, &getlk); err == nil {
- linuxTryLockFile = ofdTryLockFile
- linuxLockFile = ofdLockFile
- }
-}
-
-func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- return linuxTryLockFile(path, flag, perm)
-}
-
-func ofdTryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
-
- flock := wrlck
- if err = syscall.FcntlFlock(f.Fd(), F_OFD_SETLK, &flock); err != nil {
- f.Close()
- if err == syscall.EWOULDBLOCK {
- err = ErrLocked
- }
- return nil, err
- }
- return &LockedFile{f}, nil
-}
-
-func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- return linuxLockFile(path, flag, perm)
-}
-
-func ofdLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
-
- flock := wrlck
- err = syscall.FcntlFlock(f.Fd(), F_OFD_SETLKW, &flock)
-
- if err != nil {
- f.Close()
- return nil, err
- }
- return &LockedFile{f}, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go
deleted file mode 100644
index fee6a7c8f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_plan9.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fileutil
-
-import (
- "os"
- "syscall"
- "time"
-)
-
-func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- if err := os.Chmod(path, syscall.DMEXCL|PrivateFileMode); err != nil {
- return nil, err
- }
- f, err := os.Open(path, flag, perm)
- if err != nil {
- return nil, ErrLocked
- }
- return &LockedFile{f}, nil
-}
-
-func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- if err := os.Chmod(path, syscall.DMEXCL|PrivateFileMode); err != nil {
- return nil, err
- }
- for {
- f, err := os.OpenFile(path, flag, perm)
- if err == nil {
- return &LockedFile{f}, nil
- }
- time.Sleep(10 * time.Millisecond)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go
deleted file mode 100644
index 352ca5590..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_solaris.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build solaris
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- var lock syscall.Flock_t
- lock.Start = 0
- lock.Len = 0
- lock.Pid = 0
- lock.Type = syscall.F_WRLCK
- lock.Whence = 0
- lock.Pid = 0
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err := syscall.FcntlFlock(f.Fd(), syscall.F_SETLK, &lock); err != nil {
- f.Close()
- if err == syscall.EAGAIN {
- err = ErrLocked
- }
- return nil, err
- }
- return &LockedFile{f}, nil
-}
-
-func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- var lock syscall.Flock_t
- lock.Start = 0
- lock.Len = 0
- lock.Pid = 0
- lock.Type = syscall.F_WRLCK
- lock.Whence = 0
- f, err := os.OpenFile(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err = syscall.FcntlFlock(f.Fd(), syscall.F_SETLKW, &lock); err != nil {
- f.Close()
- return nil, err
- }
- return &LockedFile{f}, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go
deleted file mode 100644
index ed01164de..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_unix.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows,!plan9,!solaris,!linux
-
-package fileutil
-
-import (
- "os"
-)
-
-func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- return flockTryLockFile(path, flag, perm)
-}
-
-func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- return flockLockFile(path, flag, perm)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go
deleted file mode 100644
index 8698f4a8d..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/lock_windows.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build windows
-
-package fileutil
-
-import (
- "errors"
- "fmt"
- "os"
- "syscall"
- "unsafe"
-)
-
-var (
- modkernel32 = syscall.NewLazyDLL("kernel32.dll")
- procLockFileEx = modkernel32.NewProc("LockFileEx")
-
- errLocked = errors.New("The process cannot access the file because another process has locked a portion of the file.")
-)
-
-const (
- // https://msdn.microsoft.com/en-us/library/windows/desktop/aa365203(v=vs.85).aspx
- LOCKFILE_EXCLUSIVE_LOCK = 2
- LOCKFILE_FAIL_IMMEDIATELY = 1
-
- // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
- errLockViolation syscall.Errno = 0x21
-)
-
-func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := open(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err := lockFile(syscall.Handle(f.Fd()), LOCKFILE_FAIL_IMMEDIATELY); err != nil {
- f.Close()
- return nil, err
- }
- return &LockedFile{f}, nil
-}
-
-func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error) {
- f, err := open(path, flag, perm)
- if err != nil {
- return nil, err
- }
- if err := lockFile(syscall.Handle(f.Fd()), 0); err != nil {
- f.Close()
- return nil, err
- }
- return &LockedFile{f}, nil
-}
-
-func open(path string, flag int, perm os.FileMode) (*os.File, error) {
- if path == "" {
- return nil, fmt.Errorf("cannot open empty filename")
- }
- var access uint32
- switch flag {
- case syscall.O_RDONLY:
- access = syscall.GENERIC_READ
- case syscall.O_WRONLY:
- access = syscall.GENERIC_WRITE
- case syscall.O_RDWR:
- access = syscall.GENERIC_READ | syscall.GENERIC_WRITE
- case syscall.O_WRONLY | syscall.O_CREAT:
- access = syscall.GENERIC_ALL
- default:
- panic(fmt.Errorf("flag %v is not supported", flag))
- }
- fd, err := syscall.CreateFile(&(syscall.StringToUTF16(path)[0]),
- access,
- syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
- nil,
- syscall.OPEN_ALWAYS,
- syscall.FILE_ATTRIBUTE_NORMAL,
- 0)
- if err != nil {
- return nil, err
- }
- return os.NewFile(uintptr(fd), path), nil
-}
-
-func lockFile(fd syscall.Handle, flags uint32) error {
- var flag uint32 = LOCKFILE_EXCLUSIVE_LOCK
- flag |= flags
- if fd == syscall.InvalidHandle {
- return nil
- }
- err := lockFileEx(fd, flag, 1, 0, &syscall.Overlapped{})
- if err == nil {
- return nil
- } else if err.Error() == errLocked.Error() {
- return ErrLocked
- } else if err != errLockViolation {
- return err
- }
- return nil
-}
-
-func lockFileEx(h syscall.Handle, flags, locklow, lockhigh uint32, ol *syscall.Overlapped) (err error) {
- var reserved uint32 = 0
- r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(h), uintptr(flags), uintptr(reserved), uintptr(locklow), uintptr(lockhigh), uintptr(unsafe.Pointer(ol)))
- if r1 == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go
deleted file mode 100644
index bb7f02812..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fileutil
-
-import "os"
-
-// Preallocate tries to allocate the space for given
-// file. This operation is only supported on linux by a
-// few filesystems (btrfs, ext4, etc.).
-// If the operation is unsupported, no error will be returned.
-// Otherwise, the error encountered will be returned.
-func Preallocate(f *os.File, sizeInBytes int64, extendFile bool) error {
- if extendFile {
- return preallocExtend(f, sizeInBytes)
- }
- return preallocFixed(f, sizeInBytes)
-}
-
-func preallocExtendTrunc(f *os.File, sizeInBytes int64) error {
- curOff, err := f.Seek(0, os.SEEK_CUR)
- if err != nil {
- return err
- }
- size, err := f.Seek(sizeInBytes, os.SEEK_END)
- if err != nil {
- return err
- }
- if _, err = f.Seek(curOff, os.SEEK_SET); err != nil {
- return err
- }
- if sizeInBytes > size {
- return nil
- }
- return f.Truncate(sizeInBytes)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go
deleted file mode 100644
index 1ed09c560..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_darwin.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build darwin
-
-package fileutil
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-func preallocExtend(f *os.File, sizeInBytes int64) error {
- if err := preallocFixed(f, sizeInBytes); err != nil {
- return err
- }
- return preallocExtendTrunc(f, sizeInBytes)
-}
-
-func preallocFixed(f *os.File, sizeInBytes int64) error {
- fstore := &syscall.Fstore_t{
- Flags: syscall.F_ALLOCATEALL,
- Posmode: syscall.F_PEOFPOSMODE,
- Length: sizeInBytes}
- p := unsafe.Pointer(fstore)
- _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_PREALLOCATE), uintptr(p))
- if errno == 0 || errno == syscall.ENOTSUP {
- return nil
- }
- return errno
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go
deleted file mode 100644
index 50bd84f02..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unix.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build linux
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-func preallocExtend(f *os.File, sizeInBytes int64) error {
- // use mode = 0 to change size
- err := syscall.Fallocate(int(f.Fd()), 0, 0, sizeInBytes)
- if err != nil {
- errno, ok := err.(syscall.Errno)
- // not supported; fallback
- // fallocate EINTRs frequently in some environments; fallback
- if ok && (errno == syscall.ENOTSUP || errno == syscall.EINTR) {
- return preallocExtendTrunc(f, sizeInBytes)
- }
- }
- return err
-}
-
-func preallocFixed(f *os.File, sizeInBytes int64) error {
- // use mode = 1 to keep size; see FALLOC_FL_KEEP_SIZE
- err := syscall.Fallocate(int(f.Fd()), 1, 0, sizeInBytes)
- if err != nil {
- errno, ok := err.(syscall.Errno)
- // treat not supported as nil error
- if ok && errno == syscall.ENOTSUP {
- return nil
- }
- }
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go
deleted file mode 100644
index 162fbc5f7..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/preallocate_unsupported.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !linux,!darwin
-
-package fileutil
-
-import "os"
-
-func preallocExtend(f *os.File, sizeInBytes int64) error {
- return preallocExtendTrunc(f, sizeInBytes)
-}
-
-func preallocFixed(f *os.File, sizeInBytes int64) error { return nil }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go
deleted file mode 100644
index 53bda0c01..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/purge.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fileutil
-
-import (
- "os"
- "path"
- "sort"
- "strings"
- "time"
-)
-
-func PurgeFile(dirname string, suffix string, max uint, interval time.Duration, stop <-chan struct{}) <-chan error {
- return purgeFile(dirname, suffix, max, interval, stop, nil)
-}
-
-// purgeFile is the internal implementation for PurgeFile which can post purged files to purgec if non-nil.
-func purgeFile(dirname string, suffix string, max uint, interval time.Duration, stop <-chan struct{}, purgec chan<- string) <-chan error {
- errC := make(chan error, 1)
- go func() {
- for {
- fnames, err := ReadDir(dirname)
- if err != nil {
- errC <- err
- return
- }
- newfnames := make([]string, 0)
- for _, fname := range fnames {
- if strings.HasSuffix(fname, suffix) {
- newfnames = append(newfnames, fname)
- }
- }
- sort.Strings(newfnames)
- fnames = newfnames
- for len(newfnames) > int(max) {
- f := path.Join(dirname, newfnames[0])
- l, err := TryLockFile(f, os.O_WRONLY, PrivateFileMode)
- if err != nil {
- break
- }
- if err = os.Remove(f); err != nil {
- errC <- err
- return
- }
- if err = l.Close(); err != nil {
- plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err)
- errC <- err
- return
- }
- plog.Infof("purged file %s successfully", f)
- newfnames = newfnames[1:]
- }
- if purgec != nil {
- for i := 0; i < len(fnames)-len(newfnames); i++ {
- purgec <- fnames[i]
- }
- }
- select {
- case <-time.After(interval):
- case <-stop:
- return
- }
- }
- }()
- return errC
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go
deleted file mode 100644
index 54dd41f4f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !linux,!darwin
-
-package fileutil
-
-import "os"
-
-// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform.
-func Fsync(f *os.File) error {
- return f.Sync()
-}
-
-// Fdatasync is a wrapper around file.Sync(). Special handling is needed on linux platform.
-func Fdatasync(f *os.File) error {
- return f.Sync()
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go
deleted file mode 100644
index c2f39bf20..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_darwin.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build darwin
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-// Fsync on HFS/OSX flushes the data on to the physical drive but the drive
-// may not write it to the persistent media for quite sometime and it may be
-// written in out-of-order sequence. Using F_FULLFSYNC ensures that the
-// physical drive's buffer will also get flushed to the media.
-func Fsync(f *os.File) error {
- _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.Fd(), uintptr(syscall.F_FULLFSYNC), uintptr(0))
- if errno == 0 {
- return nil
- }
- return errno
-}
-
-// Fdatasync on darwin platform invokes fcntl(F_FULLFSYNC) for actual persistence
-// on physical drive media.
-func Fdatasync(f *os.File) error {
- return Fsync(f)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go
deleted file mode 100644
index 1bbced915..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/fileutil/sync_linux.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build linux
-
-package fileutil
-
-import (
- "os"
- "syscall"
-)
-
-// Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform.
-func Fsync(f *os.File) error {
- return f.Sync()
-}
-
-// Fdatasync is similar to fsync(), but does not flush modified metadata
-// unless that metadata is needed in order to allow a subsequent data retrieval
-// to be correctly handled.
-func Fdatasync(f *os.File) error {
- return syscall.Fdatasync(int(f.Fd()))
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/pathutil/path.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/pathutil/path.go
deleted file mode 100644
index f26254ba9..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/pathutil/path.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package pathutil implements utility functions for handling slash-separated
-// paths.
-package pathutil
-
-import "path"
-
-// CanonicalURLPath returns the canonical url path for p, which follows the rules:
-// 1. the path always starts with "/"
-// 2. replace multiple slashes with a single slash
-// 3. replace each '.' '..' path name element with equivalent one
-// 4. keep the trailing slash
-// The function is borrowed from stdlib http.cleanPath in server.go.
-func CanonicalURLPath(p string) string {
- if p == "" {
- return "/"
- }
- if p[0] != '/' {
- p = "/" + p
- }
- np := path.Clean(p)
- // path.Clean removes trailing slash except for root,
- // put the trailing slash back if necessary.
- if p[len(p)-1] == '/' && np != "/" {
- np += "/"
- }
- return np
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go
deleted file mode 100644
index 3b6aa670b..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/doc.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package tlsutil provides utility functions for handling TLS.
-package tlsutil
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go
deleted file mode 100644
index 79b1f632e..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/tlsutil/tlsutil.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package tlsutil
-
-import (
- "crypto/tls"
- "crypto/x509"
- "encoding/pem"
- "io/ioutil"
-)
-
-// NewCertPool creates x509 certPool with provided CA files.
-func NewCertPool(CAFiles []string) (*x509.CertPool, error) {
- certPool := x509.NewCertPool()
-
- for _, CAFile := range CAFiles {
- pemByte, err := ioutil.ReadFile(CAFile)
- if err != nil {
- return nil, err
- }
-
- for {
- var block *pem.Block
- block, pemByte = pem.Decode(pemByte)
- if block == nil {
- break
- }
- cert, err := x509.ParseCertificate(block.Bytes)
- if err != nil {
- return nil, err
- }
- certPool.AddCert(cert)
- }
- }
-
- return certPool, nil
-}
-
-// NewCert generates TLS cert by using the given cert,key and parse function.
-func NewCert(certfile, keyfile string, parseFunc func([]byte, []byte) (tls.Certificate, error)) (*tls.Certificate, error) {
- cert, err := ioutil.ReadFile(certfile)
- if err != nil {
- return nil, err
- }
-
- key, err := ioutil.ReadFile(keyfile)
- if err != nil {
- return nil, err
- }
-
- if parseFunc == nil {
- parseFunc = tls.X509KeyPair
- }
-
- tlsCert, err := parseFunc(cert, key)
- if err != nil {
- return nil, err
- }
- return &tlsCert, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/doc.go
deleted file mode 100644
index 37658ce59..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/doc.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package transport implements various HTTP transport utilities based on Go
-// net package.
-package transport
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go
deleted file mode 100644
index 6ccae4ee4..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/keepalive_listener.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "crypto/tls"
- "fmt"
- "net"
- "time"
-)
-
-type keepAliveConn interface {
- SetKeepAlive(bool) error
- SetKeepAlivePeriod(d time.Duration) error
-}
-
-// NewKeepAliveListener returns a listener that listens on the given address.
-// Be careful when wrap around KeepAliveListener with another Listener if TLSInfo is not nil.
-// Some pkgs (like go/http) might expect Listener to return TLSConn type to start TLS handshake.
-// http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html
-func NewKeepAliveListener(l net.Listener, scheme string, tlscfg *tls.Config) (net.Listener, error) {
- if scheme == "https" {
- if tlscfg == nil {
- return nil, fmt.Errorf("cannot listen on TLS for given listener: KeyFile and CertFile are not presented")
- }
- return newTLSKeepaliveListener(l, tlscfg), nil
- }
-
- return &keepaliveListener{
- Listener: l,
- }, nil
-}
-
-type keepaliveListener struct{ net.Listener }
-
-func (kln *keepaliveListener) Accept() (net.Conn, error) {
- c, err := kln.Listener.Accept()
- if err != nil {
- return nil, err
- }
- kac := c.(keepAliveConn)
- // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl
- // default on linux: 30 + 8 * 30
- // default on osx: 30 + 8 * 75
- kac.SetKeepAlive(true)
- kac.SetKeepAlivePeriod(30 * time.Second)
- return c, nil
-}
-
-// A tlsKeepaliveListener implements a network listener (net.Listener) for TLS connections.
-type tlsKeepaliveListener struct {
- net.Listener
- config *tls.Config
-}
-
-// Accept waits for and returns the next incoming TLS connection.
-// The returned connection c is a *tls.Conn.
-func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) {
- c, err = l.Listener.Accept()
- if err != nil {
- return
- }
- kac := c.(keepAliveConn)
- // detection time: tcp_keepalive_time + tcp_keepalive_probes + tcp_keepalive_intvl
- // default on linux: 30 + 8 * 30
- // default on osx: 30 + 8 * 75
- kac.SetKeepAlive(true)
- kac.SetKeepAlivePeriod(30 * time.Second)
- c = tls.Server(c, l.config)
- return
-}
-
-// NewListener creates a Listener which accepts connections from an inner
-// Listener and wraps each connection with Server.
-// The configuration config must be non-nil and must have
-// at least one certificate.
-func newTLSKeepaliveListener(inner net.Listener, config *tls.Config) net.Listener {
- l := &tlsKeepaliveListener{}
- l.Listener = inner
- l.config = config
- return l
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go
deleted file mode 100644
index 930c54206..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/limit_listen.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2013 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package transport provides network utility functions, complementing the more
-// common ones in the net package.
-package transport
-
-import (
- "errors"
- "net"
- "sync"
- "time"
-)
-
-var (
- ErrNotTCP = errors.New("only tcp connections have keepalive")
-)
-
-// LimitListener returns a Listener that accepts at most n simultaneous
-// connections from the provided Listener.
-func LimitListener(l net.Listener, n int) net.Listener {
- return &limitListener{l, make(chan struct{}, n)}
-}
-
-type limitListener struct {
- net.Listener
- sem chan struct{}
-}
-
-func (l *limitListener) acquire() { l.sem <- struct{}{} }
-func (l *limitListener) release() { <-l.sem }
-
-func (l *limitListener) Accept() (net.Conn, error) {
- l.acquire()
- c, err := l.Listener.Accept()
- if err != nil {
- l.release()
- return nil, err
- }
- return &limitListenerConn{Conn: c, release: l.release}, nil
-}
-
-type limitListenerConn struct {
- net.Conn
- releaseOnce sync.Once
- release func()
-}
-
-func (l *limitListenerConn) Close() error {
- err := l.Conn.Close()
- l.releaseOnce.Do(l.release)
- return err
-}
-
-func (l *limitListenerConn) SetKeepAlive(doKeepAlive bool) error {
- tcpc, ok := l.Conn.(*net.TCPConn)
- if !ok {
- return ErrNotTCP
- }
- return tcpc.SetKeepAlive(doKeepAlive)
-}
-
-func (l *limitListenerConn) SetKeepAlivePeriod(d time.Duration) error {
- tcpc, ok := l.Conn.(*net.TCPConn)
- if !ok {
- return ErrNotTCP
- }
- return tcpc.SetKeepAlivePeriod(d)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/listener.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/listener.go
deleted file mode 100644
index 46fe12009..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/listener.go
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/tls"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/pem"
- "fmt"
- "math/big"
- "net"
- "os"
- "path"
- "strings"
- "time"
-
- "github.com/coreos/etcd/pkg/fileutil"
- "github.com/coreos/etcd/pkg/tlsutil"
-)
-
-func NewListener(addr string, scheme string, tlscfg *tls.Config) (l net.Listener, err error) {
- if scheme == "unix" || scheme == "unixs" {
- // unix sockets via unix://laddr
- l, err = NewUnixListener(addr)
- } else {
- l, err = net.Listen("tcp", addr)
- }
-
- if err != nil {
- return nil, err
- }
-
- if scheme == "https" || scheme == "unixs" {
- if tlscfg == nil {
- return nil, fmt.Errorf("cannot listen on TLS for %s: KeyFile and CertFile are not presented", scheme+"://"+addr)
- }
-
- l = tls.NewListener(l, tlscfg)
- }
-
- return l, nil
-}
-
-type TLSInfo struct {
- CertFile string
- KeyFile string
- CAFile string
- TrustedCAFile string
- ClientCertAuth bool
-
- // ServerName ensures the cert matches the given host in case of discovery / virtual hosting
- ServerName string
-
- selfCert bool
-
- // parseFunc exists to simplify testing. Typically, parseFunc
- // should be left nil. In that case, tls.X509KeyPair will be used.
- parseFunc func([]byte, []byte) (tls.Certificate, error)
-}
-
-func (info TLSInfo) String() string {
- return fmt.Sprintf("cert = %s, key = %s, ca = %s, trusted-ca = %s, client-cert-auth = %v", info.CertFile, info.KeyFile, info.CAFile, info.TrustedCAFile, info.ClientCertAuth)
-}
-
-func (info TLSInfo) Empty() bool {
- return info.CertFile == "" && info.KeyFile == ""
-}
-
-func SelfCert(dirpath string, hosts []string) (info TLSInfo, err error) {
- if err = fileutil.TouchDirAll(dirpath); err != nil {
- return
- }
-
- certPath := path.Join(dirpath, "cert.pem")
- keyPath := path.Join(dirpath, "key.pem")
- _, errcert := os.Stat(certPath)
- _, errkey := os.Stat(keyPath)
- if errcert == nil && errkey == nil {
- info.CertFile = certPath
- info.KeyFile = keyPath
- info.selfCert = true
- return
- }
-
- serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
- serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
- if err != nil {
- return
- }
-
- tmpl := x509.Certificate{
- SerialNumber: serialNumber,
- Subject: pkix.Name{Organization: []string{"etcd"}},
- NotBefore: time.Now(),
- NotAfter: time.Now().Add(365 * (24 * time.Hour)),
-
- KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
- BasicConstraintsValid: true,
- }
-
- for _, host := range hosts {
- if ip := net.ParseIP(host); ip != nil {
- tmpl.IPAddresses = append(tmpl.IPAddresses, ip)
- } else {
- tmpl.DNSNames = append(tmpl.DNSNames, strings.Split(host, ":")[0])
- }
- }
-
- priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
- if err != nil {
- return
- }
-
- derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv)
- if err != nil {
- return
- }
-
- certOut, err := os.Create(certPath)
- if err != nil {
- return
- }
- pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
- certOut.Close()
-
- b, err := x509.MarshalECPrivateKey(priv)
- if err != nil {
- return
- }
- keyOut, err := os.OpenFile(keyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
- if err != nil {
- return
- }
- pem.Encode(keyOut, &pem.Block{Type: "EC PRIVATE KEY", Bytes: b})
- keyOut.Close()
-
- return SelfCert(dirpath, hosts)
-}
-
-func (info TLSInfo) baseConfig() (*tls.Config, error) {
- if info.KeyFile == "" || info.CertFile == "" {
- return nil, fmt.Errorf("KeyFile and CertFile must both be present[key: %v, cert: %v]", info.KeyFile, info.CertFile)
- }
-
- tlsCert, err := tlsutil.NewCert(info.CertFile, info.KeyFile, info.parseFunc)
- if err != nil {
- return nil, err
- }
-
- cfg := &tls.Config{
- Certificates: []tls.Certificate{*tlsCert},
- MinVersion: tls.VersionTLS12,
- ServerName: info.ServerName,
- }
- return cfg, nil
-}
-
-// cafiles returns a list of CA file paths.
-func (info TLSInfo) cafiles() []string {
- cs := make([]string, 0)
- if info.CAFile != "" {
- cs = append(cs, info.CAFile)
- }
- if info.TrustedCAFile != "" {
- cs = append(cs, info.TrustedCAFile)
- }
- return cs
-}
-
-// ServerConfig generates a tls.Config object for use by an HTTP server.
-func (info TLSInfo) ServerConfig() (*tls.Config, error) {
- cfg, err := info.baseConfig()
- if err != nil {
- return nil, err
- }
-
- cfg.ClientAuth = tls.NoClientCert
- if info.CAFile != "" || info.ClientCertAuth {
- cfg.ClientAuth = tls.RequireAndVerifyClientCert
- }
-
- CAFiles := info.cafiles()
- if len(CAFiles) > 0 {
- cp, err := tlsutil.NewCertPool(CAFiles)
- if err != nil {
- return nil, err
- }
- cfg.ClientCAs = cp
- }
-
- return cfg, nil
-}
-
-// ClientConfig generates a tls.Config object for use by an HTTP client.
-func (info TLSInfo) ClientConfig() (*tls.Config, error) {
- var cfg *tls.Config
- var err error
-
- if !info.Empty() {
- cfg, err = info.baseConfig()
- if err != nil {
- return nil, err
- }
- } else {
- cfg = &tls.Config{ServerName: info.ServerName}
- }
-
- CAFiles := info.cafiles()
- if len(CAFiles) > 0 {
- cfg.RootCAs, err = tlsutil.NewCertPool(CAFiles)
- if err != nil {
- return nil, err
- }
- // if given a CA, trust any host with a cert signed by the CA
- cfg.ServerName = ""
- }
-
- if info.selfCert {
- cfg.InsecureSkipVerify = true
- }
- return cfg, nil
-}
-
-// ShallowCopyTLSConfig copies *tls.Config. This is only
-// work-around for go-vet tests, which complains
-//
-// assignment copies lock value to p: crypto/tls.Config contains sync.Once contains sync.Mutex
-//
-// Keep up-to-date with 'go/src/crypto/tls/common.go'
-func ShallowCopyTLSConfig(cfg *tls.Config) *tls.Config {
- ncfg := tls.Config{
- Time: cfg.Time,
- Certificates: cfg.Certificates,
- NameToCertificate: cfg.NameToCertificate,
- GetCertificate: cfg.GetCertificate,
- RootCAs: cfg.RootCAs,
- NextProtos: cfg.NextProtos,
- ServerName: cfg.ServerName,
- ClientAuth: cfg.ClientAuth,
- ClientCAs: cfg.ClientCAs,
- InsecureSkipVerify: cfg.InsecureSkipVerify,
- CipherSuites: cfg.CipherSuites,
- PreferServerCipherSuites: cfg.PreferServerCipherSuites,
- SessionTicketKey: cfg.SessionTicketKey,
- ClientSessionCache: cfg.ClientSessionCache,
- MinVersion: cfg.MinVersion,
- MaxVersion: cfg.MaxVersion,
- CurvePreferences: cfg.CurvePreferences,
- }
- return &ncfg
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go
deleted file mode 100644
index 7e8c02030..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_conn.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "net"
- "time"
-)
-
-type timeoutConn struct {
- net.Conn
- wtimeoutd time.Duration
- rdtimeoutd time.Duration
-}
-
-func (c timeoutConn) Write(b []byte) (n int, err error) {
- if c.wtimeoutd > 0 {
- if err := c.SetWriteDeadline(time.Now().Add(c.wtimeoutd)); err != nil {
- return 0, err
- }
- }
- return c.Conn.Write(b)
-}
-
-func (c timeoutConn) Read(b []byte) (n int, err error) {
- if c.rdtimeoutd > 0 {
- if err := c.SetReadDeadline(time.Now().Add(c.rdtimeoutd)); err != nil {
- return 0, err
- }
- }
- return c.Conn.Read(b)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go
deleted file mode 100644
index 6ae39ecfc..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_dialer.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "net"
- "time"
-)
-
-type rwTimeoutDialer struct {
- wtimeoutd time.Duration
- rdtimeoutd time.Duration
- net.Dialer
-}
-
-func (d *rwTimeoutDialer) Dial(network, address string) (net.Conn, error) {
- conn, err := d.Dialer.Dial(network, address)
- tconn := &timeoutConn{
- rdtimeoutd: d.rdtimeoutd,
- wtimeoutd: d.wtimeoutd,
- Conn: conn,
- }
- return tconn, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go
deleted file mode 100644
index f176c43b9..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_listener.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "crypto/tls"
- "net"
- "time"
-)
-
-// NewTimeoutListener returns a listener that listens on the given address.
-// If read/write on the accepted connection blocks longer than its time limit,
-// it will return timeout error.
-func NewTimeoutListener(addr string, scheme string, tlscfg *tls.Config, rdtimeoutd, wtimeoutd time.Duration) (net.Listener, error) {
- ln, err := NewListener(addr, scheme, tlscfg)
- if err != nil {
- return nil, err
- }
- return &rwTimeoutListener{
- Listener: ln,
- rdtimeoutd: rdtimeoutd,
- wtimeoutd: wtimeoutd,
- }, nil
-}
-
-type rwTimeoutListener struct {
- net.Listener
- wtimeoutd time.Duration
- rdtimeoutd time.Duration
-}
-
-func (rwln *rwTimeoutListener) Accept() (net.Conn, error) {
- c, err := rwln.Listener.Accept()
- if err != nil {
- return nil, err
- }
- return timeoutConn{
- Conn: c,
- wtimeoutd: rwln.wtimeoutd,
- rdtimeoutd: rwln.rdtimeoutd,
- }, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go
deleted file mode 100644
index 742cc5cbf..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/timeout_transport.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "net"
- "net/http"
- "time"
-)
-
-// NewTimeoutTransport returns a transport created using the given TLS info.
-// If read/write on the created connection blocks longer than its time limit,
-// it will return timeout error.
-// If read/write timeout is set, transport will not be able to reuse connection.
-func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time.Duration) (*http.Transport, error) {
- tr, err := NewTransport(info, dialtimeoutd)
- if err != nil {
- return nil, err
- }
-
- if rdtimeoutd != 0 || wtimeoutd != 0 {
- // the timed out connection will timeout soon after it is idle.
- // it should not be put back to http transport as an idle connection for future usage.
- tr.MaxIdleConnsPerHost = -1
- } else {
- // allow more idle connections between peers to avoid unncessary port allocation.
- tr.MaxIdleConnsPerHost = 1024
- }
-
- tr.Dial = (&rwTimeoutDialer{
- Dialer: net.Dialer{
- Timeout: dialtimeoutd,
- KeepAlive: 30 * time.Second,
- },
- rdtimeoutd: rdtimeoutd,
- wtimeoutd: wtimeoutd,
- }).Dial
- return tr, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/tls.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/tls.go
deleted file mode 100644
index 62fe0d385..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/tls.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "fmt"
- "strings"
- "time"
-)
-
-// ValidateSecureEndpoints scans the given endpoints against tls info, returning only those
-// endpoints that could be validated as secure.
-func ValidateSecureEndpoints(tlsInfo TLSInfo, eps []string) ([]string, error) {
- t, err := NewTransport(tlsInfo, 5*time.Second)
- if err != nil {
- return nil, err
- }
- var errs []string
- var endpoints []string
- for _, ep := range eps {
- if !strings.HasPrefix(ep, "https://") {
- errs = append(errs, fmt.Sprintf("%q is insecure", ep))
- continue
- }
- conn, cerr := t.Dial("tcp", ep[len("https://"):])
- if cerr != nil {
- errs = append(errs, fmt.Sprintf("%q failed to dial (%v)", ep, cerr))
- continue
- }
- conn.Close()
- endpoints = append(endpoints, ep)
- }
- if len(errs) != 0 {
- err = fmt.Errorf("%s", strings.Join(errs, ","))
- }
- return endpoints, err
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/transport.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/transport.go
deleted file mode 100644
index ca9ccfd80..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/transport.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "net"
- "net/http"
- "strings"
- "time"
-)
-
-type unixTransport struct{ *http.Transport }
-
-func NewTransport(info TLSInfo, dialtimeoutd time.Duration) (*http.Transport, error) {
- cfg, err := info.ClientConfig()
- if err != nil {
- return nil, err
- }
-
- t := &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: (&net.Dialer{
- Timeout: dialtimeoutd,
- // value taken from http.DefaultTransport
- KeepAlive: 30 * time.Second,
- }).Dial,
- // value taken from http.DefaultTransport
- TLSHandshakeTimeout: 10 * time.Second,
- TLSClientConfig: cfg,
- }
-
- dialer := (&net.Dialer{
- Timeout: dialtimeoutd,
- KeepAlive: 30 * time.Second,
- })
- dial := func(net, addr string) (net.Conn, error) {
- return dialer.Dial("unix", addr)
- }
-
- tu := &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: dial,
- TLSHandshakeTimeout: 10 * time.Second,
- TLSClientConfig: cfg,
- }
- ut := &unixTransport{tu}
-
- t.RegisterProtocol("unix", ut)
- t.RegisterProtocol("unixs", ut)
-
- return t, nil
-}
-
-func (urt *unixTransport) RoundTrip(req *http.Request) (*http.Response, error) {
- req2 := *req
- req2.URL.Scheme = strings.Replace(req.URL.Scheme, "unix", "http", 1)
- return urt.Transport.RoundTrip(req)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go
deleted file mode 100644
index c126b6f7f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/transport/unix_listener.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2016 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package transport
-
-import (
- "net"
- "os"
-)
-
-type unixListener struct{ net.Listener }
-
-func NewUnixListener(addr string) (net.Listener, error) {
- if err := os.RemoveAll(addr); err != nil {
- return nil, err
- }
- l, err := net.Listen("unix", addr)
- if err != nil {
- return nil, err
- }
- return &unixListener{l}, nil
-}
-
-func (ul *unixListener) Close() error {
- if err := os.RemoveAll(ul.Addr().String()); err != nil {
- return err
- }
- return ul.Listener.Close()
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/doc.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/doc.go
deleted file mode 100644
index de8ef0bd7..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/doc.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package types declares various data types and implements type-checking
-// functions.
-package types
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/id.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/id.go
deleted file mode 100644
index 1b042d9ce..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/id.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "strconv"
-)
-
-// ID represents a generic identifier which is canonically
-// stored as a uint64 but is typically represented as a
-// base-16 string for input/output
-type ID uint64
-
-func (i ID) String() string {
- return strconv.FormatUint(uint64(i), 16)
-}
-
-// IDFromString attempts to create an ID from a base-16 string.
-func IDFromString(s string) (ID, error) {
- i, err := strconv.ParseUint(s, 16, 64)
- return ID(i), err
-}
-
-// IDSlice implements the sort interface
-type IDSlice []ID
-
-func (p IDSlice) Len() int { return len(p) }
-func (p IDSlice) Less(i, j int) bool { return uint64(p[i]) < uint64(p[j]) }
-func (p IDSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/set.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/set.go
deleted file mode 100644
index 73ef431be..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/set.go
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "sort"
- "sync"
-)
-
-type Set interface {
- Add(string)
- Remove(string)
- Contains(string) bool
- Equals(Set) bool
- Length() int
- Values() []string
- Copy() Set
- Sub(Set) Set
-}
-
-func NewUnsafeSet(values ...string) *unsafeSet {
- set := &unsafeSet{make(map[string]struct{})}
- for _, v := range values {
- set.Add(v)
- }
- return set
-}
-
-func NewThreadsafeSet(values ...string) *tsafeSet {
- us := NewUnsafeSet(values...)
- return &tsafeSet{us, sync.RWMutex{}}
-}
-
-type unsafeSet struct {
- d map[string]struct{}
-}
-
-// Add adds a new value to the set (no-op if the value is already present)
-func (us *unsafeSet) Add(value string) {
- us.d[value] = struct{}{}
-}
-
-// Remove removes the given value from the set
-func (us *unsafeSet) Remove(value string) {
- delete(us.d, value)
-}
-
-// Contains returns whether the set contains the given value
-func (us *unsafeSet) Contains(value string) (exists bool) {
- _, exists = us.d[value]
- return
-}
-
-// ContainsAll returns whether the set contains all given values
-func (us *unsafeSet) ContainsAll(values []string) bool {
- for _, s := range values {
- if !us.Contains(s) {
- return false
- }
- }
- return true
-}
-
-// Equals returns whether the contents of two sets are identical
-func (us *unsafeSet) Equals(other Set) bool {
- v1 := sort.StringSlice(us.Values())
- v2 := sort.StringSlice(other.Values())
- v1.Sort()
- v2.Sort()
- return reflect.DeepEqual(v1, v2)
-}
-
-// Length returns the number of elements in the set
-func (us *unsafeSet) Length() int {
- return len(us.d)
-}
-
-// Values returns the values of the Set in an unspecified order.
-func (us *unsafeSet) Values() (values []string) {
- values = make([]string, 0)
- for val := range us.d {
- values = append(values, val)
- }
- return
-}
-
-// Copy creates a new Set containing the values of the first
-func (us *unsafeSet) Copy() Set {
- cp := NewUnsafeSet()
- for val := range us.d {
- cp.Add(val)
- }
-
- return cp
-}
-
-// Sub removes all elements in other from the set
-func (us *unsafeSet) Sub(other Set) Set {
- oValues := other.Values()
- result := us.Copy().(*unsafeSet)
-
- for _, val := range oValues {
- if _, ok := result.d[val]; !ok {
- continue
- }
- delete(result.d, val)
- }
-
- return result
-}
-
-type tsafeSet struct {
- us *unsafeSet
- m sync.RWMutex
-}
-
-func (ts *tsafeSet) Add(value string) {
- ts.m.Lock()
- defer ts.m.Unlock()
- ts.us.Add(value)
-}
-
-func (ts *tsafeSet) Remove(value string) {
- ts.m.Lock()
- defer ts.m.Unlock()
- ts.us.Remove(value)
-}
-
-func (ts *tsafeSet) Contains(value string) (exists bool) {
- ts.m.RLock()
- defer ts.m.RUnlock()
- return ts.us.Contains(value)
-}
-
-func (ts *tsafeSet) Equals(other Set) bool {
- ts.m.RLock()
- defer ts.m.RUnlock()
- return ts.us.Equals(other)
-}
-
-func (ts *tsafeSet) Length() int {
- ts.m.RLock()
- defer ts.m.RUnlock()
- return ts.us.Length()
-}
-
-func (ts *tsafeSet) Values() (values []string) {
- ts.m.RLock()
- defer ts.m.RUnlock()
- return ts.us.Values()
-}
-
-func (ts *tsafeSet) Copy() Set {
- ts.m.RLock()
- defer ts.m.RUnlock()
- usResult := ts.us.Copy().(*unsafeSet)
- return &tsafeSet{usResult, sync.RWMutex{}}
-}
-
-func (ts *tsafeSet) Sub(other Set) Set {
- ts.m.RLock()
- defer ts.m.RUnlock()
- usResult := ts.us.Sub(other).(*unsafeSet)
- return &tsafeSet{usResult, sync.RWMutex{}}
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/slice.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/slice.go
deleted file mode 100644
index 0dd9ca798..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/slice.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-// Uint64Slice implements sort interface
-type Uint64Slice []uint64
-
-func (p Uint64Slice) Len() int { return len(p) }
-func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urls.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urls.go
deleted file mode 100644
index 9e5d03ff6..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urls.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "errors"
- "fmt"
- "net"
- "net/url"
- "sort"
- "strings"
-)
-
-type URLs []url.URL
-
-func NewURLs(strs []string) (URLs, error) {
- all := make([]url.URL, len(strs))
- if len(all) == 0 {
- return nil, errors.New("no valid URLs given")
- }
- for i, in := range strs {
- in = strings.TrimSpace(in)
- u, err := url.Parse(in)
- if err != nil {
- return nil, err
- }
- if u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "unix" && u.Scheme != "unixs" {
- return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in)
- }
- if _, _, err := net.SplitHostPort(u.Host); err != nil {
- return nil, fmt.Errorf(`URL address does not have the form "host:port": %s`, in)
- }
- if u.Path != "" {
- return nil, fmt.Errorf("URL must not contain a path: %s", in)
- }
- all[i] = *u
- }
- us := URLs(all)
- us.Sort()
-
- return us, nil
-}
-
-func MustNewURLs(strs []string) URLs {
- urls, err := NewURLs(strs)
- if err != nil {
- panic(err)
- }
- return urls
-}
-
-func (us URLs) String() string {
- return strings.Join(us.StringSlice(), ",")
-}
-
-func (us *URLs) Sort() {
- sort.Sort(us)
-}
-func (us URLs) Len() int { return len(us) }
-func (us URLs) Less(i, j int) bool { return us[i].String() < us[j].String() }
-func (us URLs) Swap(i, j int) { us[i], us[j] = us[j], us[i] }
-
-func (us URLs) StringSlice() []string {
- out := make([]string, len(us))
- for i := range us {
- out[i] = us[i].String()
- }
-
- return out
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urlsmap.go b/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urlsmap.go
deleted file mode 100644
index 47690cc38..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/etcd/pkg/types/urlsmap.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2015 The etcd Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "fmt"
- "sort"
- "strings"
-)
-
-// URLsMap is a map from a name to its URLs.
-type URLsMap map[string]URLs
-
-// NewURLsMap returns a URLsMap instantiated from the given string,
-// which consists of discovery-formatted names-to-URLs, like:
-// mach0=http://1.1.1.1:2380,mach0=http://2.2.2.2::2380,mach1=http://3.3.3.3:2380,mach2=http://4.4.4.4:2380
-func NewURLsMap(s string) (URLsMap, error) {
- m := parse(s)
-
- cl := URLsMap{}
- for name, urls := range m {
- us, err := NewURLs(urls)
- if err != nil {
- return nil, err
- }
- cl[name] = us
- }
- return cl, nil
-}
-
-// NewURLsMapFromStringMap takes a map of strings and returns a URLsMap. The
-// string values in the map can be multiple values separated by the sep string.
-func NewURLsMapFromStringMap(m map[string]string, sep string) (URLsMap, error) {
- var err error
- um := URLsMap{}
- for k, v := range m {
- um[k], err = NewURLs(strings.Split(v, sep))
- if err != nil {
- return nil, err
- }
- }
- return um, nil
-}
-
-// String turns URLsMap into discovery-formatted name-to-URLs sorted by name.
-func (c URLsMap) String() string {
- var pairs []string
- for name, urls := range c {
- for _, url := range urls {
- pairs = append(pairs, fmt.Sprintf("%s=%s", name, url.String()))
- }
- }
- sort.Strings(pairs)
- return strings.Join(pairs, ",")
-}
-
-// URLs returns a list of all URLs.
-// The returned list is sorted in ascending lexicographical order.
-func (c URLsMap) URLs() []string {
- var urls []string
- for _, us := range c {
- for _, u := range us {
- urls = append(urls, u.String())
- }
- }
- sort.Strings(urls)
- return urls
-}
-
-// Len returns the size of URLsMap.
-func (c URLsMap) Len() int {
- return len(c)
-}
-
-// parse parses the given string and returns a map listing the values specified for each key.
-func parse(s string) map[string][]string {
- m := make(map[string][]string)
- for s != "" {
- key := s
- if i := strings.IndexAny(key, ","); i >= 0 {
- key, s = key[:i], key[i+1:]
- } else {
- s = ""
- }
- if key == "" {
- continue
- }
- value := ""
- if i := strings.Index(key, "="); i >= 0 {
- key, value = key[:i], key[i+1:]
- }
- m[key] = append(m[key], value)
- }
- return m
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/go-systemd/LICENSE b/archived/event-adapter/vendor/github.com/coreos/go-systemd/LICENSE
deleted file mode 100644
index 37ec93a14..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/go-systemd/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go b/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go
deleted file mode 100644
index ba6d41d85..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/sdnotify.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2014 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// Code forked from Docker project
-package daemon
-
-import (
- "net"
- "os"
-)
-
-// SdNotify sends a message to the init daemon. It is common to ignore the error.
-// If `unsetEnvironment` is true, the environment variable `NOTIFY_SOCKET`
-// will be unconditionally unset.
-//
-// It returns one of the following:
-// (false, nil) - notification not supported (i.e. NOTIFY_SOCKET is unset)
-// (false, err) - notification supported, but failure happened (e.g. error connecting to NOTIFY_SOCKET or while sending data)
-// (true, nil) - notification supported, data has been sent
-func SdNotify(unsetEnvironment bool, state string) (sent bool, err error) {
- socketAddr := &net.UnixAddr{
- Name: os.Getenv("NOTIFY_SOCKET"),
- Net: "unixgram",
- }
-
- // NOTIFY_SOCKET not set
- if socketAddr.Name == "" {
- return false, nil
- }
-
- if unsetEnvironment {
- err = os.Unsetenv("NOTIFY_SOCKET")
- }
- if err != nil {
- return false, err
- }
-
- conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr)
- // Error connecting to NOTIFY_SOCKET
- if err != nil {
- return false, err
- }
- defer conn.Close()
-
- _, err = conn.Write([]byte(state))
- // Error sending the message
- if err != nil {
- return false, err
- }
- return true, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/watchdog.go b/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/watchdog.go
deleted file mode 100644
index 35a92e6e6..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/go-systemd/daemon/watchdog.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package daemon
-
-import (
- "fmt"
- "os"
- "strconv"
- "time"
-)
-
-// SdWatchdogEnabled return watchdog information for a service.
-// Process should send daemon.SdNotify("WATCHDOG=1") every time / 2.
-// If `unsetEnvironment` is true, the environment variables `WATCHDOG_USEC`
-// and `WATCHDOG_PID` will be unconditionally unset.
-//
-// It returns one of the following:
-// (0, nil) - watchdog isn't enabled or we aren't the watched PID.
-// (0, err) - an error happened (e.g. error converting time).
-// (time, nil) - watchdog is enabled and we can send ping.
-// time is delay before inactive service will be killed.
-func SdWatchdogEnabled(unsetEnvironment bool) (time.Duration, error) {
- wusec := os.Getenv("WATCHDOG_USEC")
- wpid := os.Getenv("WATCHDOG_PID")
- if unsetEnvironment {
- wusecErr := os.Unsetenv("WATCHDOG_USEC")
- wpidErr := os.Unsetenv("WATCHDOG_PID")
- if wusecErr != nil {
- return 0, wusecErr
- }
- if wpidErr != nil {
- return 0, wpidErr
- }
- }
-
- if wusec == "" {
- return 0, nil
- }
- s, err := strconv.Atoi(wusec)
- if err != nil {
- return 0, fmt.Errorf("error converting WATCHDOG_USEC: %s", err)
- }
- if s <= 0 {
- return 0, fmt.Errorf("error WATCHDOG_USEC must be a positive number")
- }
- interval := time.Duration(s) * time.Microsecond
-
- if wpid == "" {
- return interval, nil
- }
- p, err := strconv.Atoi(wpid)
- if err != nil {
- return 0, fmt.Errorf("error converting WATCHDOG_PID: %s", err)
- }
- if os.Getpid() != p {
- return 0, nil
- }
-
- return interval, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/go-systemd/journal/journal.go b/archived/event-adapter/vendor/github.com/coreos/go-systemd/journal/journal.go
deleted file mode 100644
index 7f434990d..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/go-systemd/journal/journal.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package journal provides write bindings to the local systemd journal.
-// It is implemented in pure Go and connects to the journal directly over its
-// unix socket.
-//
-// To read from the journal, see the "sdjournal" package, which wraps the
-// sd-journal a C API.
-//
-// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html
-package journal
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net"
- "os"
- "strconv"
- "strings"
- "syscall"
-)
-
-// Priority of a journal message
-type Priority int
-
-const (
- PriEmerg Priority = iota
- PriAlert
- PriCrit
- PriErr
- PriWarning
- PriNotice
- PriInfo
- PriDebug
-)
-
-var conn net.Conn
-
-func init() {
- var err error
- conn, err = net.Dial("unixgram", "/run/systemd/journal/socket")
- if err != nil {
- conn = nil
- }
-}
-
-// Enabled returns true if the local systemd journal is available for logging
-func Enabled() bool {
- return conn != nil
-}
-
-// Send a message to the local systemd journal. vars is a map of journald
-// fields to values. Fields must be composed of uppercase letters, numbers,
-// and underscores, but must not start with an underscore. Within these
-// restrictions, any arbitrary field name may be used. Some names have special
-// significance: see the journalctl documentation
-// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html)
-// for more details. vars may be nil.
-func Send(message string, priority Priority, vars map[string]string) error {
- if conn == nil {
- return journalError("could not connect to journald socket")
- }
-
- data := new(bytes.Buffer)
- appendVariable(data, "PRIORITY", strconv.Itoa(int(priority)))
- appendVariable(data, "MESSAGE", message)
- for k, v := range vars {
- appendVariable(data, k, v)
- }
-
- _, err := io.Copy(conn, data)
- if err != nil && isSocketSpaceError(err) {
- file, err := tempFd()
- if err != nil {
- return journalError(err.Error())
- }
- defer file.Close()
- _, err = io.Copy(file, data)
- if err != nil {
- return journalError(err.Error())
- }
-
- rights := syscall.UnixRights(int(file.Fd()))
-
- /* this connection should always be a UnixConn, but better safe than sorry */
- unixConn, ok := conn.(*net.UnixConn)
- if !ok {
- return journalError("can't send file through non-Unix connection")
- }
- unixConn.WriteMsgUnix([]byte{}, rights, nil)
- } else if err != nil {
- return journalError(err.Error())
- }
- return nil
-}
-
-// Print prints a message to the local systemd journal using Send().
-func Print(priority Priority, format string, a ...interface{}) error {
- return Send(fmt.Sprintf(format, a...), priority, nil)
-}
-
-func appendVariable(w io.Writer, name, value string) {
- if !validVarName(name) {
- journalError("variable name contains invalid character, ignoring")
- }
- if strings.ContainsRune(value, '\n') {
- /* When the value contains a newline, we write:
- * - the variable name, followed by a newline
- * - the size (in 64bit little endian format)
- * - the data, followed by a newline
- */
- fmt.Fprintln(w, name)
- binary.Write(w, binary.LittleEndian, uint64(len(value)))
- fmt.Fprintln(w, value)
- } else {
- /* just write the variable and value all on one line */
- fmt.Fprintf(w, "%s=%s\n", name, value)
- }
-}
-
-func validVarName(name string) bool {
- /* The variable name must be in uppercase and consist only of characters,
- * numbers and underscores, and may not begin with an underscore. (from the docs)
- */
-
- valid := name[0] != '_'
- for _, c := range name {
- valid = valid && ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_'
- }
- return valid
-}
-
-func isSocketSpaceError(err error) bool {
- opErr, ok := err.(*net.OpError)
- if !ok {
- return false
- }
-
- sysErr, ok := opErr.Err.(syscall.Errno)
- if !ok {
- return false
- }
-
- return sysErr == syscall.EMSGSIZE || sysErr == syscall.ENOBUFS
-}
-
-func tempFd() (*os.File, error) {
- file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX")
- if err != nil {
- return nil, err
- }
- syscall.Unlink(file.Name())
- if err != nil {
- return nil, err
- }
- return file, nil
-}
-
-func journalError(s string) error {
- s = "journal error: " + s
- fmt.Fprintln(os.Stderr, s)
- return errors.New(s)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/LICENSE b/archived/event-adapter/vendor/github.com/coreos/pkg/LICENSE
deleted file mode 100644
index e06d20818..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/NOTICE b/archived/event-adapter/vendor/github.com/coreos/pkg/NOTICE
deleted file mode 100644
index b39ddfa5c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-CoreOS Project
-Copyright 2014 CoreOS, Inc
-
-This product includes software developed at CoreOS, Inc.
-(http://www.coreos.com/).
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/README.md b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/README.md
deleted file mode 100644
index 81efb1fb6..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# capnslog, the CoreOS logging package
-
-There are far too many logging packages out there, with varying degrees of licenses, far too many features (colorization, all sorts of log frameworks) or are just a pain to use (lack of `Fatalln()`?).
-capnslog provides a simple but consistent logging interface suitable for all kinds of projects.
-
-### Design Principles
-
-##### `package main` is the place where logging gets turned on and routed
-
-A library should not touch log options, only generate log entries. Libraries are silent until main lets them speak.
-
-##### All log options are runtime-configurable.
-
-Still the job of `main` to expose these configurations. `main` may delegate this to, say, a configuration webhook, but does so explicitly.
-
-##### There is one log object per package. It is registered under its repository and package name.
-
-`main` activates logging for its repository and any dependency repositories it would also like to have output in its logstream. `main` also dictates at which level each subpackage logs.
-
-##### There is *one* output stream, and it is an `io.Writer` composed with a formatter.
-
-Splitting streams is probably not the job of your program, but rather, your log aggregation framework. If you must split output streams, again, `main` configures this and you can write a very simple two-output struct that satisfies io.Writer.
-
-Fancy colorful formatting and JSON output are beyond the scope of a basic logging framework -- they're application/log-collector dependant. These are, at best, provided as options, but more likely, provided by your application.
-
-##### Log objects are an interface
-
-An object knows best how to print itself. Log objects can collect more interesting metadata if they wish, however, because text isn't going away anytime soon, they must all be marshalable to text. The simplest log object is a string, which returns itself. If you wish to do more fancy tricks for printing your log objects, see also JSON output -- introspect and write a formatter which can handle your advanced log interface. Making strings is the only thing guaranteed.
-
-##### Log levels have specific meanings:
-
- * Critical: Unrecoverable. Must fail.
- * Error: Data has been lost, a request has failed for a bad reason, or a required resource has been lost
- * Warning: (Hopefully) Temporary conditions that may cause errors, but may work fine. A replica disappearing (that may reconnect) is a warning.
- * Notice: Normal, but important (uncommon) log information.
- * Info: Normal, working log information, everything is fine, but helpful notices for auditing or common operations.
- * Debug: Everything is still fine, but even common operations may be logged, and less helpful but more quantity of notices.
- * Trace: Anything goes, from logging every function call as part of a common operation, to tracing execution of a query.
-
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/formatters.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/formatters.go
deleted file mode 100644
index b305a845f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/formatters.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import (
- "bufio"
- "fmt"
- "io"
- "log"
- "runtime"
- "strings"
- "time"
-)
-
-type Formatter interface {
- Format(pkg string, level LogLevel, depth int, entries ...interface{})
- Flush()
-}
-
-func NewStringFormatter(w io.Writer) Formatter {
- return &StringFormatter{
- w: bufio.NewWriter(w),
- }
-}
-
-type StringFormatter struct {
- w *bufio.Writer
-}
-
-func (s *StringFormatter) Format(pkg string, l LogLevel, i int, entries ...interface{}) {
- now := time.Now().UTC()
- s.w.WriteString(now.Format(time.RFC3339))
- s.w.WriteByte(' ')
- writeEntries(s.w, pkg, l, i, entries...)
- s.Flush()
-}
-
-func writeEntries(w *bufio.Writer, pkg string, _ LogLevel, _ int, entries ...interface{}) {
- if pkg != "" {
- w.WriteString(pkg + ": ")
- }
- str := fmt.Sprint(entries...)
- endsInNL := strings.HasSuffix(str, "\n")
- w.WriteString(str)
- if !endsInNL {
- w.WriteString("\n")
- }
-}
-
-func (s *StringFormatter) Flush() {
- s.w.Flush()
-}
-
-func NewPrettyFormatter(w io.Writer, debug bool) Formatter {
- return &PrettyFormatter{
- w: bufio.NewWriter(w),
- debug: debug,
- }
-}
-
-type PrettyFormatter struct {
- w *bufio.Writer
- debug bool
-}
-
-func (c *PrettyFormatter) Format(pkg string, l LogLevel, depth int, entries ...interface{}) {
- now := time.Now()
- ts := now.Format("2006-01-02 15:04:05")
- c.w.WriteString(ts)
- ms := now.Nanosecond() / 1000
- c.w.WriteString(fmt.Sprintf(".%06d", ms))
- if c.debug {
- _, file, line, ok := runtime.Caller(depth) // It's always the same number of frames to the user's call.
- if !ok {
- file = "???"
- line = 1
- } else {
- slash := strings.LastIndex(file, "/")
- if slash >= 0 {
- file = file[slash+1:]
- }
- }
- if line < 0 {
- line = 0 // not a real line number
- }
- c.w.WriteString(fmt.Sprintf(" [%s:%d]", file, line))
- }
- c.w.WriteString(fmt.Sprint(" ", l.Char(), " | "))
- writeEntries(c.w, pkg, l, depth, entries...)
- c.Flush()
-}
-
-func (c *PrettyFormatter) Flush() {
- c.w.Flush()
-}
-
-// LogFormatter emulates the form of the traditional built-in logger.
-type LogFormatter struct {
- logger *log.Logger
- prefix string
-}
-
-// NewLogFormatter is a helper to produce a new LogFormatter struct. It uses the
-// golang log package to actually do the logging work so that logs look similar.
-func NewLogFormatter(w io.Writer, prefix string, flag int) Formatter {
- return &LogFormatter{
- logger: log.New(w, "", flag), // don't use prefix here
- prefix: prefix, // save it instead
- }
-}
-
-// Format builds a log message for the LogFormatter. The LogLevel is ignored.
-func (lf *LogFormatter) Format(pkg string, _ LogLevel, _ int, entries ...interface{}) {
- str := fmt.Sprint(entries...)
- prefix := lf.prefix
- if pkg != "" {
- prefix = fmt.Sprintf("%s%s: ", prefix, pkg)
- }
- lf.logger.Output(5, fmt.Sprintf("%s%v", prefix, str)) // call depth is 5
-}
-
-// Flush is included so that the interface is complete, but is a no-op.
-func (lf *LogFormatter) Flush() {
- // noop
-}
-
-// NilFormatter is a no-op log formatter that does nothing.
-type NilFormatter struct {
-}
-
-// NewNilFormatter is a helper to produce a new LogFormatter struct. It logs no
-// messages so that you can cause part of your logging to be silent.
-func NewNilFormatter() Formatter {
- return &NilFormatter{}
-}
-
-// Format does nothing.
-func (_ *NilFormatter) Format(_ string, _ LogLevel, _ int, _ ...interface{}) {
- // noop
-}
-
-// Flush is included so that the interface is complete, but is a no-op.
-func (_ *NilFormatter) Flush() {
- // noop
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go
deleted file mode 100644
index 426603ef3..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/glog_formatter.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import (
- "bufio"
- "bytes"
- "io"
- "os"
- "runtime"
- "strconv"
- "strings"
- "time"
-)
-
-var pid = os.Getpid()
-
-type GlogFormatter struct {
- StringFormatter
-}
-
-func NewGlogFormatter(w io.Writer) *GlogFormatter {
- g := &GlogFormatter{}
- g.w = bufio.NewWriter(w)
- return g
-}
-
-func (g GlogFormatter) Format(pkg string, level LogLevel, depth int, entries ...interface{}) {
- g.w.Write(GlogHeader(level, depth+1))
- g.StringFormatter.Format(pkg, level, depth+1, entries...)
-}
-
-func GlogHeader(level LogLevel, depth int) []byte {
- // Lmmdd hh:mm:ss.uuuuuu threadid file:line]
- now := time.Now().UTC()
- _, file, line, ok := runtime.Caller(depth) // It's always the same number of frames to the user's call.
- if !ok {
- file = "???"
- line = 1
- } else {
- slash := strings.LastIndex(file, "/")
- if slash >= 0 {
- file = file[slash+1:]
- }
- }
- if line < 0 {
- line = 0 // not a real line number
- }
- buf := &bytes.Buffer{}
- buf.Grow(30)
- _, month, day := now.Date()
- hour, minute, second := now.Clock()
- buf.WriteString(level.Char())
- twoDigits(buf, int(month))
- twoDigits(buf, day)
- buf.WriteByte(' ')
- twoDigits(buf, hour)
- buf.WriteByte(':')
- twoDigits(buf, minute)
- buf.WriteByte(':')
- twoDigits(buf, second)
- buf.WriteByte('.')
- buf.WriteString(strconv.Itoa(now.Nanosecond() / 1000))
- buf.WriteByte('Z')
- buf.WriteByte(' ')
- buf.WriteString(strconv.Itoa(pid))
- buf.WriteByte(' ')
- buf.WriteString(file)
- buf.WriteByte(':')
- buf.WriteString(strconv.Itoa(line))
- buf.WriteByte(']')
- buf.WriteByte(' ')
- return buf.Bytes()
-}
-
-const digits = "0123456789"
-
-func twoDigits(b *bytes.Buffer, d int) {
- c2 := digits[d%10]
- d /= 10
- c1 := digits[d%10]
- b.WriteByte(c1)
- b.WriteByte(c2)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init.go
deleted file mode 100644
index 44b8cd361..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// +build !windows
-
-package capnslog
-
-import (
- "io"
- "os"
- "syscall"
-)
-
-// Here's where the opinionation comes in. We need some sensible defaults,
-// especially after taking over the log package. Your project (whatever it may
-// be) may see things differently. That's okay; there should be no defaults in
-// the main package that cannot be controlled or overridden programatically,
-// otherwise it's a bug. Doing so is creating your own init_log.go file much
-// like this one.
-
-func init() {
- initHijack()
-
- // Go `log` pacakge uses os.Stderr.
- SetFormatter(NewDefaultFormatter(os.Stderr))
- SetGlobalLogLevel(INFO)
-}
-
-func NewDefaultFormatter(out io.Writer) Formatter {
- if syscall.Getppid() == 1 {
- // We're running under init, which may be systemd.
- f, err := NewJournaldFormatter()
- if err == nil {
- return f
- }
- }
- return NewPrettyFormatter(out, false)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init_windows.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init_windows.go
deleted file mode 100644
index 455305065..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/init_windows.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import "os"
-
-func init() {
- initHijack()
-
- // Go `log` package uses os.Stderr.
- SetFormatter(NewPrettyFormatter(os.Stderr, false))
- SetGlobalLogLevel(INFO)
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go
deleted file mode 100644
index 72e05207c..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/journald_formatter.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// +build !windows
-
-package capnslog
-
-import (
- "errors"
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/coreos/go-systemd/journal"
-)
-
-func NewJournaldFormatter() (Formatter, error) {
- if !journal.Enabled() {
- return nil, errors.New("No systemd detected")
- }
- return &journaldFormatter{}, nil
-}
-
-type journaldFormatter struct{}
-
-func (j *journaldFormatter) Format(pkg string, l LogLevel, _ int, entries ...interface{}) {
- var pri journal.Priority
- switch l {
- case CRITICAL:
- pri = journal.PriCrit
- case ERROR:
- pri = journal.PriErr
- case WARNING:
- pri = journal.PriWarning
- case NOTICE:
- pri = journal.PriNotice
- case INFO:
- pri = journal.PriInfo
- case DEBUG:
- pri = journal.PriDebug
- case TRACE:
- pri = journal.PriDebug
- default:
- panic("Unhandled loglevel")
- }
- msg := fmt.Sprint(entries...)
- tags := map[string]string{
- "PACKAGE": pkg,
- "SYSLOG_IDENTIFIER": filepath.Base(os.Args[0]),
- }
- err := journal.Send(msg, pri, tags)
- if err != nil {
- fmt.Fprintln(os.Stderr, err)
- }
-}
-
-func (j *journaldFormatter) Flush() {}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/log_hijack.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/log_hijack.go
deleted file mode 100644
index 970086b9f..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/log_hijack.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import (
- "log"
-)
-
-func initHijack() {
- pkg := NewPackageLogger("log", "")
- w := packageWriter{pkg}
- log.SetFlags(0)
- log.SetPrefix("")
- log.SetOutput(w)
-}
-
-type packageWriter struct {
- pl *PackageLogger
-}
-
-func (p packageWriter) Write(b []byte) (int, error) {
- if p.pl.level < INFO {
- return 0, nil
- }
- p.pl.internalLog(calldepth+2, INFO, string(b))
- return len(b), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/logmap.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/logmap.go
deleted file mode 100644
index 849544883..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/logmap.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import (
- "errors"
- "strings"
- "sync"
-)
-
-// LogLevel is the set of all log levels.
-type LogLevel int8
-
-const (
- // CRITICAL is the lowest log level; only errors which will end the program will be propagated.
- CRITICAL LogLevel = iota - 1
- // ERROR is for errors that are not fatal but lead to troubling behavior.
- ERROR
- // WARNING is for errors which are not fatal and not errors, but are unusual. Often sourced from misconfigurations.
- WARNING
- // NOTICE is for normal but significant conditions.
- NOTICE
- // INFO is a log level for common, everyday log updates.
- INFO
- // DEBUG is the default hidden level for more verbose updates about internal processes.
- DEBUG
- // TRACE is for (potentially) call by call tracing of programs.
- TRACE
-)
-
-// Char returns a single-character representation of the log level.
-func (l LogLevel) Char() string {
- switch l {
- case CRITICAL:
- return "C"
- case ERROR:
- return "E"
- case WARNING:
- return "W"
- case NOTICE:
- return "N"
- case INFO:
- return "I"
- case DEBUG:
- return "D"
- case TRACE:
- return "T"
- default:
- panic("Unhandled loglevel")
- }
-}
-
-// String returns a multi-character representation of the log level.
-func (l LogLevel) String() string {
- switch l {
- case CRITICAL:
- return "CRITICAL"
- case ERROR:
- return "ERROR"
- case WARNING:
- return "WARNING"
- case NOTICE:
- return "NOTICE"
- case INFO:
- return "INFO"
- case DEBUG:
- return "DEBUG"
- case TRACE:
- return "TRACE"
- default:
- panic("Unhandled loglevel")
- }
-}
-
-// Update using the given string value. Fulfills the flag.Value interface.
-func (l *LogLevel) Set(s string) error {
- value, err := ParseLevel(s)
- if err != nil {
- return err
- }
-
- *l = value
- return nil
-}
-
-// ParseLevel translates some potential loglevel strings into their corresponding levels.
-func ParseLevel(s string) (LogLevel, error) {
- switch s {
- case "CRITICAL", "C":
- return CRITICAL, nil
- case "ERROR", "0", "E":
- return ERROR, nil
- case "WARNING", "1", "W":
- return WARNING, nil
- case "NOTICE", "2", "N":
- return NOTICE, nil
- case "INFO", "3", "I":
- return INFO, nil
- case "DEBUG", "4", "D":
- return DEBUG, nil
- case "TRACE", "5", "T":
- return TRACE, nil
- }
- return CRITICAL, errors.New("couldn't parse log level " + s)
-}
-
-type RepoLogger map[string]*PackageLogger
-
-type loggerStruct struct {
- sync.Mutex
- repoMap map[string]RepoLogger
- formatter Formatter
-}
-
-// logger is the global logger
-var logger = new(loggerStruct)
-
-// SetGlobalLogLevel sets the log level for all packages in all repositories
-// registered with capnslog.
-func SetGlobalLogLevel(l LogLevel) {
- logger.Lock()
- defer logger.Unlock()
- for _, r := range logger.repoMap {
- r.setRepoLogLevelInternal(l)
- }
-}
-
-// GetRepoLogger may return the handle to the repository's set of packages' loggers.
-func GetRepoLogger(repo string) (RepoLogger, error) {
- logger.Lock()
- defer logger.Unlock()
- r, ok := logger.repoMap[repo]
- if !ok {
- return nil, errors.New("no packages registered for repo " + repo)
- }
- return r, nil
-}
-
-// MustRepoLogger returns the handle to the repository's packages' loggers.
-func MustRepoLogger(repo string) RepoLogger {
- r, err := GetRepoLogger(repo)
- if err != nil {
- panic(err)
- }
- return r
-}
-
-// SetRepoLogLevel sets the log level for all packages in the repository.
-func (r RepoLogger) SetRepoLogLevel(l LogLevel) {
- logger.Lock()
- defer logger.Unlock()
- r.setRepoLogLevelInternal(l)
-}
-
-func (r RepoLogger) setRepoLogLevelInternal(l LogLevel) {
- for _, v := range r {
- v.level = l
- }
-}
-
-// ParseLogLevelConfig parses a comma-separated string of "package=loglevel", in
-// order, and returns a map of the results, for use in SetLogLevel.
-func (r RepoLogger) ParseLogLevelConfig(conf string) (map[string]LogLevel, error) {
- setlist := strings.Split(conf, ",")
- out := make(map[string]LogLevel)
- for _, setstring := range setlist {
- setting := strings.Split(setstring, "=")
- if len(setting) != 2 {
- return nil, errors.New("oddly structured `pkg=level` option: " + setstring)
- }
- l, err := ParseLevel(setting[1])
- if err != nil {
- return nil, err
- }
- out[setting[0]] = l
- }
- return out, nil
-}
-
-// SetLogLevel takes a map of package names within a repository to their desired
-// loglevel, and sets the levels appropriately. Unknown packages are ignored.
-// "*" is a special package name that corresponds to all packages, and will be
-// processed first.
-func (r RepoLogger) SetLogLevel(m map[string]LogLevel) {
- logger.Lock()
- defer logger.Unlock()
- if l, ok := m["*"]; ok {
- r.setRepoLogLevelInternal(l)
- }
- for k, v := range m {
- l, ok := r[k]
- if !ok {
- continue
- }
- l.level = v
- }
-}
-
-// SetFormatter sets the formatting function for all logs.
-func SetFormatter(f Formatter) {
- logger.Lock()
- defer logger.Unlock()
- logger.formatter = f
-}
-
-// NewPackageLogger creates a package logger object.
-// This should be defined as a global var in your package, referencing your repo.
-func NewPackageLogger(repo string, pkg string) (p *PackageLogger) {
- logger.Lock()
- defer logger.Unlock()
- if logger.repoMap == nil {
- logger.repoMap = make(map[string]RepoLogger)
- }
- r, rok := logger.repoMap[repo]
- if !rok {
- logger.repoMap[repo] = make(RepoLogger)
- r = logger.repoMap[repo]
- }
- p, pok := r[pkg]
- if !pok {
- r[pkg] = &PackageLogger{
- pkg: pkg,
- level: INFO,
- }
- p = r[pkg]
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go
deleted file mode 100644
index 612d55c66..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package capnslog
-
-import (
- "fmt"
- "os"
-)
-
-type PackageLogger struct {
- pkg string
- level LogLevel
-}
-
-const calldepth = 2
-
-func (p *PackageLogger) internalLog(depth int, inLevel LogLevel, entries ...interface{}) {
- logger.Lock()
- defer logger.Unlock()
- if inLevel != CRITICAL && p.level < inLevel {
- return
- }
- if logger.formatter != nil {
- logger.formatter.Format(p.pkg, inLevel, depth+1, entries...)
- }
-}
-
-func (p *PackageLogger) LevelAt(l LogLevel) bool {
- logger.Lock()
- defer logger.Unlock()
- return p.level >= l
-}
-
-// Log a formatted string at any level between ERROR and TRACE
-func (p *PackageLogger) Logf(l LogLevel, format string, args ...interface{}) {
- p.internalLog(calldepth, l, fmt.Sprintf(format, args...))
-}
-
-// Log a message at any level between ERROR and TRACE
-func (p *PackageLogger) Log(l LogLevel, args ...interface{}) {
- p.internalLog(calldepth, l, fmt.Sprint(args...))
-}
-
-// log stdlib compatibility
-
-func (p *PackageLogger) Println(args ...interface{}) {
- p.internalLog(calldepth, INFO, fmt.Sprintln(args...))
-}
-
-func (p *PackageLogger) Printf(format string, args ...interface{}) {
- p.Logf(INFO, format, args...)
-}
-
-func (p *PackageLogger) Print(args ...interface{}) {
- p.internalLog(calldepth, INFO, fmt.Sprint(args...))
-}
-
-// Panic and fatal
-
-func (p *PackageLogger) Panicf(format string, args ...interface{}) {
- s := fmt.Sprintf(format, args...)
- p.internalLog(calldepth, CRITICAL, s)
- panic(s)
-}
-
-func (p *PackageLogger) Panic(args ...interface{}) {
- s := fmt.Sprint(args...)
- p.internalLog(calldepth, CRITICAL, s)
- panic(s)
-}
-
-func (p *PackageLogger) Fatalf(format string, args ...interface{}) {
- p.Logf(CRITICAL, format, args...)
- os.Exit(1)
-}
-
-func (p *PackageLogger) Fatal(args ...interface{}) {
- s := fmt.Sprint(args...)
- p.internalLog(calldepth, CRITICAL, s)
- os.Exit(1)
-}
-
-func (p *PackageLogger) Fatalln(args ...interface{}) {
- s := fmt.Sprintln(args...)
- p.internalLog(calldepth, CRITICAL, s)
- os.Exit(1)
-}
-
-// Error Functions
-
-func (p *PackageLogger) Errorf(format string, args ...interface{}) {
- p.Logf(ERROR, format, args...)
-}
-
-func (p *PackageLogger) Error(entries ...interface{}) {
- p.internalLog(calldepth, ERROR, entries...)
-}
-
-// Warning Functions
-
-func (p *PackageLogger) Warningf(format string, args ...interface{}) {
- p.Logf(WARNING, format, args...)
-}
-
-func (p *PackageLogger) Warning(entries ...interface{}) {
- p.internalLog(calldepth, WARNING, entries...)
-}
-
-// Notice Functions
-
-func (p *PackageLogger) Noticef(format string, args ...interface{}) {
- p.Logf(NOTICE, format, args...)
-}
-
-func (p *PackageLogger) Notice(entries ...interface{}) {
- p.internalLog(calldepth, NOTICE, entries...)
-}
-
-// Info Functions
-
-func (p *PackageLogger) Infof(format string, args ...interface{}) {
- p.Logf(INFO, format, args...)
-}
-
-func (p *PackageLogger) Info(entries ...interface{}) {
- p.internalLog(calldepth, INFO, entries...)
-}
-
-// Debug Functions
-
-func (p *PackageLogger) Debugf(format string, args ...interface{}) {
- if p.level < DEBUG {
- return
- }
- p.Logf(DEBUG, format, args...)
-}
-
-func (p *PackageLogger) Debug(entries ...interface{}) {
- if p.level < DEBUG {
- return
- }
- p.internalLog(calldepth, DEBUG, entries...)
-}
-
-// Trace Functions
-
-func (p *PackageLogger) Tracef(format string, args ...interface{}) {
- if p.level < TRACE {
- return
- }
- p.Logf(TRACE, format, args...)
-}
-
-func (p *PackageLogger) Trace(entries ...interface{}) {
- if p.level < TRACE {
- return
- }
- p.internalLog(calldepth, TRACE, entries...)
-}
-
-func (p *PackageLogger) Flush() {
- logger.Lock()
- defer logger.Unlock()
- logger.formatter.Flush()
-}
diff --git a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go b/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go
deleted file mode 100644
index 4be5a1f2d..000000000
--- a/archived/event-adapter/vendor/github.com/coreos/pkg/capnslog/syslog_formatter.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// +build !windows
-
-package capnslog
-
-import (
- "fmt"
- "log/syslog"
-)
-
-func NewSyslogFormatter(w *syslog.Writer) Formatter {
- return &syslogFormatter{w}
-}
-
-func NewDefaultSyslogFormatter(tag string) (Formatter, error) {
- w, err := syslog.New(syslog.LOG_DEBUG, tag)
- if err != nil {
- return nil, err
- }
- return NewSyslogFormatter(w), nil
-}
-
-type syslogFormatter struct {
- w *syslog.Writer
-}
-
-func (s *syslogFormatter) Format(pkg string, l LogLevel, _ int, entries ...interface{}) {
- for _, entry := range entries {
- str := fmt.Sprint(entry)
- switch l {
- case CRITICAL:
- s.w.Crit(str)
- case ERROR:
- s.w.Err(str)
- case WARNING:
- s.w.Warning(str)
- case NOTICE:
- s.w.Notice(str)
- case INFO:
- s.w.Info(str)
- case DEBUG:
- s.w.Debug(str)
- case TRACE:
- s.w.Debug(str)
- default:
- panic("Unhandled loglevel")
- }
- }
-}
-
-func (s *syslogFormatter) Flush() {
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/LICENSE b/archived/event-adapter/vendor/github.com/davecgh/go-spew/LICENSE
deleted file mode 100644
index 2a7cfd2bf..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2012-2013 Dave Collins
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypass.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypass.go
deleted file mode 100644
index 565bf5899..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypass.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) 2015 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when the code is not running on Google App Engine and "-tags disableunsafe"
-// is not added to the go build command line.
-// +build !appengine,!disableunsafe
-
-package spew
-
-import (
- "reflect"
- "unsafe"
-)
-
-const (
- // UnsafeDisabled is a build-time constant which specifies whether or
- // not access to the unsafe package is available.
- UnsafeDisabled = false
-
- // ptrSize is the size of a pointer on the current arch.
- ptrSize = unsafe.Sizeof((*byte)(nil))
-)
-
-var (
- // offsetPtr, offsetScalar, and offsetFlag are the offsets for the
- // internal reflect.Value fields. These values are valid before golang
- // commit ecccf07e7f9d which changed the format. The are also valid
- // after commit 82f48826c6c7 which changed the format again to mirror
- // the original format. Code in the init function updates these offsets
- // as necessary.
- offsetPtr = uintptr(ptrSize)
- offsetScalar = uintptr(0)
- offsetFlag = uintptr(ptrSize * 2)
-
- // flagKindWidth and flagKindShift indicate various bits that the
- // reflect package uses internally to track kind information.
- //
- // flagRO indicates whether or not the value field of a reflect.Value is
- // read-only.
- //
- // flagIndir indicates whether the value field of a reflect.Value is
- // the actual data or a pointer to the data.
- //
- // These values are valid before golang commit 90a7c3c86944 which
- // changed their positions. Code in the init function updates these
- // flags as necessary.
- flagKindWidth = uintptr(5)
- flagKindShift = uintptr(flagKindWidth - 1)
- flagRO = uintptr(1 << 0)
- flagIndir = uintptr(1 << 1)
-)
-
-func init() {
- // Older versions of reflect.Value stored small integers directly in the
- // ptr field (which is named val in the older versions). Versions
- // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named
- // scalar for this purpose which unfortunately came before the flag
- // field, so the offset of the flag field is different for those
- // versions.
- //
- // This code constructs a new reflect.Value from a known small integer
- // and checks if the size of the reflect.Value struct indicates it has
- // the scalar field. When it does, the offsets are updated accordingly.
- vv := reflect.ValueOf(0xf00)
- if unsafe.Sizeof(vv) == (ptrSize * 4) {
- offsetScalar = ptrSize * 2
- offsetFlag = ptrSize * 3
- }
-
- // Commit 90a7c3c86944 changed the flag positions such that the low
- // order bits are the kind. This code extracts the kind from the flags
- // field and ensures it's the correct type. When it's not, the flag
- // order has been changed to the newer format, so the flags are updated
- // accordingly.
- upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag)
- upfv := *(*uintptr)(upf)
- flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) {
- flagKindShift = 0
- flagRO = 1 << 5
- flagIndir = 1 << 6
-
- // Commit adf9b30e5594 modified the flags to separate the
- // flagRO flag into two bits which specifies whether or not the
- // field is embedded. This causes flagIndir to move over a bit
- // and means that flagRO is the combination of either of the
- // original flagRO bit and the new bit.
- //
- // This code detects the change by extracting what used to be
- // the indirect bit to ensure it's set. When it's not, the flag
- // order has been changed to the newer format, so the flags are
- // updated accordingly.
- if upfv&flagIndir == 0 {
- flagRO = 3 << 5
- flagIndir = 1 << 7
- }
- }
-}
-
-// unsafeReflectValue converts the passed reflect.Value into a one that bypasses
-// the typical safety restrictions preventing access to unaddressable and
-// unexported data. It works by digging the raw pointer to the underlying
-// value out of the protected value and generating a new unprotected (unsafe)
-// reflect.Value to it.
-//
-// This allows us to check for implementations of the Stringer and error
-// interfaces to be used for pretty printing ordinarily unaddressable and
-// inaccessible values such as unexported struct fields.
-func unsafeReflectValue(v reflect.Value) (rv reflect.Value) {
- indirects := 1
- vt := v.Type()
- upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr)
- rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag))
- if rvf&flagIndir != 0 {
- vt = reflect.PtrTo(v.Type())
- indirects++
- } else if offsetScalar != 0 {
- // The value is in the scalar field when it's not one of the
- // reference types.
- switch vt.Kind() {
- case reflect.Uintptr:
- case reflect.Chan:
- case reflect.Func:
- case reflect.Map:
- case reflect.Ptr:
- case reflect.UnsafePointer:
- default:
- upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) +
- offsetScalar)
- }
- }
-
- pv := reflect.NewAt(vt, upv)
- rv = pv
- for i := 0; i < indirects; i++ {
- rv = rv.Elem()
- }
- return rv
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
deleted file mode 100644
index 457e41235..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2015 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when either the code is running on Google App Engine or "-tags disableunsafe"
-// is added to the go build command line.
-// +build appengine disableunsafe
-
-package spew
-
-import "reflect"
-
-const (
- // UnsafeDisabled is a build-time constant which specifies whether or
- // not access to the unsafe package is available.
- UnsafeDisabled = true
-)
-
-// unsafeReflectValue typically converts the passed reflect.Value into a one
-// that bypasses the typical safety restrictions preventing access to
-// unaddressable and unexported data. However, doing this relies on access to
-// the unsafe package. This is a stub version which simply returns the passed
-// reflect.Value when the unsafe package is not available.
-func unsafeReflectValue(v reflect.Value) reflect.Value {
- return v
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/common.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/common.go
deleted file mode 100644
index 14f02dc15..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/common.go
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "sort"
- "strconv"
-)
-
-// Some constants in the form of bytes to avoid string overhead. This mirrors
-// the technique used in the fmt package.
-var (
- panicBytes = []byte("(PANIC=")
- plusBytes = []byte("+")
- iBytes = []byte("i")
- trueBytes = []byte("true")
- falseBytes = []byte("false")
- interfaceBytes = []byte("(interface {})")
- commaNewlineBytes = []byte(",\n")
- newlineBytes = []byte("\n")
- openBraceBytes = []byte("{")
- openBraceNewlineBytes = []byte("{\n")
- closeBraceBytes = []byte("}")
- asteriskBytes = []byte("*")
- colonBytes = []byte(":")
- colonSpaceBytes = []byte(": ")
- openParenBytes = []byte("(")
- closeParenBytes = []byte(")")
- spaceBytes = []byte(" ")
- pointerChainBytes = []byte("->")
- nilAngleBytes = []byte("")
- maxNewlineBytes = []byte("\n")
- maxShortBytes = []byte("")
- circularBytes = []byte("")
- circularShortBytes = []byte("")
- invalidAngleBytes = []byte("")
- openBracketBytes = []byte("[")
- closeBracketBytes = []byte("]")
- percentBytes = []byte("%")
- precisionBytes = []byte(".")
- openAngleBytes = []byte("<")
- closeAngleBytes = []byte(">")
- openMapBytes = []byte("map[")
- closeMapBytes = []byte("]")
- lenEqualsBytes = []byte("len=")
- capEqualsBytes = []byte("cap=")
-)
-
-// hexDigits is used to map a decimal value to a hex digit.
-var hexDigits = "0123456789abcdef"
-
-// catchPanic handles any panics that might occur during the handleMethods
-// calls.
-func catchPanic(w io.Writer, v reflect.Value) {
- if err := recover(); err != nil {
- w.Write(panicBytes)
- fmt.Fprintf(w, "%v", err)
- w.Write(closeParenBytes)
- }
-}
-
-// handleMethods attempts to call the Error and String methods on the underlying
-// type the passed reflect.Value represents and outputes the result to Writer w.
-//
-// It handles panics in any called methods by catching and displaying the error
-// as the formatted value.
-func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {
- // We need an interface to check if the type implements the error or
- // Stringer interface. However, the reflect package won't give us an
- // interface on certain things like unexported struct fields in order
- // to enforce visibility rules. We use unsafe, when it's available,
- // to bypass these restrictions since this package does not mutate the
- // values.
- if !v.CanInterface() {
- if UnsafeDisabled {
- return false
- }
-
- v = unsafeReflectValue(v)
- }
-
- // Choose whether or not to do error and Stringer interface lookups against
- // the base type or a pointer to the base type depending on settings.
- // Technically calling one of these methods with a pointer receiver can
- // mutate the value, however, types which choose to satisify an error or
- // Stringer interface with a pointer receiver should not be mutating their
- // state inside these interface methods.
- if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {
- v = unsafeReflectValue(v)
- }
- if v.CanAddr() {
- v = v.Addr()
- }
-
- // Is it an error or Stringer?
- switch iface := v.Interface().(type) {
- case error:
- defer catchPanic(w, v)
- if cs.ContinueOnMethod {
- w.Write(openParenBytes)
- w.Write([]byte(iface.Error()))
- w.Write(closeParenBytes)
- w.Write(spaceBytes)
- return false
- }
-
- w.Write([]byte(iface.Error()))
- return true
-
- case fmt.Stringer:
- defer catchPanic(w, v)
- if cs.ContinueOnMethod {
- w.Write(openParenBytes)
- w.Write([]byte(iface.String()))
- w.Write(closeParenBytes)
- w.Write(spaceBytes)
- return false
- }
- w.Write([]byte(iface.String()))
- return true
- }
- return false
-}
-
-// printBool outputs a boolean value as true or false to Writer w.
-func printBool(w io.Writer, val bool) {
- if val {
- w.Write(trueBytes)
- } else {
- w.Write(falseBytes)
- }
-}
-
-// printInt outputs a signed integer value to Writer w.
-func printInt(w io.Writer, val int64, base int) {
- w.Write([]byte(strconv.FormatInt(val, base)))
-}
-
-// printUint outputs an unsigned integer value to Writer w.
-func printUint(w io.Writer, val uint64, base int) {
- w.Write([]byte(strconv.FormatUint(val, base)))
-}
-
-// printFloat outputs a floating point value using the specified precision,
-// which is expected to be 32 or 64bit, to Writer w.
-func printFloat(w io.Writer, val float64, precision int) {
- w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))
-}
-
-// printComplex outputs a complex value using the specified float precision
-// for the real and imaginary parts to Writer w.
-func printComplex(w io.Writer, c complex128, floatPrecision int) {
- r := real(c)
- w.Write(openParenBytes)
- w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))
- i := imag(c)
- if i >= 0 {
- w.Write(plusBytes)
- }
- w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))
- w.Write(iBytes)
- w.Write(closeParenBytes)
-}
-
-// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x'
-// prefix to Writer w.
-func printHexPtr(w io.Writer, p uintptr) {
- // Null pointer.
- num := uint64(p)
- if num == 0 {
- w.Write(nilAngleBytes)
- return
- }
-
- // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix
- buf := make([]byte, 18)
-
- // It's simpler to construct the hex string right to left.
- base := uint64(16)
- i := len(buf) - 1
- for num >= base {
- buf[i] = hexDigits[num%base]
- num /= base
- i--
- }
- buf[i] = hexDigits[num]
-
- // Add '0x' prefix.
- i--
- buf[i] = 'x'
- i--
- buf[i] = '0'
-
- // Strip unused leading bytes.
- buf = buf[i:]
- w.Write(buf)
-}
-
-// valuesSorter implements sort.Interface to allow a slice of reflect.Value
-// elements to be sorted.
-type valuesSorter struct {
- values []reflect.Value
- strings []string // either nil or same len and values
- cs *ConfigState
-}
-
-// newValuesSorter initializes a valuesSorter instance, which holds a set of
-// surrogate keys on which the data should be sorted. It uses flags in
-// ConfigState to decide if and how to populate those surrogate keys.
-func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {
- vs := &valuesSorter{values: values, cs: cs}
- if canSortSimply(vs.values[0].Kind()) {
- return vs
- }
- if !cs.DisableMethods {
- vs.strings = make([]string, len(values))
- for i := range vs.values {
- b := bytes.Buffer{}
- if !handleMethods(cs, &b, vs.values[i]) {
- vs.strings = nil
- break
- }
- vs.strings[i] = b.String()
- }
- }
- if vs.strings == nil && cs.SpewKeys {
- vs.strings = make([]string, len(values))
- for i := range vs.values {
- vs.strings[i] = Sprintf("%#v", vs.values[i].Interface())
- }
- }
- return vs
-}
-
-// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted
-// directly, or whether it should be considered for sorting by surrogate keys
-// (if the ConfigState allows it).
-func canSortSimply(kind reflect.Kind) bool {
- // This switch parallels valueSortLess, except for the default case.
- switch kind {
- case reflect.Bool:
- return true
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- return true
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- return true
- case reflect.Float32, reflect.Float64:
- return true
- case reflect.String:
- return true
- case reflect.Uintptr:
- return true
- case reflect.Array:
- return true
- }
- return false
-}
-
-// Len returns the number of values in the slice. It is part of the
-// sort.Interface implementation.
-func (s *valuesSorter) Len() int {
- return len(s.values)
-}
-
-// Swap swaps the values at the passed indices. It is part of the
-// sort.Interface implementation.
-func (s *valuesSorter) Swap(i, j int) {
- s.values[i], s.values[j] = s.values[j], s.values[i]
- if s.strings != nil {
- s.strings[i], s.strings[j] = s.strings[j], s.strings[i]
- }
-}
-
-// valueSortLess returns whether the first value should sort before the second
-// value. It is used by valueSorter.Less as part of the sort.Interface
-// implementation.
-func valueSortLess(a, b reflect.Value) bool {
- switch a.Kind() {
- case reflect.Bool:
- return !a.Bool() && b.Bool()
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- return a.Int() < b.Int()
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- return a.Uint() < b.Uint()
- case reflect.Float32, reflect.Float64:
- return a.Float() < b.Float()
- case reflect.String:
- return a.String() < b.String()
- case reflect.Uintptr:
- return a.Uint() < b.Uint()
- case reflect.Array:
- // Compare the contents of both arrays.
- l := a.Len()
- for i := 0; i < l; i++ {
- av := a.Index(i)
- bv := b.Index(i)
- if av.Interface() == bv.Interface() {
- continue
- }
- return valueSortLess(av, bv)
- }
- }
- return a.String() < b.String()
-}
-
-// Less returns whether the value at index i should sort before the
-// value at index j. It is part of the sort.Interface implementation.
-func (s *valuesSorter) Less(i, j int) bool {
- if s.strings == nil {
- return valueSortLess(s.values[i], s.values[j])
- }
- return s.strings[i] < s.strings[j]
-}
-
-// sortValues is a sort function that handles both native types and any type that
-// can be converted to error or Stringer. Other inputs are sorted according to
-// their Value.String() value to ensure display stability.
-func sortValues(values []reflect.Value, cs *ConfigState) {
- if len(values) == 0 {
- return
- }
- sort.Sort(newValuesSorter(values, cs))
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/config.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/config.go
deleted file mode 100644
index ee1ab07b3..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/config.go
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
-)
-
-// ConfigState houses the configuration options used by spew to format and
-// display values. There is a global instance, Config, that is used to control
-// all top-level Formatter and Dump functionality. Each ConfigState instance
-// provides methods equivalent to the top-level functions.
-//
-// The zero value for ConfigState provides no indentation. You would typically
-// want to set it to a space or a tab.
-//
-// Alternatively, you can use NewDefaultConfig to get a ConfigState instance
-// with default settings. See the documentation of NewDefaultConfig for default
-// values.
-type ConfigState struct {
- // Indent specifies the string to use for each indentation level. The
- // global config instance that all top-level functions use set this to a
- // single space by default. If you would like more indentation, you might
- // set this to a tab with "\t" or perhaps two spaces with " ".
- Indent string
-
- // MaxDepth controls the maximum number of levels to descend into nested
- // data structures. The default, 0, means there is no limit.
- //
- // NOTE: Circular data structures are properly detected, so it is not
- // necessary to set this value unless you specifically want to limit deeply
- // nested data structures.
- MaxDepth int
-
- // DisableMethods specifies whether or not error and Stringer interfaces are
- // invoked for types that implement them.
- DisableMethods bool
-
- // DisablePointerMethods specifies whether or not to check for and invoke
- // error and Stringer interfaces on types which only accept a pointer
- // receiver when the current type is not a pointer.
- //
- // NOTE: This might be an unsafe action since calling one of these methods
- // with a pointer receiver could technically mutate the value, however,
- // in practice, types which choose to satisify an error or Stringer
- // interface with a pointer receiver should not be mutating their state
- // inside these interface methods. As a result, this option relies on
- // access to the unsafe package, so it will not have any effect when
- // running in environments without access to the unsafe package such as
- // Google App Engine or with the "disableunsafe" build tag specified.
- DisablePointerMethods bool
-
- // ContinueOnMethod specifies whether or not recursion should continue once
- // a custom error or Stringer interface is invoked. The default, false,
- // means it will print the results of invoking the custom error or Stringer
- // interface and return immediately instead of continuing to recurse into
- // the internals of the data type.
- //
- // NOTE: This flag does not have any effect if method invocation is disabled
- // via the DisableMethods or DisablePointerMethods options.
- ContinueOnMethod bool
-
- // SortKeys specifies map keys should be sorted before being printed. Use
- // this to have a more deterministic, diffable output. Note that only
- // native types (bool, int, uint, floats, uintptr and string) and types
- // that support the error or Stringer interfaces (if methods are
- // enabled) are supported, with other types sorted according to the
- // reflect.Value.String() output which guarantees display stability.
- SortKeys bool
-
- // SpewKeys specifies that, as a last resort attempt, map keys should
- // be spewed to strings and sorted by those strings. This is only
- // considered if SortKeys is true.
- SpewKeys bool
-}
-
-// Config is the active configuration of the top-level functions.
-// The configuration can be changed by modifying the contents of spew.Config.
-var Config = ConfigState{Indent: " "}
-
-// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the formatted string as a value that satisfies error. See NewFormatter
-// for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {
- return fmt.Errorf(format, c.convertArgs(a)...)
-}
-
-// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprint(w, c.convertArgs(a)...)
-}
-
-// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- return fmt.Fprintf(w, format, c.convertArgs(a)...)
-}
-
-// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
-// passed with a Formatter interface returned by c.NewFormatter. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprintln(w, c.convertArgs(a)...)
-}
-
-// Print is a wrapper for fmt.Print that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Print(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
- return fmt.Print(c.convertArgs(a)...)
-}
-
-// Printf is a wrapper for fmt.Printf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {
- return fmt.Printf(format, c.convertArgs(a)...)
-}
-
-// Println is a wrapper for fmt.Println that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Println(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
- return fmt.Println(c.convertArgs(a)...)
-}
-
-// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprint(a ...interface{}) string {
- return fmt.Sprint(c.convertArgs(a)...)
-}
-
-// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
- return fmt.Sprintf(format, c.convertArgs(a)...)
-}
-
-// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
-// were passed with a Formatter interface returned by c.NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprintln(a ...interface{}) string {
- return fmt.Sprintln(c.convertArgs(a)...)
-}
-
-/*
-NewFormatter returns a custom formatter that satisfies the fmt.Formatter
-interface. As a result, it integrates cleanly with standard fmt package
-printing functions. The formatter is useful for inline printing of smaller data
-types similar to the standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Typically this function shouldn't be called directly. It is much easier to make
-use of the custom formatter by calling one of the convenience functions such as
-c.Printf, c.Println, or c.Printf.
-*/
-func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
- return newFormatter(c, v)
-}
-
-// Fdump formats and displays the passed arguments to io.Writer w. It formats
-// exactly the same as Dump.
-func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
- fdump(c, w, a...)
-}
-
-/*
-Dump displays the passed parameters to standard out with newlines, customizable
-indentation, and additional debug information such as complete types and all
-pointer addresses used to indirect to the final value. It provides the
-following features over the built-in printing facilities provided by the fmt
-package:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output
-
-The configuration options are controlled by modifying the public members
-of c. See ConfigState for options documentation.
-
-See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
-get the formatted result as a string.
-*/
-func (c *ConfigState) Dump(a ...interface{}) {
- fdump(c, os.Stdout, a...)
-}
-
-// Sdump returns a string with the passed arguments formatted exactly the same
-// as Dump.
-func (c *ConfigState) Sdump(a ...interface{}) string {
- var buf bytes.Buffer
- fdump(c, &buf, a...)
- return buf.String()
-}
-
-// convertArgs accepts a slice of arguments and returns a slice of the same
-// length with each argument converted to a spew Formatter interface using
-// the ConfigState associated with s.
-func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {
- formatters = make([]interface{}, len(args))
- for index, arg := range args {
- formatters[index] = newFormatter(c, arg)
- }
- return formatters
-}
-
-// NewDefaultConfig returns a ConfigState with the following default settings.
-//
-// Indent: " "
-// MaxDepth: 0
-// DisableMethods: false
-// DisablePointerMethods: false
-// ContinueOnMethod: false
-// SortKeys: false
-func NewDefaultConfig() *ConfigState {
- return &ConfigState{Indent: " "}
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/doc.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/doc.go
deleted file mode 100644
index 5be0c4060..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/doc.go
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Package spew implements a deep pretty printer for Go data structures to aid in
-debugging.
-
-A quick overview of the additional features spew provides over the built-in
-printing facilities for Go data types are as follows:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output (only when using
- Dump style)
-
-There are two different approaches spew allows for dumping Go data structures:
-
- * Dump style which prints with newlines, customizable indentation,
- and additional debug information such as types and all pointer addresses
- used to indirect to the final value
- * A custom Formatter interface that integrates cleanly with the standard fmt
- package and replaces %v, %+v, %#v, and %#+v to provide inline printing
- similar to the default %v while providing the additional functionality
- outlined above and passing unsupported format verbs such as %x and %q
- along to fmt
-
-Quick Start
-
-This section demonstrates how to quickly get started with spew. See the
-sections below for further details on formatting and configuration options.
-
-To dump a variable with full newlines, indentation, type, and pointer
-information use Dump, Fdump, or Sdump:
- spew.Dump(myVar1, myVar2, ...)
- spew.Fdump(someWriter, myVar1, myVar2, ...)
- str := spew.Sdump(myVar1, myVar2, ...)
-
-Alternatively, if you would prefer to use format strings with a compacted inline
-printing style, use the convenience wrappers Printf, Fprintf, etc with
-%v (most compact), %+v (adds pointer addresses), %#v (adds types), or
-%#+v (adds types and pointer addresses):
- spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
- spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
-
-Configuration Options
-
-Configuration of spew is handled by fields in the ConfigState type. For
-convenience, all of the top-level functions use a global state available
-via the spew.Config global.
-
-It is also possible to create a ConfigState instance that provides methods
-equivalent to the top-level functions. This allows concurrent configuration
-options. See the ConfigState documentation for more details.
-
-The following configuration options are available:
- * Indent
- String to use for each indentation level for Dump functions.
- It is a single space by default. A popular alternative is "\t".
-
- * MaxDepth
- Maximum number of levels to descend into nested data structures.
- There is no limit by default.
-
- * DisableMethods
- Disables invocation of error and Stringer interface methods.
- Method invocation is enabled by default.
-
- * DisablePointerMethods
- Disables invocation of error and Stringer interface methods on types
- which only accept pointer receivers from non-pointer variables.
- Pointer method invocation is enabled by default.
-
- * ContinueOnMethod
- Enables recursion into types after invoking error and Stringer interface
- methods. Recursion after method invocation is disabled by default.
-
- * SortKeys
- Specifies map keys should be sorted before being printed. Use
- this to have a more deterministic, diffable output. Note that
- only native types (bool, int, uint, floats, uintptr and string)
- and types which implement error or Stringer interfaces are
- supported with other types sorted according to the
- reflect.Value.String() output which guarantees display
- stability. Natural map order is used by default.
-
- * SpewKeys
- Specifies that, as a last resort attempt, map keys should be
- spewed to strings and sorted by those strings. This is only
- considered if SortKeys is true.
-
-Dump Usage
-
-Simply call spew.Dump with a list of variables you want to dump:
-
- spew.Dump(myVar1, myVar2, ...)
-
-You may also call spew.Fdump if you would prefer to output to an arbitrary
-io.Writer. For example, to dump to standard error:
-
- spew.Fdump(os.Stderr, myVar1, myVar2, ...)
-
-A third option is to call spew.Sdump to get the formatted output as a string:
-
- str := spew.Sdump(myVar1, myVar2, ...)
-
-Sample Dump Output
-
-See the Dump example for details on the setup of the types and variables being
-shown here.
-
- (main.Foo) {
- unexportedField: (*main.Bar)(0xf84002e210)({
- flag: (main.Flag) flagTwo,
- data: (uintptr)
- }),
- ExportedField: (map[interface {}]interface {}) (len=1) {
- (string) (len=3) "one": (bool) true
- }
- }
-
-Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C
-command as shown.
- ([]uint8) (len=32 cap=32) {
- 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
- 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
- 00000020 31 32 |12|
- }
-
-Custom Formatter
-
-Spew provides a custom formatter that implements the fmt.Formatter interface
-so that it integrates cleanly with standard fmt package printing functions. The
-formatter is useful for inline printing of smaller data types similar to the
-standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Custom Formatter Usage
-
-The simplest way to make use of the spew custom formatter is to call one of the
-convenience functions such as spew.Printf, spew.Println, or spew.Printf. The
-functions have syntax you are most likely already familiar with:
-
- spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
- spew.Println(myVar, myVar2)
- spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
-
-See the Index for the full list convenience functions.
-
-Sample Formatter Output
-
-Double pointer to a uint8:
- %v: <**>5
- %+v: <**>(0xf8400420d0->0xf8400420c8)5
- %#v: (**uint8)5
- %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5
-
-Pointer to circular struct with a uint8 field and a pointer to itself:
- %v: <*>{1 <*>}
- %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)}
- %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)}
- %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)}
-
-See the Printf example for details on the setup of variables being shown
-here.
-
-Errors
-
-Since it is possible for custom Stringer/error interfaces to panic, spew
-detects them and handles them internally by printing the panic information
-inline with the output. Since spew is intended to provide deep pretty printing
-capabilities on structures, it intentionally does not return any errors.
-*/
-package spew
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/dump.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/dump.go
deleted file mode 100644
index a0ff95e27..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/dump.go
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "io"
- "os"
- "reflect"
- "regexp"
- "strconv"
- "strings"
-)
-
-var (
- // uint8Type is a reflect.Type representing a uint8. It is used to
- // convert cgo types to uint8 slices for hexdumping.
- uint8Type = reflect.TypeOf(uint8(0))
-
- // cCharRE is a regular expression that matches a cgo char.
- // It is used to detect character arrays to hexdump them.
- cCharRE = regexp.MustCompile("^.*\\._Ctype_char$")
-
- // cUnsignedCharRE is a regular expression that matches a cgo unsigned
- // char. It is used to detect unsigned character arrays to hexdump
- // them.
- cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$")
-
- // cUint8tCharRE is a regular expression that matches a cgo uint8_t.
- // It is used to detect uint8_t arrays to hexdump them.
- cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$")
-)
-
-// dumpState contains information about the state of a dump operation.
-type dumpState struct {
- w io.Writer
- depth int
- pointers map[uintptr]int
- ignoreNextType bool
- ignoreNextIndent bool
- cs *ConfigState
-}
-
-// indent performs indentation according to the depth level and cs.Indent
-// option.
-func (d *dumpState) indent() {
- if d.ignoreNextIndent {
- d.ignoreNextIndent = false
- return
- }
- d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))
-}
-
-// unpackValue returns values inside of non-nil interfaces when possible.
-// This is useful for data types like structs, arrays, slices, and maps which
-// can contain varying types packed inside an interface.
-func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
- if v.Kind() == reflect.Interface && !v.IsNil() {
- v = v.Elem()
- }
- return v
-}
-
-// dumpPtr handles formatting of pointers by indirecting them as necessary.
-func (d *dumpState) dumpPtr(v reflect.Value) {
- // Remove pointers at or below the current depth from map used to detect
- // circular refs.
- for k, depth := range d.pointers {
- if depth >= d.depth {
- delete(d.pointers, k)
- }
- }
-
- // Keep list of all dereferenced pointers to show later.
- pointerChain := make([]uintptr, 0)
-
- // Figure out how many levels of indirection there are by dereferencing
- // pointers and unpacking interfaces down the chain while detecting circular
- // references.
- nilFound := false
- cycleFound := false
- indirects := 0
- ve := v
- for ve.Kind() == reflect.Ptr {
- if ve.IsNil() {
- nilFound = true
- break
- }
- indirects++
- addr := ve.Pointer()
- pointerChain = append(pointerChain, addr)
- if pd, ok := d.pointers[addr]; ok && pd < d.depth {
- cycleFound = true
- indirects--
- break
- }
- d.pointers[addr] = d.depth
-
- ve = ve.Elem()
- if ve.Kind() == reflect.Interface {
- if ve.IsNil() {
- nilFound = true
- break
- }
- ve = ve.Elem()
- }
- }
-
- // Display type information.
- d.w.Write(openParenBytes)
- d.w.Write(bytes.Repeat(asteriskBytes, indirects))
- d.w.Write([]byte(ve.Type().String()))
- d.w.Write(closeParenBytes)
-
- // Display pointer information.
- if len(pointerChain) > 0 {
- d.w.Write(openParenBytes)
- for i, addr := range pointerChain {
- if i > 0 {
- d.w.Write(pointerChainBytes)
- }
- printHexPtr(d.w, addr)
- }
- d.w.Write(closeParenBytes)
- }
-
- // Display dereferenced value.
- d.w.Write(openParenBytes)
- switch {
- case nilFound == true:
- d.w.Write(nilAngleBytes)
-
- case cycleFound == true:
- d.w.Write(circularBytes)
-
- default:
- d.ignoreNextType = true
- d.dump(ve)
- }
- d.w.Write(closeParenBytes)
-}
-
-// dumpSlice handles formatting of arrays and slices. Byte (uint8 under
-// reflection) arrays and slices are dumped in hexdump -C fashion.
-func (d *dumpState) dumpSlice(v reflect.Value) {
- // Determine whether this type should be hex dumped or not. Also,
- // for types which should be hexdumped, try to use the underlying data
- // first, then fall back to trying to convert them to a uint8 slice.
- var buf []uint8
- doConvert := false
- doHexDump := false
- numEntries := v.Len()
- if numEntries > 0 {
- vt := v.Index(0).Type()
- vts := vt.String()
- switch {
- // C types that need to be converted.
- case cCharRE.MatchString(vts):
- fallthrough
- case cUnsignedCharRE.MatchString(vts):
- fallthrough
- case cUint8tCharRE.MatchString(vts):
- doConvert = true
-
- // Try to use existing uint8 slices and fall back to converting
- // and copying if that fails.
- case vt.Kind() == reflect.Uint8:
- // We need an addressable interface to convert the type
- // to a byte slice. However, the reflect package won't
- // give us an interface on certain things like
- // unexported struct fields in order to enforce
- // visibility rules. We use unsafe, when available, to
- // bypass these restrictions since this package does not
- // mutate the values.
- vs := v
- if !vs.CanInterface() || !vs.CanAddr() {
- vs = unsafeReflectValue(vs)
- }
- if !UnsafeDisabled {
- vs = vs.Slice(0, numEntries)
-
- // Use the existing uint8 slice if it can be
- // type asserted.
- iface := vs.Interface()
- if slice, ok := iface.([]uint8); ok {
- buf = slice
- doHexDump = true
- break
- }
- }
-
- // The underlying data needs to be converted if it can't
- // be type asserted to a uint8 slice.
- doConvert = true
- }
-
- // Copy and convert the underlying type if needed.
- if doConvert && vt.ConvertibleTo(uint8Type) {
- // Convert and copy each element into a uint8 byte
- // slice.
- buf = make([]uint8, numEntries)
- for i := 0; i < numEntries; i++ {
- vv := v.Index(i)
- buf[i] = uint8(vv.Convert(uint8Type).Uint())
- }
- doHexDump = true
- }
- }
-
- // Hexdump the entire slice as needed.
- if doHexDump {
- indent := strings.Repeat(d.cs.Indent, d.depth)
- str := indent + hex.Dump(buf)
- str = strings.Replace(str, "\n", "\n"+indent, -1)
- str = strings.TrimRight(str, d.cs.Indent)
- d.w.Write([]byte(str))
- return
- }
-
- // Recursively call dump for each item.
- for i := 0; i < numEntries; i++ {
- d.dump(d.unpackValue(v.Index(i)))
- if i < (numEntries - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
-}
-
-// dump is the main workhorse for dumping a value. It uses the passed reflect
-// value to figure out what kind of object we are dealing with and formats it
-// appropriately. It is a recursive function, however circular data structures
-// are detected and handled properly.
-func (d *dumpState) dump(v reflect.Value) {
- // Handle invalid reflect values immediately.
- kind := v.Kind()
- if kind == reflect.Invalid {
- d.w.Write(invalidAngleBytes)
- return
- }
-
- // Handle pointers specially.
- if kind == reflect.Ptr {
- d.indent()
- d.dumpPtr(v)
- return
- }
-
- // Print type information unless already handled elsewhere.
- if !d.ignoreNextType {
- d.indent()
- d.w.Write(openParenBytes)
- d.w.Write([]byte(v.Type().String()))
- d.w.Write(closeParenBytes)
- d.w.Write(spaceBytes)
- }
- d.ignoreNextType = false
-
- // Display length and capacity if the built-in len and cap functions
- // work with the value's kind and the len/cap itself is non-zero.
- valueLen, valueCap := 0, 0
- switch v.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- valueLen, valueCap = v.Len(), v.Cap()
- case reflect.Map, reflect.String:
- valueLen = v.Len()
- }
- if valueLen != 0 || valueCap != 0 {
- d.w.Write(openParenBytes)
- if valueLen != 0 {
- d.w.Write(lenEqualsBytes)
- printInt(d.w, int64(valueLen), 10)
- }
- if valueCap != 0 {
- if valueLen != 0 {
- d.w.Write(spaceBytes)
- }
- d.w.Write(capEqualsBytes)
- printInt(d.w, int64(valueCap), 10)
- }
- d.w.Write(closeParenBytes)
- d.w.Write(spaceBytes)
- }
-
- // Call Stringer/error interfaces if they exist and the handle methods flag
- // is enabled
- if !d.cs.DisableMethods {
- if (kind != reflect.Invalid) && (kind != reflect.Interface) {
- if handled := handleMethods(d.cs, d.w, v); handled {
- return
- }
- }
- }
-
- switch kind {
- case reflect.Invalid:
- // Do nothing. We should never get here since invalid has already
- // been handled above.
-
- case reflect.Bool:
- printBool(d.w, v.Bool())
-
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- printInt(d.w, v.Int(), 10)
-
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- printUint(d.w, v.Uint(), 10)
-
- case reflect.Float32:
- printFloat(d.w, v.Float(), 32)
-
- case reflect.Float64:
- printFloat(d.w, v.Float(), 64)
-
- case reflect.Complex64:
- printComplex(d.w, v.Complex(), 32)
-
- case reflect.Complex128:
- printComplex(d.w, v.Complex(), 64)
-
- case reflect.Slice:
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- break
- }
- fallthrough
-
- case reflect.Array:
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- d.dumpSlice(v)
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.String:
- d.w.Write([]byte(strconv.Quote(v.String())))
-
- case reflect.Interface:
- // The only time we should get here is for nil interfaces due to
- // unpackValue calls.
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- }
-
- case reflect.Ptr:
- // Do nothing. We should never get here since pointers have already
- // been handled above.
-
- case reflect.Map:
- // nil maps should be indicated as different than empty maps
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- break
- }
-
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- numEntries := v.Len()
- keys := v.MapKeys()
- if d.cs.SortKeys {
- sortValues(keys, d.cs)
- }
- for i, key := range keys {
- d.dump(d.unpackValue(key))
- d.w.Write(colonSpaceBytes)
- d.ignoreNextIndent = true
- d.dump(d.unpackValue(v.MapIndex(key)))
- if i < (numEntries - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.Struct:
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- vt := v.Type()
- numFields := v.NumField()
- for i := 0; i < numFields; i++ {
- d.indent()
- vtf := vt.Field(i)
- d.w.Write([]byte(vtf.Name))
- d.w.Write(colonSpaceBytes)
- d.ignoreNextIndent = true
- d.dump(d.unpackValue(v.Field(i)))
- if i < (numFields - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.Uintptr:
- printHexPtr(d.w, uintptr(v.Uint()))
-
- case reflect.UnsafePointer, reflect.Chan, reflect.Func:
- printHexPtr(d.w, v.Pointer())
-
- // There were not any other types at the time this code was written, but
- // fall back to letting the default fmt package handle it in case any new
- // types are added.
- default:
- if v.CanInterface() {
- fmt.Fprintf(d.w, "%v", v.Interface())
- } else {
- fmt.Fprintf(d.w, "%v", v.String())
- }
- }
-}
-
-// fdump is a helper function to consolidate the logic from the various public
-// methods which take varying writers and config states.
-func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
- for _, arg := range a {
- if arg == nil {
- w.Write(interfaceBytes)
- w.Write(spaceBytes)
- w.Write(nilAngleBytes)
- w.Write(newlineBytes)
- continue
- }
-
- d := dumpState{w: w, cs: cs}
- d.pointers = make(map[uintptr]int)
- d.dump(reflect.ValueOf(arg))
- d.w.Write(newlineBytes)
- }
-}
-
-// Fdump formats and displays the passed arguments to io.Writer w. It formats
-// exactly the same as Dump.
-func Fdump(w io.Writer, a ...interface{}) {
- fdump(&Config, w, a...)
-}
-
-// Sdump returns a string with the passed arguments formatted exactly the same
-// as Dump.
-func Sdump(a ...interface{}) string {
- var buf bytes.Buffer
- fdump(&Config, &buf, a...)
- return buf.String()
-}
-
-/*
-Dump displays the passed parameters to standard out with newlines, customizable
-indentation, and additional debug information such as complete types and all
-pointer addresses used to indirect to the final value. It provides the
-following features over the built-in printing facilities provided by the fmt
-package:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output
-
-The configuration options are controlled by an exported package global,
-spew.Config. See ConfigState for options documentation.
-
-See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
-get the formatted result as a string.
-*/
-func Dump(a ...interface{}) {
- fdump(&Config, os.Stdout, a...)
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/format.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/format.go
deleted file mode 100644
index ecf3b80e2..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/format.go
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-)
-
-// supportedFlags is a list of all the character flags supported by fmt package.
-const supportedFlags = "0-+# "
-
-// formatState implements the fmt.Formatter interface and contains information
-// about the state of a formatting operation. The NewFormatter function can
-// be used to get a new Formatter which can be used directly as arguments
-// in standard fmt package printing calls.
-type formatState struct {
- value interface{}
- fs fmt.State
- depth int
- pointers map[uintptr]int
- ignoreNextType bool
- cs *ConfigState
-}
-
-// buildDefaultFormat recreates the original format string without precision
-// and width information to pass in to fmt.Sprintf in the case of an
-// unrecognized type. Unless new types are added to the language, this
-// function won't ever be called.
-func (f *formatState) buildDefaultFormat() (format string) {
- buf := bytes.NewBuffer(percentBytes)
-
- for _, flag := range supportedFlags {
- if f.fs.Flag(int(flag)) {
- buf.WriteRune(flag)
- }
- }
-
- buf.WriteRune('v')
-
- format = buf.String()
- return format
-}
-
-// constructOrigFormat recreates the original format string including precision
-// and width information to pass along to the standard fmt package. This allows
-// automatic deferral of all format strings this package doesn't support.
-func (f *formatState) constructOrigFormat(verb rune) (format string) {
- buf := bytes.NewBuffer(percentBytes)
-
- for _, flag := range supportedFlags {
- if f.fs.Flag(int(flag)) {
- buf.WriteRune(flag)
- }
- }
-
- if width, ok := f.fs.Width(); ok {
- buf.WriteString(strconv.Itoa(width))
- }
-
- if precision, ok := f.fs.Precision(); ok {
- buf.Write(precisionBytes)
- buf.WriteString(strconv.Itoa(precision))
- }
-
- buf.WriteRune(verb)
-
- format = buf.String()
- return format
-}
-
-// unpackValue returns values inside of non-nil interfaces when possible and
-// ensures that types for values which have been unpacked from an interface
-// are displayed when the show types flag is also set.
-// This is useful for data types like structs, arrays, slices, and maps which
-// can contain varying types packed inside an interface.
-func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
- if v.Kind() == reflect.Interface {
- f.ignoreNextType = false
- if !v.IsNil() {
- v = v.Elem()
- }
- }
- return v
-}
-
-// formatPtr handles formatting of pointers by indirecting them as necessary.
-func (f *formatState) formatPtr(v reflect.Value) {
- // Display nil if top level pointer is nil.
- showTypes := f.fs.Flag('#')
- if v.IsNil() && (!showTypes || f.ignoreNextType) {
- f.fs.Write(nilAngleBytes)
- return
- }
-
- // Remove pointers at or below the current depth from map used to detect
- // circular refs.
- for k, depth := range f.pointers {
- if depth >= f.depth {
- delete(f.pointers, k)
- }
- }
-
- // Keep list of all dereferenced pointers to possibly show later.
- pointerChain := make([]uintptr, 0)
-
- // Figure out how many levels of indirection there are by derferencing
- // pointers and unpacking interfaces down the chain while detecting circular
- // references.
- nilFound := false
- cycleFound := false
- indirects := 0
- ve := v
- for ve.Kind() == reflect.Ptr {
- if ve.IsNil() {
- nilFound = true
- break
- }
- indirects++
- addr := ve.Pointer()
- pointerChain = append(pointerChain, addr)
- if pd, ok := f.pointers[addr]; ok && pd < f.depth {
- cycleFound = true
- indirects--
- break
- }
- f.pointers[addr] = f.depth
-
- ve = ve.Elem()
- if ve.Kind() == reflect.Interface {
- if ve.IsNil() {
- nilFound = true
- break
- }
- ve = ve.Elem()
- }
- }
-
- // Display type or indirection level depending on flags.
- if showTypes && !f.ignoreNextType {
- f.fs.Write(openParenBytes)
- f.fs.Write(bytes.Repeat(asteriskBytes, indirects))
- f.fs.Write([]byte(ve.Type().String()))
- f.fs.Write(closeParenBytes)
- } else {
- if nilFound || cycleFound {
- indirects += strings.Count(ve.Type().String(), "*")
- }
- f.fs.Write(openAngleBytes)
- f.fs.Write([]byte(strings.Repeat("*", indirects)))
- f.fs.Write(closeAngleBytes)
- }
-
- // Display pointer information depending on flags.
- if f.fs.Flag('+') && (len(pointerChain) > 0) {
- f.fs.Write(openParenBytes)
- for i, addr := range pointerChain {
- if i > 0 {
- f.fs.Write(pointerChainBytes)
- }
- printHexPtr(f.fs, addr)
- }
- f.fs.Write(closeParenBytes)
- }
-
- // Display dereferenced value.
- switch {
- case nilFound == true:
- f.fs.Write(nilAngleBytes)
-
- case cycleFound == true:
- f.fs.Write(circularShortBytes)
-
- default:
- f.ignoreNextType = true
- f.format(ve)
- }
-}
-
-// format is the main workhorse for providing the Formatter interface. It
-// uses the passed reflect value to figure out what kind of object we are
-// dealing with and formats it appropriately. It is a recursive function,
-// however circular data structures are detected and handled properly.
-func (f *formatState) format(v reflect.Value) {
- // Handle invalid reflect values immediately.
- kind := v.Kind()
- if kind == reflect.Invalid {
- f.fs.Write(invalidAngleBytes)
- return
- }
-
- // Handle pointers specially.
- if kind == reflect.Ptr {
- f.formatPtr(v)
- return
- }
-
- // Print type information unless already handled elsewhere.
- if !f.ignoreNextType && f.fs.Flag('#') {
- f.fs.Write(openParenBytes)
- f.fs.Write([]byte(v.Type().String()))
- f.fs.Write(closeParenBytes)
- }
- f.ignoreNextType = false
-
- // Call Stringer/error interfaces if they exist and the handle methods
- // flag is enabled.
- if !f.cs.DisableMethods {
- if (kind != reflect.Invalid) && (kind != reflect.Interface) {
- if handled := handleMethods(f.cs, f.fs, v); handled {
- return
- }
- }
- }
-
- switch kind {
- case reflect.Invalid:
- // Do nothing. We should never get here since invalid has already
- // been handled above.
-
- case reflect.Bool:
- printBool(f.fs, v.Bool())
-
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- printInt(f.fs, v.Int(), 10)
-
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- printUint(f.fs, v.Uint(), 10)
-
- case reflect.Float32:
- printFloat(f.fs, v.Float(), 32)
-
- case reflect.Float64:
- printFloat(f.fs, v.Float(), 64)
-
- case reflect.Complex64:
- printComplex(f.fs, v.Complex(), 32)
-
- case reflect.Complex128:
- printComplex(f.fs, v.Complex(), 64)
-
- case reflect.Slice:
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- break
- }
- fallthrough
-
- case reflect.Array:
- f.fs.Write(openBracketBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- numEntries := v.Len()
- for i := 0; i < numEntries; i++ {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- f.ignoreNextType = true
- f.format(f.unpackValue(v.Index(i)))
- }
- }
- f.depth--
- f.fs.Write(closeBracketBytes)
-
- case reflect.String:
- f.fs.Write([]byte(v.String()))
-
- case reflect.Interface:
- // The only time we should get here is for nil interfaces due to
- // unpackValue calls.
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- }
-
- case reflect.Ptr:
- // Do nothing. We should never get here since pointers have already
- // been handled above.
-
- case reflect.Map:
- // nil maps should be indicated as different than empty maps
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- break
- }
-
- f.fs.Write(openMapBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- keys := v.MapKeys()
- if f.cs.SortKeys {
- sortValues(keys, f.cs)
- }
- for i, key := range keys {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- f.ignoreNextType = true
- f.format(f.unpackValue(key))
- f.fs.Write(colonBytes)
- f.ignoreNextType = true
- f.format(f.unpackValue(v.MapIndex(key)))
- }
- }
- f.depth--
- f.fs.Write(closeMapBytes)
-
- case reflect.Struct:
- numFields := v.NumField()
- f.fs.Write(openBraceBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- vt := v.Type()
- for i := 0; i < numFields; i++ {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- vtf := vt.Field(i)
- if f.fs.Flag('+') || f.fs.Flag('#') {
- f.fs.Write([]byte(vtf.Name))
- f.fs.Write(colonBytes)
- }
- f.format(f.unpackValue(v.Field(i)))
- }
- }
- f.depth--
- f.fs.Write(closeBraceBytes)
-
- case reflect.Uintptr:
- printHexPtr(f.fs, uintptr(v.Uint()))
-
- case reflect.UnsafePointer, reflect.Chan, reflect.Func:
- printHexPtr(f.fs, v.Pointer())
-
- // There were not any other types at the time this code was written, but
- // fall back to letting the default fmt package handle it if any get added.
- default:
- format := f.buildDefaultFormat()
- if v.CanInterface() {
- fmt.Fprintf(f.fs, format, v.Interface())
- } else {
- fmt.Fprintf(f.fs, format, v.String())
- }
- }
-}
-
-// Format satisfies the fmt.Formatter interface. See NewFormatter for usage
-// details.
-func (f *formatState) Format(fs fmt.State, verb rune) {
- f.fs = fs
-
- // Use standard formatting for verbs that are not v.
- if verb != 'v' {
- format := f.constructOrigFormat(verb)
- fmt.Fprintf(fs, format, f.value)
- return
- }
-
- if f.value == nil {
- if fs.Flag('#') {
- fs.Write(interfaceBytes)
- }
- fs.Write(nilAngleBytes)
- return
- }
-
- f.format(reflect.ValueOf(f.value))
-}
-
-// newFormatter is a helper function to consolidate the logic from the various
-// public methods which take varying config states.
-func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
- fs := &formatState{value: v, cs: cs}
- fs.pointers = make(map[uintptr]int)
- return fs
-}
-
-/*
-NewFormatter returns a custom formatter that satisfies the fmt.Formatter
-interface. As a result, it integrates cleanly with standard fmt package
-printing functions. The formatter is useful for inline printing of smaller data
-types similar to the standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Typically this function shouldn't be called directly. It is much easier to make
-use of the custom formatter by calling one of the convenience functions such as
-Printf, Println, or Fprintf.
-*/
-func NewFormatter(v interface{}) fmt.Formatter {
- return newFormatter(&Config, v)
-}
diff --git a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/spew.go b/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/spew.go
deleted file mode 100644
index d8233f542..000000000
--- a/archived/event-adapter/vendor/github.com/davecgh/go-spew/spew/spew.go
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "fmt"
- "io"
-)
-
-// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the formatted string as a value that satisfies error. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Errorf(format string, a ...interface{}) (err error) {
- return fmt.Errorf(format, convertArgs(a)...)
-}
-
-// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprint(w, convertArgs(a)...)
-}
-
-// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- return fmt.Fprintf(w, format, convertArgs(a)...)
-}
-
-// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
-// passed with a default Formatter interface returned by NewFormatter. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprintln(w, convertArgs(a)...)
-}
-
-// Print is a wrapper for fmt.Print that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))
-func Print(a ...interface{}) (n int, err error) {
- return fmt.Print(convertArgs(a)...)
-}
-
-// Printf is a wrapper for fmt.Printf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Printf(format string, a ...interface{}) (n int, err error) {
- return fmt.Printf(format, convertArgs(a)...)
-}
-
-// Println is a wrapper for fmt.Println that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))
-func Println(a ...interface{}) (n int, err error) {
- return fmt.Println(convertArgs(a)...)
-}
-
-// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprint(a ...interface{}) string {
- return fmt.Sprint(convertArgs(a)...)
-}
-
-// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprintf(format string, a ...interface{}) string {
- return fmt.Sprintf(format, convertArgs(a)...)
-}
-
-// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
-// were passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprintln(a ...interface{}) string {
- return fmt.Sprintln(convertArgs(a)...)
-}
-
-// convertArgs accepts a slice of arguments and returns a slice of the same
-// length with each argument converted to a default spew Formatter interface.
-func convertArgs(args []interface{}) (formatters []interface{}) {
- formatters = make([]interface{}, len(args))
- for index, arg := range args {
- formatters[index] = NewFormatter(arg)
- }
- return formatters
-}
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/LICENSE b/archived/event-adapter/vendor/github.com/docker/distribution/LICENSE
deleted file mode 100644
index e06d20818..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/digestset/set.go b/archived/event-adapter/vendor/github.com/docker/distribution/digestset/set.go
deleted file mode 100644
index 71327dca7..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/digestset/set.go
+++ /dev/null
@@ -1,247 +0,0 @@
-package digestset
-
-import (
- "errors"
- "sort"
- "strings"
- "sync"
-
- digest "github.com/opencontainers/go-digest"
-)
-
-var (
- // ErrDigestNotFound is used when a matching digest
- // could not be found in a set.
- ErrDigestNotFound = errors.New("digest not found")
-
- // ErrDigestAmbiguous is used when multiple digests
- // are found in a set. None of the matching digests
- // should be considered valid matches.
- ErrDigestAmbiguous = errors.New("ambiguous digest string")
-)
-
-// Set is used to hold a unique set of digests which
-// may be easily referenced by easily referenced by a string
-// representation of the digest as well as short representation.
-// The uniqueness of the short representation is based on other
-// digests in the set. If digests are omitted from this set,
-// collisions in a larger set may not be detected, therefore it
-// is important to always do short representation lookups on
-// the complete set of digests. To mitigate collisions, an
-// appropriately long short code should be used.
-type Set struct {
- mutex sync.RWMutex
- entries digestEntries
-}
-
-// NewSet creates an empty set of digests
-// which may have digests added.
-func NewSet() *Set {
- return &Set{
- entries: digestEntries{},
- }
-}
-
-// checkShortMatch checks whether two digests match as either whole
-// values or short values. This function does not test equality,
-// rather whether the second value could match against the first
-// value.
-func checkShortMatch(alg digest.Algorithm, hex, shortAlg, shortHex string) bool {
- if len(hex) == len(shortHex) {
- if hex != shortHex {
- return false
- }
- if len(shortAlg) > 0 && string(alg) != shortAlg {
- return false
- }
- } else if !strings.HasPrefix(hex, shortHex) {
- return false
- } else if len(shortAlg) > 0 && string(alg) != shortAlg {
- return false
- }
- return true
-}
-
-// Lookup looks for a digest matching the given string representation.
-// If no digests could be found ErrDigestNotFound will be returned
-// with an empty digest value. If multiple matches are found
-// ErrDigestAmbiguous will be returned with an empty digest value.
-func (dst *Set) Lookup(d string) (digest.Digest, error) {
- dst.mutex.RLock()
- defer dst.mutex.RUnlock()
- if len(dst.entries) == 0 {
- return "", ErrDigestNotFound
- }
- var (
- searchFunc func(int) bool
- alg digest.Algorithm
- hex string
- )
- dgst, err := digest.Parse(d)
- if err == digest.ErrDigestInvalidFormat {
- hex = d
- searchFunc = func(i int) bool {
- return dst.entries[i].val >= d
- }
- } else {
- hex = dgst.Hex()
- alg = dgst.Algorithm()
- searchFunc = func(i int) bool {
- if dst.entries[i].val == hex {
- return dst.entries[i].alg >= alg
- }
- return dst.entries[i].val >= hex
- }
- }
- idx := sort.Search(len(dst.entries), searchFunc)
- if idx == len(dst.entries) || !checkShortMatch(dst.entries[idx].alg, dst.entries[idx].val, string(alg), hex) {
- return "", ErrDigestNotFound
- }
- if dst.entries[idx].alg == alg && dst.entries[idx].val == hex {
- return dst.entries[idx].digest, nil
- }
- if idx+1 < len(dst.entries) && checkShortMatch(dst.entries[idx+1].alg, dst.entries[idx+1].val, string(alg), hex) {
- return "", ErrDigestAmbiguous
- }
-
- return dst.entries[idx].digest, nil
-}
-
-// Add adds the given digest to the set. An error will be returned
-// if the given digest is invalid. If the digest already exists in the
-// set, this operation will be a no-op.
-func (dst *Set) Add(d digest.Digest) error {
- if err := d.Validate(); err != nil {
- return err
- }
- dst.mutex.Lock()
- defer dst.mutex.Unlock()
- entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d}
- searchFunc := func(i int) bool {
- if dst.entries[i].val == entry.val {
- return dst.entries[i].alg >= entry.alg
- }
- return dst.entries[i].val >= entry.val
- }
- idx := sort.Search(len(dst.entries), searchFunc)
- if idx == len(dst.entries) {
- dst.entries = append(dst.entries, entry)
- return nil
- } else if dst.entries[idx].digest == d {
- return nil
- }
-
- entries := append(dst.entries, nil)
- copy(entries[idx+1:], entries[idx:len(entries)-1])
- entries[idx] = entry
- dst.entries = entries
- return nil
-}
-
-// Remove removes the given digest from the set. An err will be
-// returned if the given digest is invalid. If the digest does
-// not exist in the set, this operation will be a no-op.
-func (dst *Set) Remove(d digest.Digest) error {
- if err := d.Validate(); err != nil {
- return err
- }
- dst.mutex.Lock()
- defer dst.mutex.Unlock()
- entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d}
- searchFunc := func(i int) bool {
- if dst.entries[i].val == entry.val {
- return dst.entries[i].alg >= entry.alg
- }
- return dst.entries[i].val >= entry.val
- }
- idx := sort.Search(len(dst.entries), searchFunc)
- // Not found if idx is after or value at idx is not digest
- if idx == len(dst.entries) || dst.entries[idx].digest != d {
- return nil
- }
-
- entries := dst.entries
- copy(entries[idx:], entries[idx+1:])
- entries = entries[:len(entries)-1]
- dst.entries = entries
-
- return nil
-}
-
-// All returns all the digests in the set
-func (dst *Set) All() []digest.Digest {
- dst.mutex.RLock()
- defer dst.mutex.RUnlock()
- retValues := make([]digest.Digest, len(dst.entries))
- for i := range dst.entries {
- retValues[i] = dst.entries[i].digest
- }
-
- return retValues
-}
-
-// ShortCodeTable returns a map of Digest to unique short codes. The
-// length represents the minimum value, the maximum length may be the
-// entire value of digest if uniqueness cannot be achieved without the
-// full value. This function will attempt to make short codes as short
-// as possible to be unique.
-func ShortCodeTable(dst *Set, length int) map[digest.Digest]string {
- dst.mutex.RLock()
- defer dst.mutex.RUnlock()
- m := make(map[digest.Digest]string, len(dst.entries))
- l := length
- resetIdx := 0
- for i := 0; i < len(dst.entries); i++ {
- var short string
- extended := true
- for extended {
- extended = false
- if len(dst.entries[i].val) <= l {
- short = dst.entries[i].digest.String()
- } else {
- short = dst.entries[i].val[:l]
- for j := i + 1; j < len(dst.entries); j++ {
- if checkShortMatch(dst.entries[j].alg, dst.entries[j].val, "", short) {
- if j > resetIdx {
- resetIdx = j
- }
- extended = true
- } else {
- break
- }
- }
- if extended {
- l++
- }
- }
- }
- m[dst.entries[i].digest] = short
- if i >= resetIdx {
- l = length
- }
- }
- return m
-}
-
-type digestEntry struct {
- alg digest.Algorithm
- val string
- digest digest.Digest
-}
-
-type digestEntries []*digestEntry
-
-func (d digestEntries) Len() int {
- return len(d)
-}
-
-func (d digestEntries) Less(i, j int) bool {
- if d[i].val != d[j].val {
- return d[i].val < d[j].val
- }
- return d[i].alg < d[j].alg
-}
-
-func (d digestEntries) Swap(i, j int) {
- d[i], d[j] = d[j], d[i]
-}
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/reference/helpers.go b/archived/event-adapter/vendor/github.com/docker/distribution/reference/helpers.go
deleted file mode 100644
index 978df7eab..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/reference/helpers.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package reference
-
-import "path"
-
-// IsNameOnly returns true if reference only contains a repo name.
-func IsNameOnly(ref Named) bool {
- if _, ok := ref.(NamedTagged); ok {
- return false
- }
- if _, ok := ref.(Canonical); ok {
- return false
- }
- return true
-}
-
-// FamiliarName returns the familiar name string
-// for the given named, familiarizing if needed.
-func FamiliarName(ref Named) string {
- if nn, ok := ref.(normalizedNamed); ok {
- return nn.Familiar().Name()
- }
- return ref.Name()
-}
-
-// FamiliarString returns the familiar string representation
-// for the given reference, familiarizing if needed.
-func FamiliarString(ref Reference) string {
- if nn, ok := ref.(normalizedNamed); ok {
- return nn.Familiar().String()
- }
- return ref.String()
-}
-
-// FamiliarMatch reports whether ref matches the specified pattern.
-// See https://godoc.org/path#Match for supported patterns.
-func FamiliarMatch(pattern string, ref Reference) (bool, error) {
- matched, err := path.Match(pattern, FamiliarString(ref))
- if namedRef, isNamed := ref.(Named); isNamed && !matched {
- matched, _ = path.Match(pattern, FamiliarName(namedRef))
- }
- return matched, err
-}
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/reference/normalize.go b/archived/event-adapter/vendor/github.com/docker/distribution/reference/normalize.go
deleted file mode 100644
index 2d71fc5e9..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/reference/normalize.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package reference
-
-import (
- "errors"
- "fmt"
- "strings"
-
- "github.com/docker/distribution/digestset"
- "github.com/opencontainers/go-digest"
-)
-
-var (
- legacyDefaultDomain = "index.docker.io"
- defaultDomain = "docker.io"
- officialRepoName = "library"
- defaultTag = "latest"
-)
-
-// normalizedNamed represents a name which has been
-// normalized and has a familiar form. A familiar name
-// is what is used in Docker UI. An example normalized
-// name is "docker.io/library/ubuntu" and corresponding
-// familiar name of "ubuntu".
-type normalizedNamed interface {
- Named
- Familiar() Named
-}
-
-// ParseNormalizedNamed parses a string into a named reference
-// transforming a familiar name from Docker UI to a fully
-// qualified reference. If the value may be an identifier
-// use ParseAnyReference.
-func ParseNormalizedNamed(s string) (Named, error) {
- if ok := anchoredIdentifierRegexp.MatchString(s); ok {
- return nil, fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings", s)
- }
- domain, remainder := splitDockerDomain(s)
- var remoteName string
- if tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 {
- remoteName = remainder[:tagSep]
- } else {
- remoteName = remainder
- }
- if strings.ToLower(remoteName) != remoteName {
- return nil, errors.New("invalid reference format: repository name must be lowercase")
- }
-
- ref, err := Parse(domain + "/" + remainder)
- if err != nil {
- return nil, err
- }
- named, isNamed := ref.(Named)
- if !isNamed {
- return nil, fmt.Errorf("reference %s has no name", ref.String())
- }
- return named, nil
-}
-
-// splitDockerDomain splits a repository name to domain and remotename string.
-// If no valid domain is found, the default domain is used. Repository name
-// needs to be already validated before.
-func splitDockerDomain(name string) (domain, remainder string) {
- i := strings.IndexRune(name, '/')
- if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost") {
- domain, remainder = defaultDomain, name
- } else {
- domain, remainder = name[:i], name[i+1:]
- }
- if domain == legacyDefaultDomain {
- domain = defaultDomain
- }
- if domain == defaultDomain && !strings.ContainsRune(remainder, '/') {
- remainder = officialRepoName + "/" + remainder
- }
- return
-}
-
-// familiarizeName returns a shortened version of the name familiar
-// to to the Docker UI. Familiar names have the default domain
-// "docker.io" and "library/" repository prefix removed.
-// For example, "docker.io/library/redis" will have the familiar
-// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp".
-// Returns a familiarized named only reference.
-func familiarizeName(named namedRepository) repository {
- repo := repository{
- domain: named.Domain(),
- path: named.Path(),
- }
-
- if repo.domain == defaultDomain {
- repo.domain = ""
- // Handle official repositories which have the pattern "library/"
- if split := strings.Split(repo.path, "/"); len(split) == 2 && split[0] == officialRepoName {
- repo.path = split[1]
- }
- }
- return repo
-}
-
-func (r reference) Familiar() Named {
- return reference{
- namedRepository: familiarizeName(r.namedRepository),
- tag: r.tag,
- digest: r.digest,
- }
-}
-
-func (r repository) Familiar() Named {
- return familiarizeName(r)
-}
-
-func (t taggedReference) Familiar() Named {
- return taggedReference{
- namedRepository: familiarizeName(t.namedRepository),
- tag: t.tag,
- }
-}
-
-func (c canonicalReference) Familiar() Named {
- return canonicalReference{
- namedRepository: familiarizeName(c.namedRepository),
- digest: c.digest,
- }
-}
-
-// TagNameOnly adds the default tag "latest" to a reference if it only has
-// a repo name.
-func TagNameOnly(ref Named) Named {
- if IsNameOnly(ref) {
- namedTagged, err := WithTag(ref, defaultTag)
- if err != nil {
- // Default tag must be valid, to create a NamedTagged
- // type with non-validated input the WithTag function
- // should be used instead
- panic(err)
- }
- return namedTagged
- }
- return ref
-}
-
-// ParseAnyReference parses a reference string as a possible identifier,
-// full digest, or familiar name.
-func ParseAnyReference(ref string) (Reference, error) {
- if ok := anchoredIdentifierRegexp.MatchString(ref); ok {
- return digestReference("sha256:" + ref), nil
- }
- if dgst, err := digest.Parse(ref); err == nil {
- return digestReference(dgst), nil
- }
-
- return ParseNormalizedNamed(ref)
-}
-
-// ParseAnyReferenceWithSet parses a reference string as a possible short
-// identifier to be matched in a digest set, a full digest, or familiar name.
-func ParseAnyReferenceWithSet(ref string, ds *digestset.Set) (Reference, error) {
- if ok := anchoredShortIdentifierRegexp.MatchString(ref); ok {
- dgst, err := ds.Lookup(ref)
- if err == nil {
- return digestReference(dgst), nil
- }
- } else {
- if dgst, err := digest.Parse(ref); err == nil {
- return digestReference(dgst), nil
- }
- }
-
- return ParseNormalizedNamed(ref)
-}
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/reference/reference.go b/archived/event-adapter/vendor/github.com/docker/distribution/reference/reference.go
deleted file mode 100644
index 2f66cca87..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/reference/reference.go
+++ /dev/null
@@ -1,433 +0,0 @@
-// Package reference provides a general type to represent any way of referencing images within the registry.
-// Its main purpose is to abstract tags and digests (content-addressable hash).
-//
-// Grammar
-//
-// reference := name [ ":" tag ] [ "@" digest ]
-// name := [domain '/'] path-component ['/' path-component]*
-// domain := domain-component ['.' domain-component]* [':' port-number]
-// domain-component := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/
-// port-number := /[0-9]+/
-// path-component := alpha-numeric [separator alpha-numeric]*
-// alpha-numeric := /[a-z0-9]+/
-// separator := /[_.]|__|[-]*/
-//
-// tag := /[\w][\w.-]{0,127}/
-//
-// digest := digest-algorithm ":" digest-hex
-// digest-algorithm := digest-algorithm-component [ digest-algorithm-separator digest-algorithm-component ]*
-// digest-algorithm-separator := /[+.-_]/
-// digest-algorithm-component := /[A-Za-z][A-Za-z0-9]*/
-// digest-hex := /[0-9a-fA-F]{32,}/ ; At least 128 bit digest value
-//
-// identifier := /[a-f0-9]{64}/
-// short-identifier := /[a-f0-9]{6,64}/
-package reference
-
-import (
- "errors"
- "fmt"
- "strings"
-
- "github.com/opencontainers/go-digest"
-)
-
-const (
- // NameTotalLengthMax is the maximum total number of characters in a repository name.
- NameTotalLengthMax = 255
-)
-
-var (
- // ErrReferenceInvalidFormat represents an error while trying to parse a string as a reference.
- ErrReferenceInvalidFormat = errors.New("invalid reference format")
-
- // ErrTagInvalidFormat represents an error while trying to parse a string as a tag.
- ErrTagInvalidFormat = errors.New("invalid tag format")
-
- // ErrDigestInvalidFormat represents an error while trying to parse a string as a tag.
- ErrDigestInvalidFormat = errors.New("invalid digest format")
-
- // ErrNameContainsUppercase is returned for invalid repository names that contain uppercase characters.
- ErrNameContainsUppercase = errors.New("repository name must be lowercase")
-
- // ErrNameEmpty is returned for empty, invalid repository names.
- ErrNameEmpty = errors.New("repository name must have at least one component")
-
- // ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax.
- ErrNameTooLong = fmt.Errorf("repository name must not be more than %v characters", NameTotalLengthMax)
-
- // ErrNameNotCanonical is returned when a name is not canonical.
- ErrNameNotCanonical = errors.New("repository name must be canonical")
-)
-
-// Reference is an opaque object reference identifier that may include
-// modifiers such as a hostname, name, tag, and digest.
-type Reference interface {
- // String returns the full reference
- String() string
-}
-
-// Field provides a wrapper type for resolving correct reference types when
-// working with encoding.
-type Field struct {
- reference Reference
-}
-
-// AsField wraps a reference in a Field for encoding.
-func AsField(reference Reference) Field {
- return Field{reference}
-}
-
-// Reference unwraps the reference type from the field to
-// return the Reference object. This object should be
-// of the appropriate type to further check for different
-// reference types.
-func (f Field) Reference() Reference {
- return f.reference
-}
-
-// MarshalText serializes the field to byte text which
-// is the string of the reference.
-func (f Field) MarshalText() (p []byte, err error) {
- return []byte(f.reference.String()), nil
-}
-
-// UnmarshalText parses text bytes by invoking the
-// reference parser to ensure the appropriately
-// typed reference object is wrapped by field.
-func (f *Field) UnmarshalText(p []byte) error {
- r, err := Parse(string(p))
- if err != nil {
- return err
- }
-
- f.reference = r
- return nil
-}
-
-// Named is an object with a full name
-type Named interface {
- Reference
- Name() string
-}
-
-// Tagged is an object which has a tag
-type Tagged interface {
- Reference
- Tag() string
-}
-
-// NamedTagged is an object including a name and tag.
-type NamedTagged interface {
- Named
- Tag() string
-}
-
-// Digested is an object which has a digest
-// in which it can be referenced by
-type Digested interface {
- Reference
- Digest() digest.Digest
-}
-
-// Canonical reference is an object with a fully unique
-// name including a name with domain and digest
-type Canonical interface {
- Named
- Digest() digest.Digest
-}
-
-// namedRepository is a reference to a repository with a name.
-// A namedRepository has both domain and path components.
-type namedRepository interface {
- Named
- Domain() string
- Path() string
-}
-
-// Domain returns the domain part of the Named reference
-func Domain(named Named) string {
- if r, ok := named.(namedRepository); ok {
- return r.Domain()
- }
- domain, _ := splitDomain(named.Name())
- return domain
-}
-
-// Path returns the name without the domain part of the Named reference
-func Path(named Named) (name string) {
- if r, ok := named.(namedRepository); ok {
- return r.Path()
- }
- _, path := splitDomain(named.Name())
- return path
-}
-
-func splitDomain(name string) (string, string) {
- match := anchoredNameRegexp.FindStringSubmatch(name)
- if len(match) != 3 {
- return "", name
- }
- return match[1], match[2]
-}
-
-// SplitHostname splits a named reference into a
-// hostname and name string. If no valid hostname is
-// found, the hostname is empty and the full value
-// is returned as name
-// DEPRECATED: Use Domain or Path
-func SplitHostname(named Named) (string, string) {
- if r, ok := named.(namedRepository); ok {
- return r.Domain(), r.Path()
- }
- return splitDomain(named.Name())
-}
-
-// Parse parses s and returns a syntactically valid Reference.
-// If an error was encountered it is returned, along with a nil Reference.
-// NOTE: Parse will not handle short digests.
-func Parse(s string) (Reference, error) {
- matches := ReferenceRegexp.FindStringSubmatch(s)
- if matches == nil {
- if s == "" {
- return nil, ErrNameEmpty
- }
- if ReferenceRegexp.FindStringSubmatch(strings.ToLower(s)) != nil {
- return nil, ErrNameContainsUppercase
- }
- return nil, ErrReferenceInvalidFormat
- }
-
- if len(matches[1]) > NameTotalLengthMax {
- return nil, ErrNameTooLong
- }
-
- var repo repository
-
- nameMatch := anchoredNameRegexp.FindStringSubmatch(matches[1])
- if nameMatch != nil && len(nameMatch) == 3 {
- repo.domain = nameMatch[1]
- repo.path = nameMatch[2]
- } else {
- repo.domain = ""
- repo.path = matches[1]
- }
-
- ref := reference{
- namedRepository: repo,
- tag: matches[2],
- }
- if matches[3] != "" {
- var err error
- ref.digest, err = digest.Parse(matches[3])
- if err != nil {
- return nil, err
- }
- }
-
- r := getBestReferenceType(ref)
- if r == nil {
- return nil, ErrNameEmpty
- }
-
- return r, nil
-}
-
-// ParseNamed parses s and returns a syntactically valid reference implementing
-// the Named interface. The reference must have a name and be in the canonical
-// form, otherwise an error is returned.
-// If an error was encountered it is returned, along with a nil Reference.
-// NOTE: ParseNamed will not handle short digests.
-func ParseNamed(s string) (Named, error) {
- named, err := ParseNormalizedNamed(s)
- if err != nil {
- return nil, err
- }
- if named.String() != s {
- return nil, ErrNameNotCanonical
- }
- return named, nil
-}
-
-// WithName returns a named object representing the given string. If the input
-// is invalid ErrReferenceInvalidFormat will be returned.
-func WithName(name string) (Named, error) {
- if len(name) > NameTotalLengthMax {
- return nil, ErrNameTooLong
- }
-
- match := anchoredNameRegexp.FindStringSubmatch(name)
- if match == nil || len(match) != 3 {
- return nil, ErrReferenceInvalidFormat
- }
- return repository{
- domain: match[1],
- path: match[2],
- }, nil
-}
-
-// WithTag combines the name from "name" and the tag from "tag" to form a
-// reference incorporating both the name and the tag.
-func WithTag(name Named, tag string) (NamedTagged, error) {
- if !anchoredTagRegexp.MatchString(tag) {
- return nil, ErrTagInvalidFormat
- }
- var repo repository
- if r, ok := name.(namedRepository); ok {
- repo.domain = r.Domain()
- repo.path = r.Path()
- } else {
- repo.path = name.Name()
- }
- if canonical, ok := name.(Canonical); ok {
- return reference{
- namedRepository: repo,
- tag: tag,
- digest: canonical.Digest(),
- }, nil
- }
- return taggedReference{
- namedRepository: repo,
- tag: tag,
- }, nil
-}
-
-// WithDigest combines the name from "name" and the digest from "digest" to form
-// a reference incorporating both the name and the digest.
-func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
- if !anchoredDigestRegexp.MatchString(digest.String()) {
- return nil, ErrDigestInvalidFormat
- }
- var repo repository
- if r, ok := name.(namedRepository); ok {
- repo.domain = r.Domain()
- repo.path = r.Path()
- } else {
- repo.path = name.Name()
- }
- if tagged, ok := name.(Tagged); ok {
- return reference{
- namedRepository: repo,
- tag: tagged.Tag(),
- digest: digest,
- }, nil
- }
- return canonicalReference{
- namedRepository: repo,
- digest: digest,
- }, nil
-}
-
-// TrimNamed removes any tag or digest from the named reference.
-func TrimNamed(ref Named) Named {
- domain, path := SplitHostname(ref)
- return repository{
- domain: domain,
- path: path,
- }
-}
-
-func getBestReferenceType(ref reference) Reference {
- if ref.Name() == "" {
- // Allow digest only references
- if ref.digest != "" {
- return digestReference(ref.digest)
- }
- return nil
- }
- if ref.tag == "" {
- if ref.digest != "" {
- return canonicalReference{
- namedRepository: ref.namedRepository,
- digest: ref.digest,
- }
- }
- return ref.namedRepository
- }
- if ref.digest == "" {
- return taggedReference{
- namedRepository: ref.namedRepository,
- tag: ref.tag,
- }
- }
-
- return ref
-}
-
-type reference struct {
- namedRepository
- tag string
- digest digest.Digest
-}
-
-func (r reference) String() string {
- return r.Name() + ":" + r.tag + "@" + r.digest.String()
-}
-
-func (r reference) Tag() string {
- return r.tag
-}
-
-func (r reference) Digest() digest.Digest {
- return r.digest
-}
-
-type repository struct {
- domain string
- path string
-}
-
-func (r repository) String() string {
- return r.Name()
-}
-
-func (r repository) Name() string {
- if r.domain == "" {
- return r.path
- }
- return r.domain + "/" + r.path
-}
-
-func (r repository) Domain() string {
- return r.domain
-}
-
-func (r repository) Path() string {
- return r.path
-}
-
-type digestReference digest.Digest
-
-func (d digestReference) String() string {
- return digest.Digest(d).String()
-}
-
-func (d digestReference) Digest() digest.Digest {
- return digest.Digest(d)
-}
-
-type taggedReference struct {
- namedRepository
- tag string
-}
-
-func (t taggedReference) String() string {
- return t.Name() + ":" + t.tag
-}
-
-func (t taggedReference) Tag() string {
- return t.tag
-}
-
-type canonicalReference struct {
- namedRepository
- digest digest.Digest
-}
-
-func (c canonicalReference) String() string {
- return c.Name() + "@" + c.digest.String()
-}
-
-func (c canonicalReference) Digest() digest.Digest {
- return c.digest
-}
diff --git a/archived/event-adapter/vendor/github.com/docker/distribution/reference/regexp.go b/archived/event-adapter/vendor/github.com/docker/distribution/reference/regexp.go
deleted file mode 100644
index 786034932..000000000
--- a/archived/event-adapter/vendor/github.com/docker/distribution/reference/regexp.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package reference
-
-import "regexp"
-
-var (
- // alphaNumericRegexp defines the alpha numeric atom, typically a
- // component of names. This only allows lower case characters and digits.
- alphaNumericRegexp = match(`[a-z0-9]+`)
-
- // separatorRegexp defines the separators allowed to be embedded in name
- // components. This allow one period, one or two underscore and multiple
- // dashes.
- separatorRegexp = match(`(?:[._]|__|[-]*)`)
-
- // nameComponentRegexp restricts registry path component names to start
- // with at least one letter or number, with following parts able to be
- // separated by one period, one or two underscore and multiple dashes.
- nameComponentRegexp = expression(
- alphaNumericRegexp,
- optional(repeated(separatorRegexp, alphaNumericRegexp)))
-
- // domainComponentRegexp restricts the registry domain component of a
- // repository name to start with a component as defined by DomainRegexp
- // and followed by an optional port.
- domainComponentRegexp = match(`(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])`)
-
- // DomainRegexp defines the structure of potential domain components
- // that may be part of image names. This is purposely a subset of what is
- // allowed by DNS to ensure backwards compatibility with Docker image
- // names.
- DomainRegexp = expression(
- domainComponentRegexp,
- optional(repeated(literal(`.`), domainComponentRegexp)),
- optional(literal(`:`), match(`[0-9]+`)))
-
- // TagRegexp matches valid tag names. From docker/docker:graph/tags.go.
- TagRegexp = match(`[\w][\w.-]{0,127}`)
-
- // anchoredTagRegexp matches valid tag names, anchored at the start and
- // end of the matched string.
- anchoredTagRegexp = anchored(TagRegexp)
-
- // DigestRegexp matches valid digests.
- DigestRegexp = match(`[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}`)
-
- // anchoredDigestRegexp matches valid digests, anchored at the start and
- // end of the matched string.
- anchoredDigestRegexp = anchored(DigestRegexp)
-
- // NameRegexp is the format for the name component of references. The
- // regexp has capturing groups for the domain and name part omitting
- // the separating forward slash from either.
- NameRegexp = expression(
- optional(DomainRegexp, literal(`/`)),
- nameComponentRegexp,
- optional(repeated(literal(`/`), nameComponentRegexp)))
-
- // anchoredNameRegexp is used to parse a name value, capturing the
- // domain and trailing components.
- anchoredNameRegexp = anchored(
- optional(capture(DomainRegexp), literal(`/`)),
- capture(nameComponentRegexp,
- optional(repeated(literal(`/`), nameComponentRegexp))))
-
- // ReferenceRegexp is the full supported format of a reference. The regexp
- // is anchored and has capturing groups for name, tag, and digest
- // components.
- ReferenceRegexp = anchored(capture(NameRegexp),
- optional(literal(":"), capture(TagRegexp)),
- optional(literal("@"), capture(DigestRegexp)))
-
- // IdentifierRegexp is the format for string identifier used as a
- // content addressable identifier using sha256. These identifiers
- // are like digests without the algorithm, since sha256 is used.
- IdentifierRegexp = match(`([a-f0-9]{64})`)
-
- // ShortIdentifierRegexp is the format used to represent a prefix
- // of an identifier. A prefix may be used to match a sha256 identifier
- // within a list of trusted identifiers.
- ShortIdentifierRegexp = match(`([a-f0-9]{6,64})`)
-
- // anchoredIdentifierRegexp is used to check or match an
- // identifier value, anchored at start and end of string.
- anchoredIdentifierRegexp = anchored(IdentifierRegexp)
-
- // anchoredShortIdentifierRegexp is used to check if a value
- // is a possible identifier prefix, anchored at start and end
- // of string.
- anchoredShortIdentifierRegexp = anchored(ShortIdentifierRegexp)
-)
-
-// match compiles the string to a regular expression.
-var match = regexp.MustCompile
-
-// literal compiles s into a literal regular expression, escaping any regexp
-// reserved characters.
-func literal(s string) *regexp.Regexp {
- re := match(regexp.QuoteMeta(s))
-
- if _, complete := re.LiteralPrefix(); !complete {
- panic("must be a literal")
- }
-
- return re
-}
-
-// expression defines a full expression, where each regular expression must
-// follow the previous.
-func expression(res ...*regexp.Regexp) *regexp.Regexp {
- var s string
- for _, re := range res {
- s += re.String()
- }
-
- return match(s)
-}
-
-// optional wraps the expression in a non-capturing group and makes the
-// production optional.
-func optional(res ...*regexp.Regexp) *regexp.Regexp {
- return match(group(expression(res...)).String() + `?`)
-}
-
-// repeated wraps the regexp in a non-capturing group to get one or more
-// matches.
-func repeated(res ...*regexp.Regexp) *regexp.Regexp {
- return match(group(expression(res...)).String() + `+`)
-}
-
-// group wraps the regexp in a non-capturing group.
-func group(res ...*regexp.Regexp) *regexp.Regexp {
- return match(`(?:` + expression(res...).String() + `)`)
-}
-
-// capture wraps the expression in a capturing group.
-func capture(res ...*regexp.Regexp) *regexp.Regexp {
- return match(`(` + expression(res...).String() + `)`)
-}
-
-// anchored anchors the regular expression by adding start and end delimiters.
-func anchored(res ...*regexp.Regexp) *regexp.Regexp {
- return match(`^` + expression(res...).String() + `$`)
-}
diff --git a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/LICENSE b/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/LICENSE
deleted file mode 100644
index 5782c7269..000000000
--- a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2014, Elazar Leibovich
-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.
-
-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 HOLDER 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.
diff --git a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/README.md b/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/README.md
deleted file mode 100644
index 795d3d320..000000000
--- a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# go-bindata-assetfs
-
-Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) with `net/http`.
-
-[GoDoc](http://godoc.org/github.com/elazarl/go-bindata-assetfs)
-
-### Installation
-
-Install with
-
- $ go get github.com/jteeuwen/go-bindata/...
- $ go get github.com/elazarl/go-bindata-assetfs/...
-
-### Creating embedded data
-
-Usage is identical to [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) usage,
-instead of running `go-bindata` run `go-bindata-assetfs`.
-
-The tool will create a `bindata_assetfs.go` file, which contains the embedded data.
-
-A typical use case is
-
- $ go-bindata-assetfs data/...
-
-### Using assetFS in your code
-
-The generated file provides an `assetFS()` function that returns a `http.Filesystem`
-wrapping the embedded files. What you usually want to do is:
-
- http.Handle("/", http.FileServer(assetFS()))
-
-This would run an HTTP server serving the embedded files.
-
-## Without running binary tool
-
-You can always just run the `go-bindata` tool, and then
-
-use
-
- import "github.com/elazarl/go-bindata-assetfs"
- ...
- http.Handle("/",
- http.FileServer(
- &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"}))
-
-to serve files embedded from the `data` directory.
diff --git a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go b/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go
deleted file mode 100644
index 5174d5a6d..000000000
--- a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package assetfs
-
-import (
- "bytes"
- "errors"
- "io"
- "io/ioutil"
- "net/http"
- "os"
- "path"
- "path/filepath"
- "time"
-)
-
-var (
- fileTimestamp = time.Now()
-)
-
-// FakeFile implements os.FileInfo interface for a given path and size
-type FakeFile struct {
- // Path is the path of this file
- Path string
- // Dir marks of the path is a directory
- Dir bool
- // Len is the length of the fake file, zero if it is a directory
- Len int64
-}
-
-func (f *FakeFile) Name() string {
- _, name := filepath.Split(f.Path)
- return name
-}
-
-func (f *FakeFile) Mode() os.FileMode {
- mode := os.FileMode(0644)
- if f.Dir {
- return mode | os.ModeDir
- }
- return mode
-}
-
-func (f *FakeFile) ModTime() time.Time {
- return fileTimestamp
-}
-
-func (f *FakeFile) Size() int64 {
- return f.Len
-}
-
-func (f *FakeFile) IsDir() bool {
- return f.Mode().IsDir()
-}
-
-func (f *FakeFile) Sys() interface{} {
- return nil
-}
-
-// AssetFile implements http.File interface for a no-directory file with content
-type AssetFile struct {
- *bytes.Reader
- io.Closer
- FakeFile
-}
-
-func NewAssetFile(name string, content []byte) *AssetFile {
- return &AssetFile{
- bytes.NewReader(content),
- ioutil.NopCloser(nil),
- FakeFile{name, false, int64(len(content))}}
-}
-
-func (f *AssetFile) Readdir(count int) ([]os.FileInfo, error) {
- return nil, errors.New("not a directory")
-}
-
-func (f *AssetFile) Size() int64 {
- return f.FakeFile.Size()
-}
-
-func (f *AssetFile) Stat() (os.FileInfo, error) {
- return f, nil
-}
-
-// AssetDirectory implements http.File interface for a directory
-type AssetDirectory struct {
- AssetFile
- ChildrenRead int
- Children []os.FileInfo
-}
-
-func NewAssetDirectory(name string, children []string, fs *AssetFS) *AssetDirectory {
- fileinfos := make([]os.FileInfo, 0, len(children))
- for _, child := range children {
- _, err := fs.AssetDir(filepath.Join(name, child))
- fileinfos = append(fileinfos, &FakeFile{child, err == nil, 0})
- }
- return &AssetDirectory{
- AssetFile{
- bytes.NewReader(nil),
- ioutil.NopCloser(nil),
- FakeFile{name, true, 0},
- },
- 0,
- fileinfos}
-}
-
-func (f *AssetDirectory) Readdir(count int) ([]os.FileInfo, error) {
- if count <= 0 {
- return f.Children, nil
- }
- if f.ChildrenRead+count > len(f.Children) {
- count = len(f.Children) - f.ChildrenRead
- }
- rv := f.Children[f.ChildrenRead : f.ChildrenRead+count]
- f.ChildrenRead += count
- return rv, nil
-}
-
-func (f *AssetDirectory) Stat() (os.FileInfo, error) {
- return f, nil
-}
-
-// AssetFS implements http.FileSystem, allowing
-// embedded files to be served from net/http package.
-type AssetFS struct {
- // Asset should return content of file in path if exists
- Asset func(path string) ([]byte, error)
- // AssetDir should return list of files in the path
- AssetDir func(path string) ([]string, error)
- // Prefix would be prepended to http requests
- Prefix string
-}
-
-func (fs *AssetFS) Open(name string) (http.File, error) {
- name = path.Join(fs.Prefix, name)
- if len(name) > 0 && name[0] == '/' {
- name = name[1:]
- }
- if b, err := fs.Asset(name); err == nil {
- return NewAssetFile(name, b), nil
- }
- if children, err := fs.AssetDir(name); err == nil {
- return NewAssetDirectory(name, children, fs), nil
- } else {
- return nil, err
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/doc.go b/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/doc.go
deleted file mode 100644
index a664249f3..000000000
--- a/archived/event-adapter/vendor/github.com/elazarl/go-bindata-assetfs/doc.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// assetfs allows packages to serve static content embedded
-// with the go-bindata tool with the standard net/http package.
-//
-// See https://github.com/jteeuwen/go-bindata for more information
-// about embedding binary data with go-bindata.
-//
-// Usage example, after running
-// $ go-bindata data/...
-// use:
-// http.Handle("/",
-// http.FileServer(
-// &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "data"}))
-package assetfs
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/.gitignore b/archived/event-adapter/vendor/github.com/emicklei/go-restful/.gitignore
deleted file mode 100644
index cece7be66..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/.gitignore
+++ /dev/null
@@ -1,70 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-
-restful.html
-
-*.out
-
-tmp.prof
-
-go-restful.test
-
-examples/restful-basic-authentication
-
-examples/restful-encoding-filter
-
-examples/restful-filters
-
-examples/restful-hello-world
-
-examples/restful-resource-functions
-
-examples/restful-serve-static
-
-examples/restful-user-service
-
-*.DS_Store
-examples/restful-user-resource
-
-examples/restful-multi-containers
-
-examples/restful-form-handling
-
-examples/restful-CORS-filter
-
-examples/restful-options-filter
-
-examples/restful-curly-router
-
-examples/restful-cpuprofiler-service
-
-examples/restful-pre-post-filters
-
-curly.prof
-
-examples/restful-NCSA-logging
-
-examples/restful-html-template
-
-s.html
-restful-path-tail
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/CHANGES.md b/archived/event-adapter/vendor/github.com/emicklei/go-restful/CHANGES.md
deleted file mode 100644
index 133da800a..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/CHANGES.md
+++ /dev/null
@@ -1,171 +0,0 @@
-Change history of go-restful
-=
-2016-11-26
-- Default change! now use CurlyRouter (was RouterJSR311)
-- Default change! no more caching of request content
-- Default change! do not recover from panics
-
-2016-09-22
-- fix the DefaultRequestContentType feature
-
-2016-02-14
-- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response
-- add constructors for custom entity accessors for xml and json
-
-2015-09-27
-- rename new WriteStatusAnd... to WriteHeaderAnd... for consistency
-
-2015-09-25
-- fixed problem with changing Header after WriteHeader (issue 235)
-
-2015-09-14
-- changed behavior of WriteHeader (immediate write) and WriteEntity (no status write)
-- added support for custom EntityReaderWriters.
-
-2015-08-06
-- add support for reading entities from compressed request content
-- use sync.Pool for compressors of http response and request body
-- add Description to Parameter for documentation in Swagger UI
-
-2015-03-20
-- add configurable logging
-
-2015-03-18
-- if not specified, the Operation is derived from the Route function
-
-2015-03-17
-- expose Parameter creation functions
-- make trace logger an interface
-- fix OPTIONSFilter
-- customize rendering of ServiceError
-- JSR311 router now handles wildcards
-- add Notes to Route
-
-2014-11-27
-- (api add) PrettyPrint per response. (as proposed in #167)
-
-2014-11-12
-- (api add) ApiVersion(.) for documentation in Swagger UI
-
-2014-11-10
-- (api change) struct fields tagged with "description" show up in Swagger UI
-
-2014-10-31
-- (api change) ReturnsError -> Returns
-- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder
-- fix swagger nested structs
-- sort Swagger response messages by code
-
-2014-10-23
-- (api add) ReturnsError allows you to document Http codes in swagger
-- fixed problem with greedy CurlyRouter
-- (api add) Access-Control-Max-Age in CORS
-- add tracing functionality (injectable) for debugging purposes
-- support JSON parse 64bit int
-- fix empty parameters for swagger
-- WebServicesUrl is now optional for swagger
-- fixed duplicate AccessControlAllowOrigin in CORS
-- (api change) expose ServeMux in container
-- (api add) added AllowedDomains in CORS
-- (api add) ParameterNamed for detailed documentation
-
-2014-04-16
-- (api add) expose constructor of Request for testing.
-
-2014-06-27
-- (api add) ParameterNamed gives access to a Parameter definition and its data (for further specification).
-- (api add) SetCacheReadEntity allow scontrol over whether or not the request body is being cached (default true for compatibility reasons).
-
-2014-07-03
-- (api add) CORS can be configured with a list of allowed domains
-
-2014-03-12
-- (api add) Route path parameters can use wildcard or regular expressions. (requires CurlyRouter)
-
-2014-02-26
-- (api add) Request now provides information about the matched Route, see method SelectedRoutePath
-
-2014-02-17
-- (api change) renamed parameter constants (go-lint checks)
-
-2014-01-10
- - (api add) support for CloseNotify, see http://golang.org/pkg/net/http/#CloseNotifier
-
-2014-01-07
- - (api change) Write* methods in Response now return the error or nil.
- - added example of serving HTML from a Go template.
- - fixed comparing Allowed headers in CORS (is now case-insensitive)
-
-2013-11-13
- - (api add) Response knows how many bytes are written to the response body.
-
-2013-10-29
- - (api add) RecoverHandler(handler RecoverHandleFunction) to change how panic recovery is handled. Default behavior is to log and return a stacktrace. This may be a security issue as it exposes sourcecode information.
-
-2013-10-04
- - (api add) Response knows what HTTP status has been written
- - (api add) Request can have attributes (map of string->interface, also called request-scoped variables
-
-2013-09-12
- - (api change) Router interface simplified
- - Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths
-
-2013-08-05
- - add OPTIONS support
- - add CORS support
-
-2013-08-27
- - fixed some reported issues (see github)
- - (api change) deprecated use of WriteError; use WriteErrorString instead
-
-2014-04-15
- - (fix) v1.0.1 tag: fix Issue 111: WriteErrorString
-
-2013-08-08
- - (api add) Added implementation Container: a WebServices collection with its own http.ServeMux allowing multiple endpoints per program. Existing uses of go-restful will register their services to the DefaultContainer.
- - (api add) the swagger package has be extended to have a UI per container.
- - if panic is detected then a small stack trace is printed (thanks to runner-mei)
- - (api add) WriteErrorString to Response
-
-Important API changes:
-
- - (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead.
- - (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead.
-
-
-2013-07-06
-
- - (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature.
-
-2013-06-19
-
- - (improve) DoNotRecover option, moved request body closer, improved ReadEntity
-
-2013-06-03
-
- - (api change) removed Dispatcher interface, hide PathExpression
- - changed receiver names of type functions to be more idiomatic Go
-
-2013-06-02
-
- - (optimize) Cache the RegExp compilation of Paths.
-
-2013-05-22
-
- - (api add) Added support for request/response filter functions
-
-2013-05-18
-
-
- - (api add) Added feature to change the default Http Request Dispatch function (travis cline)
- - (api change) Moved Swagger Webservice to swagger package (see example restful-user)
-
-[2012-11-14 .. 2013-05-18>
-
- - See https://github.com/emicklei/go-restful/commits
-
-2012-11-14
-
- - Initial commit
-
-
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/LICENSE b/archived/event-adapter/vendor/github.com/emicklei/go-restful/LICENSE
deleted file mode 100644
index ece7ec61e..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012,2013 Ernest Micklei
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/README.md b/archived/event-adapter/vendor/github.com/emicklei/go-restful/README.md
deleted file mode 100644
index cfe6d0a91..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/README.md
+++ /dev/null
@@ -1,74 +0,0 @@
-go-restful
-==========
-
-package for building REST-style Web Services using Google Go
-
-REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping:
-
-- GET = Retrieve a representation of a resource
-- POST = Create if you are sending content to the server to create a subordinate of the specified resource collection, using some server-side algorithm.
-- PUT = Create if you are sending the full content of the specified resource (URI).
-- PUT = Update if you are updating the full content of the specified resource.
-- DELETE = Delete if you are requesting the server to delete the resource
-- PATCH = Update partial content of a resource
-- OPTIONS = Get information about the communication options for the request URI
-
-### Example
-
-```Go
-ws := new(restful.WebService)
-ws.
- Path("/users").
- Consumes(restful.MIME_XML, restful.MIME_JSON).
- Produces(restful.MIME_JSON, restful.MIME_XML)
-
-ws.Route(ws.GET("/{user-id}").To(u.findUser).
- Doc("get a user").
- Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")).
- Writes(User{}))
-...
-
-func (u UserResource) findUser(request *restful.Request, response *restful.Response) {
- id := request.PathParameter("user-id")
- ...
-}
-```
-
-[Full API of a UserResource](https://github.com/emicklei/go-restful/tree/master/examples/restful-user-resource.go)
-
-### Features
-
-- Routes for request → function mapping with path parameter (e.g. {id}) support
-- Configurable router:
- - Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions (See RouterJSR311 which is used by default)
- - Fast routing algorithm that allows static elements, regular expressions and dynamic parameters in the URL path (e.g. /meetings/{id} or /static/{subpath:*}, See CurlyRouter)
-- Request API for reading structs from JSON/XML and accesing parameters (path,query,header)
-- Response API for writing structs to JSON/XML and setting headers
-- Filters for intercepting the request → response flow on Service or Route level
-- Request-scoped variables using attributes
-- Containers for WebServices on different HTTP endpoints
-- Content encoding (gzip,deflate) of request and response payloads
-- Automatic responses on OPTIONS (using a filter)
-- Automatic CORS request handling (using a filter)
-- API declaration for Swagger UI (see swagger package)
-- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...)
-- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...)
-- Configurable (trace) logging
-- Customizable encoding using EntityReaderWriter registration
-- Customizable gzip/deflate readers and writers using CompressorProvider registration
-
-### Resources
-
-- [Documentation on godoc.org](http://godoc.org/github.com/emicklei/go-restful)
-- [Code examples](https://github.com/emicklei/go-restful/tree/master/examples)
-- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/)
-- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/)
-- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful)
-- [gopkg.in](https://gopkg.in/emicklei/go-restful.v1)
-- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora)
-
-[![Build Status](https://drone.io/github.com/emicklei/go-restful/status.png)](https://drone.io/github.com/emicklei/go-restful/latest)
-
-(c) 2012 - 2015, http://ernestmicklei.com. MIT License
-
-Type ```git shortlog -s``` for a full list of contributors.
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/Srcfile b/archived/event-adapter/vendor/github.com/emicklei/go-restful/Srcfile
deleted file mode 100644
index 16fd18689..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/Srcfile
+++ /dev/null
@@ -1 +0,0 @@
-{"SkipDirs": ["examples"]}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/bench_test.sh b/archived/event-adapter/vendor/github.com/emicklei/go-restful/bench_test.sh
deleted file mode 100644
index 47ffbe4ac..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/bench_test.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#go test -run=none -file bench_test.go -test.bench . -cpuprofile=bench_test.out
-
-go test -c
-./go-restful.test -test.run=none -test.cpuprofile=tmp.prof -test.bench=BenchmarkMany
-./go-restful.test -test.run=none -test.cpuprofile=curly.prof -test.bench=BenchmarkManyCurly
-
-#go tool pprof go-restful.test tmp.prof
-go tool pprof go-restful.test curly.prof
-
-
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compress.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/compress.go
deleted file mode 100644
index 220b37712..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compress.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bufio"
- "compress/gzip"
- "compress/zlib"
- "errors"
- "io"
- "net"
- "net/http"
- "strings"
-)
-
-// OBSOLETE : use restful.DefaultContainer.EnableContentEncoding(true) to change this setting.
-var EnableContentEncoding = false
-
-// CompressingResponseWriter is a http.ResponseWriter that can perform content encoding (gzip and zlib)
-type CompressingResponseWriter struct {
- writer http.ResponseWriter
- compressor io.WriteCloser
- encoding string
-}
-
-// Header is part of http.ResponseWriter interface
-func (c *CompressingResponseWriter) Header() http.Header {
- return c.writer.Header()
-}
-
-// WriteHeader is part of http.ResponseWriter interface
-func (c *CompressingResponseWriter) WriteHeader(status int) {
- c.writer.WriteHeader(status)
-}
-
-// Write is part of http.ResponseWriter interface
-// It is passed through the compressor
-func (c *CompressingResponseWriter) Write(bytes []byte) (int, error) {
- if c.isCompressorClosed() {
- return -1, errors.New("Compressing error: tried to write data using closed compressor")
- }
- return c.compressor.Write(bytes)
-}
-
-// CloseNotify is part of http.CloseNotifier interface
-func (c *CompressingResponseWriter) CloseNotify() <-chan bool {
- return c.writer.(http.CloseNotifier).CloseNotify()
-}
-
-// Close the underlying compressor
-func (c *CompressingResponseWriter) Close() error {
- if c.isCompressorClosed() {
- return errors.New("Compressing error: tried to close already closed compressor")
- }
-
- c.compressor.Close()
- if ENCODING_GZIP == c.encoding {
- currentCompressorProvider.ReleaseGzipWriter(c.compressor.(*gzip.Writer))
- }
- if ENCODING_DEFLATE == c.encoding {
- currentCompressorProvider.ReleaseZlibWriter(c.compressor.(*zlib.Writer))
- }
- // gc hint needed?
- c.compressor = nil
- return nil
-}
-
-func (c *CompressingResponseWriter) isCompressorClosed() bool {
- return nil == c.compressor
-}
-
-// Hijack implements the Hijacker interface
-// This is especially useful when combining Container.EnabledContentEncoding
-// in combination with websockets (for instance gorilla/websocket)
-func (c *CompressingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- hijacker, ok := c.writer.(http.Hijacker)
- if !ok {
- return nil, nil, errors.New("ResponseWriter doesn't support Hijacker interface")
- }
- return hijacker.Hijack()
-}
-
-// WantsCompressedResponse reads the Accept-Encoding header to see if and which encoding is requested.
-func wantsCompressedResponse(httpRequest *http.Request) (bool, string) {
- header := httpRequest.Header.Get(HEADER_AcceptEncoding)
- gi := strings.Index(header, ENCODING_GZIP)
- zi := strings.Index(header, ENCODING_DEFLATE)
- // use in order of appearance
- if gi == -1 {
- return zi != -1, ENCODING_DEFLATE
- } else if zi == -1 {
- return gi != -1, ENCODING_GZIP
- } else {
- if gi < zi {
- return true, ENCODING_GZIP
- }
- return true, ENCODING_DEFLATE
- }
-}
-
-// NewCompressingResponseWriter create a CompressingResponseWriter for a known encoding = {gzip,deflate}
-func NewCompressingResponseWriter(httpWriter http.ResponseWriter, encoding string) (*CompressingResponseWriter, error) {
- httpWriter.Header().Set(HEADER_ContentEncoding, encoding)
- c := new(CompressingResponseWriter)
- c.writer = httpWriter
- var err error
- if ENCODING_GZIP == encoding {
- w := currentCompressorProvider.AcquireGzipWriter()
- w.Reset(httpWriter)
- c.compressor = w
- c.encoding = ENCODING_GZIP
- } else if ENCODING_DEFLATE == encoding {
- w := currentCompressorProvider.AcquireZlibWriter()
- w.Reset(httpWriter)
- c.compressor = w
- c.encoding = ENCODING_DEFLATE
- } else {
- return nil, errors.New("Unknown encoding:" + encoding)
- }
- return c, err
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_cache.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_cache.go
deleted file mode 100644
index ee426010a..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_cache.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package restful
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "compress/gzip"
- "compress/zlib"
-)
-
-// BoundedCachedCompressors is a CompressorProvider that uses a cache with a fixed amount
-// of writers and readers (resources).
-// If a new resource is acquired and all are in use, it will return a new unmanaged resource.
-type BoundedCachedCompressors struct {
- gzipWriters chan *gzip.Writer
- gzipReaders chan *gzip.Reader
- zlibWriters chan *zlib.Writer
- writersCapacity int
- readersCapacity int
-}
-
-// NewBoundedCachedCompressors returns a new, with filled cache, BoundedCachedCompressors.
-func NewBoundedCachedCompressors(writersCapacity, readersCapacity int) *BoundedCachedCompressors {
- b := &BoundedCachedCompressors{
- gzipWriters: make(chan *gzip.Writer, writersCapacity),
- gzipReaders: make(chan *gzip.Reader, readersCapacity),
- zlibWriters: make(chan *zlib.Writer, writersCapacity),
- writersCapacity: writersCapacity,
- readersCapacity: readersCapacity,
- }
- for ix := 0; ix < writersCapacity; ix++ {
- b.gzipWriters <- newGzipWriter()
- b.zlibWriters <- newZlibWriter()
- }
- for ix := 0; ix < readersCapacity; ix++ {
- b.gzipReaders <- newGzipReader()
- }
- return b
-}
-
-// AcquireGzipWriter returns an resettable *gzip.Writer. Needs to be released.
-func (b *BoundedCachedCompressors) AcquireGzipWriter() *gzip.Writer {
- var writer *gzip.Writer
- select {
- case writer, _ = <-b.gzipWriters:
- default:
- // return a new unmanaged one
- writer = newGzipWriter()
- }
- return writer
-}
-
-// ReleaseGzipWriter accepts a writer (does not have to be one that was cached)
-// only when the cache has room for it. It will ignore it otherwise.
-func (b *BoundedCachedCompressors) ReleaseGzipWriter(w *gzip.Writer) {
- // forget the unmanaged ones
- if len(b.gzipWriters) < b.writersCapacity {
- b.gzipWriters <- w
- }
-}
-
-// AcquireGzipReader returns a *gzip.Reader. Needs to be released.
-func (b *BoundedCachedCompressors) AcquireGzipReader() *gzip.Reader {
- var reader *gzip.Reader
- select {
- case reader, _ = <-b.gzipReaders:
- default:
- // return a new unmanaged one
- reader = newGzipReader()
- }
- return reader
-}
-
-// ReleaseGzipReader accepts a reader (does not have to be one that was cached)
-// only when the cache has room for it. It will ignore it otherwise.
-func (b *BoundedCachedCompressors) ReleaseGzipReader(r *gzip.Reader) {
- // forget the unmanaged ones
- if len(b.gzipReaders) < b.readersCapacity {
- b.gzipReaders <- r
- }
-}
-
-// AcquireZlibWriter returns an resettable *zlib.Writer. Needs to be released.
-func (b *BoundedCachedCompressors) AcquireZlibWriter() *zlib.Writer {
- var writer *zlib.Writer
- select {
- case writer, _ = <-b.zlibWriters:
- default:
- // return a new unmanaged one
- writer = newZlibWriter()
- }
- return writer
-}
-
-// ReleaseZlibWriter accepts a writer (does not have to be one that was cached)
-// only when the cache has room for it. It will ignore it otherwise.
-func (b *BoundedCachedCompressors) ReleaseZlibWriter(w *zlib.Writer) {
- // forget the unmanaged ones
- if len(b.zlibWriters) < b.writersCapacity {
- b.zlibWriters <- w
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_pools.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_pools.go
deleted file mode 100644
index d866ce64b..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressor_pools.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package restful
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "compress/gzip"
- "compress/zlib"
- "sync"
-)
-
-// SyncPoolCompessors is a CompressorProvider that use the standard sync.Pool.
-type SyncPoolCompessors struct {
- GzipWriterPool *sync.Pool
- GzipReaderPool *sync.Pool
- ZlibWriterPool *sync.Pool
-}
-
-// NewSyncPoolCompessors returns a new ("empty") SyncPoolCompessors.
-func NewSyncPoolCompessors() *SyncPoolCompessors {
- return &SyncPoolCompessors{
- GzipWriterPool: &sync.Pool{
- New: func() interface{} { return newGzipWriter() },
- },
- GzipReaderPool: &sync.Pool{
- New: func() interface{} { return newGzipReader() },
- },
- ZlibWriterPool: &sync.Pool{
- New: func() interface{} { return newZlibWriter() },
- },
- }
-}
-
-func (s *SyncPoolCompessors) AcquireGzipWriter() *gzip.Writer {
- return s.GzipWriterPool.Get().(*gzip.Writer)
-}
-
-func (s *SyncPoolCompessors) ReleaseGzipWriter(w *gzip.Writer) {
- s.GzipWriterPool.Put(w)
-}
-
-func (s *SyncPoolCompessors) AcquireGzipReader() *gzip.Reader {
- return s.GzipReaderPool.Get().(*gzip.Reader)
-}
-
-func (s *SyncPoolCompessors) ReleaseGzipReader(r *gzip.Reader) {
- s.GzipReaderPool.Put(r)
-}
-
-func (s *SyncPoolCompessors) AcquireZlibWriter() *zlib.Writer {
- return s.ZlibWriterPool.Get().(*zlib.Writer)
-}
-
-func (s *SyncPoolCompessors) ReleaseZlibWriter(w *zlib.Writer) {
- s.ZlibWriterPool.Put(w)
-}
-
-func newGzipWriter() *gzip.Writer {
- // create with an empty bytes writer; it will be replaced before using the gzipWriter
- writer, err := gzip.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed)
- if err != nil {
- panic(err.Error())
- }
- return writer
-}
-
-func newGzipReader() *gzip.Reader {
- // create with an empty reader (but with GZIP header); it will be replaced before using the gzipReader
- // we can safely use currentCompressProvider because it is set on package initialization.
- w := currentCompressorProvider.AcquireGzipWriter()
- defer currentCompressorProvider.ReleaseGzipWriter(w)
- b := new(bytes.Buffer)
- w.Reset(b)
- w.Flush()
- w.Close()
- reader, err := gzip.NewReader(bytes.NewReader(b.Bytes()))
- if err != nil {
- panic(err.Error())
- }
- return reader
-}
-
-func newZlibWriter() *zlib.Writer {
- writer, err := zlib.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed)
- if err != nil {
- panic(err.Error())
- }
- return writer
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressors.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressors.go
deleted file mode 100644
index f028456e0..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/compressors.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package restful
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "compress/gzip"
- "compress/zlib"
-)
-
-type CompressorProvider interface {
- // Returns a *gzip.Writer which needs to be released later.
- // Before using it, call Reset().
- AcquireGzipWriter() *gzip.Writer
-
- // Releases an aqcuired *gzip.Writer.
- ReleaseGzipWriter(w *gzip.Writer)
-
- // Returns a *gzip.Reader which needs to be released later.
- AcquireGzipReader() *gzip.Reader
-
- // Releases an aqcuired *gzip.Reader.
- ReleaseGzipReader(w *gzip.Reader)
-
- // Returns a *zlib.Writer which needs to be released later.
- // Before using it, call Reset().
- AcquireZlibWriter() *zlib.Writer
-
- // Releases an aqcuired *zlib.Writer.
- ReleaseZlibWriter(w *zlib.Writer)
-}
-
-// DefaultCompressorProvider is the actual provider of compressors (zlib or gzip).
-var currentCompressorProvider CompressorProvider
-
-func init() {
- currentCompressorProvider = NewSyncPoolCompessors()
-}
-
-// CurrentCompressorProvider returns the current CompressorProvider.
-// It is initialized using a SyncPoolCompessors.
-func CurrentCompressorProvider() CompressorProvider {
- return currentCompressorProvider
-}
-
-// CompressorProvider sets the actual provider of compressors (zlib or gzip).
-func SetCompressorProvider(p CompressorProvider) {
- if p == nil {
- panic("cannot set compressor provider to nil")
- }
- currentCompressorProvider = p
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/constants.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/constants.go
deleted file mode 100644
index 203439c5e..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/constants.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-const (
- MIME_XML = "application/xml" // Accept or Content-Type used in Consumes() and/or Produces()
- MIME_JSON = "application/json" // Accept or Content-Type used in Consumes() and/or Produces()
- MIME_OCTET = "application/octet-stream" // If Content-Type is not present in request, use the default
-
- HEADER_Allow = "Allow"
- HEADER_Accept = "Accept"
- HEADER_Origin = "Origin"
- HEADER_ContentType = "Content-Type"
- HEADER_LastModified = "Last-Modified"
- HEADER_AcceptEncoding = "Accept-Encoding"
- HEADER_ContentEncoding = "Content-Encoding"
- HEADER_AccessControlExposeHeaders = "Access-Control-Expose-Headers"
- HEADER_AccessControlRequestMethod = "Access-Control-Request-Method"
- HEADER_AccessControlRequestHeaders = "Access-Control-Request-Headers"
- HEADER_AccessControlAllowMethods = "Access-Control-Allow-Methods"
- HEADER_AccessControlAllowOrigin = "Access-Control-Allow-Origin"
- HEADER_AccessControlAllowCredentials = "Access-Control-Allow-Credentials"
- HEADER_AccessControlAllowHeaders = "Access-Control-Allow-Headers"
- HEADER_AccessControlMaxAge = "Access-Control-Max-Age"
-
- ENCODING_GZIP = "gzip"
- ENCODING_DEFLATE = "deflate"
-)
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/container.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/container.go
deleted file mode 100644
index 79eb3c4cf..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/container.go
+++ /dev/null
@@ -1,361 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "errors"
- "fmt"
- "net/http"
- "os"
- "runtime"
- "strings"
- "sync"
-
- "github.com/emicklei/go-restful/log"
-)
-
-// Container holds a collection of WebServices and a http.ServeMux to dispatch http requests.
-// The requests are further dispatched to routes of WebServices using a RouteSelector
-type Container struct {
- webServicesLock sync.RWMutex
- webServices []*WebService
- ServeMux *http.ServeMux
- isRegisteredOnRoot bool
- containerFilters []FilterFunction
- doNotRecover bool // default is true
- recoverHandleFunc RecoverHandleFunction
- serviceErrorHandleFunc ServiceErrorHandleFunction
- router RouteSelector // default is a CurlyRouter (RouterJSR311 is a slower alternative)
- contentEncodingEnabled bool // default is false
-}
-
-// NewContainer creates a new Container using a new ServeMux and default router (RouterJSR311)
-func NewContainer() *Container {
- return &Container{
- webServices: []*WebService{},
- ServeMux: http.NewServeMux(),
- isRegisteredOnRoot: false,
- containerFilters: []FilterFunction{},
- doNotRecover: true,
- recoverHandleFunc: logStackOnRecover,
- serviceErrorHandleFunc: writeServiceError,
- router: CurlyRouter{},
- contentEncodingEnabled: false}
-}
-
-// RecoverHandleFunction declares functions that can be used to handle a panic situation.
-// The first argument is what recover() returns. The second must be used to communicate an error response.
-type RecoverHandleFunction func(interface{}, http.ResponseWriter)
-
-// RecoverHandler changes the default function (logStackOnRecover) to be called
-// when a panic is detected. DoNotRecover must be have its default value (=false).
-func (c *Container) RecoverHandler(handler RecoverHandleFunction) {
- c.recoverHandleFunc = handler
-}
-
-// ServiceErrorHandleFunction declares functions that can be used to handle a service error situation.
-// The first argument is the service error, the second is the request that resulted in the error and
-// the third must be used to communicate an error response.
-type ServiceErrorHandleFunction func(ServiceError, *Request, *Response)
-
-// ServiceErrorHandler changes the default function (writeServiceError) to be called
-// when a ServiceError is detected.
-func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) {
- c.serviceErrorHandleFunc = handler
-}
-
-// DoNotRecover controls whether panics will be caught to return HTTP 500.
-// If set to true, Route functions are responsible for handling any error situation.
-// Default value is true.
-func (c *Container) DoNotRecover(doNot bool) {
- c.doNotRecover = doNot
-}
-
-// Router changes the default Router (currently RouterJSR311)
-func (c *Container) Router(aRouter RouteSelector) {
- c.router = aRouter
-}
-
-// EnableContentEncoding (default=false) allows for GZIP or DEFLATE encoding of responses.
-func (c *Container) EnableContentEncoding(enabled bool) {
- c.contentEncodingEnabled = enabled
-}
-
-// Add a WebService to the Container. It will detect duplicate root paths and exit in that case.
-func (c *Container) Add(service *WebService) *Container {
- c.webServicesLock.Lock()
- defer c.webServicesLock.Unlock()
-
- // if rootPath was not set then lazy initialize it
- if len(service.rootPath) == 0 {
- service.Path("/")
- }
-
- // cannot have duplicate root paths
- for _, each := range c.webServices {
- if each.RootPath() == service.RootPath() {
- log.Printf("[restful] WebService with duplicate root path detected:['%v']", each)
- os.Exit(1)
- }
- }
-
- // If not registered on root then add specific mapping
- if !c.isRegisteredOnRoot {
- c.isRegisteredOnRoot = c.addHandler(service, c.ServeMux)
- }
- c.webServices = append(c.webServices, service)
- return c
-}
-
-// addHandler may set a new HandleFunc for the serveMux
-// this function must run inside the critical region protected by the webServicesLock.
-// returns true if the function was registered on root ("/")
-func (c *Container) addHandler(service *WebService, serveMux *http.ServeMux) bool {
- pattern := fixedPrefixPath(service.RootPath())
- // check if root path registration is needed
- if "/" == pattern || "" == pattern {
- serveMux.HandleFunc("/", c.dispatch)
- return true
- }
- // detect if registration already exists
- alreadyMapped := false
- for _, each := range c.webServices {
- if each.RootPath() == service.RootPath() {
- alreadyMapped = true
- break
- }
- }
- if !alreadyMapped {
- serveMux.HandleFunc(pattern, c.dispatch)
- if !strings.HasSuffix(pattern, "/") {
- serveMux.HandleFunc(pattern+"/", c.dispatch)
- }
- }
- return false
-}
-
-func (c *Container) Remove(ws *WebService) error {
- if c.ServeMux == http.DefaultServeMux {
- errMsg := fmt.Sprintf("[restful] cannot remove a WebService from a Container using the DefaultServeMux: ['%v']", ws)
- log.Printf(errMsg)
- return errors.New(errMsg)
- }
- c.webServicesLock.Lock()
- defer c.webServicesLock.Unlock()
- // build a new ServeMux and re-register all WebServices
- newServeMux := http.NewServeMux()
- newServices := []*WebService{}
- newIsRegisteredOnRoot := false
- for _, each := range c.webServices {
- if each.rootPath != ws.rootPath {
- // If not registered on root then add specific mapping
- if !newIsRegisteredOnRoot {
- newIsRegisteredOnRoot = c.addHandler(each, newServeMux)
- }
- newServices = append(newServices, each)
- }
- }
- c.webServices, c.ServeMux, c.isRegisteredOnRoot = newServices, newServeMux, newIsRegisteredOnRoot
- return nil
-}
-
-// logStackOnRecover is the default RecoverHandleFunction and is called
-// when DoNotRecover is false and the recoverHandleFunc is not set for the container.
-// Default implementation logs the stacktrace and writes the stacktrace on the response.
-// This may be a security issue as it exposes sourcecode information.
-func logStackOnRecover(panicReason interface{}, httpWriter http.ResponseWriter) {
- var buffer bytes.Buffer
- buffer.WriteString(fmt.Sprintf("[restful] recover from panic situation: - %v\r\n", panicReason))
- for i := 2; ; i += 1 {
- _, file, line, ok := runtime.Caller(i)
- if !ok {
- break
- }
- buffer.WriteString(fmt.Sprintf(" %s:%d\r\n", file, line))
- }
- log.Print(buffer.String())
- httpWriter.WriteHeader(http.StatusInternalServerError)
- httpWriter.Write(buffer.Bytes())
-}
-
-// writeServiceError is the default ServiceErrorHandleFunction and is called
-// when a ServiceError is returned during route selection. Default implementation
-// calls resp.WriteErrorString(err.Code, err.Message)
-func writeServiceError(err ServiceError, req *Request, resp *Response) {
- resp.WriteErrorString(err.Code, err.Message)
-}
-
-// Dispatch the incoming Http Request to a matching WebService.
-func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) {
- writer := httpWriter
-
- // CompressingResponseWriter should be closed after all operations are done
- defer func() {
- if compressWriter, ok := writer.(*CompressingResponseWriter); ok {
- compressWriter.Close()
- }
- }()
-
- // Instal panic recovery unless told otherwise
- if !c.doNotRecover { // catch all for 500 response
- defer func() {
- if r := recover(); r != nil {
- c.recoverHandleFunc(r, writer)
- return
- }
- }()
- }
- // Install closing the request body (if any)
- defer func() {
- if nil != httpRequest.Body {
- httpRequest.Body.Close()
- }
- }()
-
- // Detect if compression is needed
- // assume without compression, test for override
- if c.contentEncodingEnabled {
- doCompress, encoding := wantsCompressedResponse(httpRequest)
- if doCompress {
- var err error
- writer, err = NewCompressingResponseWriter(httpWriter, encoding)
- if err != nil {
- log.Print("[restful] unable to install compressor: ", err)
- httpWriter.WriteHeader(http.StatusInternalServerError)
- return
- }
- }
- }
- // Find best match Route ; err is non nil if no match was found
- var webService *WebService
- var route *Route
- var err error
- func() {
- c.webServicesLock.RLock()
- defer c.webServicesLock.RUnlock()
- webService, route, err = c.router.SelectRoute(
- c.webServices,
- httpRequest)
- }()
- if err != nil {
- // a non-200 response has already been written
- // run container filters anyway ; they should not touch the response...
- chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) {
- switch err.(type) {
- case ServiceError:
- ser := err.(ServiceError)
- c.serviceErrorHandleFunc(ser, req, resp)
- }
- // TODO
- }}
- chain.ProcessFilter(NewRequest(httpRequest), NewResponse(writer))
- return
- }
- wrappedRequest, wrappedResponse := route.wrapRequestResponse(writer, httpRequest)
- // pass through filters (if any)
- if len(c.containerFilters)+len(webService.filters)+len(route.Filters) > 0 {
- // compose filter chain
- allFilters := []FilterFunction{}
- allFilters = append(allFilters, c.containerFilters...)
- allFilters = append(allFilters, webService.filters...)
- allFilters = append(allFilters, route.Filters...)
- chain := FilterChain{Filters: allFilters, Target: func(req *Request, resp *Response) {
- // handle request by route after passing all filters
- route.Function(wrappedRequest, wrappedResponse)
- }}
- chain.ProcessFilter(wrappedRequest, wrappedResponse)
- } else {
- // no filters, handle request by route
- route.Function(wrappedRequest, wrappedResponse)
- }
-}
-
-// fixedPrefixPath returns the fixed part of the partspec ; it may include template vars {}
-func fixedPrefixPath(pathspec string) string {
- varBegin := strings.Index(pathspec, "{")
- if -1 == varBegin {
- return pathspec
- }
- return pathspec[:varBegin]
-}
-
-// ServeHTTP implements net/http.Handler therefore a Container can be a Handler in a http.Server
-func (c *Container) ServeHTTP(httpwriter http.ResponseWriter, httpRequest *http.Request) {
- c.ServeMux.ServeHTTP(httpwriter, httpRequest)
-}
-
-// Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.
-func (c *Container) Handle(pattern string, handler http.Handler) {
- c.ServeMux.Handle(pattern, handler)
-}
-
-// HandleWithFilter registers the handler for the given pattern.
-// Container's filter chain is applied for handler.
-// If a handler already exists for pattern, HandleWithFilter panics.
-func (c *Container) HandleWithFilter(pattern string, handler http.Handler) {
- f := func(httpResponse http.ResponseWriter, httpRequest *http.Request) {
- if len(c.containerFilters) == 0 {
- handler.ServeHTTP(httpResponse, httpRequest)
- return
- }
-
- chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) {
- handler.ServeHTTP(httpResponse, httpRequest)
- }}
- chain.ProcessFilter(NewRequest(httpRequest), NewResponse(httpResponse))
- }
-
- c.Handle(pattern, http.HandlerFunc(f))
-}
-
-// Filter appends a container FilterFunction. These are called before dispatching
-// a http.Request to a WebService from the container
-func (c *Container) Filter(filter FilterFunction) {
- c.containerFilters = append(c.containerFilters, filter)
-}
-
-// RegisteredWebServices returns the collections of added WebServices
-func (c *Container) RegisteredWebServices() []*WebService {
- c.webServicesLock.RLock()
- defer c.webServicesLock.RUnlock()
- result := make([]*WebService, len(c.webServices))
- for ix := range c.webServices {
- result[ix] = c.webServices[ix]
- }
- return result
-}
-
-// computeAllowedMethods returns a list of HTTP methods that are valid for a Request
-func (c *Container) computeAllowedMethods(req *Request) []string {
- // Go through all RegisteredWebServices() and all its Routes to collect the options
- methods := []string{}
- requestPath := req.Request.URL.Path
- for _, ws := range c.RegisteredWebServices() {
- matches := ws.pathExpr.Matcher.FindStringSubmatch(requestPath)
- if matches != nil {
- finalMatch := matches[len(matches)-1]
- for _, rt := range ws.Routes() {
- matches := rt.pathExpr.Matcher.FindStringSubmatch(finalMatch)
- if matches != nil {
- lastMatch := matches[len(matches)-1]
- if lastMatch == "" || lastMatch == "/" { // do not include if value is neither empty nor ‘/’.
- methods = append(methods, rt.Method)
- }
- }
- }
- }
- }
- // methods = append(methods, "OPTIONS") not sure about this
- return methods
-}
-
-// newBasicRequestResponse creates a pair of Request,Response from its http versions.
-// It is basic because no parameter or (produces) content-type information is given.
-func newBasicRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request) (*Request, *Response) {
- resp := NewResponse(httpWriter)
- resp.requestAccept = httpRequest.Header.Get(HEADER_Accept)
- return NewRequest(httpRequest), resp
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/cors_filter.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/cors_filter.go
deleted file mode 100644
index 1efeef072..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/cors_filter.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "regexp"
- "strconv"
- "strings"
-)
-
-// CrossOriginResourceSharing is used to create a Container Filter that implements CORS.
-// Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page
-// to make XMLHttpRequests to another domain, not the domain the JavaScript originated from.
-//
-// http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
-// http://enable-cors.org/server.html
-// http://www.html5rocks.com/en/tutorials/cors/#toc-handling-a-not-so-simple-request
-type CrossOriginResourceSharing struct {
- ExposeHeaders []string // list of Header names
- AllowedHeaders []string // list of Header names
- AllowedDomains []string // list of allowed values for Http Origin. An allowed value can be a regular expression to support subdomain matching. If empty all are allowed.
- AllowedMethods []string
- MaxAge int // number of seconds before requiring new Options request
- CookiesAllowed bool
- Container *Container
-
- allowedOriginPatterns []*regexp.Regexp // internal field for origin regexp check.
-}
-
-// Filter is a filter function that implements the CORS flow as documented on http://enable-cors.org/server.html
-// and http://www.html5rocks.com/static/images/cors_server_flowchart.png
-func (c CrossOriginResourceSharing) Filter(req *Request, resp *Response, chain *FilterChain) {
- origin := req.Request.Header.Get(HEADER_Origin)
- if len(origin) == 0 {
- if trace {
- traceLogger.Print("no Http header Origin set")
- }
- chain.ProcessFilter(req, resp)
- return
- }
- if !c.isOriginAllowed(origin) { // check whether this origin is allowed
- if trace {
- traceLogger.Printf("HTTP Origin:%s is not part of %v, neither matches any part of %v", origin, c.AllowedDomains, c.allowedOriginPatterns)
- }
- chain.ProcessFilter(req, resp)
- return
- }
- if req.Request.Method != "OPTIONS" {
- c.doActualRequest(req, resp)
- chain.ProcessFilter(req, resp)
- return
- }
- if acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod); acrm != "" {
- c.doPreflightRequest(req, resp)
- } else {
- c.doActualRequest(req, resp)
- chain.ProcessFilter(req, resp)
- return
- }
-}
-
-func (c CrossOriginResourceSharing) doActualRequest(req *Request, resp *Response) {
- c.setOptionsHeaders(req, resp)
- // continue processing the response
-}
-
-func (c *CrossOriginResourceSharing) doPreflightRequest(req *Request, resp *Response) {
- if len(c.AllowedMethods) == 0 {
- if c.Container == nil {
- c.AllowedMethods = DefaultContainer.computeAllowedMethods(req)
- } else {
- c.AllowedMethods = c.Container.computeAllowedMethods(req)
- }
- }
-
- acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod)
- if !c.isValidAccessControlRequestMethod(acrm, c.AllowedMethods) {
- if trace {
- traceLogger.Printf("Http header %s:%s is not in %v",
- HEADER_AccessControlRequestMethod,
- acrm,
- c.AllowedMethods)
- }
- return
- }
- acrhs := req.Request.Header.Get(HEADER_AccessControlRequestHeaders)
- if len(acrhs) > 0 {
- for _, each := range strings.Split(acrhs, ",") {
- if !c.isValidAccessControlRequestHeader(strings.Trim(each, " ")) {
- if trace {
- traceLogger.Printf("Http header %s:%s is not in %v",
- HEADER_AccessControlRequestHeaders,
- acrhs,
- c.AllowedHeaders)
- }
- return
- }
- }
- }
- resp.AddHeader(HEADER_AccessControlAllowMethods, strings.Join(c.AllowedMethods, ","))
- resp.AddHeader(HEADER_AccessControlAllowHeaders, acrhs)
- c.setOptionsHeaders(req, resp)
-
- // return http 200 response, no body
-}
-
-func (c CrossOriginResourceSharing) setOptionsHeaders(req *Request, resp *Response) {
- c.checkAndSetExposeHeaders(resp)
- c.setAllowOriginHeader(req, resp)
- c.checkAndSetAllowCredentials(resp)
- if c.MaxAge > 0 {
- resp.AddHeader(HEADER_AccessControlMaxAge, strconv.Itoa(c.MaxAge))
- }
-}
-
-func (c CrossOriginResourceSharing) isOriginAllowed(origin string) bool {
- if len(origin) == 0 {
- return false
- }
- if len(c.AllowedDomains) == 0 {
- return true
- }
-
- allowed := false
- for _, domain := range c.AllowedDomains {
- if domain == origin {
- allowed = true
- break
- }
- }
-
- if !allowed {
- if len(c.allowedOriginPatterns) == 0 {
- // compile allowed domains to allowed origin patterns
- allowedOriginRegexps, err := compileRegexps(c.AllowedDomains)
- if err != nil {
- return false
- }
- c.allowedOriginPatterns = allowedOriginRegexps
- }
-
- for _, pattern := range c.allowedOriginPatterns {
- if allowed = pattern.MatchString(origin); allowed {
- break
- }
- }
- }
-
- return allowed
-}
-
-func (c CrossOriginResourceSharing) setAllowOriginHeader(req *Request, resp *Response) {
- origin := req.Request.Header.Get(HEADER_Origin)
- if c.isOriginAllowed(origin) {
- resp.AddHeader(HEADER_AccessControlAllowOrigin, origin)
- }
-}
-
-func (c CrossOriginResourceSharing) checkAndSetExposeHeaders(resp *Response) {
- if len(c.ExposeHeaders) > 0 {
- resp.AddHeader(HEADER_AccessControlExposeHeaders, strings.Join(c.ExposeHeaders, ","))
- }
-}
-
-func (c CrossOriginResourceSharing) checkAndSetAllowCredentials(resp *Response) {
- if c.CookiesAllowed {
- resp.AddHeader(HEADER_AccessControlAllowCredentials, "true")
- }
-}
-
-func (c CrossOriginResourceSharing) isValidAccessControlRequestMethod(method string, allowedMethods []string) bool {
- for _, each := range allowedMethods {
- if each == method {
- return true
- }
- }
- return false
-}
-
-func (c CrossOriginResourceSharing) isValidAccessControlRequestHeader(header string) bool {
- for _, each := range c.AllowedHeaders {
- if strings.ToLower(each) == strings.ToLower(header) {
- return true
- }
- }
- return false
-}
-
-// Take a list of strings and compile them into a list of regular expressions.
-func compileRegexps(regexpStrings []string) ([]*regexp.Regexp, error) {
- regexps := []*regexp.Regexp{}
- for _, regexpStr := range regexpStrings {
- r, err := regexp.Compile(regexpStr)
- if err != nil {
- return regexps, err
- }
- regexps = append(regexps, r)
- }
- return regexps, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/coverage.sh b/archived/event-adapter/vendor/github.com/emicklei/go-restful/coverage.sh
deleted file mode 100644
index e27dbf1a9..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/coverage.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-go test -coverprofile=coverage.out
-go tool cover -html=coverage.out
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly.go
deleted file mode 100644
index 79f1f5aa2..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "net/http"
- "regexp"
- "sort"
- "strings"
-)
-
-// CurlyRouter expects Routes with paths that contain zero or more parameters in curly brackets.
-type CurlyRouter struct{}
-
-// SelectRoute is part of the Router interface and returns the best match
-// for the WebService and its Route for the given Request.
-func (c CurlyRouter) SelectRoute(
- webServices []*WebService,
- httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) {
-
- requestTokens := tokenizePath(httpRequest.URL.Path)
-
- detectedService := c.detectWebService(requestTokens, webServices)
- if detectedService == nil {
- if trace {
- traceLogger.Printf("no WebService was found to match URL path:%s\n", httpRequest.URL.Path)
- }
- return nil, nil, NewError(http.StatusNotFound, "404: Page Not Found")
- }
- candidateRoutes := c.selectRoutes(detectedService, requestTokens)
- if len(candidateRoutes) == 0 {
- if trace {
- traceLogger.Printf("no Route in WebService with path %s was found to match URL path:%s\n", detectedService.rootPath, httpRequest.URL.Path)
- }
- return detectedService, nil, NewError(http.StatusNotFound, "404: Page Not Found")
- }
- selectedRoute, err := c.detectRoute(candidateRoutes, httpRequest)
- if selectedRoute == nil {
- return detectedService, nil, err
- }
- return detectedService, selectedRoute, nil
-}
-
-// selectRoutes return a collection of Route from a WebService that matches the path tokens from the request.
-func (c CurlyRouter) selectRoutes(ws *WebService, requestTokens []string) sortableCurlyRoutes {
- candidates := sortableCurlyRoutes{}
- for _, each := range ws.routes {
- matches, paramCount, staticCount := c.matchesRouteByPathTokens(each.pathParts, requestTokens)
- if matches {
- candidates.add(curlyRoute{each, paramCount, staticCount}) // TODO make sure Routes() return pointers?
- }
- }
- sort.Sort(sort.Reverse(candidates))
- return candidates
-}
-
-// matchesRouteByPathTokens computes whether it matches, howmany parameters do match and what the number of static path elements are.
-func (c CurlyRouter) matchesRouteByPathTokens(routeTokens, requestTokens []string) (matches bool, paramCount int, staticCount int) {
- if len(routeTokens) < len(requestTokens) {
- // proceed in matching only if last routeToken is wildcard
- count := len(routeTokens)
- if count == 0 || !strings.HasSuffix(routeTokens[count-1], "*}") {
- return false, 0, 0
- }
- // proceed
- }
- for i, routeToken := range routeTokens {
- if i == len(requestTokens) {
- // reached end of request path
- return false, 0, 0
- }
- requestToken := requestTokens[i]
- if strings.HasPrefix(routeToken, "{") {
- paramCount++
- if colon := strings.Index(routeToken, ":"); colon != -1 {
- // match by regex
- matchesToken, matchesRemainder := c.regularMatchesPathToken(routeToken, colon, requestToken)
- if !matchesToken {
- return false, 0, 0
- }
- if matchesRemainder {
- break
- }
- }
- } else { // no { prefix
- if requestToken != routeToken {
- return false, 0, 0
- }
- staticCount++
- }
- }
- return true, paramCount, staticCount
-}
-
-// regularMatchesPathToken tests whether the regular expression part of routeToken matches the requestToken or all remaining tokens
-// format routeToken is {someVar:someExpression}, e.g. {zipcode:[\d][\d][\d][\d][A-Z][A-Z]}
-func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, requestToken string) (matchesToken bool, matchesRemainder bool) {
- regPart := routeToken[colon+1 : len(routeToken)-1]
- if regPart == "*" {
- if trace {
- traceLogger.Printf("wildcard parameter detected in route token %s that matches %s\n", routeToken, requestToken)
- }
- return true, true
- }
- matched, err := regexp.MatchString(regPart, requestToken)
- return (matched && err == nil), false
-}
-
-var jsr311Router = RouterJSR311{}
-
-// detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type
-// headers of the Request. See also RouterJSR311 in jsr311.go
-func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) {
- // tracing is done inside detectRoute
- return jsr311Router.detectRoute(candidateRoutes.routes(), httpRequest)
-}
-
-// detectWebService returns the best matching webService given the list of path tokens.
-// see also computeWebserviceScore
-func (c CurlyRouter) detectWebService(requestTokens []string, webServices []*WebService) *WebService {
- var best *WebService
- score := -1
- for _, each := range webServices {
- matches, eachScore := c.computeWebserviceScore(requestTokens, each.pathExpr.tokens)
- if matches && (eachScore > score) {
- best = each
- score = eachScore
- }
- }
- return best
-}
-
-// computeWebserviceScore returns whether tokens match and
-// the weighted score of the longest matching consecutive tokens from the beginning.
-func (c CurlyRouter) computeWebserviceScore(requestTokens []string, tokens []string) (bool, int) {
- if len(tokens) > len(requestTokens) {
- return false, 0
- }
- score := 0
- for i := 0; i < len(tokens); i++ {
- each := requestTokens[i]
- other := tokens[i]
- if len(each) == 0 && len(other) == 0 {
- score++
- continue
- }
- if len(other) > 0 && strings.HasPrefix(other, "{") {
- // no empty match
- if len(each) == 0 {
- return false, score
- }
- score += 1
- } else {
- // not a parameter
- if each != other {
- return false, score
- }
- score += (len(tokens) - i) * 10 //fuzzy
- }
- }
- return true, score
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly_route.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly_route.go
deleted file mode 100644
index 296f94650..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/curly_route.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-// curlyRoute exits for sorting Routes by the CurlyRouter based on number of parameters and number of static path elements.
-type curlyRoute struct {
- route Route
- paramCount int
- staticCount int
-}
-
-type sortableCurlyRoutes []curlyRoute
-
-func (s *sortableCurlyRoutes) add(route curlyRoute) {
- *s = append(*s, route)
-}
-
-func (s sortableCurlyRoutes) routes() (routes []Route) {
- for _, each := range s {
- routes = append(routes, each.route) // TODO change return type
- }
- return routes
-}
-
-func (s sortableCurlyRoutes) Len() int {
- return len(s)
-}
-func (s sortableCurlyRoutes) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-func (s sortableCurlyRoutes) Less(i, j int) bool {
- ci := s[i]
- cj := s[j]
-
- // primary key
- if ci.staticCount < cj.staticCount {
- return true
- }
- if ci.staticCount > cj.staticCount {
- return false
- }
- // secundary key
- if ci.paramCount < cj.paramCount {
- return true
- }
- if ci.paramCount > cj.paramCount {
- return false
- }
- return ci.route.Path < cj.route.Path
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/doc.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/doc.go
deleted file mode 100644
index 21b26ac5a..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/doc.go
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-Package restful, a lean package for creating REST-style WebServices without magic.
-
-WebServices and Routes
-
-A WebService has a collection of Route objects that dispatch incoming Http Requests to a function calls.
-Typically, a WebService has a root path (e.g. /users) and defines common MIME types for its routes.
-WebServices must be added to a container (see below) in order to handler Http requests from a server.
-
-A Route is defined by a HTTP method, an URL path and (optionally) the MIME types it consumes (Content-Type) and produces (Accept).
-This package has the logic to find the best matching Route and if found, call its Function.
-
- ws := new(restful.WebService)
- ws.
- Path("/users").
- Consumes(restful.MIME_JSON, restful.MIME_XML).
- Produces(restful.MIME_JSON, restful.MIME_XML)
-
- ws.Route(ws.GET("/{user-id}").To(u.findUser)) // u is a UserResource
-
- ...
-
- // GET http://localhost:8080/users/1
- func (u UserResource) findUser(request *restful.Request, response *restful.Response) {
- id := request.PathParameter("user-id")
- ...
- }
-
-The (*Request, *Response) arguments provide functions for reading information from the request and writing information back to the response.
-
-See the example https://github.com/emicklei/go-restful/blob/master/examples/restful-user-resource.go with a full implementation.
-
-Regular expression matching Routes
-
-A Route parameter can be specified using the format "uri/{var[:regexp]}" or the special version "uri/{var:*}" for matching the tail of the path.
-For example, /persons/{name:[A-Z][A-Z]} can be used to restrict values for the parameter "name" to only contain capital alphabetic characters.
-Regular expressions must use the standard Go syntax as described in the regexp package. (https://code.google.com/p/re2/wiki/Syntax)
-This feature requires the use of a CurlyRouter.
-
-Containers
-
-A Container holds a collection of WebServices, Filters and a http.ServeMux for multiplexing http requests.
-Using the statements "restful.Add(...) and restful.Filter(...)" will register WebServices and Filters to the Default Container.
-The Default container of go-restful uses the http.DefaultServeMux.
-You can create your own Container and create a new http.Server for that particular container.
-
- container := restful.NewContainer()
- server := &http.Server{Addr: ":8081", Handler: container}
-
-Filters
-
-A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses.
-You can use filters to perform generic logging, measurement, authentication, redirect, set response headers etc.
-In the restful package there are three hooks into the request,response flow where filters can be added.
-Each filter must define a FilterFunction:
-
- func (req *restful.Request, resp *restful.Response, chain *restful.FilterChain)
-
-Use the following statement to pass the request,response pair to the next filter or RouteFunction
-
- chain.ProcessFilter(req, resp)
-
-Container Filters
-
-These are processed before any registered WebService.
-
- // install a (global) filter for the default container (processed before any webservice)
- restful.Filter(globalLogging)
-
-WebService Filters
-
-These are processed before any Route of a WebService.
-
- // install a webservice filter (processed before any route)
- ws.Filter(webserviceLogging).Filter(measureTime)
-
-
-Route Filters
-
-These are processed before calling the function associated with the Route.
-
- // install 2 chained route filters (processed before calling findUser)
- ws.Route(ws.GET("/{user-id}").Filter(routeLogging).Filter(NewCountFilter().routeCounter).To(findUser))
-
-See the example https://github.com/emicklei/go-restful/blob/master/examples/restful-filters.go with full implementations.
-
-Response Encoding
-
-Two encodings are supported: gzip and deflate. To enable this for all responses:
-
- restful.DefaultContainer.EnableContentEncoding(true)
-
-If a Http request includes the Accept-Encoding header then the response content will be compressed using the specified encoding.
-Alternatively, you can create a Filter that performs the encoding and install it per WebService or Route.
-
-See the example https://github.com/emicklei/go-restful/blob/master/examples/restful-encoding-filter.go
-
-OPTIONS support
-
-By installing a pre-defined container filter, your Webservice(s) can respond to the OPTIONS Http request.
-
- Filter(OPTIONSFilter())
-
-CORS
-
-By installing the filter of a CrossOriginResourceSharing (CORS), your WebService(s) can handle CORS requests.
-
- cors := CrossOriginResourceSharing{ExposeHeaders: []string{"X-My-Header"}, CookiesAllowed: false, Container: DefaultContainer}
- Filter(cors.Filter)
-
-Error Handling
-
-Unexpected things happen. If a request cannot be processed because of a failure, your service needs to tell via the response what happened and why.
-For this reason HTTP status codes exist and it is important to use the correct code in every exceptional situation.
-
- 400: Bad Request
-
-If path or query parameters are not valid (content or type) then use http.StatusBadRequest.
-
- 404: Not Found
-
-Despite a valid URI, the resource requested may not be available
-
- 500: Internal Server Error
-
-If the application logic could not process the request (or write the response) then use http.StatusInternalServerError.
-
- 405: Method Not Allowed
-
-The request has a valid URL but the method (GET,PUT,POST,...) is not allowed.
-
- 406: Not Acceptable
-
-The request does not have or has an unknown Accept Header set for this operation.
-
- 415: Unsupported Media Type
-
-The request does not have or has an unknown Content-Type Header set for this operation.
-
-ServiceError
-
-In addition to setting the correct (error) Http status code, you can choose to write a ServiceError message on the response.
-
-Performance options
-
-This package has several options that affect the performance of your service. It is important to understand them and how you can change it.
-
- restful.DefaultContainer.DoNotRecover(false)
-
-DoNotRecover controls whether panics will be caught to return HTTP 500.
-If set to false, the container will recover from panics.
-Default value is true
-
- restful.SetCompressorProvider(NewBoundedCachedCompressors(20, 20))
-
-If content encoding is enabled then the default strategy for getting new gzip/zlib writers and readers is to use a sync.Pool.
-Because writers are expensive structures, performance is even more improved when using a preloaded cache. You can also inject your own implementation.
-
-Trouble shooting
-
-This package has the means to produce detail logging of the complete Http request matching process and filter invocation.
-Enabling this feature requires you to set an implementation of restful.StdLogger (e.g. log.Logger) instance such as:
-
- restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile))
-
-Logging
-
-The restful.SetLogger() method allows you to override the logger used by the package. By default restful
-uses the standard library `log` package and logs to stdout. Different logging packages are supported as
-long as they conform to `StdLogger` interface defined in the `log` sub-package, writing an adapter for your
-preferred package is simple.
-
-Resources
-
-[project]: https://github.com/emicklei/go-restful
-
-[examples]: https://github.com/emicklei/go-restful/blob/master/examples
-
-[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/
-
-[showcases]: https://github.com/emicklei/mora, https://github.com/emicklei/landskape
-
-(c) 2012-2015, http://ernestmicklei.com. MIT License
-*/
-package restful
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/entity_accessors.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/entity_accessors.go
deleted file mode 100644
index 6ecf6c7f8..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/entity_accessors.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package restful
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "encoding/json"
- "encoding/xml"
- "strings"
- "sync"
-)
-
-// EntityReaderWriter can read and write values using an encoding such as JSON,XML.
-type EntityReaderWriter interface {
- // Read a serialized version of the value from the request.
- // The Request may have a decompressing reader. Depends on Content-Encoding.
- Read(req *Request, v interface{}) error
-
- // Write a serialized version of the value on the response.
- // The Response may have a compressing writer. Depends on Accept-Encoding.
- // status should be a valid Http Status code
- Write(resp *Response, status int, v interface{}) error
-}
-
-// entityAccessRegistry is a singleton
-var entityAccessRegistry = &entityReaderWriters{
- protection: new(sync.RWMutex),
- accessors: map[string]EntityReaderWriter{},
-}
-
-// entityReaderWriters associates MIME to an EntityReaderWriter
-type entityReaderWriters struct {
- protection *sync.RWMutex
- accessors map[string]EntityReaderWriter
-}
-
-func init() {
- RegisterEntityAccessor(MIME_JSON, NewEntityAccessorJSON(MIME_JSON))
- RegisterEntityAccessor(MIME_XML, NewEntityAccessorXML(MIME_XML))
-}
-
-// RegisterEntityAccessor add/overrides the ReaderWriter for encoding content with this MIME type.
-func RegisterEntityAccessor(mime string, erw EntityReaderWriter) {
- entityAccessRegistry.protection.Lock()
- defer entityAccessRegistry.protection.Unlock()
- entityAccessRegistry.accessors[mime] = erw
-}
-
-// NewEntityAccessorJSON returns a new EntityReaderWriter for accessing JSON content.
-// This package is already initialized with such an accessor using the MIME_JSON contentType.
-func NewEntityAccessorJSON(contentType string) EntityReaderWriter {
- return entityJSONAccess{ContentType: contentType}
-}
-
-// NewEntityAccessorXML returns a new EntityReaderWriter for accessing XML content.
-// This package is already initialized with such an accessor using the MIME_XML contentType.
-func NewEntityAccessorXML(contentType string) EntityReaderWriter {
- return entityXMLAccess{ContentType: contentType}
-}
-
-// accessorAt returns the registered ReaderWriter for this MIME type.
-func (r *entityReaderWriters) accessorAt(mime string) (EntityReaderWriter, bool) {
- r.protection.RLock()
- defer r.protection.RUnlock()
- er, ok := r.accessors[mime]
- if !ok {
- // retry with reverse lookup
- // more expensive but we are in an exceptional situation anyway
- for k, v := range r.accessors {
- if strings.Contains(mime, k) {
- return v, true
- }
- }
- }
- return er, ok
-}
-
-// entityXMLAccess is a EntityReaderWriter for XML encoding
-type entityXMLAccess struct {
- // This is used for setting the Content-Type header when writing
- ContentType string
-}
-
-// Read unmarshalls the value from XML
-func (e entityXMLAccess) Read(req *Request, v interface{}) error {
- return xml.NewDecoder(req.Request.Body).Decode(v)
-}
-
-// Write marshalls the value to JSON and set the Content-Type Header.
-func (e entityXMLAccess) Write(resp *Response, status int, v interface{}) error {
- return writeXML(resp, status, e.ContentType, v)
-}
-
-// writeXML marshalls the value to JSON and set the Content-Type Header.
-func writeXML(resp *Response, status int, contentType string, v interface{}) error {
- if v == nil {
- resp.WriteHeader(status)
- // do not write a nil representation
- return nil
- }
- if resp.prettyPrint {
- // pretty output must be created and written explicitly
- output, err := xml.MarshalIndent(v, " ", " ")
- if err != nil {
- return err
- }
- resp.Header().Set(HEADER_ContentType, contentType)
- resp.WriteHeader(status)
- _, err = resp.Write([]byte(xml.Header))
- if err != nil {
- return err
- }
- _, err = resp.Write(output)
- return err
- }
- // not-so-pretty
- resp.Header().Set(HEADER_ContentType, contentType)
- resp.WriteHeader(status)
- return xml.NewEncoder(resp).Encode(v)
-}
-
-// entityJSONAccess is a EntityReaderWriter for JSON encoding
-type entityJSONAccess struct {
- // This is used for setting the Content-Type header when writing
- ContentType string
-}
-
-// Read unmarshalls the value from JSON
-func (e entityJSONAccess) Read(req *Request, v interface{}) error {
- decoder := json.NewDecoder(req.Request.Body)
- decoder.UseNumber()
- return decoder.Decode(v)
-}
-
-// Write marshalls the value to JSON and set the Content-Type Header.
-func (e entityJSONAccess) Write(resp *Response, status int, v interface{}) error {
- return writeJSON(resp, status, e.ContentType, v)
-}
-
-// write marshalls the value to JSON and set the Content-Type Header.
-func writeJSON(resp *Response, status int, contentType string, v interface{}) error {
- if v == nil {
- resp.WriteHeader(status)
- // do not write a nil representation
- return nil
- }
- if resp.prettyPrint {
- // pretty output must be created and written explicitly
- output, err := json.MarshalIndent(v, " ", " ")
- if err != nil {
- return err
- }
- resp.Header().Set(HEADER_ContentType, contentType)
- resp.WriteHeader(status)
- _, err = resp.Write(output)
- return err
- }
- // not-so-pretty
- resp.Header().Set(HEADER_ContentType, contentType)
- resp.WriteHeader(status)
- return json.NewEncoder(resp).Encode(v)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/filter.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/filter.go
deleted file mode 100644
index c23bfb591..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/filter.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-// FilterChain is a request scoped object to process one or more filters before calling the target RouteFunction.
-type FilterChain struct {
- Filters []FilterFunction // ordered list of FilterFunction
- Index int // index into filters that is currently in progress
- Target RouteFunction // function to call after passing all filters
-}
-
-// ProcessFilter passes the request,response pair through the next of Filters.
-// Each filter can decide to proceed to the next Filter or handle the Response itself.
-func (f *FilterChain) ProcessFilter(request *Request, response *Response) {
- if f.Index < len(f.Filters) {
- f.Index++
- f.Filters[f.Index-1](request, response, f)
- } else {
- f.Target(request, response)
- }
-}
-
-// FilterFunction definitions must call ProcessFilter on the FilterChain to pass on the control and eventually call the RouteFunction
-type FilterFunction func(*Request, *Response, *FilterChain)
-
-// NoBrowserCacheFilter is a filter function to set HTTP headers that disable browser caching
-// See examples/restful-no-cache-filter.go for usage
-func NoBrowserCacheFilter(req *Request, resp *Response, chain *FilterChain) {
- resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1.
- resp.Header().Set("Pragma", "no-cache") // HTTP 1.0.
- resp.Header().Set("Expires", "0") // Proxies.
- chain.ProcessFilter(req, resp)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/install.sh b/archived/event-adapter/vendor/github.com/emicklei/go-restful/install.sh
deleted file mode 100644
index 36cbf25f8..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/install.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-go test -test.v ...restful && \
-go test -test.v ...swagger && \
-go vet ...restful && \
-go fmt ...swagger && \
-go install ...swagger && \
-go fmt ...restful && \
-go install ...restful
-cd examples
- ls *.go | xargs -I {} go build -o /tmp/ignore {}
- cd ..
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/jsr311.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/jsr311.go
deleted file mode 100644
index 511444ac6..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/jsr311.go
+++ /dev/null
@@ -1,248 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "errors"
- "fmt"
- "net/http"
- "sort"
-)
-
-// RouterJSR311 implements the flow for matching Requests to Routes (and consequently Resource Functions)
-// as specified by the JSR311 http://jsr311.java.net/nonav/releases/1.1/spec/spec.html.
-// RouterJSR311 implements the Router interface.
-// Concept of locators is not implemented.
-type RouterJSR311 struct{}
-
-// SelectRoute is part of the Router interface and returns the best match
-// for the WebService and its Route for the given Request.
-func (r RouterJSR311) SelectRoute(
- webServices []*WebService,
- httpRequest *http.Request) (selectedService *WebService, selectedRoute *Route, err error) {
-
- // Identify the root resource class (WebService)
- dispatcher, finalMatch, err := r.detectDispatcher(httpRequest.URL.Path, webServices)
- if err != nil {
- return nil, nil, NewError(http.StatusNotFound, "")
- }
- // Obtain the set of candidate methods (Routes)
- routes := r.selectRoutes(dispatcher, finalMatch)
- if len(routes) == 0 {
- return dispatcher, nil, NewError(http.StatusNotFound, "404: Page Not Found")
- }
-
- // Identify the method (Route) that will handle the request
- route, ok := r.detectRoute(routes, httpRequest)
- return dispatcher, route, ok
-}
-
-// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2
-func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*Route, error) {
- // http method
- methodOk := []Route{}
- for _, each := range routes {
- if httpRequest.Method == each.Method {
- methodOk = append(methodOk, each)
- }
- }
- if len(methodOk) == 0 {
- if trace {
- traceLogger.Printf("no Route found (in %d routes) that matches HTTP method %s\n", len(routes), httpRequest.Method)
- }
- return nil, NewError(http.StatusMethodNotAllowed, "405: Method Not Allowed")
- }
- inputMediaOk := methodOk
-
- // content-type
- contentType := httpRequest.Header.Get(HEADER_ContentType)
- inputMediaOk = []Route{}
- for _, each := range methodOk {
- if each.matchesContentType(contentType) {
- inputMediaOk = append(inputMediaOk, each)
- }
- }
- if len(inputMediaOk) == 0 {
- if trace {
- traceLogger.Printf("no Route found (from %d) that matches HTTP Content-Type: %s\n", len(methodOk), contentType)
- }
- return nil, NewError(http.StatusUnsupportedMediaType, "415: Unsupported Media Type")
- }
-
- // accept
- outputMediaOk := []Route{}
- accept := httpRequest.Header.Get(HEADER_Accept)
- if len(accept) == 0 {
- accept = "*/*"
- }
- for _, each := range inputMediaOk {
- if each.matchesAccept(accept) {
- outputMediaOk = append(outputMediaOk, each)
- }
- }
- if len(outputMediaOk) == 0 {
- if trace {
- traceLogger.Printf("no Route found (from %d) that matches HTTP Accept: %s\n", len(inputMediaOk), accept)
- }
- return nil, NewError(http.StatusNotAcceptable, "406: Not Acceptable")
- }
- // return r.bestMatchByMedia(outputMediaOk, contentType, accept), nil
- return &outputMediaOk[0], nil
-}
-
-// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2
-// n/m > n/* > */*
-func (r RouterJSR311) bestMatchByMedia(routes []Route, contentType string, accept string) *Route {
- // TODO
- return &routes[0]
-}
-
-// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 2)
-func (r RouterJSR311) selectRoutes(dispatcher *WebService, pathRemainder string) []Route {
- filtered := &sortableRouteCandidates{}
- for _, each := range dispatcher.Routes() {
- pathExpr := each.pathExpr
- matches := pathExpr.Matcher.FindStringSubmatch(pathRemainder)
- if matches != nil {
- lastMatch := matches[len(matches)-1]
- if len(lastMatch) == 0 || lastMatch == "/" { // do not include if value is neither empty nor ‘/’.
- filtered.candidates = append(filtered.candidates,
- routeCandidate{each, len(matches) - 1, pathExpr.LiteralCount, pathExpr.VarCount})
- }
- }
- }
- if len(filtered.candidates) == 0 {
- if trace {
- traceLogger.Printf("WebService on path %s has no routes that match URL path remainder:%s\n", dispatcher.rootPath, pathRemainder)
- }
- return []Route{}
- }
- sort.Sort(sort.Reverse(filtered))
-
- // select other routes from candidates whoes expression matches rmatch
- matchingRoutes := []Route{filtered.candidates[0].route}
- for c := 1; c < len(filtered.candidates); c++ {
- each := filtered.candidates[c]
- if each.route.pathExpr.Matcher.MatchString(pathRemainder) {
- matchingRoutes = append(matchingRoutes, each.route)
- }
- }
- return matchingRoutes
-}
-
-// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 1)
-func (r RouterJSR311) detectDispatcher(requestPath string, dispatchers []*WebService) (*WebService, string, error) {
- filtered := &sortableDispatcherCandidates{}
- for _, each := range dispatchers {
- matches := each.pathExpr.Matcher.FindStringSubmatch(requestPath)
- if matches != nil {
- filtered.candidates = append(filtered.candidates,
- dispatcherCandidate{each, matches[len(matches)-1], len(matches), each.pathExpr.LiteralCount, each.pathExpr.VarCount})
- }
- }
- if len(filtered.candidates) == 0 {
- if trace {
- traceLogger.Printf("no WebService was found to match URL path:%s\n", requestPath)
- }
- return nil, "", errors.New("not found")
- }
- sort.Sort(sort.Reverse(filtered))
- return filtered.candidates[0].dispatcher, filtered.candidates[0].finalMatch, nil
-}
-
-// Types and functions to support the sorting of Routes
-
-type routeCandidate struct {
- route Route
- matchesCount int // the number of capturing groups
- literalCount int // the number of literal characters (means those not resulting from template variable substitution)
- nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’)
-}
-
-func (r routeCandidate) expressionToMatch() string {
- return r.route.pathExpr.Source
-}
-
-func (r routeCandidate) String() string {
- return fmt.Sprintf("(m=%d,l=%d,n=%d)", r.matchesCount, r.literalCount, r.nonDefaultCount)
-}
-
-type sortableRouteCandidates struct {
- candidates []routeCandidate
-}
-
-func (rcs *sortableRouteCandidates) Len() int {
- return len(rcs.candidates)
-}
-func (rcs *sortableRouteCandidates) Swap(i, j int) {
- rcs.candidates[i], rcs.candidates[j] = rcs.candidates[j], rcs.candidates[i]
-}
-func (rcs *sortableRouteCandidates) Less(i, j int) bool {
- ci := rcs.candidates[i]
- cj := rcs.candidates[j]
- // primary key
- if ci.literalCount < cj.literalCount {
- return true
- }
- if ci.literalCount > cj.literalCount {
- return false
- }
- // secundary key
- if ci.matchesCount < cj.matchesCount {
- return true
- }
- if ci.matchesCount > cj.matchesCount {
- return false
- }
- // tertiary key
- if ci.nonDefaultCount < cj.nonDefaultCount {
- return true
- }
- if ci.nonDefaultCount > cj.nonDefaultCount {
- return false
- }
- // quaternary key ("source" is interpreted as Path)
- return ci.route.Path < cj.route.Path
-}
-
-// Types and functions to support the sorting of Dispatchers
-
-type dispatcherCandidate struct {
- dispatcher *WebService
- finalMatch string
- matchesCount int // the number of capturing groups
- literalCount int // the number of literal characters (means those not resulting from template variable substitution)
- nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’)
-}
-type sortableDispatcherCandidates struct {
- candidates []dispatcherCandidate
-}
-
-func (dc *sortableDispatcherCandidates) Len() int {
- return len(dc.candidates)
-}
-func (dc *sortableDispatcherCandidates) Swap(i, j int) {
- dc.candidates[i], dc.candidates[j] = dc.candidates[j], dc.candidates[i]
-}
-func (dc *sortableDispatcherCandidates) Less(i, j int) bool {
- ci := dc.candidates[i]
- cj := dc.candidates[j]
- // primary key
- if ci.matchesCount < cj.matchesCount {
- return true
- }
- if ci.matchesCount > cj.matchesCount {
- return false
- }
- // secundary key
- if ci.literalCount < cj.literalCount {
- return true
- }
- if ci.literalCount > cj.literalCount {
- return false
- }
- // tertiary key
- return ci.nonDefaultCount < cj.nonDefaultCount
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/log/log.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/log/log.go
deleted file mode 100644
index f70d89524..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/log/log.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package log
-
-import (
- stdlog "log"
- "os"
-)
-
-// Logger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger
-type StdLogger interface {
- Print(v ...interface{})
- Printf(format string, v ...interface{})
-}
-
-var Logger StdLogger
-
-func init() {
- // default Logger
- SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile))
-}
-
-func SetLogger(customLogger StdLogger) {
- Logger = customLogger
-}
-
-func Print(v ...interface{}) {
- Logger.Print(v...)
-}
-
-func Printf(format string, v ...interface{}) {
- Logger.Printf(format, v...)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/logger.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/logger.go
deleted file mode 100644
index 3f1c4db86..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/logger.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package restful
-
-// Copyright 2014 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-import (
- "github.com/emicklei/go-restful/log"
-)
-
-var trace bool = false
-var traceLogger log.StdLogger
-
-func init() {
- traceLogger = log.Logger // use the package logger by default
-}
-
-// TraceLogger enables detailed logging of Http request matching and filter invocation. Default no logger is set.
-// You may call EnableTracing() directly to enable trace logging to the package-wide logger.
-func TraceLogger(logger log.StdLogger) {
- traceLogger = logger
- EnableTracing(logger != nil)
-}
-
-// expose the setter for the global logger on the top-level package
-func SetLogger(customLogger log.StdLogger) {
- log.SetLogger(customLogger)
-}
-
-// EnableTracing can be used to Trace logging on and off.
-func EnableTracing(enabled bool) {
- trace = enabled
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/mime.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/mime.go
deleted file mode 100644
index d7ea2b615..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/mime.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package restful
-
-import (
- "strconv"
- "strings"
-)
-
-type mime struct {
- media string
- quality float64
-}
-
-// insertMime adds a mime to a list and keeps it sorted by quality.
-func insertMime(l []mime, e mime) []mime {
- for i, each := range l {
- // if current mime has lower quality then insert before
- if e.quality > each.quality {
- left := append([]mime{}, l[0:i]...)
- return append(append(left, e), l[i:]...)
- }
- }
- return append(l, e)
-}
-
-// sortedMimes returns a list of mime sorted (desc) by its specified quality.
-func sortedMimes(accept string) (sorted []mime) {
- for _, each := range strings.Split(accept, ",") {
- typeAndQuality := strings.Split(strings.Trim(each, " "), ";")
- if len(typeAndQuality) == 1 {
- sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0})
- } else {
- // take factor
- parts := strings.Split(typeAndQuality[1], "=")
- if len(parts) == 2 {
- f, err := strconv.ParseFloat(parts[1], 64)
- if err != nil {
- traceLogger.Printf("unable to parse quality in %s, %v", each, err)
- } else {
- sorted = insertMime(sorted, mime{typeAndQuality[0], f})
- }
- }
- }
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/options_filter.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/options_filter.go
deleted file mode 100644
index 4514eadcf..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/options_filter.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package restful
-
-import "strings"
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method
-// and provides the response with a set of allowed methods for the request URL Path.
-// As for any filter, you can also install it for a particular WebService within a Container.
-// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS).
-func (c *Container) OPTIONSFilter(req *Request, resp *Response, chain *FilterChain) {
- if "OPTIONS" != req.Request.Method {
- chain.ProcessFilter(req, resp)
- return
- }
- resp.AddHeader(HEADER_Allow, strings.Join(c.computeAllowedMethods(req), ","))
-}
-
-// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method
-// and provides the response with a set of allowed methods for the request URL Path.
-// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS).
-func OPTIONSFilter() FilterFunction {
- return DefaultContainer.OPTIONSFilter
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/parameter.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/parameter.go
deleted file mode 100644
index e11c8162a..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/parameter.go
+++ /dev/null
@@ -1,114 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-const (
- // PathParameterKind = indicator of Request parameter type "path"
- PathParameterKind = iota
-
- // QueryParameterKind = indicator of Request parameter type "query"
- QueryParameterKind
-
- // BodyParameterKind = indicator of Request parameter type "body"
- BodyParameterKind
-
- // HeaderParameterKind = indicator of Request parameter type "header"
- HeaderParameterKind
-
- // FormParameterKind = indicator of Request parameter type "form"
- FormParameterKind
-)
-
-// Parameter is for documententing the parameter used in a Http Request
-// ParameterData kinds are Path,Query and Body
-type Parameter struct {
- data *ParameterData
-}
-
-// ParameterData represents the state of a Parameter.
-// It is made public to make it accessible to e.g. the Swagger package.
-type ParameterData struct {
- Name, Description, DataType, DataFormat string
- Kind int
- Required bool
- AllowableValues map[string]string
- AllowMultiple bool
- DefaultValue string
-}
-
-// Data returns the state of the Parameter
-func (p *Parameter) Data() ParameterData {
- return *p.data
-}
-
-// Kind returns the parameter type indicator (see const for valid values)
-func (p *Parameter) Kind() int {
- return p.data.Kind
-}
-
-func (p *Parameter) bePath() *Parameter {
- p.data.Kind = PathParameterKind
- return p
-}
-func (p *Parameter) beQuery() *Parameter {
- p.data.Kind = QueryParameterKind
- return p
-}
-func (p *Parameter) beBody() *Parameter {
- p.data.Kind = BodyParameterKind
- return p
-}
-
-func (p *Parameter) beHeader() *Parameter {
- p.data.Kind = HeaderParameterKind
- return p
-}
-
-func (p *Parameter) beForm() *Parameter {
- p.data.Kind = FormParameterKind
- return p
-}
-
-// Required sets the required field and returns the receiver
-func (p *Parameter) Required(required bool) *Parameter {
- p.data.Required = required
- return p
-}
-
-// AllowMultiple sets the allowMultiple field and returns the receiver
-func (p *Parameter) AllowMultiple(multiple bool) *Parameter {
- p.data.AllowMultiple = multiple
- return p
-}
-
-// AllowableValues sets the allowableValues field and returns the receiver
-func (p *Parameter) AllowableValues(values map[string]string) *Parameter {
- p.data.AllowableValues = values
- return p
-}
-
-// DataType sets the dataType field and returns the receiver
-func (p *Parameter) DataType(typeName string) *Parameter {
- p.data.DataType = typeName
- return p
-}
-
-// DataFormat sets the dataFormat field for Swagger UI
-func (p *Parameter) DataFormat(formatName string) *Parameter {
- p.data.DataFormat = formatName
- return p
-}
-
-// DefaultValue sets the default value field and returns the receiver
-func (p *Parameter) DefaultValue(stringRepresentation string) *Parameter {
- p.data.DefaultValue = stringRepresentation
- return p
-}
-
-// Description sets the description value field and returns the receiver
-func (p *Parameter) Description(doc string) *Parameter {
- p.data.Description = doc
- return p
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/path_expression.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/path_expression.go
deleted file mode 100644
index a921e6f22..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/path_expression.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "strings"
-)
-
-// PathExpression holds a compiled path expression (RegExp) needed to match against
-// Http request paths and to extract path parameter values.
-type pathExpression struct {
- LiteralCount int // the number of literal characters (means those not resulting from template variable substitution)
- VarCount int // the number of named parameters (enclosed by {}) in the path
- Matcher *regexp.Regexp
- Source string // Path as defined by the RouteBuilder
- tokens []string
-}
-
-// NewPathExpression creates a PathExpression from the input URL path.
-// Returns an error if the path is invalid.
-func newPathExpression(path string) (*pathExpression, error) {
- expression, literalCount, varCount, tokens := templateToRegularExpression(path)
- compiled, err := regexp.Compile(expression)
- if err != nil {
- return nil, err
- }
- return &pathExpression{literalCount, varCount, compiled, expression, tokens}, nil
-}
-
-// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-370003.7.3
-func templateToRegularExpression(template string) (expression string, literalCount int, varCount int, tokens []string) {
- var buffer bytes.Buffer
- buffer.WriteString("^")
- //tokens = strings.Split(template, "/")
- tokens = tokenizePath(template)
- for _, each := range tokens {
- if each == "" {
- continue
- }
- buffer.WriteString("/")
- if strings.HasPrefix(each, "{") {
- // check for regular expression in variable
- colon := strings.Index(each, ":")
- if colon != -1 {
- // extract expression
- paramExpr := strings.TrimSpace(each[colon+1 : len(each)-1])
- if paramExpr == "*" { // special case
- buffer.WriteString("(.*)")
- } else {
- buffer.WriteString(fmt.Sprintf("(%s)", paramExpr)) // between colon and closing moustache
- }
- } else {
- // plain var
- buffer.WriteString("([^/]+?)")
- }
- varCount += 1
- } else {
- literalCount += len(each)
- encoded := each // TODO URI encode
- buffer.WriteString(regexp.QuoteMeta(encoded))
- }
- }
- return strings.TrimRight(buffer.String(), "/") + "(/.*)?$", literalCount, varCount, tokens
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/request.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/request.go
deleted file mode 100644
index 295e6acde..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/request.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "compress/zlib"
- "io/ioutil"
- "net/http"
-)
-
-var defaultRequestContentType string
-
-var doCacheReadEntityBytes = false
-
-// Request is a wrapper for a http Request that provides convenience methods
-type Request struct {
- Request *http.Request
- bodyContent *[]byte // to cache the request body for multiple reads of ReadEntity
- pathParameters map[string]string
- attributes map[string]interface{} // for storing request-scoped values
- selectedRoutePath string // root path + route path that matched the request, e.g. /meetings/{id}/attendees
-}
-
-func NewRequest(httpRequest *http.Request) *Request {
- return &Request{
- Request: httpRequest,
- pathParameters: map[string]string{},
- attributes: map[string]interface{}{},
- } // empty parameters, attributes
-}
-
-// If ContentType is missing or */* is given then fall back to this type, otherwise
-// a "Unable to unmarshal content of type:" response is returned.
-// Valid values are restful.MIME_JSON and restful.MIME_XML
-// Example:
-// restful.DefaultRequestContentType(restful.MIME_JSON)
-func DefaultRequestContentType(mime string) {
- defaultRequestContentType = mime
-}
-
-// SetCacheReadEntity controls whether the response data ([]byte) is cached such that ReadEntity is repeatable.
-// Default is true (due to backwardcompatibility). For better performance, you should set it to false if you don't need it.
-func SetCacheReadEntity(doCache bool) {
- doCacheReadEntityBytes = doCache
-}
-
-// PathParameter accesses the Path parameter value by its name
-func (r *Request) PathParameter(name string) string {
- return r.pathParameters[name]
-}
-
-// PathParameters accesses the Path parameter values
-func (r *Request) PathParameters() map[string]string {
- return r.pathParameters
-}
-
-// QueryParameter returns the (first) Query parameter value by its name
-func (r *Request) QueryParameter(name string) string {
- return r.Request.FormValue(name)
-}
-
-// BodyParameter parses the body of the request (once for typically a POST or a PUT) and returns the value of the given name or an error.
-func (r *Request) BodyParameter(name string) (string, error) {
- err := r.Request.ParseForm()
- if err != nil {
- return "", err
- }
- return r.Request.PostFormValue(name), nil
-}
-
-// HeaderParameter returns the HTTP Header value of a Header name or empty if missing
-func (r *Request) HeaderParameter(name string) string {
- return r.Request.Header.Get(name)
-}
-
-// ReadEntity checks the Accept header and reads the content into the entityPointer.
-func (r *Request) ReadEntity(entityPointer interface{}) (err error) {
- contentType := r.Request.Header.Get(HEADER_ContentType)
- contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding)
-
- // OLD feature, cache the body for reads
- if doCacheReadEntityBytes {
- if r.bodyContent == nil {
- data, err := ioutil.ReadAll(r.Request.Body)
- if err != nil {
- return err
- }
- r.bodyContent = &data
- }
- r.Request.Body = ioutil.NopCloser(bytes.NewReader(*r.bodyContent))
- }
-
- // check if the request body needs decompression
- if ENCODING_GZIP == contentEncoding {
- gzipReader := currentCompressorProvider.AcquireGzipReader()
- defer currentCompressorProvider.ReleaseGzipReader(gzipReader)
- gzipReader.Reset(r.Request.Body)
- r.Request.Body = gzipReader
- } else if ENCODING_DEFLATE == contentEncoding {
- zlibReader, err := zlib.NewReader(r.Request.Body)
- if err != nil {
- return err
- }
- r.Request.Body = zlibReader
- }
-
- // lookup the EntityReader, use defaultRequestContentType if needed and provided
- entityReader, ok := entityAccessRegistry.accessorAt(contentType)
- if !ok {
- if len(defaultRequestContentType) != 0 {
- entityReader, ok = entityAccessRegistry.accessorAt(defaultRequestContentType)
- }
- if !ok {
- return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType)
- }
- }
- return entityReader.Read(r, entityPointer)
-}
-
-// SetAttribute adds or replaces the attribute with the given value.
-func (r *Request) SetAttribute(name string, value interface{}) {
- r.attributes[name] = value
-}
-
-// Attribute returns the value associated to the given name. Returns nil if absent.
-func (r Request) Attribute(name string) interface{} {
- return r.attributes[name]
-}
-
-// SelectedRoutePath root path + route path that matched the request, e.g. /meetings/{id}/attendees
-func (r Request) SelectedRoutePath() string {
- return r.selectedRoutePath
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/response.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/response.go
deleted file mode 100644
index 971cd0b42..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/response.go
+++ /dev/null
@@ -1,235 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "errors"
- "net/http"
-)
-
-// DEPRECATED, use DefaultResponseContentType(mime)
-var DefaultResponseMimeType string
-
-//PrettyPrintResponses controls the indentation feature of XML and JSON serialization
-var PrettyPrintResponses = true
-
-// Response is a wrapper on the actual http ResponseWriter
-// It provides several convenience methods to prepare and write response content.
-type Response struct {
- http.ResponseWriter
- requestAccept string // mime-type what the Http Request says it wants to receive
- routeProduces []string // mime-types what the Route says it can produce
- statusCode int // HTTP status code that has been written explicity (if zero then net/http has written 200)
- contentLength int // number of bytes written for the response body
- prettyPrint bool // controls the indentation feature of XML and JSON serialization. It is initialized using var PrettyPrintResponses.
- err error // err property is kept when WriteError is called
-}
-
-// Creates a new response based on a http ResponseWriter.
-func NewResponse(httpWriter http.ResponseWriter) *Response {
- return &Response{httpWriter, "", []string{}, http.StatusOK, 0, PrettyPrintResponses, nil} // empty content-types
-}
-
-// If Accept header matching fails, fall back to this type.
-// Valid values are restful.MIME_JSON and restful.MIME_XML
-// Example:
-// restful.DefaultResponseContentType(restful.MIME_JSON)
-func DefaultResponseContentType(mime string) {
- DefaultResponseMimeType = mime
-}
-
-// InternalServerError writes the StatusInternalServerError header.
-// DEPRECATED, use WriteErrorString(http.StatusInternalServerError,reason)
-func (r Response) InternalServerError() Response {
- r.WriteHeader(http.StatusInternalServerError)
- return r
-}
-
-// PrettyPrint changes whether this response must produce pretty (line-by-line, indented) JSON or XML output.
-func (r *Response) PrettyPrint(bePretty bool) {
- r.prettyPrint = bePretty
-}
-
-// AddHeader is a shortcut for .Header().Add(header,value)
-func (r Response) AddHeader(header string, value string) Response {
- r.Header().Add(header, value)
- return r
-}
-
-// SetRequestAccepts tells the response what Mime-type(s) the HTTP request said it wants to accept. Exposed for testing.
-func (r *Response) SetRequestAccepts(mime string) {
- r.requestAccept = mime
-}
-
-// EntityWriter returns the registered EntityWriter that the entity (requested resource)
-// can write according to what the request wants (Accept) and what the Route can produce or what the restful defaults say.
-// If called before WriteEntity and WriteHeader then a false return value can be used to write a 406: Not Acceptable.
-func (r *Response) EntityWriter() (EntityReaderWriter, bool) {
- sorted := sortedMimes(r.requestAccept)
- for _, eachAccept := range sorted {
- for _, eachProduce := range r.routeProduces {
- if eachProduce == eachAccept.media {
- if w, ok := entityAccessRegistry.accessorAt(eachAccept.media); ok {
- return w, true
- }
- }
- }
- if eachAccept.media == "*/*" {
- for _, each := range r.routeProduces {
- if w, ok := entityAccessRegistry.accessorAt(each); ok {
- return w, true
- }
- }
- }
- }
- // if requestAccept is empty
- writer, ok := entityAccessRegistry.accessorAt(r.requestAccept)
- if !ok {
- // if not registered then fallback to the defaults (if set)
- if DefaultResponseMimeType == MIME_JSON {
- return entityAccessRegistry.accessorAt(MIME_JSON)
- }
- if DefaultResponseMimeType == MIME_XML {
- return entityAccessRegistry.accessorAt(MIME_XML)
- }
- // Fallback to whatever the route says it can produce.
- // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
- for _, each := range r.routeProduces {
- if w, ok := entityAccessRegistry.accessorAt(each); ok {
- return w, true
- }
- }
- if trace {
- traceLogger.Printf("no registered EntityReaderWriter found for %s", r.requestAccept)
- }
- }
- return writer, ok
-}
-
-// WriteEntity calls WriteHeaderAndEntity with Http Status OK (200)
-func (r *Response) WriteEntity(value interface{}) error {
- return r.WriteHeaderAndEntity(http.StatusOK, value)
-}
-
-// WriteHeaderAndEntity marshals the value using the representation denoted by the Accept Header and the registered EntityWriters.
-// If no Accept header is specified (or */*) then respond with the Content-Type as specified by the first in the Route.Produces.
-// If an Accept header is specified then respond with the Content-Type as specified by the first in the Route.Produces that is matched with the Accept header.
-// If the value is nil then no response is send except for the Http status. You may want to call WriteHeader(http.StatusNotFound) instead.
-// If there is no writer available that can represent the value in the requested MIME type then Http Status NotAcceptable is written.
-// Current implementation ignores any q-parameters in the Accept Header.
-// Returns an error if the value could not be written on the response.
-func (r *Response) WriteHeaderAndEntity(status int, value interface{}) error {
- writer, ok := r.EntityWriter()
- if !ok {
- r.WriteHeader(http.StatusNotAcceptable)
- return nil
- }
- return writer.Write(r, status, value)
-}
-
-// WriteAsXml is a convenience method for writing a value in xml (requires Xml tags on the value)
-// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter.
-func (r *Response) WriteAsXml(value interface{}) error {
- return writeXML(r, http.StatusOK, MIME_XML, value)
-}
-
-// WriteHeaderAndXml is a convenience method for writing a status and value in xml (requires Xml tags on the value)
-// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter.
-func (r *Response) WriteHeaderAndXml(status int, value interface{}) error {
- return writeXML(r, status, MIME_XML, value)
-}
-
-// WriteAsJson is a convenience method for writing a value in json.
-// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter.
-func (r *Response) WriteAsJson(value interface{}) error {
- return writeJSON(r, http.StatusOK, MIME_JSON, value)
-}
-
-// WriteJson is a convenience method for writing a value in Json with a given Content-Type.
-// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter.
-func (r *Response) WriteJson(value interface{}, contentType string) error {
- return writeJSON(r, http.StatusOK, contentType, value)
-}
-
-// WriteHeaderAndJson is a convenience method for writing the status and a value in Json with a given Content-Type.
-// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter.
-func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error {
- return writeJSON(r, status, contentType, value)
-}
-
-// WriteError write the http status and the error string on the response.
-func (r *Response) WriteError(httpStatus int, err error) error {
- r.err = err
- return r.WriteErrorString(httpStatus, err.Error())
-}
-
-// WriteServiceError is a convenience method for a responding with a status and a ServiceError
-func (r *Response) WriteServiceError(httpStatus int, err ServiceError) error {
- r.err = err
- return r.WriteHeaderAndEntity(httpStatus, err)
-}
-
-// WriteErrorString is a convenience method for an error status with the actual error
-func (r *Response) WriteErrorString(httpStatus int, errorReason string) error {
- if r.err == nil {
- // if not called from WriteError
- r.err = errors.New(errorReason)
- }
- r.WriteHeader(httpStatus)
- if _, err := r.Write([]byte(errorReason)); err != nil {
- return err
- }
- return nil
-}
-
-// Flush implements http.Flusher interface, which sends any buffered data to the client.
-func (r *Response) Flush() {
- if f, ok := r.ResponseWriter.(http.Flusher); ok {
- f.Flush()
- } else if trace {
- traceLogger.Printf("ResponseWriter %v doesn't support Flush", r)
- }
-}
-
-// WriteHeader is overridden to remember the Status Code that has been written.
-// Changes to the Header of the response have no effect after this.
-func (r *Response) WriteHeader(httpStatus int) {
- r.statusCode = httpStatus
- r.ResponseWriter.WriteHeader(httpStatus)
-}
-
-// StatusCode returns the code that has been written using WriteHeader.
-func (r Response) StatusCode() int {
- if 0 == r.statusCode {
- // no status code has been written yet; assume OK
- return http.StatusOK
- }
- return r.statusCode
-}
-
-// Write writes the data to the connection as part of an HTTP reply.
-// Write is part of http.ResponseWriter interface.
-func (r *Response) Write(bytes []byte) (int, error) {
- written, err := r.ResponseWriter.Write(bytes)
- r.contentLength += written
- return written, err
-}
-
-// ContentLength returns the number of bytes written for the response content.
-// Note that this value is only correct if all data is written through the Response using its Write* methods.
-// Data written directly using the underlying http.ResponseWriter is not accounted for.
-func (r Response) ContentLength() int {
- return r.contentLength
-}
-
-// CloseNotify is part of http.CloseNotifier interface
-func (r Response) CloseNotify() <-chan bool {
- return r.ResponseWriter.(http.CloseNotifier).CloseNotify()
-}
-
-// Error returns the err created by WriteError
-func (r Response) Error() error {
- return r.err
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/route.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/route.go
deleted file mode 100644
index f54e8622e..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/route.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "net/http"
- "strings"
-)
-
-// RouteFunction declares the signature of a function that can be bound to a Route.
-type RouteFunction func(*Request, *Response)
-
-// Route binds a HTTP Method,Path,Consumes combination to a RouteFunction.
-type Route struct {
- Method string
- Produces []string
- Consumes []string
- Path string // webservice root path + described path
- Function RouteFunction
- Filters []FilterFunction
-
- // cached values for dispatching
- relativePath string
- pathParts []string
- pathExpr *pathExpression // cached compilation of relativePath as RegExp
-
- // documentation
- Doc string
- Notes string
- Operation string
- ParameterDocs []*Parameter
- ResponseErrors map[int]ResponseError
- ReadSample, WriteSample interface{} // structs that model an example request or response payload
-}
-
-// Initialize for Route
-func (r *Route) postBuild() {
- r.pathParts = tokenizePath(r.Path)
-}
-
-// Create Request and Response from their http versions
-func (r *Route) wrapRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request) (*Request, *Response) {
- params := r.extractParameters(httpRequest.URL.Path)
- wrappedRequest := NewRequest(httpRequest)
- wrappedRequest.pathParameters = params
- wrappedRequest.selectedRoutePath = r.Path
- wrappedResponse := NewResponse(httpWriter)
- wrappedResponse.requestAccept = httpRequest.Header.Get(HEADER_Accept)
- wrappedResponse.routeProduces = r.Produces
- return wrappedRequest, wrappedResponse
-}
-
-// dispatchWithFilters call the function after passing through its own filters
-func (r *Route) dispatchWithFilters(wrappedRequest *Request, wrappedResponse *Response) {
- if len(r.Filters) > 0 {
- chain := FilterChain{Filters: r.Filters, Target: r.Function}
- chain.ProcessFilter(wrappedRequest, wrappedResponse)
- } else {
- // unfiltered
- r.Function(wrappedRequest, wrappedResponse)
- }
-}
-
-// Return whether the mimeType matches to what this Route can produce.
-func (r Route) matchesAccept(mimeTypesWithQuality string) bool {
- parts := strings.Split(mimeTypesWithQuality, ",")
- for _, each := range parts {
- var withoutQuality string
- if strings.Contains(each, ";") {
- withoutQuality = strings.Split(each, ";")[0]
- } else {
- withoutQuality = each
- }
- // trim before compare
- withoutQuality = strings.Trim(withoutQuality, " ")
- if withoutQuality == "*/*" {
- return true
- }
- for _, producibleType := range r.Produces {
- if producibleType == "*/*" || producibleType == withoutQuality {
- return true
- }
- }
- }
- return false
-}
-
-// Return whether this Route can consume content with a type specified by mimeTypes (can be empty).
-func (r Route) matchesContentType(mimeTypes string) bool {
-
- if len(r.Consumes) == 0 {
- // did not specify what it can consume ; any media type (“*/*”) is assumed
- return true
- }
-
- if len(mimeTypes) == 0 {
- // idempotent methods with (most-likely or garanteed) empty content match missing Content-Type
- m := r.Method
- if m == "GET" || m == "HEAD" || m == "OPTIONS" || m == "DELETE" || m == "TRACE" {
- return true
- }
- // proceed with default
- mimeTypes = MIME_OCTET
- }
-
- parts := strings.Split(mimeTypes, ",")
- for _, each := range parts {
- var contentType string
- if strings.Contains(each, ";") {
- contentType = strings.Split(each, ";")[0]
- } else {
- contentType = each
- }
- // trim before compare
- contentType = strings.Trim(contentType, " ")
- for _, consumeableType := range r.Consumes {
- if consumeableType == "*/*" || consumeableType == contentType {
- return true
- }
- }
- }
- return false
-}
-
-// Extract the parameters from the request url path
-func (r Route) extractParameters(urlPath string) map[string]string {
- urlParts := tokenizePath(urlPath)
- pathParameters := map[string]string{}
- for i, key := range r.pathParts {
- var value string
- if i >= len(urlParts) {
- value = ""
- } else {
- value = urlParts[i]
- }
- if strings.HasPrefix(key, "{") { // path-parameter
- if colon := strings.Index(key, ":"); colon != -1 {
- // extract by regex
- regPart := key[colon+1 : len(key)-1]
- keyPart := key[1:colon]
- if regPart == "*" {
- pathParameters[keyPart] = untokenizePath(i, urlParts)
- break
- } else {
- pathParameters[keyPart] = value
- }
- } else {
- // without enclosing {}
- pathParameters[key[1:len(key)-1]] = value
- }
- }
- }
- return pathParameters
-}
-
-// Untokenize back into an URL path using the slash separator
-func untokenizePath(offset int, parts []string) string {
- var buffer bytes.Buffer
- for p := offset; p < len(parts); p++ {
- buffer.WriteString(parts[p])
- // do not end
- if p < len(parts)-1 {
- buffer.WriteString("/")
- }
- }
- return buffer.String()
-}
-
-// Tokenize an URL path using the slash separator ; the result does not have empty tokens
-func tokenizePath(path string) []string {
- if "/" == path {
- return []string{}
- }
- return strings.Split(strings.Trim(path, "/"), "/")
-}
-
-// for debugging
-func (r Route) String() string {
- return r.Method + " " + r.Path
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/route_builder.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/route_builder.go
deleted file mode 100644
index 8bc1ab684..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/route_builder.go
+++ /dev/null
@@ -1,240 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "os"
- "reflect"
- "runtime"
- "strings"
-
- "github.com/emicklei/go-restful/log"
-)
-
-// RouteBuilder is a helper to construct Routes.
-type RouteBuilder struct {
- rootPath string
- currentPath string
- produces []string
- consumes []string
- httpMethod string // required
- function RouteFunction // required
- filters []FilterFunction
- // documentation
- doc string
- notes string
- operation string
- readSample, writeSample interface{}
- parameters []*Parameter
- errorMap map[int]ResponseError
-}
-
-// Do evaluates each argument with the RouteBuilder itself.
-// This allows you to follow DRY principles without breaking the fluent programming style.
-// Example:
-// ws.Route(ws.DELETE("/{name}").To(t.deletePerson).Do(Returns200, Returns500))
-//
-// func Returns500(b *RouteBuilder) {
-// b.Returns(500, "Internal Server Error", restful.ServiceError{})
-// }
-func (b *RouteBuilder) Do(oneArgBlocks ...func(*RouteBuilder)) *RouteBuilder {
- for _, each := range oneArgBlocks {
- each(b)
- }
- return b
-}
-
-// To bind the route to a function.
-// If this route is matched with the incoming Http Request then call this function with the *Request,*Response pair. Required.
-func (b *RouteBuilder) To(function RouteFunction) *RouteBuilder {
- b.function = function
- return b
-}
-
-// Method specifies what HTTP method to match. Required.
-func (b *RouteBuilder) Method(method string) *RouteBuilder {
- b.httpMethod = method
- return b
-}
-
-// Produces specifies what MIME types can be produced ; the matched one will appear in the Content-Type Http header.
-func (b *RouteBuilder) Produces(mimeTypes ...string) *RouteBuilder {
- b.produces = mimeTypes
- return b
-}
-
-// Consumes specifies what MIME types can be consumes ; the Accept Http header must matched any of these
-func (b *RouteBuilder) Consumes(mimeTypes ...string) *RouteBuilder {
- b.consumes = mimeTypes
- return b
-}
-
-// Path specifies the relative (w.r.t WebService root path) URL path to match. Default is "/".
-func (b *RouteBuilder) Path(subPath string) *RouteBuilder {
- b.currentPath = subPath
- return b
-}
-
-// Doc tells what this route is all about. Optional.
-func (b *RouteBuilder) Doc(documentation string) *RouteBuilder {
- b.doc = documentation
- return b
-}
-
-// A verbose explanation of the operation behavior. Optional.
-func (b *RouteBuilder) Notes(notes string) *RouteBuilder {
- b.notes = notes
- return b
-}
-
-// Reads tells what resource type will be read from the request payload. Optional.
-// A parameter of type "body" is added ,required is set to true and the dataType is set to the qualified name of the sample's type.
-func (b *RouteBuilder) Reads(sample interface{}) *RouteBuilder {
- b.readSample = sample
- typeAsName := reflect.TypeOf(sample).String()
- bodyParameter := &Parameter{&ParameterData{Name: "body"}}
- bodyParameter.beBody()
- bodyParameter.Required(true)
- bodyParameter.DataType(typeAsName)
- b.Param(bodyParameter)
- return b
-}
-
-// ParameterNamed returns a Parameter already known to the RouteBuilder. Returns nil if not.
-// Use this to modify or extend information for the Parameter (through its Data()).
-func (b RouteBuilder) ParameterNamed(name string) (p *Parameter) {
- for _, each := range b.parameters {
- if each.Data().Name == name {
- return each
- }
- }
- return p
-}
-
-// Writes tells what resource type will be written as the response payload. Optional.
-func (b *RouteBuilder) Writes(sample interface{}) *RouteBuilder {
- b.writeSample = sample
- return b
-}
-
-// Param allows you to document the parameters of the Route. It adds a new Parameter (does not check for duplicates).
-func (b *RouteBuilder) Param(parameter *Parameter) *RouteBuilder {
- if b.parameters == nil {
- b.parameters = []*Parameter{}
- }
- b.parameters = append(b.parameters, parameter)
- return b
-}
-
-// Operation allows you to document what the actual method/function call is of the Route.
-// Unless called, the operation name is derived from the RouteFunction set using To(..).
-func (b *RouteBuilder) Operation(name string) *RouteBuilder {
- b.operation = name
- return b
-}
-
-// ReturnsError is deprecated, use Returns instead.
-func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder {
- log.Print("ReturnsError is deprecated, use Returns instead.")
- return b.Returns(code, message, model)
-}
-
-// Returns allows you to document what responses (errors or regular) can be expected.
-// The model parameter is optional ; either pass a struct instance or use nil if not applicable.
-func (b *RouteBuilder) Returns(code int, message string, model interface{}) *RouteBuilder {
- err := ResponseError{
- Code: code,
- Message: message,
- Model: model,
- }
- // lazy init because there is no NewRouteBuilder (yet)
- if b.errorMap == nil {
- b.errorMap = map[int]ResponseError{}
- }
- b.errorMap[code] = err
- return b
-}
-
-type ResponseError struct {
- Code int
- Message string
- Model interface{}
-}
-
-func (b *RouteBuilder) servicePath(path string) *RouteBuilder {
- b.rootPath = path
- return b
-}
-
-// Filter appends a FilterFunction to the end of filters for this Route to build.
-func (b *RouteBuilder) Filter(filter FilterFunction) *RouteBuilder {
- b.filters = append(b.filters, filter)
- return b
-}
-
-// If no specific Route path then set to rootPath
-// If no specific Produces then set to rootProduces
-// If no specific Consumes then set to rootConsumes
-func (b *RouteBuilder) copyDefaults(rootProduces, rootConsumes []string) {
- if len(b.produces) == 0 {
- b.produces = rootProduces
- }
- if len(b.consumes) == 0 {
- b.consumes = rootConsumes
- }
-}
-
-// Build creates a new Route using the specification details collected by the RouteBuilder
-func (b *RouteBuilder) Build() Route {
- pathExpr, err := newPathExpression(b.currentPath)
- if err != nil {
- log.Printf("[restful] Invalid path:%s because:%v", b.currentPath, err)
- os.Exit(1)
- }
- if b.function == nil {
- log.Printf("[restful] No function specified for route:" + b.currentPath)
- os.Exit(1)
- }
- operationName := b.operation
- if len(operationName) == 0 && b.function != nil {
- // extract from definition
- operationName = nameOfFunction(b.function)
- }
- route := Route{
- Method: b.httpMethod,
- Path: concatPath(b.rootPath, b.currentPath),
- Produces: b.produces,
- Consumes: b.consumes,
- Function: b.function,
- Filters: b.filters,
- relativePath: b.currentPath,
- pathExpr: pathExpr,
- Doc: b.doc,
- Notes: b.notes,
- Operation: operationName,
- ParameterDocs: b.parameters,
- ResponseErrors: b.errorMap,
- ReadSample: b.readSample,
- WriteSample: b.writeSample}
- route.postBuild()
- return route
-}
-
-func concatPath(path1, path2 string) string {
- return strings.TrimRight(path1, "/") + "/" + strings.TrimLeft(path2, "/")
-}
-
-// nameOfFunction returns the short name of the function f for documentation.
-// It uses a runtime feature for debugging ; its value may change for later Go versions.
-func nameOfFunction(f interface{}) string {
- fun := runtime.FuncForPC(reflect.ValueOf(f).Pointer())
- tokenized := strings.Split(fun.Name(), ".")
- last := tokenized[len(tokenized)-1]
- last = strings.TrimSuffix(last, ")·fm") // < Go 1.5
- last = strings.TrimSuffix(last, ")-fm") // Go 1.5
- last = strings.TrimSuffix(last, "·fm") // < Go 1.5
- last = strings.TrimSuffix(last, "-fm") // Go 1.5
- return last
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/router.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/router.go
deleted file mode 100644
index 9b32fb675..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/router.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import "net/http"
-
-// A RouteSelector finds the best matching Route given the input HTTP Request
-type RouteSelector interface {
-
- // SelectRoute finds a Route given the input HTTP Request and a list of WebServices.
- // It returns a selected Route and its containing WebService or an error indicating
- // a problem.
- SelectRoute(
- webServices []*WebService,
- httpRequest *http.Request) (selectedService *WebService, selected *Route, err error)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/service_error.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/service_error.go
deleted file mode 100644
index 62d1108bb..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/service_error.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import "fmt"
-
-// ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request.
-type ServiceError struct {
- Code int
- Message string
-}
-
-// NewError returns a ServiceError using the code and reason
-func NewError(code int, message string) ServiceError {
- return ServiceError{Code: code, Message: message}
-}
-
-// Error returns a text representation of the service error
-func (s ServiceError) Error() string {
- return fmt.Sprintf("[ServiceError:%v] %v", s.Code, s.Message)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/CHANGES.md b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/CHANGES.md
deleted file mode 100644
index 736f6f37c..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/CHANGES.md
+++ /dev/null
@@ -1,43 +0,0 @@
-Change history of swagger
-=
-2015-10-16
-- add type override mechanism for swagger models (MR 254, nathanejohnson)
-- replace uses of wildcard in generated apidocs (issue 251)
-
-2015-05-25
-- (api break) changed the type of Properties in Model
-- (api break) changed the type of Models in ApiDeclaration
-- (api break) changed the parameter type of PostBuildDeclarationMapFunc
-
-2015-04-09
-- add ModelBuildable interface for customization of Model
-
-2015-03-17
-- preserve order of Routes per WebService in Swagger listing
-- fix use of $ref and type in Swagger models
-- add api version to listing
-
-2014-11-14
-- operation parameters are now sorted using ordering path,query,form,header,body
-
-2014-11-12
-- respect omitempty tag value for embedded structs
-- expose ApiVersion of WebService to Swagger ApiDeclaration
-
-2014-05-29
-- (api add) Ability to define custom http.Handler to serve swagger-ui static files
-
-2014-05-04
-- (fix) include model for array element type of response
-
-2014-01-03
-- (fix) do not add primitive type to the Api models
-
-2013-11-27
-- (fix) make Swagger work for WebServices with root ("/" or "") paths
-
-2013-10-29
-- (api add) package variable LogInfo to customize logging function
-
-2013-10-15
-- upgraded to spec version 1.2 (https://github.com/wordnik/swagger-core/wiki/1.2-transition)
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/README.md b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/README.md
deleted file mode 100644
index 6c27c3070..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-How to use Swagger UI with go-restful
-=
-
-Get the Swagger UI sources (version 1.2 only)
-
- git clone https://github.com/wordnik/swagger-ui.git
-
-The project contains a "dist" folder.
-Its contents has all the Swagger UI files you need.
-
-The `index.html` has an `url` set to `http://petstore.swagger.wordnik.com/api/api-docs`.
-You need to change that to match your WebService JSON endpoint e.g. `http://localhost:8080/apidocs.json`
-
-Now, you can install the Swagger WebService for serving the Swagger specification in JSON.
-
- config := swagger.Config{
- WebServices: restful.RegisteredWebServices(),
- ApiPath: "/apidocs.json",
- SwaggerPath: "/apidocs/",
- SwaggerFilePath: "/Users/emicklei/Projects/swagger-ui/dist"}
- swagger.InstallSwaggerService(config)
-
-
-Documenting Structs
---
-
-Currently there are 2 ways to document your structs in the go-restful Swagger.
-
-###### By using struct tags
-- Use tag "description" to annotate a struct field with a description to show in the UI
-- Use tag "modelDescription" to annotate the struct itself with a description to show in the UI. The tag can be added in an field of the struct and in case that there are multiple definition, they will be appended with an empty line.
-
-###### By using the SwaggerDoc method
-Here is an example with an `Address` struct and the documentation for each of the fields. The `""` is a special entry for **documenting the struct itself**.
-
- type Address struct {
- Country string `json:"country,omitempty"`
- PostCode int `json:"postcode,omitempty"`
- }
-
- func (Address) SwaggerDoc() map[string]string {
- return map[string]string{
- "": "Address doc",
- "country": "Country doc",
- "postcode": "PostCode doc",
- }
- }
-
-This example will generate a JSON like this
-
- {
- "Address": {
- "id": "Address",
- "description": "Address doc",
- "properties": {
- "country": {
- "type": "string",
- "description": "Country doc"
- },
- "postcode": {
- "type": "integer",
- "format": "int32",
- "description": "PostCode doc"
- }
- }
- }
- }
-
-**Very Important Notes:**
-- `SwaggerDoc()` is using a **NON-Pointer** receiver (e.g. func (Address) and not func (*Address))
-- The returned map should use as key the name of the field as defined in the JSON parameter (e.g. `"postcode"` and not `"PostCode"`)
-
-Notes
---
-- The Nickname of an Operation is automatically set by finding the name of the function. You can override it using RouteBuilder.Operation(..)
-- The WebServices field of swagger.Config can be used to control which service you want to expose and document ; you can have multiple configs and therefore multiple endpoints.
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/api_declaration_list.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/api_declaration_list.go
deleted file mode 100644
index 9f4c3690a..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/api_declaration_list.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package swagger
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "encoding/json"
-)
-
-// ApiDeclarationList maintains an ordered list of ApiDeclaration.
-type ApiDeclarationList struct {
- List []ApiDeclaration
-}
-
-// At returns the ApiDeclaration by its path unless absent, then ok is false
-func (l *ApiDeclarationList) At(path string) (a ApiDeclaration, ok bool) {
- for _, each := range l.List {
- if each.ResourcePath == path {
- return each, true
- }
- }
- return a, false
-}
-
-// Put adds or replaces a ApiDeclaration with this name
-func (l *ApiDeclarationList) Put(path string, a ApiDeclaration) {
- // maybe replace existing
- for i, each := range l.List {
- if each.ResourcePath == path {
- // replace
- l.List[i] = a
- return
- }
- }
- // add
- l.List = append(l.List, a)
-}
-
-// Do enumerates all the properties, each with its assigned name
-func (l *ApiDeclarationList) Do(block func(path string, decl ApiDeclaration)) {
- for _, each := range l.List {
- block(each.ResourcePath, each)
- }
-}
-
-// MarshalJSON writes the ModelPropertyList as if it was a map[string]ModelProperty
-func (l ApiDeclarationList) MarshalJSON() ([]byte, error) {
- var buf bytes.Buffer
- encoder := json.NewEncoder(&buf)
- buf.WriteString("{\n")
- for i, each := range l.List {
- buf.WriteString("\"")
- buf.WriteString(each.ResourcePath)
- buf.WriteString("\": ")
- encoder.Encode(each)
- if i < len(l.List)-1 {
- buf.WriteString(",\n")
- }
- }
- buf.WriteString("}")
- return buf.Bytes(), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/config.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/config.go
deleted file mode 100644
index 18f8e57d9..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/config.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package swagger
-
-import (
- "net/http"
- "reflect"
-
- "github.com/emicklei/go-restful"
-)
-
-// PostBuildDeclarationMapFunc can be used to modify the api declaration map.
-type PostBuildDeclarationMapFunc func(apiDeclarationMap *ApiDeclarationList)
-
-// MapSchemaFormatFunc can be used to modify typeName at definition time.
-type MapSchemaFormatFunc func(typeName string) string
-
-// MapModelTypeNameFunc can be used to return the desired typeName for a given
-// type. It will return false if the default name should be used.
-type MapModelTypeNameFunc func(t reflect.Type) (string, bool)
-
-type Config struct {
- // url where the services are available, e.g. http://localhost:8080
- // if left empty then the basePath of Swagger is taken from the actual request
- WebServicesUrl string
- // path where the JSON api is avaiable , e.g. /apidocs
- ApiPath string
- // [optional] path where the swagger UI will be served, e.g. /swagger
- SwaggerPath string
- // [optional] location of folder containing Swagger HTML5 application index.html
- SwaggerFilePath string
- // api listing is constructed from this list of restful WebServices.
- WebServices []*restful.WebService
- // will serve all static content (scripts,pages,images)
- StaticHandler http.Handler
- // [optional] on default CORS (Cross-Origin-Resource-Sharing) is enabled.
- DisableCORS bool
- // Top-level API version. Is reflected in the resource listing.
- ApiVersion string
- // If set then call this handler after building the complete ApiDeclaration Map
- PostBuildHandler PostBuildDeclarationMapFunc
- // Swagger global info struct
- Info Info
- // [optional] If set, model builder should call this handler to get addition typename-to-swagger-format-field conversion.
- SchemaFormatHandler MapSchemaFormatFunc
- // [optional] If set, model builder should call this handler to retrieve the name for a given type.
- ModelTypeNameHandler MapModelTypeNameFunc
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_builder.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_builder.go
deleted file mode 100644
index d40786f25..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_builder.go
+++ /dev/null
@@ -1,467 +0,0 @@
-package swagger
-
-import (
- "encoding/json"
- "reflect"
- "strings"
-)
-
-// ModelBuildable is used for extending Structs that need more control over
-// how the Model appears in the Swagger api declaration.
-type ModelBuildable interface {
- PostBuildModel(m *Model) *Model
-}
-
-type modelBuilder struct {
- Models *ModelList
- Config *Config
-}
-
-type documentable interface {
- SwaggerDoc() map[string]string
-}
-
-// Check if this structure has a method with signature func () SwaggerDoc() map[string]string
-// If it exists, retrive the documentation and overwrite all struct tag descriptions
-func getDocFromMethodSwaggerDoc2(model reflect.Type) map[string]string {
- if docable, ok := reflect.New(model).Elem().Interface().(documentable); ok {
- return docable.SwaggerDoc()
- }
- return make(map[string]string)
-}
-
-// addModelFrom creates and adds a Model to the builder and detects and calls
-// the post build hook for customizations
-func (b modelBuilder) addModelFrom(sample interface{}) {
- if modelOrNil := b.addModel(reflect.TypeOf(sample), ""); modelOrNil != nil {
- // allow customizations
- if buildable, ok := sample.(ModelBuildable); ok {
- modelOrNil = buildable.PostBuildModel(modelOrNil)
- b.Models.Put(modelOrNil.Id, *modelOrNil)
- }
- }
-}
-
-func (b modelBuilder) addModel(st reflect.Type, nameOverride string) *Model {
- // Turn pointers into simpler types so further checks are
- // correct.
- if st.Kind() == reflect.Ptr {
- st = st.Elem()
- }
-
- modelName := b.keyFrom(st)
- if nameOverride != "" {
- modelName = nameOverride
- }
- // no models needed for primitive types
- if b.isPrimitiveType(modelName) {
- return nil
- }
- // golang encoding/json packages says array and slice values encode as
- // JSON arrays, except that []byte encodes as a base64-encoded string.
- // If we see a []byte here, treat it at as a primitive type (string)
- // and deal with it in buildArrayTypeProperty.
- if (st.Kind() == reflect.Slice || st.Kind() == reflect.Array) &&
- st.Elem().Kind() == reflect.Uint8 {
- return nil
- }
- // see if we already have visited this model
- if _, ok := b.Models.At(modelName); ok {
- return nil
- }
- sm := Model{
- Id: modelName,
- Required: []string{},
- Properties: ModelPropertyList{}}
-
- // reference the model before further initializing (enables recursive structs)
- b.Models.Put(modelName, sm)
-
- // check for slice or array
- if st.Kind() == reflect.Slice || st.Kind() == reflect.Array {
- b.addModel(st.Elem(), "")
- return &sm
- }
- // check for structure or primitive type
- if st.Kind() != reflect.Struct {
- return &sm
- }
-
- fullDoc := getDocFromMethodSwaggerDoc2(st)
- modelDescriptions := []string{}
-
- for i := 0; i < st.NumField(); i++ {
- field := st.Field(i)
- jsonName, modelDescription, prop := b.buildProperty(field, &sm, modelName)
- if len(modelDescription) > 0 {
- modelDescriptions = append(modelDescriptions, modelDescription)
- }
-
- // add if not omitted
- if len(jsonName) != 0 {
- // update description
- if fieldDoc, ok := fullDoc[jsonName]; ok {
- prop.Description = fieldDoc
- }
- // update Required
- if b.isPropertyRequired(field) {
- sm.Required = append(sm.Required, jsonName)
- }
- sm.Properties.Put(jsonName, prop)
- }
- }
-
- // We always overwrite documentation if SwaggerDoc method exists
- // "" is special for documenting the struct itself
- if modelDoc, ok := fullDoc[""]; ok {
- sm.Description = modelDoc
- } else if len(modelDescriptions) != 0 {
- sm.Description = strings.Join(modelDescriptions, "\n")
- }
-
- // update model builder with completed model
- b.Models.Put(modelName, sm)
-
- return &sm
-}
-
-func (b modelBuilder) isPropertyRequired(field reflect.StructField) bool {
- required := true
- if jsonTag := field.Tag.Get("json"); jsonTag != "" {
- s := strings.Split(jsonTag, ",")
- if len(s) > 1 && s[1] == "omitempty" {
- return false
- }
- }
- return required
-}
-
-func (b modelBuilder) buildProperty(field reflect.StructField, model *Model, modelName string) (jsonName, modelDescription string, prop ModelProperty) {
- jsonName = b.jsonNameOfField(field)
- if len(jsonName) == 0 {
- // empty name signals skip property
- return "", "", prop
- }
-
- if field.Name == "XMLName" && field.Type.String() == "xml.Name" {
- // property is metadata for the xml.Name attribute, can be skipped
- return "", "", prop
- }
-
- if tag := field.Tag.Get("modelDescription"); tag != "" {
- modelDescription = tag
- }
-
- prop.setPropertyMetadata(field)
- if prop.Type != nil {
- return jsonName, modelDescription, prop
- }
- fieldType := field.Type
-
- // check if type is doing its own marshalling
- marshalerType := reflect.TypeOf((*json.Marshaler)(nil)).Elem()
- if fieldType.Implements(marshalerType) {
- var pType = "string"
- if prop.Type == nil {
- prop.Type = &pType
- }
- if prop.Format == "" {
- prop.Format = b.jsonSchemaFormat(b.keyFrom(fieldType))
- }
- return jsonName, modelDescription, prop
- }
-
- // check if annotation says it is a string
- if jsonTag := field.Tag.Get("json"); jsonTag != "" {
- s := strings.Split(jsonTag, ",")
- if len(s) > 1 && s[1] == "string" {
- stringt := "string"
- prop.Type = &stringt
- return jsonName, modelDescription, prop
- }
- }
-
- fieldKind := fieldType.Kind()
- switch {
- case fieldKind == reflect.Struct:
- jsonName, prop := b.buildStructTypeProperty(field, jsonName, model)
- return jsonName, modelDescription, prop
- case fieldKind == reflect.Slice || fieldKind == reflect.Array:
- jsonName, prop := b.buildArrayTypeProperty(field, jsonName, modelName)
- return jsonName, modelDescription, prop
- case fieldKind == reflect.Ptr:
- jsonName, prop := b.buildPointerTypeProperty(field, jsonName, modelName)
- return jsonName, modelDescription, prop
- case fieldKind == reflect.String:
- stringt := "string"
- prop.Type = &stringt
- return jsonName, modelDescription, prop
- case fieldKind == reflect.Map:
- // if it's a map, it's unstructured, and swagger 1.2 can't handle it
- objectType := "object"
- prop.Type = &objectType
- return jsonName, modelDescription, prop
- }
-
- fieldTypeName := b.keyFrom(fieldType)
- if b.isPrimitiveType(fieldTypeName) {
- mapped := b.jsonSchemaType(fieldTypeName)
- prop.Type = &mapped
- prop.Format = b.jsonSchemaFormat(fieldTypeName)
- return jsonName, modelDescription, prop
- }
- modelType := b.keyFrom(fieldType)
- prop.Ref = &modelType
-
- if fieldType.Name() == "" { // override type of anonymous structs
- nestedTypeName := modelName + "." + jsonName
- prop.Ref = &nestedTypeName
- b.addModel(fieldType, nestedTypeName)
- }
- return jsonName, modelDescription, prop
-}
-
-func hasNamedJSONTag(field reflect.StructField) bool {
- parts := strings.Split(field.Tag.Get("json"), ",")
- if len(parts) == 0 {
- return false
- }
- for _, s := range parts[1:] {
- if s == "inline" {
- return false
- }
- }
- return len(parts[0]) > 0
-}
-
-func (b modelBuilder) buildStructTypeProperty(field reflect.StructField, jsonName string, model *Model) (nameJson string, prop ModelProperty) {
- prop.setPropertyMetadata(field)
- // Check for type override in tag
- if prop.Type != nil {
- return jsonName, prop
- }
- fieldType := field.Type
- // check for anonymous
- if len(fieldType.Name()) == 0 {
- // anonymous
- anonType := model.Id + "." + jsonName
- b.addModel(fieldType, anonType)
- prop.Ref = &anonType
- return jsonName, prop
- }
-
- if field.Name == fieldType.Name() && field.Anonymous && !hasNamedJSONTag(field) {
- // embedded struct
- sub := modelBuilder{new(ModelList), b.Config}
- sub.addModel(fieldType, "")
- subKey := sub.keyFrom(fieldType)
- // merge properties from sub
- subModel, _ := sub.Models.At(subKey)
- subModel.Properties.Do(func(k string, v ModelProperty) {
- model.Properties.Put(k, v)
- // if subModel says this property is required then include it
- required := false
- for _, each := range subModel.Required {
- if k == each {
- required = true
- break
- }
- }
- if required {
- model.Required = append(model.Required, k)
- }
- })
- // add all new referenced models
- sub.Models.Do(func(key string, sub Model) {
- if key != subKey {
- if _, ok := b.Models.At(key); !ok {
- b.Models.Put(key, sub)
- }
- }
- })
- // empty name signals skip property
- return "", prop
- }
- // simple struct
- b.addModel(fieldType, "")
- var pType = b.keyFrom(fieldType)
- prop.Ref = &pType
- return jsonName, prop
-}
-
-func (b modelBuilder) buildArrayTypeProperty(field reflect.StructField, jsonName, modelName string) (nameJson string, prop ModelProperty) {
- // check for type override in tags
- prop.setPropertyMetadata(field)
- if prop.Type != nil {
- return jsonName, prop
- }
- fieldType := field.Type
- if fieldType.Elem().Kind() == reflect.Uint8 {
- stringt := "string"
- prop.Type = &stringt
- return jsonName, prop
- }
- var pType = "array"
- prop.Type = &pType
- isPrimitive := b.isPrimitiveType(fieldType.Elem().Name())
- elemTypeName := b.getElementTypeName(modelName, jsonName, fieldType.Elem())
- prop.Items = new(Item)
- if isPrimitive {
- mapped := b.jsonSchemaType(elemTypeName)
- prop.Items.Type = &mapped
- } else {
- prop.Items.Ref = &elemTypeName
- }
- // add|overwrite model for element type
- if fieldType.Elem().Kind() == reflect.Ptr {
- fieldType = fieldType.Elem()
- }
- if !isPrimitive {
- b.addModel(fieldType.Elem(), elemTypeName)
- }
- return jsonName, prop
-}
-
-func (b modelBuilder) buildPointerTypeProperty(field reflect.StructField, jsonName, modelName string) (nameJson string, prop ModelProperty) {
- prop.setPropertyMetadata(field)
- // Check for type override in tags
- if prop.Type != nil {
- return jsonName, prop
- }
- fieldType := field.Type
-
- // override type of pointer to list-likes
- if fieldType.Elem().Kind() == reflect.Slice || fieldType.Elem().Kind() == reflect.Array {
- var pType = "array"
- prop.Type = &pType
- isPrimitive := b.isPrimitiveType(fieldType.Elem().Elem().Name())
- elemName := b.getElementTypeName(modelName, jsonName, fieldType.Elem().Elem())
- if isPrimitive {
- primName := b.jsonSchemaType(elemName)
- prop.Items = &Item{Ref: &primName}
- } else {
- prop.Items = &Item{Ref: &elemName}
- }
- if !isPrimitive {
- // add|overwrite model for element type
- b.addModel(fieldType.Elem().Elem(), elemName)
- }
- } else {
- // non-array, pointer type
- fieldTypeName := b.keyFrom(fieldType.Elem())
- var pType = b.jsonSchemaType(fieldTypeName) // no star, include pkg path
- if b.isPrimitiveType(fieldTypeName) {
- prop.Type = &pType
- prop.Format = b.jsonSchemaFormat(fieldTypeName)
- return jsonName, prop
- }
- prop.Ref = &pType
- elemName := ""
- if fieldType.Elem().Name() == "" {
- elemName = modelName + "." + jsonName
- prop.Ref = &elemName
- }
- b.addModel(fieldType.Elem(), elemName)
- }
- return jsonName, prop
-}
-
-func (b modelBuilder) getElementTypeName(modelName, jsonName string, t reflect.Type) string {
- if t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- if t.Name() == "" {
- return modelName + "." + jsonName
- }
- return b.keyFrom(t)
-}
-
-func (b modelBuilder) keyFrom(st reflect.Type) string {
- key := st.String()
- if b.Config != nil && b.Config.ModelTypeNameHandler != nil {
- if name, ok := b.Config.ModelTypeNameHandler(st); ok {
- key = name
- }
- }
- if len(st.Name()) == 0 { // unnamed type
- // Swagger UI has special meaning for [
- key = strings.Replace(key, "[]", "||", -1)
- }
- return key
-}
-
-// see also https://golang.org/ref/spec#Numeric_types
-func (b modelBuilder) isPrimitiveType(modelName string) bool {
- if len(modelName) == 0 {
- return false
- }
- return strings.Contains("uint uint8 uint16 uint32 uint64 int int8 int16 int32 int64 float32 float64 bool string byte rune time.Time", modelName)
-}
-
-// jsonNameOfField returns the name of the field as it should appear in JSON format
-// An empty string indicates that this field is not part of the JSON representation
-func (b modelBuilder) jsonNameOfField(field reflect.StructField) string {
- if jsonTag := field.Tag.Get("json"); jsonTag != "" {
- s := strings.Split(jsonTag, ",")
- if s[0] == "-" {
- // empty name signals skip property
- return ""
- } else if s[0] != "" {
- return s[0]
- }
- }
- return field.Name
-}
-
-// see also http://json-schema.org/latest/json-schema-core.html#anchor8
-func (b modelBuilder) jsonSchemaType(modelName string) string {
- schemaMap := map[string]string{
- "uint": "integer",
- "uint8": "integer",
- "uint16": "integer",
- "uint32": "integer",
- "uint64": "integer",
-
- "int": "integer",
- "int8": "integer",
- "int16": "integer",
- "int32": "integer",
- "int64": "integer",
-
- "byte": "integer",
- "float64": "number",
- "float32": "number",
- "bool": "boolean",
- "time.Time": "string",
- }
- mapped, ok := schemaMap[modelName]
- if !ok {
- return modelName // use as is (custom or struct)
- }
- return mapped
-}
-
-func (b modelBuilder) jsonSchemaFormat(modelName string) string {
- if b.Config != nil && b.Config.SchemaFormatHandler != nil {
- if mapped := b.Config.SchemaFormatHandler(modelName); mapped != "" {
- return mapped
- }
- }
- schemaMap := map[string]string{
- "int": "int32",
- "int32": "int32",
- "int64": "int64",
- "byte": "byte",
- "uint": "integer",
- "uint8": "byte",
- "float64": "double",
- "float32": "float",
- "time.Time": "date-time",
- "*time.Time": "date-time",
- }
- mapped, ok := schemaMap[modelName]
- if !ok {
- return "" // no format
- }
- return mapped
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_list.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_list.go
deleted file mode 100644
index 9bb6cb678..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_list.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package swagger
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "encoding/json"
-)
-
-// NamedModel associates a name with a Model (not using its Id)
-type NamedModel struct {
- Name string
- Model Model
-}
-
-// ModelList encapsulates a list of NamedModel (association)
-type ModelList struct {
- List []NamedModel
-}
-
-// Put adds or replaces a Model by its name
-func (l *ModelList) Put(name string, model Model) {
- for i, each := range l.List {
- if each.Name == name {
- // replace
- l.List[i] = NamedModel{name, model}
- return
- }
- }
- // add
- l.List = append(l.List, NamedModel{name, model})
-}
-
-// At returns a Model by its name, ok is false if absent
-func (l *ModelList) At(name string) (m Model, ok bool) {
- for _, each := range l.List {
- if each.Name == name {
- return each.Model, true
- }
- }
- return m, false
-}
-
-// Do enumerates all the models, each with its assigned name
-func (l *ModelList) Do(block func(name string, value Model)) {
- for _, each := range l.List {
- block(each.Name, each.Model)
- }
-}
-
-// MarshalJSON writes the ModelList as if it was a map[string]Model
-func (l ModelList) MarshalJSON() ([]byte, error) {
- var buf bytes.Buffer
- encoder := json.NewEncoder(&buf)
- buf.WriteString("{\n")
- for i, each := range l.List {
- buf.WriteString("\"")
- buf.WriteString(each.Name)
- buf.WriteString("\": ")
- encoder.Encode(each.Model)
- if i < len(l.List)-1 {
- buf.WriteString(",\n")
- }
- }
- buf.WriteString("}")
- return buf.Bytes(), nil
-}
-
-// UnmarshalJSON reads back a ModelList. This is an expensive operation.
-func (l *ModelList) UnmarshalJSON(data []byte) error {
- raw := map[string]interface{}{}
- json.NewDecoder(bytes.NewReader(data)).Decode(&raw)
- for k, v := range raw {
- // produces JSON bytes for each value
- data, err := json.Marshal(v)
- if err != nil {
- return err
- }
- var m Model
- json.NewDecoder(bytes.NewReader(data)).Decode(&m)
- l.Put(k, m)
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_ext.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_ext.go
deleted file mode 100644
index a433b6b70..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_ext.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package swagger
-
-import (
- "reflect"
- "strings"
-)
-
-func (prop *ModelProperty) setDescription(field reflect.StructField) {
- if tag := field.Tag.Get("description"); tag != "" {
- prop.Description = tag
- }
-}
-
-func (prop *ModelProperty) setDefaultValue(field reflect.StructField) {
- if tag := field.Tag.Get("default"); tag != "" {
- prop.DefaultValue = Special(tag)
- }
-}
-
-func (prop *ModelProperty) setEnumValues(field reflect.StructField) {
- // We use | to separate the enum values. This value is chosen
- // since its unlikely to be useful in actual enumeration values.
- if tag := field.Tag.Get("enum"); tag != "" {
- prop.Enum = strings.Split(tag, "|")
- }
-}
-
-func (prop *ModelProperty) setMaximum(field reflect.StructField) {
- if tag := field.Tag.Get("maximum"); tag != "" {
- prop.Maximum = tag
- }
-}
-
-func (prop *ModelProperty) setType(field reflect.StructField) {
- if tag := field.Tag.Get("type"); tag != "" {
- // Check if the first two characters of the type tag are
- // intended to emulate slice/array behaviour.
- //
- // If type is intended to be a slice/array then add the
- // overriden type to the array item instead of the main property
- if len(tag) > 2 && tag[0:2] == "[]" {
- pType := "array"
- prop.Type = &pType
- prop.Items = new(Item)
-
- iType := tag[2:]
- prop.Items.Type = &iType
- return
- }
-
- prop.Type = &tag
- }
-}
-
-func (prop *ModelProperty) setMinimum(field reflect.StructField) {
- if tag := field.Tag.Get("minimum"); tag != "" {
- prop.Minimum = tag
- }
-}
-
-func (prop *ModelProperty) setUniqueItems(field reflect.StructField) {
- tag := field.Tag.Get("unique")
- switch tag {
- case "true":
- v := true
- prop.UniqueItems = &v
- case "false":
- v := false
- prop.UniqueItems = &v
- }
-}
-
-func (prop *ModelProperty) setPropertyMetadata(field reflect.StructField) {
- prop.setDescription(field)
- prop.setEnumValues(field)
- prop.setMinimum(field)
- prop.setMaximum(field)
- prop.setUniqueItems(field)
- prop.setDefaultValue(field)
- prop.setType(field)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_list.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_list.go
deleted file mode 100644
index 3babb1944..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/model_property_list.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package swagger
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "bytes"
- "encoding/json"
-)
-
-// NamedModelProperty associates a name to a ModelProperty
-type NamedModelProperty struct {
- Name string
- Property ModelProperty
-}
-
-// ModelPropertyList encapsulates a list of NamedModelProperty (association)
-type ModelPropertyList struct {
- List []NamedModelProperty
-}
-
-// At returns the ModelPropety by its name unless absent, then ok is false
-func (l *ModelPropertyList) At(name string) (p ModelProperty, ok bool) {
- for _, each := range l.List {
- if each.Name == name {
- return each.Property, true
- }
- }
- return p, false
-}
-
-// Put adds or replaces a ModelProperty with this name
-func (l *ModelPropertyList) Put(name string, prop ModelProperty) {
- // maybe replace existing
- for i, each := range l.List {
- if each.Name == name {
- // replace
- l.List[i] = NamedModelProperty{Name: name, Property: prop}
- return
- }
- }
- // add
- l.List = append(l.List, NamedModelProperty{Name: name, Property: prop})
-}
-
-// Do enumerates all the properties, each with its assigned name
-func (l *ModelPropertyList) Do(block func(name string, value ModelProperty)) {
- for _, each := range l.List {
- block(each.Name, each.Property)
- }
-}
-
-// MarshalJSON writes the ModelPropertyList as if it was a map[string]ModelProperty
-func (l ModelPropertyList) MarshalJSON() ([]byte, error) {
- var buf bytes.Buffer
- encoder := json.NewEncoder(&buf)
- buf.WriteString("{\n")
- for i, each := range l.List {
- buf.WriteString("\"")
- buf.WriteString(each.Name)
- buf.WriteString("\": ")
- encoder.Encode(each.Property)
- if i < len(l.List)-1 {
- buf.WriteString(",\n")
- }
- }
- buf.WriteString("}")
- return buf.Bytes(), nil
-}
-
-// UnmarshalJSON reads back a ModelPropertyList. This is an expensive operation.
-func (l *ModelPropertyList) UnmarshalJSON(data []byte) error {
- raw := map[string]interface{}{}
- json.NewDecoder(bytes.NewReader(data)).Decode(&raw)
- for k, v := range raw {
- // produces JSON bytes for each value
- data, err := json.Marshal(v)
- if err != nil {
- return err
- }
- var m ModelProperty
- json.NewDecoder(bytes.NewReader(data)).Decode(&m)
- l.Put(k, m)
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/ordered_route_map.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/ordered_route_map.go
deleted file mode 100644
index b33ccfbeb..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/ordered_route_map.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package swagger
-
-// Copyright 2015 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import "github.com/emicklei/go-restful"
-
-type orderedRouteMap struct {
- elements map[string][]restful.Route
- keys []string
-}
-
-func newOrderedRouteMap() *orderedRouteMap {
- return &orderedRouteMap{
- elements: map[string][]restful.Route{},
- keys: []string{},
- }
-}
-
-func (o *orderedRouteMap) Add(key string, route restful.Route) {
- routes, ok := o.elements[key]
- if ok {
- routes = append(routes, route)
- o.elements[key] = routes
- return
- }
- o.elements[key] = []restful.Route{route}
- o.keys = append(o.keys, key)
-}
-
-func (o *orderedRouteMap) Do(block func(key string, routes []restful.Route)) {
- for _, k := range o.keys {
- block(k, o.elements[k])
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger.go
deleted file mode 100644
index 9c40833e7..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger.go
+++ /dev/null
@@ -1,185 +0,0 @@
-// Package swagger implements the structures of the Swagger
-// https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md
-package swagger
-
-const swaggerVersion = "1.2"
-
-// 4.3.3 Data Type Fields
-type DataTypeFields struct {
- Type *string `json:"type,omitempty"` // if Ref not used
- Ref *string `json:"$ref,omitempty"` // if Type not used
- Format string `json:"format,omitempty"`
- DefaultValue Special `json:"defaultValue,omitempty"`
- Enum []string `json:"enum,omitempty"`
- Minimum string `json:"minimum,omitempty"`
- Maximum string `json:"maximum,omitempty"`
- Items *Item `json:"items,omitempty"`
- UniqueItems *bool `json:"uniqueItems,omitempty"`
-}
-
-type Special string
-
-// 4.3.4 Items Object
-type Item struct {
- Type *string `json:"type,omitempty"`
- Ref *string `json:"$ref,omitempty"`
- Format string `json:"format,omitempty"`
-}
-
-// 5.1 Resource Listing
-type ResourceListing struct {
- SwaggerVersion string `json:"swaggerVersion"` // e.g 1.2
- Apis []Resource `json:"apis"`
- ApiVersion string `json:"apiVersion"`
- Info Info `json:"info"`
- Authorizations []Authorization `json:"authorizations,omitempty"`
-}
-
-// 5.1.2 Resource Object
-type Resource struct {
- Path string `json:"path"` // relative or absolute, must start with /
- Description string `json:"description"`
-}
-
-// 5.1.3 Info Object
-type Info struct {
- Title string `json:"title"`
- Description string `json:"description"`
- TermsOfServiceUrl string `json:"termsOfServiceUrl,omitempty"`
- Contact string `json:"contact,omitempty"`
- License string `json:"license,omitempty"`
- LicenseUrl string `json:"licenseUrl,omitempty"`
-}
-
-// 5.1.5
-type Authorization struct {
- Type string `json:"type"`
- PassAs string `json:"passAs"`
- Keyname string `json:"keyname"`
- Scopes []Scope `json:"scopes"`
- GrantTypes []GrantType `json:"grandTypes"`
-}
-
-// 5.1.6, 5.2.11
-type Scope struct {
- // Required. The name of the scope.
- Scope string `json:"scope"`
- // Recommended. A short description of the scope.
- Description string `json:"description"`
-}
-
-// 5.1.7
-type GrantType struct {
- Implicit Implicit `json:"implicit"`
- AuthorizationCode AuthorizationCode `json:"authorization_code"`
-}
-
-// 5.1.8 Implicit Object
-type Implicit struct {
- // Required. The login endpoint definition.
- loginEndpoint LoginEndpoint `json:"loginEndpoint"`
- // An optional alternative name to standard "access_token" OAuth2 parameter.
- TokenName string `json:"tokenName"`
-}
-
-// 5.1.9 Authorization Code Object
-type AuthorizationCode struct {
- TokenRequestEndpoint TokenRequestEndpoint `json:"tokenRequestEndpoint"`
- TokenEndpoint TokenEndpoint `json:"tokenEndpoint"`
-}
-
-// 5.1.10 Login Endpoint Object
-type LoginEndpoint struct {
- // Required. The URL of the authorization endpoint for the implicit grant flow. The value SHOULD be in a URL format.
- Url string `json:"url"`
-}
-
-// 5.1.11 Token Request Endpoint Object
-type TokenRequestEndpoint struct {
- // Required. The URL of the authorization endpoint for the authentication code grant flow. The value SHOULD be in a URL format.
- Url string `json:"url"`
- // An optional alternative name to standard "client_id" OAuth2 parameter.
- ClientIdName string `json:"clientIdName"`
- // An optional alternative name to the standard "client_secret" OAuth2 parameter.
- ClientSecretName string `json:"clientSecretName"`
-}
-
-// 5.1.12 Token Endpoint Object
-type TokenEndpoint struct {
- // Required. The URL of the token endpoint for the authentication code grant flow. The value SHOULD be in a URL format.
- Url string `json:"url"`
- // An optional alternative name to standard "access_token" OAuth2 parameter.
- TokenName string `json:"tokenName"`
-}
-
-// 5.2 API Declaration
-type ApiDeclaration struct {
- SwaggerVersion string `json:"swaggerVersion"`
- ApiVersion string `json:"apiVersion"`
- BasePath string `json:"basePath"`
- ResourcePath string `json:"resourcePath"` // must start with /
- Info Info `json:"info"`
- Apis []Api `json:"apis,omitempty"`
- Models ModelList `json:"models,omitempty"`
- Produces []string `json:"produces,omitempty"`
- Consumes []string `json:"consumes,omitempty"`
- Authorizations []Authorization `json:"authorizations,omitempty"`
-}
-
-// 5.2.2 API Object
-type Api struct {
- Path string `json:"path"` // relative or absolute, must start with /
- Description string `json:"description"`
- Operations []Operation `json:"operations,omitempty"`
-}
-
-// 5.2.3 Operation Object
-type Operation struct {
- DataTypeFields
- Method string `json:"method"`
- Summary string `json:"summary,omitempty"`
- Notes string `json:"notes,omitempty"`
- Nickname string `json:"nickname"`
- Authorizations []Authorization `json:"authorizations,omitempty"`
- Parameters []Parameter `json:"parameters"`
- ResponseMessages []ResponseMessage `json:"responseMessages,omitempty"` // optional
- Produces []string `json:"produces,omitempty"`
- Consumes []string `json:"consumes,omitempty"`
- Deprecated string `json:"deprecated,omitempty"`
-}
-
-// 5.2.4 Parameter Object
-type Parameter struct {
- DataTypeFields
- ParamType string `json:"paramType"` // path,query,body,header,form
- Name string `json:"name"`
- Description string `json:"description"`
- Required bool `json:"required"`
- AllowMultiple bool `json:"allowMultiple"`
-}
-
-// 5.2.5 Response Message Object
-type ResponseMessage struct {
- Code int `json:"code"`
- Message string `json:"message"`
- ResponseModel string `json:"responseModel,omitempty"`
-}
-
-// 5.2.6, 5.2.7 Models Object
-type Model struct {
- Id string `json:"id"`
- Description string `json:"description,omitempty"`
- Required []string `json:"required,omitempty"`
- Properties ModelPropertyList `json:"properties"`
- SubTypes []string `json:"subTypes,omitempty"`
- Discriminator string `json:"discriminator,omitempty"`
-}
-
-// 5.2.8 Properties Object
-type ModelProperty struct {
- DataTypeFields
- Description string `json:"description,omitempty"`
-}
-
-// 5.2.10
-type Authorizations map[string]Authorization
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_builder.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_builder.go
deleted file mode 100644
index 05a3c7e76..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_builder.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package swagger
-
-type SwaggerBuilder struct {
- SwaggerService
-}
-
-func NewSwaggerBuilder(config Config) *SwaggerBuilder {
- return &SwaggerBuilder{*newSwaggerService(config)}
-}
-
-func (sb SwaggerBuilder) ProduceListing() ResourceListing {
- return sb.SwaggerService.produceListing()
-}
-
-func (sb SwaggerBuilder) ProduceAllDeclarations() map[string]ApiDeclaration {
- return sb.SwaggerService.produceAllDeclarations()
-}
-
-func (sb SwaggerBuilder) ProduceDeclarations(route string) (*ApiDeclaration, bool) {
- return sb.SwaggerService.produceDeclarations(route)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_webservice.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_webservice.go
deleted file mode 100644
index f12b6b107..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/swagger/swagger_webservice.go
+++ /dev/null
@@ -1,440 +0,0 @@
-package swagger
-
-import (
- "fmt"
-
- "github.com/emicklei/go-restful"
- // "github.com/emicklei/hopwatch"
- "net/http"
- "reflect"
- "sort"
- "strings"
-
- "github.com/emicklei/go-restful/log"
-)
-
-type SwaggerService struct {
- config Config
- apiDeclarationMap *ApiDeclarationList
-}
-
-func newSwaggerService(config Config) *SwaggerService {
- sws := &SwaggerService{
- config: config,
- apiDeclarationMap: new(ApiDeclarationList)}
-
- // Build all ApiDeclarations
- for _, each := range config.WebServices {
- rootPath := each.RootPath()
- // skip the api service itself
- if rootPath != config.ApiPath {
- if rootPath == "" || rootPath == "/" {
- // use routes
- for _, route := range each.Routes() {
- entry := staticPathFromRoute(route)
- _, exists := sws.apiDeclarationMap.At(entry)
- if !exists {
- sws.apiDeclarationMap.Put(entry, sws.composeDeclaration(each, entry))
- }
- }
- } else { // use root path
- sws.apiDeclarationMap.Put(each.RootPath(), sws.composeDeclaration(each, each.RootPath()))
- }
- }
- }
-
- // if specified then call the PostBuilderHandler
- if config.PostBuildHandler != nil {
- config.PostBuildHandler(sws.apiDeclarationMap)
- }
- return sws
-}
-
-// LogInfo is the function that is called when this package needs to log. It defaults to log.Printf
-var LogInfo = func(format string, v ...interface{}) {
- // use the restful package-wide logger
- log.Printf(format, v...)
-}
-
-// InstallSwaggerService add the WebService that provides the API documentation of all services
-// conform the Swagger documentation specifcation. (https://github.com/wordnik/swagger-core/wiki).
-func InstallSwaggerService(aSwaggerConfig Config) {
- RegisterSwaggerService(aSwaggerConfig, restful.DefaultContainer)
-}
-
-// RegisterSwaggerService add the WebService that provides the API documentation of all services
-// conform the Swagger documentation specifcation. (https://github.com/wordnik/swagger-core/wiki).
-func RegisterSwaggerService(config Config, wsContainer *restful.Container) {
- sws := newSwaggerService(config)
- ws := new(restful.WebService)
- ws.Path(config.ApiPath)
- ws.Produces(restful.MIME_JSON)
- if config.DisableCORS {
- ws.Filter(enableCORS)
- }
- ws.Route(ws.GET("/").To(sws.getListing))
- ws.Route(ws.GET("/{a}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}/{c}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}/{c}/{d}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}/{c}/{d}/{e}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}/{c}/{d}/{e}/{f}").To(sws.getDeclarations))
- ws.Route(ws.GET("/{a}/{b}/{c}/{d}/{e}/{f}/{g}").To(sws.getDeclarations))
- LogInfo("[restful/swagger] listing is available at %v%v", config.WebServicesUrl, config.ApiPath)
- wsContainer.Add(ws)
-
- // Check paths for UI serving
- if config.StaticHandler == nil && config.SwaggerFilePath != "" && config.SwaggerPath != "" {
- swaggerPathSlash := config.SwaggerPath
- // path must end with slash /
- if "/" != config.SwaggerPath[len(config.SwaggerPath)-1:] {
- LogInfo("[restful/swagger] use corrected SwaggerPath ; must end with slash (/)")
- swaggerPathSlash += "/"
- }
-
- LogInfo("[restful/swagger] %v%v is mapped to folder %v", config.WebServicesUrl, swaggerPathSlash, config.SwaggerFilePath)
- wsContainer.Handle(swaggerPathSlash, http.StripPrefix(swaggerPathSlash, http.FileServer(http.Dir(config.SwaggerFilePath))))
-
- //if we define a custom static handler use it
- } else if config.StaticHandler != nil && config.SwaggerPath != "" {
- swaggerPathSlash := config.SwaggerPath
- // path must end with slash /
- if "/" != config.SwaggerPath[len(config.SwaggerPath)-1:] {
- LogInfo("[restful/swagger] use corrected SwaggerFilePath ; must end with slash (/)")
- swaggerPathSlash += "/"
-
- }
- LogInfo("[restful/swagger] %v%v is mapped to custom Handler %T", config.WebServicesUrl, swaggerPathSlash, config.StaticHandler)
- wsContainer.Handle(swaggerPathSlash, config.StaticHandler)
-
- } else {
- LogInfo("[restful/swagger] Swagger(File)Path is empty ; no UI is served")
- }
-}
-
-func staticPathFromRoute(r restful.Route) string {
- static := r.Path
- bracket := strings.Index(static, "{")
- if bracket <= 1 { // result cannot be empty
- return static
- }
- if bracket != -1 {
- static = r.Path[:bracket]
- }
- if strings.HasSuffix(static, "/") {
- return static[:len(static)-1]
- } else {
- return static
- }
-}
-
-func enableCORS(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {
- if origin := req.HeaderParameter(restful.HEADER_Origin); origin != "" {
- // prevent duplicate header
- if len(resp.Header().Get(restful.HEADER_AccessControlAllowOrigin)) == 0 {
- resp.AddHeader(restful.HEADER_AccessControlAllowOrigin, origin)
- }
- }
- chain.ProcessFilter(req, resp)
-}
-
-func (sws SwaggerService) getListing(req *restful.Request, resp *restful.Response) {
- listing := sws.produceListing()
- resp.WriteAsJson(listing)
-}
-
-func (sws SwaggerService) produceListing() ResourceListing {
- listing := ResourceListing{SwaggerVersion: swaggerVersion, ApiVersion: sws.config.ApiVersion, Info: sws.config.Info}
- sws.apiDeclarationMap.Do(func(k string, v ApiDeclaration) {
- ref := Resource{Path: k}
- if len(v.Apis) > 0 { // use description of first (could still be empty)
- ref.Description = v.Apis[0].Description
- }
- listing.Apis = append(listing.Apis, ref)
- })
- return listing
-}
-
-func (sws SwaggerService) getDeclarations(req *restful.Request, resp *restful.Response) {
- decl, ok := sws.produceDeclarations(composeRootPath(req))
- if !ok {
- resp.WriteErrorString(http.StatusNotFound, "ApiDeclaration not found")
- return
- }
- // unless WebServicesUrl is given
- if len(sws.config.WebServicesUrl) == 0 {
- // update base path from the actual request
- // TODO how to detect https? assume http for now
- var host string
- // X-Forwarded-Host or Host or Request.Host
- hostvalues, ok := req.Request.Header["X-Forwarded-Host"] // apache specific?
- if !ok || len(hostvalues) == 0 {
- forwarded, ok := req.Request.Header["Host"] // without reverse-proxy
- if !ok || len(forwarded) == 0 {
- // fallback to Host field
- host = req.Request.Host
- } else {
- host = forwarded[0]
- }
- } else {
- host = hostvalues[0]
- }
- // inspect Referer for the scheme (http vs https)
- scheme := "http"
- if referer := req.Request.Header["Referer"]; len(referer) > 0 {
- if strings.HasPrefix(referer[0], "https") {
- scheme = "https"
- }
- }
- decl.BasePath = fmt.Sprintf("%s://%s", scheme, host)
- }
- resp.WriteAsJson(decl)
-}
-
-func (sws SwaggerService) produceAllDeclarations() map[string]ApiDeclaration {
- decls := map[string]ApiDeclaration{}
- sws.apiDeclarationMap.Do(func(k string, v ApiDeclaration) {
- decls[k] = v
- })
- return decls
-}
-
-func (sws SwaggerService) produceDeclarations(route string) (*ApiDeclaration, bool) {
- decl, ok := sws.apiDeclarationMap.At(route)
- if !ok {
- return nil, false
- }
- decl.BasePath = sws.config.WebServicesUrl
- return &decl, true
-}
-
-// composeDeclaration uses all routes and parameters to create a ApiDeclaration
-func (sws SwaggerService) composeDeclaration(ws *restful.WebService, pathPrefix string) ApiDeclaration {
- decl := ApiDeclaration{
- SwaggerVersion: swaggerVersion,
- BasePath: sws.config.WebServicesUrl,
- ResourcePath: pathPrefix,
- Models: ModelList{},
- ApiVersion: ws.Version()}
-
- // collect any path parameters
- rootParams := []Parameter{}
- for _, param := range ws.PathParameters() {
- rootParams = append(rootParams, asSwaggerParameter(param.Data()))
- }
- // aggregate by path
- pathToRoutes := newOrderedRouteMap()
- for _, other := range ws.Routes() {
- if strings.HasPrefix(other.Path, pathPrefix) {
- pathToRoutes.Add(other.Path, other)
- }
- }
- pathToRoutes.Do(func(path string, routes []restful.Route) {
- api := Api{Path: strings.TrimSuffix(withoutWildcard(path), "/"), Description: ws.Documentation()}
- voidString := "void"
- for _, route := range routes {
- operation := Operation{
- Method: route.Method,
- Summary: route.Doc,
- Notes: route.Notes,
- // Type gets overwritten if there is a write sample
- DataTypeFields: DataTypeFields{Type: &voidString},
- Parameters: []Parameter{},
- Nickname: route.Operation,
- ResponseMessages: composeResponseMessages(route, &decl, &sws.config)}
-
- operation.Consumes = route.Consumes
- operation.Produces = route.Produces
-
- // share root params if any
- for _, swparam := range rootParams {
- operation.Parameters = append(operation.Parameters, swparam)
- }
- // route specific params
- for _, param := range route.ParameterDocs {
- operation.Parameters = append(operation.Parameters, asSwaggerParameter(param.Data()))
- }
-
- sws.addModelsFromRouteTo(&operation, route, &decl)
- api.Operations = append(api.Operations, operation)
- }
- decl.Apis = append(decl.Apis, api)
- })
- return decl
-}
-
-func withoutWildcard(path string) string {
- if strings.HasSuffix(path, ":*}") {
- return path[0:len(path)-3] + "}"
- }
- return path
-}
-
-// composeResponseMessages takes the ResponseErrors (if any) and creates ResponseMessages from them.
-func composeResponseMessages(route restful.Route, decl *ApiDeclaration, config *Config) (messages []ResponseMessage) {
- if route.ResponseErrors == nil {
- return messages
- }
- // sort by code
- codes := sort.IntSlice{}
- for code := range route.ResponseErrors {
- codes = append(codes, code)
- }
- codes.Sort()
- for _, code := range codes {
- each := route.ResponseErrors[code]
- message := ResponseMessage{
- Code: code,
- Message: each.Message,
- }
- if each.Model != nil {
- st := reflect.TypeOf(each.Model)
- isCollection, st := detectCollectionType(st)
- modelName := modelBuilder{}.keyFrom(st)
- if isCollection {
- modelName = "array[" + modelName + "]"
- }
- modelBuilder{Models: &decl.Models, Config: config}.addModel(st, "")
- // reference the model
- message.ResponseModel = modelName
- }
- messages = append(messages, message)
- }
- return
-}
-
-// addModelsFromRoute takes any read or write sample from the Route and creates a Swagger model from it.
-func (sws SwaggerService) addModelsFromRouteTo(operation *Operation, route restful.Route, decl *ApiDeclaration) {
- if route.ReadSample != nil {
- sws.addModelFromSampleTo(operation, false, route.ReadSample, &decl.Models)
- }
- if route.WriteSample != nil {
- sws.addModelFromSampleTo(operation, true, route.WriteSample, &decl.Models)
- }
-}
-
-func detectCollectionType(st reflect.Type) (bool, reflect.Type) {
- isCollection := false
- if st.Kind() == reflect.Slice || st.Kind() == reflect.Array {
- st = st.Elem()
- isCollection = true
- } else {
- if st.Kind() == reflect.Ptr {
- if st.Elem().Kind() == reflect.Slice || st.Elem().Kind() == reflect.Array {
- st = st.Elem().Elem()
- isCollection = true
- }
- }
- }
- return isCollection, st
-}
-
-// addModelFromSample creates and adds (or overwrites) a Model from a sample resource
-func (sws SwaggerService) addModelFromSampleTo(operation *Operation, isResponse bool, sample interface{}, models *ModelList) {
- if isResponse {
- type_, items := asDataType(sample, &sws.config)
- operation.Type = type_
- operation.Items = items
- }
- modelBuilder{Models: models, Config: &sws.config}.addModelFrom(sample)
-}
-
-func asSwaggerParameter(param restful.ParameterData) Parameter {
- return Parameter{
- DataTypeFields: DataTypeFields{
- Type: ¶m.DataType,
- Format: asFormat(param.DataType, param.DataFormat),
- DefaultValue: Special(param.DefaultValue),
- },
- Name: param.Name,
- Description: param.Description,
- ParamType: asParamType(param.Kind),
-
- Required: param.Required}
-}
-
-// Between 1..7 path parameters is supported
-func composeRootPath(req *restful.Request) string {
- path := "/" + req.PathParameter("a")
- b := req.PathParameter("b")
- if b == "" {
- return path
- }
- path = path + "/" + b
- c := req.PathParameter("c")
- if c == "" {
- return path
- }
- path = path + "/" + c
- d := req.PathParameter("d")
- if d == "" {
- return path
- }
- path = path + "/" + d
- e := req.PathParameter("e")
- if e == "" {
- return path
- }
- path = path + "/" + e
- f := req.PathParameter("f")
- if f == "" {
- return path
- }
- path = path + "/" + f
- g := req.PathParameter("g")
- if g == "" {
- return path
- }
- return path + "/" + g
-}
-
-func asFormat(dataType string, dataFormat string) string {
- if dataFormat != "" {
- return dataFormat
- }
- return "" // TODO
-}
-
-func asParamType(kind int) string {
- switch {
- case kind == restful.PathParameterKind:
- return "path"
- case kind == restful.QueryParameterKind:
- return "query"
- case kind == restful.BodyParameterKind:
- return "body"
- case kind == restful.HeaderParameterKind:
- return "header"
- case kind == restful.FormParameterKind:
- return "form"
- }
- return ""
-}
-
-func asDataType(any interface{}, config *Config) (*string, *Item) {
- // If it's not a collection, return the suggested model name
- st := reflect.TypeOf(any)
- isCollection, st := detectCollectionType(st)
- modelName := modelBuilder{}.keyFrom(st)
- // if it's not a collection we are done
- if !isCollection {
- return &modelName, nil
- }
-
- // XXX: This is not very elegant
- // We create an Item object referring to the given model
- models := ModelList{}
- mb := modelBuilder{Models: &models, Config: config}
- mb.addModelFrom(any)
-
- elemTypeName := mb.getElementTypeName(modelName, "", st)
- item := new(Item)
- if mb.isPrimitiveType(elemTypeName) {
- mapped := mb.jsonSchemaType(elemTypeName)
- item.Type = &mapped
- } else {
- item.Ref = &elemTypeName
- }
- tmp := "array"
- return &tmp, item
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service.go
deleted file mode 100644
index 2a51004f8..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service.go
+++ /dev/null
@@ -1,268 +0,0 @@
-package restful
-
-import (
- "errors"
- "os"
- "sync"
-
- "github.com/emicklei/go-restful/log"
-)
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-// WebService holds a collection of Route values that bind a Http Method + URL Path to a function.
-type WebService struct {
- rootPath string
- pathExpr *pathExpression // cached compilation of rootPath as RegExp
- routes []Route
- produces []string
- consumes []string
- pathParameters []*Parameter
- filters []FilterFunction
- documentation string
- apiVersion string
-
- dynamicRoutes bool
-
- // protects 'routes' if dynamic routes are enabled
- routesLock sync.RWMutex
-}
-
-func (w *WebService) SetDynamicRoutes(enable bool) {
- w.dynamicRoutes = enable
-}
-
-// compilePathExpression ensures that the path is compiled into a RegEx for those routers that need it.
-func (w *WebService) compilePathExpression() {
- compiled, err := newPathExpression(w.rootPath)
- if err != nil {
- log.Printf("[restful] invalid path:%s because:%v", w.rootPath, err)
- os.Exit(1)
- }
- w.pathExpr = compiled
-}
-
-// ApiVersion sets the API version for documentation purposes.
-func (w *WebService) ApiVersion(apiVersion string) *WebService {
- w.apiVersion = apiVersion
- return w
-}
-
-// Version returns the API version for documentation purposes.
-func (w *WebService) Version() string { return w.apiVersion }
-
-// Path specifies the root URL template path of the WebService.
-// All Routes will be relative to this path.
-func (w *WebService) Path(root string) *WebService {
- w.rootPath = root
- if len(w.rootPath) == 0 {
- w.rootPath = "/"
- }
- w.compilePathExpression()
- return w
-}
-
-// Param adds a PathParameter to document parameters used in the root path.
-func (w *WebService) Param(parameter *Parameter) *WebService {
- if w.pathParameters == nil {
- w.pathParameters = []*Parameter{}
- }
- w.pathParameters = append(w.pathParameters, parameter)
- return w
-}
-
-// PathParameter creates a new Parameter of kind Path for documentation purposes.
-// It is initialized as required with string as its DataType.
-func (w *WebService) PathParameter(name, description string) *Parameter {
- return PathParameter(name, description)
-}
-
-// PathParameter creates a new Parameter of kind Path for documentation purposes.
-// It is initialized as required with string as its DataType.
-func PathParameter(name, description string) *Parameter {
- p := &Parameter{&ParameterData{Name: name, Description: description, Required: true, DataType: "string"}}
- p.bePath()
- return p
-}
-
-// QueryParameter creates a new Parameter of kind Query for documentation purposes.
-// It is initialized as not required with string as its DataType.
-func (w *WebService) QueryParameter(name, description string) *Parameter {
- return QueryParameter(name, description)
-}
-
-// QueryParameter creates a new Parameter of kind Query for documentation purposes.
-// It is initialized as not required with string as its DataType.
-func QueryParameter(name, description string) *Parameter {
- p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}}
- p.beQuery()
- return p
-}
-
-// BodyParameter creates a new Parameter of kind Body for documentation purposes.
-// It is initialized as required without a DataType.
-func (w *WebService) BodyParameter(name, description string) *Parameter {
- return BodyParameter(name, description)
-}
-
-// BodyParameter creates a new Parameter of kind Body for documentation purposes.
-// It is initialized as required without a DataType.
-func BodyParameter(name, description string) *Parameter {
- p := &Parameter{&ParameterData{Name: name, Description: description, Required: true}}
- p.beBody()
- return p
-}
-
-// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes.
-// It is initialized as not required with string as its DataType.
-func (w *WebService) HeaderParameter(name, description string) *Parameter {
- return HeaderParameter(name, description)
-}
-
-// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes.
-// It is initialized as not required with string as its DataType.
-func HeaderParameter(name, description string) *Parameter {
- p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}}
- p.beHeader()
- return p
-}
-
-// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes.
-// It is initialized as required with string as its DataType.
-func (w *WebService) FormParameter(name, description string) *Parameter {
- return FormParameter(name, description)
-}
-
-// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes.
-// It is initialized as required with string as its DataType.
-func FormParameter(name, description string) *Parameter {
- p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}}
- p.beForm()
- return p
-}
-
-// Route creates a new Route using the RouteBuilder and add to the ordered list of Routes.
-func (w *WebService) Route(builder *RouteBuilder) *WebService {
- w.routesLock.Lock()
- defer w.routesLock.Unlock()
- builder.copyDefaults(w.produces, w.consumes)
- w.routes = append(w.routes, builder.Build())
- return w
-}
-
-// RemoveRoute removes the specified route, looks for something that matches 'path' and 'method'
-func (w *WebService) RemoveRoute(path, method string) error {
- if !w.dynamicRoutes {
- return errors.New("dynamic routes are not enabled.")
- }
- w.routesLock.Lock()
- defer w.routesLock.Unlock()
- newRoutes := make([]Route, (len(w.routes) - 1))
- current := 0
- for ix := range w.routes {
- if w.routes[ix].Method == method && w.routes[ix].Path == path {
- continue
- }
- newRoutes[current] = w.routes[ix]
- current = current + 1
- }
- w.routes = newRoutes
- return nil
-}
-
-// Method creates a new RouteBuilder and initialize its http method
-func (w *WebService) Method(httpMethod string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method(httpMethod)
-}
-
-// Produces specifies that this WebService can produce one or more MIME types.
-// Http requests must have one of these values set for the Accept header.
-func (w *WebService) Produces(contentTypes ...string) *WebService {
- w.produces = contentTypes
- return w
-}
-
-// Consumes specifies that this WebService can consume one or more MIME types.
-// Http requests must have one of these values set for the Content-Type header.
-func (w *WebService) Consumes(accepts ...string) *WebService {
- w.consumes = accepts
- return w
-}
-
-// Routes returns the Routes associated with this WebService
-func (w *WebService) Routes() []Route {
- if !w.dynamicRoutes {
- return w.routes
- }
- // Make a copy of the array to prevent concurrency problems
- w.routesLock.RLock()
- defer w.routesLock.RUnlock()
- result := make([]Route, len(w.routes))
- for ix := range w.routes {
- result[ix] = w.routes[ix]
- }
- return result
-}
-
-// RootPath returns the RootPath associated with this WebService. Default "/"
-func (w *WebService) RootPath() string {
- return w.rootPath
-}
-
-// PathParameters return the path parameter names for (shared amoung its Routes)
-func (w *WebService) PathParameters() []*Parameter {
- return w.pathParameters
-}
-
-// Filter adds a filter function to the chain of filters applicable to all its Routes
-func (w *WebService) Filter(filter FilterFunction) *WebService {
- w.filters = append(w.filters, filter)
- return w
-}
-
-// Doc is used to set the documentation of this service.
-func (w *WebService) Doc(plainText string) *WebService {
- w.documentation = plainText
- return w
-}
-
-// Documentation returns it.
-func (w *WebService) Documentation() string {
- return w.documentation
-}
-
-/*
- Convenience methods
-*/
-
-// HEAD is a shortcut for .Method("HEAD").Path(subPath)
-func (w *WebService) HEAD(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("HEAD").Path(subPath)
-}
-
-// GET is a shortcut for .Method("GET").Path(subPath)
-func (w *WebService) GET(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("GET").Path(subPath)
-}
-
-// POST is a shortcut for .Method("POST").Path(subPath)
-func (w *WebService) POST(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("POST").Path(subPath)
-}
-
-// PUT is a shortcut for .Method("PUT").Path(subPath)
-func (w *WebService) PUT(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("PUT").Path(subPath)
-}
-
-// PATCH is a shortcut for .Method("PATCH").Path(subPath)
-func (w *WebService) PATCH(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("PATCH").Path(subPath)
-}
-
-// DELETE is a shortcut for .Method("DELETE").Path(subPath)
-func (w *WebService) DELETE(subPath string) *RouteBuilder {
- return new(RouteBuilder).servicePath(w.rootPath).Method("DELETE").Path(subPath)
-}
diff --git a/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service_container.go b/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service_container.go
deleted file mode 100644
index c9d31b06c..000000000
--- a/archived/event-adapter/vendor/github.com/emicklei/go-restful/web_service_container.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package restful
-
-// Copyright 2013 Ernest Micklei. All rights reserved.
-// Use of this source code is governed by a license
-// that can be found in the LICENSE file.
-
-import (
- "net/http"
-)
-
-// DefaultContainer is a restful.Container that uses http.DefaultServeMux
-var DefaultContainer *Container
-
-func init() {
- DefaultContainer = NewContainer()
- DefaultContainer.ServeMux = http.DefaultServeMux
-}
-
-// If set the true then panics will not be caught to return HTTP 500.
-// In that case, Route functions are responsible for handling any error situation.
-// Default value is false = recover from panics. This has performance implications.
-// OBSOLETE ; use restful.DefaultContainer.DoNotRecover(true)
-var DoNotRecover = false
-
-// Add registers a new WebService add it to the DefaultContainer.
-func Add(service *WebService) {
- DefaultContainer.Add(service)
-}
-
-// Filter appends a container FilterFunction from the DefaultContainer.
-// These are called before dispatching a http.Request to a WebService.
-func Filter(filter FilterFunction) {
- DefaultContainer.Filter(filter)
-}
-
-// RegisteredWebServices returns the collections of WebServices from the DefaultContainer
-func RegisteredWebServices() []*WebService {
- return DefaultContainer.RegisteredWebServices()
-}
diff --git a/archived/event-adapter/vendor/github.com/evanphx/json-patch/.travis.yml b/archived/event-adapter/vendor/github.com/evanphx/json-patch/.travis.yml
deleted file mode 100644
index ed5cb244c..000000000
--- a/archived/event-adapter/vendor/github.com/evanphx/json-patch/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-language: go
-
-go:
- - 1.4
- - 1.3
-
-install:
- - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
-
-script:
- - go test -cover ./...
-
-notifications:
- email: false
diff --git a/archived/event-adapter/vendor/github.com/evanphx/json-patch/LICENSE b/archived/event-adapter/vendor/github.com/evanphx/json-patch/LICENSE
deleted file mode 100644
index 0eb9b72d8..000000000
--- a/archived/event-adapter/vendor/github.com/evanphx/json-patch/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2014, Evan Phoenix
-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 the Evan Phoenix 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.
diff --git a/archived/event-adapter/vendor/github.com/evanphx/json-patch/README.md b/archived/event-adapter/vendor/github.com/evanphx/json-patch/README.md
deleted file mode 100644
index d0d826bac..000000000
--- a/archived/event-adapter/vendor/github.com/evanphx/json-patch/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-## JSON-Patch
-
-Provides the ability to modify and test a JSON according to a
-[RFC6902 JSON patch](http://tools.ietf.org/html/rfc6902) and [RFC7396 JSON Merge Patch](https://tools.ietf.org/html/rfc7396).
-
-*Version*: **1.0**
-
-[![GoDoc](https://godoc.org/github.com/evanphx/json-patch?status.svg)](http://godoc.org/github.com/evanphx/json-patch)
-
-[![Build Status](https://travis-ci.org/evanphx/json-patch.svg?branch=master)](https://travis-ci.org/evanphx/json-patch)
-
-### API Usage
-
-* Given a `[]byte`, obtain a Patch object
-
- `obj, err := jsonpatch.DecodePatch(patch)`
-
-* Apply the patch and get a new document back
-
- `out, err := obj.Apply(doc)`
-
-* Create a JSON Merge Patch document based on two json documents (a to b):
-
- `mergeDoc, err := jsonpatch.CreateMergePatch(a, b)`
-
-* Bonus API: compare documents for structural equality
-
- `jsonpatch.Equal(doca, docb)`
-
diff --git a/archived/event-adapter/vendor/github.com/evanphx/json-patch/merge.go b/archived/event-adapter/vendor/github.com/evanphx/json-patch/merge.go
deleted file mode 100644
index 84e00b148..000000000
--- a/archived/event-adapter/vendor/github.com/evanphx/json-patch/merge.go
+++ /dev/null
@@ -1,325 +0,0 @@
-package jsonpatch
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "strings"
-)
-
-func merge(cur, patch *lazyNode, mergeMerge bool) *lazyNode {
- curDoc, err := cur.intoDoc()
-
- if err != nil {
- pruneNulls(patch)
- return patch
- }
-
- patchDoc, err := patch.intoDoc()
-
- if err != nil {
- return patch
- }
-
- mergeDocs(curDoc, patchDoc, mergeMerge)
-
- return cur
-}
-
-func mergeDocs(doc, patch *partialDoc, mergeMerge bool) {
- for k, v := range *patch {
- k := decodePatchKey(k)
- if v == nil {
- if mergeMerge {
- (*doc)[k] = nil
- } else {
- delete(*doc, k)
- }
- } else {
- cur, ok := (*doc)[k]
-
- if !ok || cur == nil {
- pruneNulls(v)
- (*doc)[k] = v
- } else {
- (*doc)[k] = merge(cur, v, mergeMerge)
- }
- }
- }
-}
-
-func pruneNulls(n *lazyNode) {
- sub, err := n.intoDoc()
-
- if err == nil {
- pruneDocNulls(sub)
- } else {
- ary, err := n.intoAry()
-
- if err == nil {
- pruneAryNulls(ary)
- }
- }
-}
-
-func pruneDocNulls(doc *partialDoc) *partialDoc {
- for k, v := range *doc {
- if v == nil {
- delete(*doc, k)
- } else {
- pruneNulls(v)
- }
- }
-
- return doc
-}
-
-func pruneAryNulls(ary *partialArray) *partialArray {
- newAry := []*lazyNode{}
-
- for _, v := range *ary {
- if v != nil {
- pruneNulls(v)
- newAry = append(newAry, v)
- }
- }
-
- *ary = newAry
-
- return ary
-}
-
-var errBadJSONDoc = fmt.Errorf("Invalid JSON Document")
-var errBadJSONPatch = fmt.Errorf("Invalid JSON Patch")
-
-// MergeMergePatches merges two merge patches together, such that
-// applying this resulting merged merge patch to a document yields the same
-// as merging each merge patch to the document in succession.
-func MergeMergePatches(patch1Data, patch2Data []byte) ([]byte, error) {
- return doMergePatch(patch1Data, patch2Data, true)
-}
-
-// MergePatch merges the patchData into the docData.
-func MergePatch(docData, patchData []byte) ([]byte, error) {
- return doMergePatch(docData, patchData, false)
-}
-
-func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) {
- doc := &partialDoc{}
-
- docErr := json.Unmarshal(docData, doc)
-
- patch := &partialDoc{}
-
- patchErr := json.Unmarshal(patchData, patch)
-
- if _, ok := docErr.(*json.SyntaxError); ok {
- return nil, errBadJSONDoc
- }
-
- if _, ok := patchErr.(*json.SyntaxError); ok {
- return nil, errBadJSONPatch
- }
-
- if docErr == nil && *doc == nil {
- return nil, errBadJSONDoc
- }
-
- if patchErr == nil && *patch == nil {
- return nil, errBadJSONPatch
- }
-
- if docErr != nil || patchErr != nil {
- // Not an error, just not a doc, so we turn straight into the patch
- if patchErr == nil {
- if mergeMerge {
- doc = patch
- } else {
- doc = pruneDocNulls(patch)
- }
- } else {
- patchAry := &partialArray{}
- patchErr = json.Unmarshal(patchData, patchAry)
-
- if patchErr != nil {
- return nil, errBadJSONPatch
- }
-
- pruneAryNulls(patchAry)
-
- out, patchErr := json.Marshal(patchAry)
-
- if patchErr != nil {
- return nil, errBadJSONPatch
- }
-
- return out, nil
- }
- } else {
- mergeDocs(doc, patch, mergeMerge)
- }
-
- return json.Marshal(doc)
-}
-
-// CreateMergePatch creates a merge patch as specified in http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07
-//
-// 'a' is original, 'b' is the modified document. Both are to be given as json encoded content.
-// The function will return a mergeable json document with differences from a to b.
-//
-// An error will be returned if any of the two documents are invalid.
-func CreateMergePatch(a, b []byte) ([]byte, error) {
- aI := map[string]interface{}{}
- bI := map[string]interface{}{}
- err := json.Unmarshal(a, &aI)
- if err != nil {
- return nil, errBadJSONDoc
- }
- err = json.Unmarshal(b, &bI)
- if err != nil {
- return nil, errBadJSONDoc
- }
- dest, err := getDiff(aI, bI)
- if err != nil {
- return nil, err
- }
- return json.Marshal(dest)
-}
-
-// Returns true if the array matches (must be json types).
-// As is idiomatic for go, an empty array is not the same as a nil array.
-func matchesArray(a, b []interface{}) bool {
- if len(a) != len(b) {
- return false
- }
- if (a == nil && b != nil) || (a != nil && b == nil) {
- return false
- }
- for i := range a {
- if !matchesValue(a[i], b[i]) {
- return false
- }
- }
- return true
-}
-
-// Returns true if the values matches (must be json types)
-// The types of the values must match, otherwise it will always return false
-// If two map[string]interface{} are given, all elements must match.
-func matchesValue(av, bv interface{}) bool {
- if reflect.TypeOf(av) != reflect.TypeOf(bv) {
- return false
- }
- switch at := av.(type) {
- case string:
- bt := bv.(string)
- if bt == at {
- return true
- }
- case float64:
- bt := bv.(float64)
- if bt == at {
- return true
- }
- case bool:
- bt := bv.(bool)
- if bt == at {
- return true
- }
- case map[string]interface{}:
- bt := bv.(map[string]interface{})
- for key := range at {
- if !matchesValue(at[key], bt[key]) {
- return false
- }
- }
- for key := range bt {
- if !matchesValue(at[key], bt[key]) {
- return false
- }
- }
- return true
- case []interface{}:
- bt := bv.([]interface{})
- return matchesArray(at, bt)
- }
- return false
-}
-
-// getDiff returns the (recursive) difference between a and b as a map[string]interface{}.
-func getDiff(a, b map[string]interface{}) (map[string]interface{}, error) {
- into := map[string]interface{}{}
- for key, bv := range b {
- escapedKey := encodePatchKey(key)
- av, ok := a[key]
- // value was added
- if !ok {
- into[escapedKey] = bv
- continue
- }
- // If types have changed, replace completely
- if reflect.TypeOf(av) != reflect.TypeOf(bv) {
- into[escapedKey] = bv
- continue
- }
- // Types are the same, compare values
- switch at := av.(type) {
- case map[string]interface{}:
- bt := bv.(map[string]interface{})
- dst := make(map[string]interface{}, len(bt))
- dst, err := getDiff(at, bt)
- if err != nil {
- return nil, err
- }
- if len(dst) > 0 {
- into[escapedKey] = dst
- }
- case string, float64, bool:
- if !matchesValue(av, bv) {
- into[escapedKey] = bv
- }
- case []interface{}:
- bt := bv.([]interface{})
- if !matchesArray(at, bt) {
- into[escapedKey] = bv
- }
- case nil:
- switch bv.(type) {
- case nil:
- // Both nil, fine.
- default:
- into[escapedKey] = bv
- }
- default:
- panic(fmt.Sprintf("Unknown type:%T in key %s", av, key))
- }
- }
- // Now add all deleted values as nil
- for key := range a {
- _, found := b[key]
- if !found {
- into[key] = nil
- }
- }
- return into, nil
-}
-
-// From http://tools.ietf.org/html/rfc6901#section-4 :
-//
-// Evaluation of each reference token begins by decoding any escaped
-// character sequence. This is performed by first transforming any
-// occurrence of the sequence '~1' to '/', and then transforming any
-// occurrence of the sequence '~0' to '~'.
-
-var (
- rfc6901Encoder = strings.NewReplacer("~", "~0", "/", "~1")
- rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~")
-)
-
-func decodePatchKey(k string) string {
- return rfc6901Decoder.Replace(k)
-}
-
-func encodePatchKey(k string) string {
- return rfc6901Encoder.Replace(k)
-}
diff --git a/archived/event-adapter/vendor/github.com/evanphx/json-patch/patch.go b/archived/event-adapter/vendor/github.com/evanphx/json-patch/patch.go
deleted file mode 100644
index 3b3301053..000000000
--- a/archived/event-adapter/vendor/github.com/evanphx/json-patch/patch.go
+++ /dev/null
@@ -1,587 +0,0 @@
-package jsonpatch
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
-)
-
-const (
- eRaw = iota
- eDoc
- eAry
-)
-
-type lazyNode struct {
- raw *json.RawMessage
- doc partialDoc
- ary partialArray
- which int
-}
-
-type operation map[string]*json.RawMessage
-
-// Patch is an ordered collection of operations.
-type Patch []operation
-
-type partialDoc map[string]*lazyNode
-type partialArray []*lazyNode
-
-type container interface {
- get(key string) (*lazyNode, error)
- set(key string, val *lazyNode) error
- add(key string, val *lazyNode) error
- remove(key string) error
-}
-
-func newLazyNode(raw *json.RawMessage) *lazyNode {
- return &lazyNode{raw: raw, doc: nil, ary: nil, which: eRaw}
-}
-
-func (n *lazyNode) MarshalJSON() ([]byte, error) {
- switch n.which {
- case eRaw:
- return json.Marshal(n.raw)
- case eDoc:
- return json.Marshal(n.doc)
- case eAry:
- return json.Marshal(n.ary)
- default:
- return nil, fmt.Errorf("Unknown type")
- }
-}
-
-func (n *lazyNode) UnmarshalJSON(data []byte) error {
- dest := make(json.RawMessage, len(data))
- copy(dest, data)
- n.raw = &dest
- n.which = eRaw
- return nil
-}
-
-func (n *lazyNode) intoDoc() (*partialDoc, error) {
- if n.which == eDoc {
- return &n.doc, nil
- }
-
- err := json.Unmarshal(*n.raw, &n.doc)
-
- if err != nil {
- return nil, err
- }
-
- n.which = eDoc
- return &n.doc, nil
-}
-
-func (n *lazyNode) intoAry() (*partialArray, error) {
- if n.which == eAry {
- return &n.ary, nil
- }
-
- err := json.Unmarshal(*n.raw, &n.ary)
-
- if err != nil {
- return nil, err
- }
-
- n.which = eAry
- return &n.ary, nil
-}
-
-func (n *lazyNode) compact() []byte {
- buf := &bytes.Buffer{}
-
- err := json.Compact(buf, *n.raw)
-
- if err != nil {
- return *n.raw
- }
-
- return buf.Bytes()
-}
-
-func (n *lazyNode) tryDoc() bool {
- err := json.Unmarshal(*n.raw, &n.doc)
-
- if err != nil {
- return false
- }
-
- n.which = eDoc
- return true
-}
-
-func (n *lazyNode) tryAry() bool {
- err := json.Unmarshal(*n.raw, &n.ary)
-
- if err != nil {
- return false
- }
-
- n.which = eAry
- return true
-}
-
-func (n *lazyNode) equal(o *lazyNode) bool {
- if n.which == eRaw {
- if !n.tryDoc() && !n.tryAry() {
- if o.which != eRaw {
- return false
- }
-
- return bytes.Equal(n.compact(), o.compact())
- }
- }
-
- if n.which == eDoc {
- if o.which == eRaw {
- if !o.tryDoc() {
- return false
- }
- }
-
- if o.which != eDoc {
- return false
- }
-
- for k, v := range n.doc {
- ov, ok := o.doc[k]
-
- if !ok {
- return false
- }
-
- if v == nil && ov == nil {
- continue
- }
-
- if !v.equal(ov) {
- return false
- }
- }
-
- return true
- }
-
- if o.which != eAry && !o.tryAry() {
- return false
- }
-
- if len(n.ary) != len(o.ary) {
- return false
- }
-
- for idx, val := range n.ary {
- if !val.equal(o.ary[idx]) {
- return false
- }
- }
-
- return true
-}
-
-func (o operation) kind() string {
- if obj, ok := o["op"]; ok {
- var op string
-
- err := json.Unmarshal(*obj, &op)
-
- if err != nil {
- return "unknown"
- }
-
- return op
- }
-
- return "unknown"
-}
-
-func (o operation) path() string {
- if obj, ok := o["path"]; ok {
- var op string
-
- err := json.Unmarshal(*obj, &op)
-
- if err != nil {
- return "unknown"
- }
-
- return op
- }
-
- return "unknown"
-}
-
-func (o operation) from() string {
- if obj, ok := o["from"]; ok {
- var op string
-
- err := json.Unmarshal(*obj, &op)
-
- if err != nil {
- return "unknown"
- }
-
- return op
- }
-
- return "unknown"
-}
-
-func (o operation) value() *lazyNode {
- if obj, ok := o["value"]; ok {
- return newLazyNode(obj)
- }
-
- return nil
-}
-
-func isArray(buf []byte) bool {
-Loop:
- for _, c := range buf {
- switch c {
- case ' ':
- case '\n':
- case '\t':
- continue
- case '[':
- return true
- default:
- break Loop
- }
- }
-
- return false
-}
-
-func findObject(pd *container, path string) (container, string) {
- doc := *pd
-
- split := strings.Split(path, "/")
-
- if len(split) < 2 {
- return nil, ""
- }
-
- parts := split[1 : len(split)-1]
-
- key := split[len(split)-1]
-
- var err error
-
- for _, part := range parts {
-
- next, ok := doc.get(decodePatchKey(part))
-
- if next == nil || ok != nil {
- return nil, ""
- }
-
- if isArray(*next.raw) {
- doc, err = next.intoAry()
-
- if err != nil {
- return nil, ""
- }
- } else {
- doc, err = next.intoDoc()
-
- if err != nil {
- return nil, ""
- }
- }
- }
-
- return doc, decodePatchKey(key)
-}
-
-func (d *partialDoc) set(key string, val *lazyNode) error {
- (*d)[key] = val
- return nil
-}
-
-func (d *partialDoc) add(key string, val *lazyNode) error {
- (*d)[key] = val
- return nil
-}
-
-func (d *partialDoc) get(key string) (*lazyNode, error) {
- return (*d)[key], nil
-}
-
-func (d *partialDoc) remove(key string) error {
- _, ok := (*d)[key]
- if !ok {
- return fmt.Errorf("Unable to remove nonexistent key: %s", key)
- }
-
- delete(*d, key)
- return nil
-}
-
-func (d *partialArray) set(key string, val *lazyNode) error {
- if key == "-" {
- *d = append(*d, val)
- return nil
- }
-
- idx, err := strconv.Atoi(key)
- if err != nil {
- return err
- }
-
- sz := len(*d)
- if idx+1 > sz {
- sz = idx + 1
- }
-
- ary := make([]*lazyNode, sz)
-
- cur := *d
-
- copy(ary, cur)
-
- if idx >= len(ary) {
- return fmt.Errorf("Unable to access invalid index: %d", idx)
- }
-
- ary[idx] = val
-
- *d = ary
- return nil
-}
-
-func (d *partialArray) add(key string, val *lazyNode) error {
- if key == "-" {
- *d = append(*d, val)
- return nil
- }
-
- idx, err := strconv.Atoi(key)
- if err != nil {
- return err
- }
-
- ary := make([]*lazyNode, len(*d)+1)
-
- cur := *d
-
- copy(ary[0:idx], cur[0:idx])
- ary[idx] = val
- copy(ary[idx+1:], cur[idx:])
-
- *d = ary
- return nil
-}
-
-func (d *partialArray) get(key string) (*lazyNode, error) {
- idx, err := strconv.Atoi(key)
-
- if err != nil {
- return nil, err
- }
-
- if idx >= len(*d) {
- return nil, fmt.Errorf("Unable to access invalid index: %d", idx)
- }
-
- return (*d)[idx], nil
-}
-
-func (d *partialArray) remove(key string) error {
- idx, err := strconv.Atoi(key)
- if err != nil {
- return err
- }
-
- cur := *d
-
- if idx >= len(cur) {
- return fmt.Errorf("Unable to remove invalid index: %d", idx)
- }
-
- ary := make([]*lazyNode, len(cur)-1)
-
- copy(ary[0:idx], cur[0:idx])
- copy(ary[idx:], cur[idx+1:])
-
- *d = ary
- return nil
-
-}
-
-func (p Patch) add(doc *container, op operation) error {
- path := op.path()
-
- con, key := findObject(doc, path)
-
- if con == nil {
- return fmt.Errorf("jsonpatch add operation does not apply: doc is missing path: %s", path)
- }
-
- return con.add(key, op.value())
-}
-
-func (p Patch) remove(doc *container, op operation) error {
- path := op.path()
-
- con, key := findObject(doc, path)
-
- if con == nil {
- return fmt.Errorf("jsonpatch remove operation does not apply: doc is missing path: %s", path)
- }
-
- return con.remove(key)
-}
-
-func (p Patch) replace(doc *container, op operation) error {
- path := op.path()
-
- con, key := findObject(doc, path)
-
- if con == nil {
- return fmt.Errorf("jsonpatch replace operation does not apply: doc is missing path: %s", path)
- }
-
- return con.set(key, op.value())
-}
-
-func (p Patch) move(doc *container, op operation) error {
- from := op.from()
-
- con, key := findObject(doc, from)
-
- if con == nil {
- return fmt.Errorf("jsonpatch move operation does not apply: doc is missing from path: %s", from)
- }
-
- val, err := con.get(key)
- if err != nil {
- return err
- }
-
- err = con.remove(key)
- if err != nil {
- return err
- }
-
- path := op.path()
-
- con, key = findObject(doc, path)
-
- if con == nil {
- return fmt.Errorf("jsonpatch move operation does not apply: doc is missing destination path: %s", path)
- }
-
- return con.set(key, val)
-}
-
-func (p Patch) test(doc *container, op operation) error {
- path := op.path()
-
- con, key := findObject(doc, path)
-
- if con == nil {
- return fmt.Errorf("jsonpatch test operation does not apply: is missing path: %s", path)
- }
-
- val, err := con.get(key)
-
- if err != nil {
- return err
- }
-
- if val == nil {
- if op.value().raw == nil {
- return nil
- }
- return fmt.Errorf("Testing value %s failed", path)
- }
-
- if val.equal(op.value()) {
- return nil
- }
-
- return fmt.Errorf("Testing value %s failed", path)
-}
-
-// Equal indicates if 2 JSON documents have the same structural equality.
-func Equal(a, b []byte) bool {
- ra := make(json.RawMessage, len(a))
- copy(ra, a)
- la := newLazyNode(&ra)
-
- rb := make(json.RawMessage, len(b))
- copy(rb, b)
- lb := newLazyNode(&rb)
-
- return la.equal(lb)
-}
-
-// DecodePatch decodes the passed JSON document as an RFC 6902 patch.
-func DecodePatch(buf []byte) (Patch, error) {
- var p Patch
-
- err := json.Unmarshal(buf, &p)
-
- if err != nil {
- return nil, err
- }
-
- return p, nil
-}
-
-// Apply mutates a JSON document according to the patch, and returns the new
-// document.
-func (p Patch) Apply(doc []byte) ([]byte, error) {
- return p.ApplyIndent(doc, "")
-}
-
-// ApplyIndent mutates a JSON document according to the patch, and returns the new
-// document indented.
-func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) {
- var pd container
- if doc[0] == '[' {
- pd = &partialArray{}
- } else {
- pd = &partialDoc{}
- }
-
- err := json.Unmarshal(doc, pd)
-
- if err != nil {
- return nil, err
- }
-
- err = nil
-
- for _, op := range p {
- switch op.kind() {
- case "add":
- err = p.add(&pd, op)
- case "remove":
- err = p.remove(&pd, op)
- case "replace":
- err = p.replace(&pd, op)
- case "move":
- err = p.move(&pd, op)
- case "test":
- err = p.test(&pd, op)
- default:
- err = fmt.Errorf("Unexpected kind: %s", op.kind())
- }
-
- if err != nil {
- return nil, err
- }
- }
-
- if indent != "" {
- return json.MarshalIndent(pd, "", indent)
- }
-
- return json.Marshal(pd)
-}
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/.gitignore b/archived/event-adapter/vendor/github.com/ghodss/yaml/.gitignore
deleted file mode 100644
index e256a31e0..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/.gitignore
+++ /dev/null
@@ -1,20 +0,0 @@
-# OSX leaves these everywhere on SMB shares
-._*
-
-# Eclipse files
-.classpath
-.project
-.settings/**
-
-# Emacs save files
-*~
-
-# Vim-related files
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-*.un~
-Session.vim
-.netrwhist
-
-# Go test binaries
-*.test
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/.travis.yml b/archived/event-adapter/vendor/github.com/ghodss/yaml/.travis.yml
deleted file mode 100644
index 0e9d6edc0..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-go:
- - 1.3
- - 1.4
-script:
- - go test
- - go build
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/LICENSE b/archived/event-adapter/vendor/github.com/ghodss/yaml/LICENSE
deleted file mode 100644
index 7805d36de..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/LICENSE
+++ /dev/null
@@ -1,50 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Sam Ghods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-Copyright (c) 2012 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/README.md b/archived/event-adapter/vendor/github.com/ghodss/yaml/README.md
deleted file mode 100644
index f8f7e3695..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/README.md
+++ /dev/null
@@ -1,116 +0,0 @@
-# YAML marshaling and unmarshaling support for Go
-
-[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml)
-
-## Introduction
-
-A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs.
-
-In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
-
-## Compatibility
-
-This package uses [go-yaml v2](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility).
-
-## Caveats
-
-**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example:
-
-```
-BAD:
- exampleKey: !!binary gIGC
-
-GOOD:
- exampleKey: gIGC
-... and decode the base64 data in your code.
-```
-
-**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys.
-
-## Installation and usage
-
-To install, run:
-
-```
-$ go get github.com/ghodss/yaml
-```
-
-And import using:
-
-```
-import "github.com/ghodss/yaml"
-```
-
-Usage is very similar to the JSON library:
-
-```go
-import (
- "fmt"
-
- "github.com/ghodss/yaml"
-)
-
-type Person struct {
- Name string `json:"name"` // Affects YAML field names too.
- Age int `json:"name"`
-}
-
-func main() {
- // Marshal a Person struct to YAML.
- p := Person{"John", 30}
- y, err := yaml.Marshal(p)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(y))
- /* Output:
- name: John
- age: 30
- */
-
- // Unmarshal the YAML back into a Person struct.
- var p2 Person
- err := yaml.Unmarshal(y, &p2)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(p2)
- /* Output:
- {John 30}
- */
-}
-```
-
-`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available:
-
-```go
-import (
- "fmt"
-
- "github.com/ghodss/yaml"
-)
-func main() {
- j := []byte(`{"name": "John", "age": 30}`)
- y, err := yaml.JSONToYAML(j)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(y))
- /* Output:
- name: John
- age: 30
- */
- j2, err := yaml.YAMLToJSON(y)
- if err != nil {
- fmt.Printf("err: %v\n", err)
- return
- }
- fmt.Println(string(j2))
- /* Output:
- {"age":30,"name":"John"}
- */
-}
-```
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/fields.go b/archived/event-adapter/vendor/github.com/ghodss/yaml/fields.go
deleted file mode 100644
index 0bd3c2b46..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/fields.go
+++ /dev/null
@@ -1,497 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package yaml
-
-import (
- "bytes"
- "encoding"
- "encoding/json"
- "reflect"
- "sort"
- "strings"
- "sync"
- "unicode"
- "unicode/utf8"
-)
-
-// indirect walks down v allocating pointers as needed,
-// until it gets to a non-pointer.
-// if it encounters an Unmarshaler, indirect stops and returns that.
-// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
-func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
- // If v is a named type and is addressable,
- // start with its address, so that if the type has pointer methods,
- // we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
- v = v.Addr()
- }
- for {
- // Load value from interface, but only if the result will be
- // usefully addressable.
- if v.Kind() == reflect.Interface && !v.IsNil() {
- e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
- v = e
- continue
- }
- }
-
- if v.Kind() != reflect.Ptr {
- break
- }
-
- if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
- break
- }
- if v.IsNil() {
- v.Set(reflect.New(v.Type().Elem()))
- }
- if v.Type().NumMethod() > 0 {
- if u, ok := v.Interface().(json.Unmarshaler); ok {
- return u, nil, reflect.Value{}
- }
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
- return nil, u, reflect.Value{}
- }
- }
- v = v.Elem()
- }
- return nil, nil, v
-}
-
-// A field represents a single field found in a struct.
-type field struct {
- name string
- nameBytes []byte // []byte(name)
- equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent
-
- tag bool
- index []int
- typ reflect.Type
- omitEmpty bool
- quoted bool
-}
-
-func fillField(f field) field {
- f.nameBytes = []byte(f.name)
- f.equalFold = foldFunc(f.nameBytes)
- return f
-}
-
-// byName sorts field by name, breaking ties with depth,
-// then breaking ties with "name came from json tag", then
-// breaking ties with index sequence.
-type byName []field
-
-func (x byName) Len() int { return len(x) }
-
-func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byName) Less(i, j int) bool {
- if x[i].name != x[j].name {
- return x[i].name < x[j].name
- }
- if len(x[i].index) != len(x[j].index) {
- return len(x[i].index) < len(x[j].index)
- }
- if x[i].tag != x[j].tag {
- return x[i].tag
- }
- return byIndex(x).Less(i, j)
-}
-
-// byIndex sorts field by index sequence.
-type byIndex []field
-
-func (x byIndex) Len() int { return len(x) }
-
-func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-func (x byIndex) Less(i, j int) bool {
- for k, xik := range x[i].index {
- if k >= len(x[j].index) {
- return false
- }
- if xik != x[j].index[k] {
- return xik < x[j].index[k]
- }
- }
- return len(x[i].index) < len(x[j].index)
-}
-
-// typeFields returns a list of fields that JSON should recognize for the given type.
-// The algorithm is breadth-first search over the set of structs to include - the top struct
-// and then any reachable anonymous structs.
-func typeFields(t reflect.Type) []field {
- // Anonymous fields to explore at the current level and the next.
- current := []field{}
- next := []field{{typ: t}}
-
- // Count of queued names for current level and the next.
- count := map[reflect.Type]int{}
- nextCount := map[reflect.Type]int{}
-
- // Types already visited at an earlier level.
- visited := map[reflect.Type]bool{}
-
- // Fields found.
- var fields []field
-
- for len(next) > 0 {
- current, next = next, current[:0]
- count, nextCount = nextCount, map[reflect.Type]int{}
-
- for _, f := range current {
- if visited[f.typ] {
- continue
- }
- visited[f.typ] = true
-
- // Scan f.typ for fields to include.
- for i := 0; i < f.typ.NumField(); i++ {
- sf := f.typ.Field(i)
- if sf.PkgPath != "" { // unexported
- continue
- }
- tag := sf.Tag.Get("json")
- if tag == "-" {
- continue
- }
- name, opts := parseTag(tag)
- if !isValidTag(name) {
- name = ""
- }
- index := make([]int, len(f.index)+1)
- copy(index, f.index)
- index[len(f.index)] = i
-
- ft := sf.Type
- if ft.Name() == "" && ft.Kind() == reflect.Ptr {
- // Follow pointer.
- ft = ft.Elem()
- }
-
- // Record found field and index sequence.
- if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
- tagged := name != ""
- if name == "" {
- name = sf.Name
- }
- fields = append(fields, fillField(field{
- name: name,
- tag: tagged,
- index: index,
- typ: ft,
- omitEmpty: opts.Contains("omitempty"),
- quoted: opts.Contains("string"),
- }))
- if count[f.typ] > 1 {
- // If there were multiple instances, add a second,
- // so that the annihilation code will see a duplicate.
- // It only cares about the distinction between 1 or 2,
- // so don't bother generating any more copies.
- fields = append(fields, fields[len(fields)-1])
- }
- continue
- }
-
- // Record new anonymous struct to explore in next round.
- nextCount[ft]++
- if nextCount[ft] == 1 {
- next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft}))
- }
- }
- }
- }
-
- sort.Sort(byName(fields))
-
- // Delete all fields that are hidden by the Go rules for embedded fields,
- // except that fields with JSON tags are promoted.
-
- // The fields are sorted in primary order of name, secondary order
- // of field index length. Loop over names; for each name, delete
- // hidden fields by choosing the one dominant field that survives.
- out := fields[:0]
- for advance, i := 0, 0; i < len(fields); i += advance {
- // One iteration per name.
- // Find the sequence of fields with the name of this first field.
- fi := fields[i]
- name := fi.name
- for advance = 1; i+advance < len(fields); advance++ {
- fj := fields[i+advance]
- if fj.name != name {
- break
- }
- }
- if advance == 1 { // Only one field with this name
- out = append(out, fi)
- continue
- }
- dominant, ok := dominantField(fields[i : i+advance])
- if ok {
- out = append(out, dominant)
- }
- }
-
- fields = out
- sort.Sort(byIndex(fields))
-
- return fields
-}
-
-// dominantField looks through the fields, all of which are known to
-// have the same name, to find the single field that dominates the
-// others using Go's embedding rules, modified by the presence of
-// JSON tags. If there are multiple top-level fields, the boolean
-// will be false: This condition is an error in Go and we skip all
-// the fields.
-func dominantField(fields []field) (field, bool) {
- // The fields are sorted in increasing index-length order. The winner
- // must therefore be one with the shortest index length. Drop all
- // longer entries, which is easy: just truncate the slice.
- length := len(fields[0].index)
- tagged := -1 // Index of first tagged field.
- for i, f := range fields {
- if len(f.index) > length {
- fields = fields[:i]
- break
- }
- if f.tag {
- if tagged >= 0 {
- // Multiple tagged fields at the same level: conflict.
- // Return no field.
- return field{}, false
- }
- tagged = i
- }
- }
- if tagged >= 0 {
- return fields[tagged], true
- }
- // All remaining fields have the same length. If there's more than one,
- // we have a conflict (two fields named "X" at the same level) and we
- // return no field.
- if len(fields) > 1 {
- return field{}, false
- }
- return fields[0], true
-}
-
-var fieldCache struct {
- sync.RWMutex
- m map[reflect.Type][]field
-}
-
-// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
-func cachedTypeFields(t reflect.Type) []field {
- fieldCache.RLock()
- f := fieldCache.m[t]
- fieldCache.RUnlock()
- if f != nil {
- return f
- }
-
- // Compute fields without lock.
- // Might duplicate effort but won't hold other computations back.
- f = typeFields(t)
- if f == nil {
- f = []field{}
- }
-
- fieldCache.Lock()
- if fieldCache.m == nil {
- fieldCache.m = map[reflect.Type][]field{}
- }
- fieldCache.m[t] = f
- fieldCache.Unlock()
- return f
-}
-
-func isValidTag(s string) bool {
- if s == "" {
- return false
- }
- for _, c := range s {
- switch {
- case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
- // Backslash and quote chars are reserved, but
- // otherwise any punctuation chars are allowed
- // in a tag name.
- default:
- if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
- return false
- }
- }
- }
- return true
-}
-
-const (
- caseMask = ^byte(0x20) // Mask to ignore case in ASCII.
- kelvin = '\u212a'
- smallLongEss = '\u017f'
-)
-
-// foldFunc returns one of four different case folding equivalence
-// functions, from most general (and slow) to fastest:
-//
-// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8
-// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S')
-// 3) asciiEqualFold, no special, but includes non-letters (including _)
-// 4) simpleLetterEqualFold, no specials, no non-letters.
-//
-// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
-// See http://play.golang.org/p/tTxjOc0OGo
-//
-// The returned function is specialized for matching against s and
-// should only be given s. It's not curried for performance reasons.
-func foldFunc(s []byte) func(s, t []byte) bool {
- nonLetter := false
- special := false // special letter
- for _, b := range s {
- if b >= utf8.RuneSelf {
- return bytes.EqualFold
- }
- upper := b & caseMask
- if upper < 'A' || upper > 'Z' {
- nonLetter = true
- } else if upper == 'K' || upper == 'S' {
- // See above for why these letters are special.
- special = true
- }
- }
- if special {
- return equalFoldRight
- }
- if nonLetter {
- return asciiEqualFold
- }
- return simpleLetterEqualFold
-}
-
-// equalFoldRight is a specialization of bytes.EqualFold when s is
-// known to be all ASCII (including punctuation), but contains an 's',
-// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
-// See comments on foldFunc.
-func equalFoldRight(s, t []byte) bool {
- for _, sb := range s {
- if len(t) == 0 {
- return false
- }
- tb := t[0]
- if tb < utf8.RuneSelf {
- if sb != tb {
- sbUpper := sb & caseMask
- if 'A' <= sbUpper && sbUpper <= 'Z' {
- if sbUpper != tb&caseMask {
- return false
- }
- } else {
- return false
- }
- }
- t = t[1:]
- continue
- }
- // sb is ASCII and t is not. t must be either kelvin
- // sign or long s; sb must be s, S, k, or K.
- tr, size := utf8.DecodeRune(t)
- switch sb {
- case 's', 'S':
- if tr != smallLongEss {
- return false
- }
- case 'k', 'K':
- if tr != kelvin {
- return false
- }
- default:
- return false
- }
- t = t[size:]
-
- }
- if len(t) > 0 {
- return false
- }
- return true
-}
-
-// asciiEqualFold is a specialization of bytes.EqualFold for use when
-// s is all ASCII (but may contain non-letters) and contains no
-// special-folding letters.
-// See comments on foldFunc.
-func asciiEqualFold(s, t []byte) bool {
- if len(s) != len(t) {
- return false
- }
- for i, sb := range s {
- tb := t[i]
- if sb == tb {
- continue
- }
- if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') {
- if sb&caseMask != tb&caseMask {
- return false
- }
- } else {
- return false
- }
- }
- return true
-}
-
-// simpleLetterEqualFold is a specialization of bytes.EqualFold for
-// use when s is all ASCII letters (no underscores, etc) and also
-// doesn't contain 'k', 'K', 's', or 'S'.
-// See comments on foldFunc.
-func simpleLetterEqualFold(s, t []byte) bool {
- if len(s) != len(t) {
- return false
- }
- for i, b := range s {
- if b&caseMask != t[i]&caseMask {
- return false
- }
- }
- return true
-}
-
-// tagOptions is the string following a comma in a struct field's "json"
-// tag, or the empty string. It does not include the leading comma.
-type tagOptions string
-
-// parseTag splits a struct field's json tag into its name and
-// comma-separated options.
-func parseTag(tag string) (string, tagOptions) {
- if idx := strings.Index(tag, ","); idx != -1 {
- return tag[:idx], tagOptions(tag[idx+1:])
- }
- return tag, tagOptions("")
-}
-
-// Contains reports whether a comma-separated list of options
-// contains a particular substr flag. substr must be surrounded by a
-// string boundary or commas.
-func (o tagOptions) Contains(optionName string) bool {
- if len(o) == 0 {
- return false
- }
- s := string(o)
- for s != "" {
- var next string
- i := strings.Index(s, ",")
- if i >= 0 {
- s, next = s[:i], s[i+1:]
- }
- if s == optionName {
- return true
- }
- s = next
- }
- return false
-}
diff --git a/archived/event-adapter/vendor/github.com/ghodss/yaml/yaml.go b/archived/event-adapter/vendor/github.com/ghodss/yaml/yaml.go
deleted file mode 100644
index c02beacb9..000000000
--- a/archived/event-adapter/vendor/github.com/ghodss/yaml/yaml.go
+++ /dev/null
@@ -1,277 +0,0 @@
-package yaml
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
-
- "gopkg.in/yaml.v2"
-)
-
-// Marshals the object into JSON then converts JSON to YAML and returns the
-// YAML.
-func Marshal(o interface{}) ([]byte, error) {
- j, err := json.Marshal(o)
- if err != nil {
- return nil, fmt.Errorf("error marshaling into JSON: ", err)
- }
-
- y, err := JSONToYAML(j)
- if err != nil {
- return nil, fmt.Errorf("error converting JSON to YAML: ", err)
- }
-
- return y, nil
-}
-
-// Converts YAML to JSON then uses JSON to unmarshal into an object.
-func Unmarshal(y []byte, o interface{}) error {
- vo := reflect.ValueOf(o)
- j, err := yamlToJSON(y, &vo)
- if err != nil {
- return fmt.Errorf("error converting YAML to JSON: %v", err)
- }
-
- err = json.Unmarshal(j, o)
- if err != nil {
- return fmt.Errorf("error unmarshaling JSON: %v", err)
- }
-
- return nil
-}
-
-// Convert JSON to YAML.
-func JSONToYAML(j []byte) ([]byte, error) {
- // Convert the JSON to an object.
- var jsonObj interface{}
- // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the
- // Go JSON library doesn't try to pick the right number type (int, float,
- // etc.) when unmarshling to interface{}, it just picks float64
- // universally. go-yaml does go through the effort of picking the right
- // number type, so we can preserve number type throughout this process.
- err := yaml.Unmarshal(j, &jsonObj)
- if err != nil {
- return nil, err
- }
-
- // Marshal this object into YAML.
- return yaml.Marshal(jsonObj)
-}
-
-// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through
-// this method should be a no-op.
-//
-// Things YAML can do that are not supported by JSON:
-// * In YAML you can have binary and null keys in your maps. These are invalid
-// in JSON. (int and float keys are converted to strings.)
-// * Binary data in YAML with the !!binary tag is not supported. If you want to
-// use binary data with this library, encode the data as base64 as usual but do
-// not use the !!binary tag in your YAML. This will ensure the original base64
-// encoded data makes it all the way through to the JSON.
-func YAMLToJSON(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil)
-}
-
-func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) {
- // Convert the YAML to an object.
- var yamlObj interface{}
- err := yaml.Unmarshal(y, &yamlObj)
- if err != nil {
- return nil, err
- }
-
- // YAML objects are not completely compatible with JSON objects (e.g. you
- // can have non-string keys in YAML). So, convert the YAML-compatible object
- // to a JSON-compatible object, failing with an error if irrecoverable
- // incompatibilties happen along the way.
- jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget)
- if err != nil {
- return nil, err
- }
-
- // Convert this object to JSON and return the data.
- return json.Marshal(jsonObj)
-}
-
-func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) {
- var err error
-
- // Resolve jsonTarget to a concrete value (i.e. not a pointer or an
- // interface). We pass decodingNull as false because we're not actually
- // decoding into the value, we're just checking if the ultimate target is a
- // string.
- if jsonTarget != nil {
- ju, tu, pv := indirect(*jsonTarget, false)
- // We have a JSON or Text Umarshaler at this level, so we can't be trying
- // to decode into a string.
- if ju != nil || tu != nil {
- jsonTarget = nil
- } else {
- jsonTarget = &pv
- }
- }
-
- // If yamlObj is a number or a boolean, check if jsonTarget is a string -
- // if so, coerce. Else return normal.
- // If yamlObj is a map or array, find the field that each key is
- // unmarshaling to, and when you recurse pass the reflect.Value for that
- // field back into this function.
- switch typedYAMLObj := yamlObj.(type) {
- case map[interface{}]interface{}:
- // JSON does not support arbitrary keys in a map, so we must convert
- // these keys to strings.
- //
- // From my reading of go-yaml v2 (specifically the resolve function),
- // keys can only have the types string, int, int64, float64, binary
- // (unsupported), or null (unsupported).
- strMap := make(map[string]interface{})
- for k, v := range typedYAMLObj {
- // Resolve the key to a string first.
- var keyString string
- switch typedKey := k.(type) {
- case string:
- keyString = typedKey
- case int:
- keyString = strconv.Itoa(typedKey)
- case int64:
- // go-yaml will only return an int64 as a key if the system
- // architecture is 32-bit and the key's value is between 32-bit
- // and 64-bit. Otherwise the key type will simply be int.
- keyString = strconv.FormatInt(typedKey, 10)
- case float64:
- // Stolen from go-yaml to use the same conversion to string as
- // the go-yaml library uses to convert float to string when
- // Marshaling.
- s := strconv.FormatFloat(typedKey, 'g', -1, 32)
- switch s {
- case "+Inf":
- s = ".inf"
- case "-Inf":
- s = "-.inf"
- case "NaN":
- s = ".nan"
- }
- keyString = s
- case bool:
- if typedKey {
- keyString = "true"
- } else {
- keyString = "false"
- }
- default:
- return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v",
- reflect.TypeOf(k), k, v)
- }
-
- // jsonTarget should be a struct or a map. If it's a struct, find
- // the field it's going to map to and pass its reflect.Value. If
- // it's a map, find the element type of the map and pass the
- // reflect.Value created from that type. If it's neither, just pass
- // nil - JSON conversion will error for us if it's a real issue.
- if jsonTarget != nil {
- t := *jsonTarget
- if t.Kind() == reflect.Struct {
- keyBytes := []byte(keyString)
- // Find the field that the JSON library would use.
- var f *field
- fields := cachedTypeFields(t.Type())
- for i := range fields {
- ff := &fields[i]
- if bytes.Equal(ff.nameBytes, keyBytes) {
- f = ff
- break
- }
- // Do case-insensitive comparison.
- if f == nil && ff.equalFold(ff.nameBytes, keyBytes) {
- f = ff
- }
- }
- if f != nil {
- // Find the reflect.Value of the most preferential
- // struct field.
- jtf := t.Field(f.index[0])
- strMap[keyString], err = convertToJSONableObject(v, &jtf)
- if err != nil {
- return nil, err
- }
- continue
- }
- } else if t.Kind() == reflect.Map {
- // Create a zero value of the map's element type to use as
- // the JSON target.
- jtv := reflect.Zero(t.Type().Elem())
- strMap[keyString], err = convertToJSONableObject(v, &jtv)
- if err != nil {
- return nil, err
- }
- continue
- }
- }
- strMap[keyString], err = convertToJSONableObject(v, nil)
- if err != nil {
- return nil, err
- }
- }
- return strMap, nil
- case []interface{}:
- // We need to recurse into arrays in case there are any
- // map[interface{}]interface{}'s inside and to convert any
- // numbers to strings.
-
- // If jsonTarget is a slice (which it really should be), find the
- // thing it's going to map to. If it's not a slice, just pass nil
- // - JSON conversion will error for us if it's a real issue.
- var jsonSliceElemValue *reflect.Value
- if jsonTarget != nil {
- t := *jsonTarget
- if t.Kind() == reflect.Slice {
- // By default slices point to nil, but we need a reflect.Value
- // pointing to a value of the slice type, so we create one here.
- ev := reflect.Indirect(reflect.New(t.Type().Elem()))
- jsonSliceElemValue = &ev
- }
- }
-
- // Make and use a new array.
- arr := make([]interface{}, len(typedYAMLObj))
- for i, v := range typedYAMLObj {
- arr[i], err = convertToJSONableObject(v, jsonSliceElemValue)
- if err != nil {
- return nil, err
- }
- }
- return arr, nil
- default:
- // If the target type is a string and the YAML type is a number,
- // convert the YAML type to a string.
- if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String {
- // Based on my reading of go-yaml, it may return int, int64,
- // float64, or uint64.
- var s string
- switch typedVal := typedYAMLObj.(type) {
- case int:
- s = strconv.FormatInt(int64(typedVal), 10)
- case int64:
- s = strconv.FormatInt(typedVal, 10)
- case float64:
- s = strconv.FormatFloat(typedVal, 'g', -1, 32)
- case uint64:
- s = strconv.FormatUint(typedVal, 10)
- case bool:
- if typedVal {
- s = "true"
- } else {
- s = "false"
- }
- }
- if len(s) > 0 {
- yamlObj = interface{}(s)
- }
- }
- return yamlObj, nil
- }
-
- return nil, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.drone.yml b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.drone.yml
deleted file mode 100644
index cb8c7b50a..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.drone.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-clone:
- path: github.com/go-openapi/jsonpointer
-
-matrix:
- GO_VERSION:
- - "1.6"
-
-build:
- integration:
- image: golang:$$GO_VERSION
- pull: true
- commands:
- - go get -u github.com/stretchr/testify/assert
- - go get -u github.com/go-openapi/swag
- - go test -race
- - go test -v -cover -coverprofile=coverage.out -covermode=count ./...
-
-notify:
- slack:
- channel: bots
- webhook_url: $$SLACK_URL
- username: drone
-
-publish:
- coverage:
- server: https://coverage.vmware.run
- token: $$GITHUB_TOKEN
- # threshold: 70
- # must_increase: true
- when:
- matrix:
- GO_VERSION: "1.6"
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.gitignore b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.gitignore
deleted file mode 100644
index 769c24400..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-secrets.yml
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.pullapprove.yml b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.pullapprove.yml
deleted file mode 100644
index 5ec183e22..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/.pullapprove.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-approve_by_comment: true
-approve_regex: '^(:shipit:|:\+1:|\+1|LGTM|lgtm|Approved)'
-reject_regex: ^[Rr]ejected
-reset_on_push: false
-reviewers:
- members:
- - casualjim
- - chancez
- - frapposelli
- - vburenin
- - pytlesk4
- name: pullapprove
- required: 1
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b065e..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at ivan+abuse@flanders.co.nz. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/LICENSE b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/README.md b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/README.md
deleted file mode 100644
index 9c9b1fd48..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# gojsonpointer [![Build Status](https://ci.vmware.run/api/badges/go-openapi/jsonpointer/status.svg)](https://ci.vmware.run/go-openapi/jsonpointer) [![Coverage](https://coverage.vmware.run/badges/go-openapi/jsonpointer/coverage.svg)](https://coverage.vmware.run/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
-
-[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer)
-An implementation of JSON Pointer - Go language
-
-## Status
-Completed YES
-
-Tested YES
-
-## References
-http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
-
-### Note
-The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented.
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/pointer.go b/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/pointer.go
deleted file mode 100644
index 39dd012c2..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonpointer/pointer.go
+++ /dev/null
@@ -1,238 +0,0 @@
-// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// author sigu-399
-// author-github https://github.com/sigu-399
-// author-mail sigu.399@gmail.com
-//
-// repository-name jsonpointer
-// repository-desc An implementation of JSON Pointer - Go language
-//
-// description Main and unique file.
-//
-// created 25-02-2013
-
-package jsonpointer
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-const (
- emptyPointer = ``
- pointerSeparator = `/`
-
- invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator
-)
-
-var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem()
-
-// JSONPointable is an interface for structs to implement when they need to customize the
-// json pointer process
-type JSONPointable interface {
- JSONLookup(string) (interface{}, error)
-}
-
-type implStruct struct {
- mode string // "SET" or "GET"
-
- inDocument interface{}
-
- setInValue interface{}
-
- getOutNode interface{}
- getOutKind reflect.Kind
- outError error
-}
-
-// New creates a new json pointer for the given string
-func New(jsonPointerString string) (Pointer, error) {
-
- var p Pointer
- err := p.parse(jsonPointerString)
- return p, err
-
-}
-
-// Pointer the json pointer reprsentation
-type Pointer struct {
- referenceTokens []string
-}
-
-// "Constructor", parses the given string JSON pointer
-func (p *Pointer) parse(jsonPointerString string) error {
-
- var err error
-
- if jsonPointerString != emptyPointer {
- if !strings.HasPrefix(jsonPointerString, pointerSeparator) {
- err = errors.New(invalidStart)
- } else {
- referenceTokens := strings.Split(jsonPointerString, pointerSeparator)
- for _, referenceToken := range referenceTokens[1:] {
- p.referenceTokens = append(p.referenceTokens, referenceToken)
- }
- }
- }
-
- return err
-}
-
-// Get uses the pointer to retrieve a value from a JSON document
-func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) {
- return p.get(document, swag.DefaultJSONNameProvider)
-}
-
-// GetForToken gets a value for a json pointer token 1 level deep
-func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) {
- return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider)
-}
-
-func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) {
- kind := reflect.Invalid
- rValue := reflect.Indirect(reflect.ValueOf(node))
- kind = rValue.Kind()
- switch kind {
-
- case reflect.Struct:
- if rValue.Type().Implements(jsonPointableType) {
- r, err := node.(JSONPointable).JSONLookup(decodedToken)
- if err != nil {
- return nil, kind, err
- }
- return r, kind, nil
- }
- nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken)
- if !ok {
- return nil, kind, fmt.Errorf("object has no field %q", decodedToken)
- }
- fld := rValue.FieldByName(nm)
- return fld.Interface(), kind, nil
-
- case reflect.Map:
- kv := reflect.ValueOf(decodedToken)
- mv := rValue.MapIndex(kv)
- if mv.IsValid() && !swag.IsZero(mv) {
- return mv.Interface(), kind, nil
- }
- return nil, kind, fmt.Errorf("object has no key %q", decodedToken)
-
- case reflect.Slice:
- tokenIndex, err := strconv.Atoi(decodedToken)
- if err != nil {
- return nil, kind, err
- }
- sLength := rValue.Len()
- if tokenIndex < 0 || tokenIndex >= sLength {
- return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex)
- }
-
- elem := rValue.Index(tokenIndex)
- return elem.Interface(), kind, nil
-
- default:
- return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken)
- }
-
-}
-
-func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) {
-
- if nameProvider == nil {
- nameProvider = swag.DefaultJSONNameProvider
- }
-
- kind := reflect.Invalid
-
- // Full document when empty
- if len(p.referenceTokens) == 0 {
- return node, kind, nil
- }
-
- for _, token := range p.referenceTokens {
-
- decodedToken := Unescape(token)
-
- r, knd, err := getSingleImpl(node, decodedToken, nameProvider)
- if err != nil {
- return nil, knd, err
- }
- node, kind = r, knd
-
- }
-
- rValue := reflect.ValueOf(node)
- kind = rValue.Kind()
-
- return node, kind, nil
-}
-
-// DecodedTokens returns the decoded tokens
-func (p *Pointer) DecodedTokens() []string {
- result := make([]string, 0, len(p.referenceTokens))
- for _, t := range p.referenceTokens {
- result = append(result, Unescape(t))
- }
- return result
-}
-
-// IsEmpty returns true if this is an empty json pointer
-// this indicates that it points to the root document
-func (p *Pointer) IsEmpty() bool {
- return len(p.referenceTokens) == 0
-}
-
-// Pointer to string representation function
-func (p *Pointer) String() string {
-
- if len(p.referenceTokens) == 0 {
- return emptyPointer
- }
-
- pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator)
-
- return pointerString
-}
-
-// Specific JSON pointer encoding here
-// ~0 => ~
-// ~1 => /
-// ... and vice versa
-
-const (
- encRefTok0 = `~0`
- encRefTok1 = `~1`
- decRefTok0 = `~`
- decRefTok1 = `/`
-)
-
-// Unescape unescapes a json pointer reference token string to the original representation
-func Unescape(token string) string {
- step1 := strings.Replace(token, encRefTok1, decRefTok1, -1)
- step2 := strings.Replace(step1, encRefTok0, decRefTok0, -1)
- return step2
-}
-
-// Escape escapes a pointer reference token string
-func Escape(token string) string {
- step1 := strings.Replace(token, decRefTok0, encRefTok0, -1)
- step2 := strings.Replace(step1, decRefTok1, encRefTok1, -1)
- return step2
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.drone.yml b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.drone.yml
deleted file mode 100644
index 157ffe579..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.drone.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-clone:
- path: github.com/go-openapi/jsonreference
-
-matrix:
- GO_VERSION:
- - "1.6"
-
-build:
- integration:
- image: golang:$$GO_VERSION
- pull: true
- commands:
- - go get -u github.com/stretchr/testify/assert
- - go get -u github.com/PuerkitoBio/purell
- - go get -u github.com/go-openapi/jsonpointer
- - go test -race
- - go test -v -cover -coverprofile=coverage.out -covermode=count ./...
-
-notify:
- slack:
- channel: bots
- webhook_url: $$SLACK_URL
- username: drone
-
-publish:
- coverage:
- server: https://coverage.vmware.run
- token: $$GITHUB_TOKEN
- # threshold: 70
- # must_increase: true
- when:
- matrix:
- GO_VERSION: "1.6"
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.gitignore b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.gitignore
deleted file mode 100644
index 769c24400..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-secrets.yml
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.pullapprove.yml b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.pullapprove.yml
deleted file mode 100644
index 5ec183e22..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/.pullapprove.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-approve_by_comment: true
-approve_regex: '^(:shipit:|:\+1:|\+1|LGTM|lgtm|Approved)'
-reject_regex: ^[Rr]ejected
-reset_on_push: false
-reviewers:
- members:
- - casualjim
- - chancez
- - frapposelli
- - vburenin
- - pytlesk4
- name: pullapprove
- required: 1
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b065e..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at ivan+abuse@flanders.co.nz. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/LICENSE b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/README.md b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/README.md
deleted file mode 100644
index 5f7881274..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# gojsonreference [![Build Status](https://ci.vmware.run/api/badges/go-openapi/jsonreference/status.svg)](https://ci.vmware.run/go-openapi/jsonreference) [![Coverage](https://coverage.vmware.run/badges/go-openapi/jsonreference/coverage.svg)](https://coverage.vmware.run/go-openapi/jsonreference) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
-
-[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonreference?status.svg)](http://godoc.org/github.com/go-openapi/jsonreference)
-An implementation of JSON Reference - Go language
-
-## Status
-Work in progress ( 90% done )
-
-## Dependencies
-https://github.com/xeipuuv/gojsonpointer
-
-## References
-http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07
-
-http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/reference.go b/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/reference.go
deleted file mode 100644
index 3bc0a6e26..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/jsonreference/reference.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// author sigu-399
-// author-github https://github.com/sigu-399
-// author-mail sigu.399@gmail.com
-//
-// repository-name jsonreference
-// repository-desc An implementation of JSON Reference - Go language
-//
-// description Main and unique file.
-//
-// created 26-02-2013
-
-package jsonreference
-
-import (
- "errors"
- "net/url"
- "strings"
-
- "github.com/PuerkitoBio/purell"
- "github.com/go-openapi/jsonpointer"
-)
-
-const (
- fragmentRune = `#`
-)
-
-// New creates a new reference for the given string
-func New(jsonReferenceString string) (Ref, error) {
-
- var r Ref
- err := r.parse(jsonReferenceString)
- return r, err
-
-}
-
-// MustCreateRef parses the ref string and panics when it's invalid.
-// Use the New method for a version that returns an error
-func MustCreateRef(ref string) Ref {
- r, err := New(ref)
- if err != nil {
- panic(err)
- }
- return r
-}
-
-// Ref represents a json reference object
-type Ref struct {
- referenceURL *url.URL
- referencePointer jsonpointer.Pointer
-
- HasFullURL bool
- HasURLPathOnly bool
- HasFragmentOnly bool
- HasFileScheme bool
- HasFullFilePath bool
-}
-
-// GetURL gets the URL for this reference
-func (r *Ref) GetURL() *url.URL {
- return r.referenceURL
-}
-
-// GetPointer gets the json pointer for this reference
-func (r *Ref) GetPointer() *jsonpointer.Pointer {
- return &r.referencePointer
-}
-
-// String returns the best version of the url for this reference
-func (r *Ref) String() string {
-
- if r.referenceURL != nil {
- return r.referenceURL.String()
- }
-
- if r.HasFragmentOnly {
- return fragmentRune + r.referencePointer.String()
- }
-
- return r.referencePointer.String()
-}
-
-// IsRoot returns true if this reference is a root document
-func (r *Ref) IsRoot() bool {
- return r.referenceURL != nil &&
- !r.IsCanonical() &&
- !r.HasURLPathOnly &&
- r.referenceURL.Fragment == ""
-}
-
-// IsCanonical returns true when this pointer starts with http(s):// or file://
-func (r *Ref) IsCanonical() bool {
- return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL)
-}
-
-// "Constructor", parses the given string JSON reference
-func (r *Ref) parse(jsonReferenceString string) error {
-
- parsed, err := url.Parse(jsonReferenceString)
- if err != nil {
- return err
- }
-
- r.referenceURL, _ = url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
- refURL := r.referenceURL
-
- if refURL.Scheme != "" && refURL.Host != "" {
- r.HasFullURL = true
- } else {
- if refURL.Path != "" {
- r.HasURLPathOnly = true
- } else if refURL.RawQuery == "" && refURL.Fragment != "" {
- r.HasFragmentOnly = true
- }
- }
-
- r.HasFileScheme = refURL.Scheme == "file"
- r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/")
-
- // invalid json-pointer error means url has no json-pointer fragment. simply ignore error
- r.referencePointer, _ = jsonpointer.New(refURL.Fragment)
-
- return nil
-}
-
-// Inherits creates a new reference from a parent and a child
-// If the child cannot inherit from the parent, an error is returned
-func (r *Ref) Inherits(child Ref) (*Ref, error) {
- childURL := child.GetURL()
- parentURL := r.GetURL()
- if childURL == nil {
- return nil, errors.New("child url is nil")
- }
- if parentURL == nil {
- return &child, nil
- }
-
- ref, err := New(parentURL.ResolveReference(childURL).String())
- if err != nil {
- return nil, err
- }
- return &ref, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/.drone.yml b/archived/event-adapter/vendor/github.com/go-openapi/spec/.drone.yml
deleted file mode 100644
index 6d0442737..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/.drone.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-clone:
- path: github.com/go-openapi/spec
-
-matrix:
- GO_VERSION:
- - "1.6"
-
-build:
- integration:
- image: golang:$$GO_VERSION
- pull: true
- commands:
- - go get -u github.com/stretchr/testify/assert
- - go get -u gopkg.in/yaml.v2
- - go get -u github.com/go-openapi/swag
- - go get -u github.com/go-openapi/jsonpointer
- - go get -u github.com/go-openapi/jsonreference
- - go test -race
- - go test -v -cover -coverprofile=coverage.out -covermode=count ./...
-
-notify:
- slack:
- channel: bots
- webhook_url: $$SLACK_URL
- username: drone
-
-publish:
- coverage:
- server: https://coverage.vmware.run
- token: $$GITHUB_TOKEN
- # threshold: 70
- # must_increase: true
- when:
- matrix:
- GO_VERSION: "1.6"
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/.gitignore b/archived/event-adapter/vendor/github.com/go-openapi/spec/.gitignore
deleted file mode 100644
index dd91ed6a0..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-secrets.yml
-coverage.out
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/.pullapprove.yml b/archived/event-adapter/vendor/github.com/go-openapi/spec/.pullapprove.yml
deleted file mode 100644
index 5ec183e22..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/.pullapprove.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-approve_by_comment: true
-approve_regex: '^(:shipit:|:\+1:|\+1|LGTM|lgtm|Approved)'
-reject_regex: ^[Rr]ejected
-reset_on_push: false
-reviewers:
- members:
- - casualjim
- - chancez
- - frapposelli
- - vburenin
- - pytlesk4
- name: pullapprove
- required: 1
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md b/archived/event-adapter/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b065e..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at ivan+abuse@flanders.co.nz. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/LICENSE b/archived/event-adapter/vendor/github.com/go-openapi/spec/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/README.md b/archived/event-adapter/vendor/github.com/go-openapi/spec/README.md
deleted file mode 100644
index 4b2af124a..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# OAI object model [![Build Status](https://ci.vmware.run/api/badges/go-openapi/spec/status.svg)](https://ci.vmware.run/go-openapi/spec) [![Coverage](https://coverage.vmware.run/badges/go-openapi/spec/coverage.svg)](https://coverage.vmware.run/go-openapi/spec) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
-
-[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/spec?status.svg)](http://godoc.org/github.com/go-openapi/spec)
-
-The object model for OpenAPI specification documents
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/bindata.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/bindata.go
deleted file mode 100644
index 294cbccf7..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/bindata.go
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Code generated by go-bindata.
-// sources:
-// schemas/jsonschema-draft-04.json
-// schemas/v2/schema.json
-// DO NOT EDIT!
-
-package spec
-
-import (
- "bytes"
- "compress/gzip"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
- "time"
-)
-
-func bindataRead(data []byte, name string) ([]byte, error) {
- gz, err := gzip.NewReader(bytes.NewBuffer(data))
- if err != nil {
- return nil, fmt.Errorf("Read %q: %v", name, err)
- }
-
- var buf bytes.Buffer
- _, err = io.Copy(&buf, gz)
- clErr := gz.Close()
-
- if err != nil {
- return nil, fmt.Errorf("Read %q: %v", name, err)
- }
- if clErr != nil {
- return nil, err
- }
-
- return buf.Bytes(), nil
-}
-
-type asset struct {
- bytes []byte
- info os.FileInfo
-}
-
-type bindataFileInfo struct {
- name string
- size int64
- mode os.FileMode
- modTime time.Time
-}
-
-func (fi bindataFileInfo) Name() string {
- return fi.name
-}
-func (fi bindataFileInfo) Size() int64 {
- return fi.size
-}
-func (fi bindataFileInfo) Mode() os.FileMode {
- return fi.mode
-}
-func (fi bindataFileInfo) ModTime() time.Time {
- return fi.modTime
-}
-func (fi bindataFileInfo) IsDir() bool {
- return false
-}
-func (fi bindataFileInfo) Sys() interface{} {
- return nil
-}
-
-var _jsonschemaDraft04JSON = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xcc\x57\x3b\x6f\xdb\x30\x10\xde\xfd\x2b\x04\xa5\x63\x52\xb9\x40\xa7\x6c\x45\xbb\x18\x68\xd1\x0c\xdd\x0c\x0f\xb4\x75\xb2\x19\x50\xa4\x42\x51\x85\x0d\x43\xff\xbd\xa4\xa8\x07\x29\x91\x92\x2d\xbb\x48\xb4\xc4\xe1\xbd\xbe\x3b\xde\x8b\xe7\x45\x20\xbf\x10\xc7\xe1\x73\x10\x1e\x84\xc8\x9e\xa3\xe8\x35\x67\xf4\x29\xdf\x1d\x20\x45\x9f\x19\xdf\x47\x31\x47\x89\x78\x5a\x7e\x8d\xf4\xd9\x43\xf8\xa8\x85\x3e\xe9\xff\x67\x48\xc6\x90\xef\x38\xce\x04\x66\x54\x49\x7f\x67\x1c\x02\xcd\x12\xa4\x20\x50\xad\xa2\xe3\x4e\x30\xc5\x8a\x39\x97\xdc\x1a\x71\x45\xd0\x6c\xdf\x38\x47\x27\x8b\x50\x11\xc5\x29\x03\xa5\x1c\x55\xe4\x47\x9b\x98\x62\xba\x12\x90\x2a\x7d\x5f\x7a\x24\x5c\x9f\x9f\xa5\x83\x1c\x12\xa5\xe2\x21\x0c\xca\x96\xa9\xec\xf8\xc3\x8c\xe5\x12\xd7\x5f\x58\x51\x01\x7b\xe0\x7e\x10\xb8\x66\x18\xc2\xc0\x69\x91\x4a\x8e\xe5\x25\xfa\x7f\x40\x82\x0a\x22\x96\x43\x3b\x88\x90\xdf\x0a\xea\xda\x82\x1d\x19\x91\x8b\xfa\x58\xa5\x21\xc5\x1c\x6b\x9d\x0a\x42\x50\x06\x1b\x27\x8c\x1c\xa7\x19\x81\x3f\xd2\x97\x7c\x68\x1a\x68\xe5\xc0\xba\x8d\x74\x10\x6e\x19\x23\x80\xa8\xfa\xd9\x3a\x1e\x84\xb4\x20\x44\xff\x4d\xb7\xfa\x84\x6d\x5f\x61\x27\xd4\xaf\x5c\x70\x4c\xf7\xa1\xcf\x7e\x45\x9d\x73\xcf\xc6\x65\x36\x7c\x8d\xa9\xf2\xf2\x94\x28\x28\x7e\x2b\xa0\xa1\x0a\x5e\x40\x07\x73\x61\x80\x6d\x6d\x34\x8e\xe9\xd3\x8c\xb3\x0c\xb8\xc0\xbd\xe8\xe9\xa2\xf3\x78\x53\xa3\xec\x01\x49\x18\x4f\x91\xba\xab\xb0\xe0\x38\x74\xc6\xaa\x2b\xca\x7b\x6b\x16\x58\x10\x98\xd4\xeb\x14\xb5\xeb\x7d\x96\x82\x26\x4b\xcf\xe6\x71\x2a\xcf\xb0\x4c\xcd\x2a\xf7\x3d\x6a\x9b\x74\xf3\x56\x5e\x8f\x02\xc7\x1d\x29\x72\x59\x28\xbf\x5a\x16\xfb\xc6\x4d\xfb\xe8\x58\xb3\x8c\x1b\x77\x0a\x77\x86\xa6\xb4\xb4\xf5\x64\x93\xbb\xa0\x24\x88\xe4\x1e\x84\xad\x13\x37\x21\x9c\xd2\x72\x0b\x42\x74\xfc\x09\x74\x2f\x0e\xbd\x9e\x3b\xd5\xbc\x2c\x1f\xaf\xd6\xd0\xb6\x52\xbb\xdf\x22\x21\x80\x4f\xe7\xa8\xb7\x78\xb8\xd4\x7d\x74\x07\x13\xc5\x71\x05\x05\x91\xa6\x91\xf4\x7b\x38\x3d\xe9\x1e\x6e\x1d\xab\xef\x3c\x0c\x74\xbf\x7d\xd5\x6c\xce\x89\xa5\xbe\x8d\xf7\x66\xce\xee\xd1\x86\x67\x80\x34\xad\x8f\xc3\xb3\xae\xc6\x1c\xe3\xb7\xc2\x96\xd9\xb4\x72\x0c\xf0\xab\x92\xe9\x5a\x05\xee\x5c\xb2\x87\xc6\x7f\xa9\x9b\x17\x6b\xb0\xcc\x75\x77\x96\x16\xb7\xcf\x1c\xde\x0a\xcc\x21\x1e\x53\x64\x0e\x73\x4f\x81\xbc\xb8\x07\xa6\xe6\xfa\x50\x55\xe2\x5b\x4d\xad\x4b\xb6\xb6\x81\x49\x77\xc7\xca\x68\x1a\x90\x67\xd7\x78\x3f\x3c\xba\xa3\x8e\xdd\xe8\x7b\xc0\x8a\x21\x03\x1a\x03\xdd\xdd\x11\xd1\x20\xd3\x46\x72\x55\x7d\x93\x0d\xb3\xcf\x34\x52\x46\x03\xd9\x8d\x75\xe2\x0e\x42\xbd\xb9\xdf\xe9\xdd\x34\xb6\x24\x9b\x5b\xa4\x56\x3f\x6b\xac\xd8\x01\x30\x1e\x25\xce\x3a\x77\xc6\x73\xd4\xbd\x96\xc9\xf5\x06\xbc\xca\xf8\x44\xb0\x2e\x09\x5a\xf3\xf5\x3a\x94\x7b\xb7\xa8\x9f\x7f\x17\x8e\x58\x53\xb2\x0e\xfc\xf5\x92\x8c\xc2\x4c\x49\xca\x84\xe7\x7d\x5d\xb6\x2f\x7e\x4f\x79\xba\x96\xe6\x75\xb7\x87\x9b\x0d\xdc\xb5\xbd\xae\xbb\x85\xb8\x8e\x64\x67\xd1\xe8\x18\xe5\xe2\x5f\x00\x00\x00\xff\xff\x4e\x9b\x8d\xdf\x17\x11\x00\x00")
-
-func jsonschemaDraft04JSONBytes() ([]byte, error) {
- return bindataRead(
- _jsonschemaDraft04JSON,
- "jsonschema-draft-04.json",
- )
-}
-
-func jsonschemaDraft04JSON() (*asset, error) {
- bytes, err := jsonschemaDraft04JSONBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "jsonschema-draft-04.json", size: 4375, mode: os.FileMode(420), modTime: time.Unix(1441640690, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-var _v2SchemaJSON = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xec\x5d\xdf\x73\xdc\xb6\xf1\x7f\xcf\x5f\x81\xb9\x78\x46\xf6\x24\xd6\x39\xfe\x7e\x5f\xea\x97\x8c\x1a\x39\x89\x5a\xbb\xd2\xf8\x9c\xf6\xc1\x95\x67\x70\x24\x4e\x87\x84\x3f\x2e\x04\x29\xe9\xea\xea\x7f\xef\x02\xfc\x71\x04\x01\x90\x20\x89\x3b\x9d\x6d\x7a\xa6\x8d\x8e\x04\x16\x8b\xc5\x62\xf7\xb3\x0b\x10\xf8\xf4\x0d\x42\xb3\x94\xa6\x01\x99\xbd\x42\xb3\x33\xf4\xb7\xc5\xe5\x3f\xd0\xc2\x5b\x93\x10\xa3\x55\x9c\xa0\xc5\x1d\xbe\xb9\x21\x09\x7a\x79\xfa\x02\x9d\x5d\x5d\x9c\xce\xbe\xe7\x15\xa8\xcf\x4b\xaf\xd3\x74\xf3\x6a\x3e\x67\x79\x91\x53\x1a\xcf\x6f\x5f\xce\x99\xa8\x7b\xfa\x3b\x8b\xa3\x6f\xf3\xc2\x4f\xf2\x47\xb5\x1a\xfc\xe5\xf3\xa2\x60\x9c\xdc\xcc\xfd\x04\xaf\xd2\xe7\x2f\xfe\xbf\xa8\x5c\xd4\x4b\xb7\x1b\xc1\x54\xbc\xfc\x9d\x78\x69\xfe\x2c\x21\x7f\x66\x34\x21\xbc\xf9\x0f\xf0\x1b\x9e\x14\xad\x8b\xd7\x9c\xb3\x68\x15\x97\x7f\x6f\x70\xba\x66\x33\xf8\xfb\x5a\xd4\xc5\xbe\x4f\x53\x1a\x47\x38\xb8\x4a\xe2\x0d\x49\x52\x4a\x18\xd0\x59\xe1\x80\x11\x51\x00\xca\xa7\x24\x89\xa4\xb7\x9f\x72\x52\x1f\xef\x9f\x57\x3f\x78\x97\x12\xb2\xe2\xac\x7d\x3b\xf7\xc9\x8a\x46\x82\x2c\x9b\xdf\x92\xc8\x8f\x93\xd7\xf7\x29\x89\x18\x3c\x98\x89\xd2\x0f\xf0\xff\x0f\x39\x79\x0d\xdd\x92\xfb\x1a\xed\xb2\xdb\x2c\x4d\x68\x74\x53\xf4\x05\x9e\x93\x28\x0b\xab\x6e\x8b\x27\x30\x26\xb3\xe2\xd7\x75\x55\xcc\x27\xcc\x4b\xe8\x86\x73\xc4\xa9\xbc\x5f\x93\x6a\x0c\x6f\x49\xc2\xf9\x42\xf1\x0a\xa5\x6b\xca\x90\x1f\x7b\x59\x48\xa2\xf4\xb4\xe0\xb4\x2e\xc2\xce\xce\x8a\x52\x52\xbd\x75\xcc\x52\x9b\x8e\x14\x62\xe6\xaf\x3e\x7e\xf8\xf8\xe9\x61\x8e\x5e\xfd\x1b\xfe\x5d\x7f\xf7\xf4\xc7\x57\xf0\x97\xff\xdd\xb3\x1f\x9f\xcc\xda\xfa\xc3\x1b\x42\x4f\x23\x1c\x12\x04\x1a\x4a\x37\xcf\xf2\x1e\x11\xa1\xa0\xe8\xf5\x3d\x0e\x37\x01\x79\x85\x4e\x76\x8a\x79\x22\x73\xba\xc4\x8c\x5c\x81\x72\xf4\xe5\x76\xde\xca\x16\xa7\x8a\xb8\xce\xa1\x34\xd6\xb1\x33\xc7\x1b\x7a\xd2\x90\xb5\x50\xf8\x9a\x42\x18\xc5\x5d\x14\x7c\x43\x41\xc6\x12\x05\x0f\xde\x66\x0d\x12\x0d\xe6\xce\x50\x00\xd5\xb8\x90\xde\x5e\xbc\x7d\x8d\x78\x4f\x19\xc2\x9e\x47\x36\x29\xf1\xd1\x72\x5b\x31\xbb\xeb\x9e\x9e\x89\x90\xf8\x14\xbf\x87\xea\x2a\x1b\xa0\xdc\x7e\xe6\xf5\x67\xa3\x68\x1a\x79\x38\x42\x05\x8d\x51\x6c\x88\x29\xdf\x29\xcd\xca\x32\xec\x6a\xd6\x5e\x77\xd7\xaf\x17\x6e\xb4\x9f\x80\x5a\x82\xc2\x58\x31\x51\x94\x3d\x37\x51\x4b\x08\xdb\xc0\x43\x1b\xfd\x28\x8b\x1a\x69\x31\xe2\x65\x09\x4d\xb7\x16\xaa\x56\x96\xd4\xd6\x3f\xef\x23\x27\x5d\x25\x89\x6a\x8a\x6f\x98\x6e\x16\xe2\x24\xc1\xdb\x9d\x1e\xd0\x94\x84\xf5\x72\xc6\x06\x81\x5e\x69\x12\x1f\xaa\xda\x59\x44\xff\xcc\xc8\x45\x41\x23\x4d\x32\x22\xf1\x40\xee\xf9\x04\xc7\xc1\x79\xec\x59\x74\x49\x2a\xdd\xb0\xf0\x3a\x1d\x52\xcc\xa9\xc6\xad\xe9\x66\xcb\x2f\x24\x22\x09\x0e\x10\xaf\x9e\x84\x98\x3f\x46\x78\x19\x67\xa9\x66\xb6\x2a\x5e\x51\x3c\x2d\xcc\x7d\x55\xac\x72\xf4\x8a\xcf\xe8\xf2\x8c\xe5\xd4\x32\x78\x47\xf1\x5a\xf6\x90\x2d\x02\xd4\x7a\xc9\x52\x8e\xf2\xc0\x69\x3c\x66\xad\x1b\x8d\xd6\x0c\x06\x5c\x27\xdb\x33\x94\xab\x04\xc2\x91\x0f\x56\x87\x78\x14\x2c\xb7\x20\x5a\xf7\x24\x35\xce\xbe\x57\xa5\x3a\xa6\x75\x06\x20\x27\x4a\xa9\x57\x79\x64\x70\xed\x4b\x70\xd0\x9d\x8d\xcb\x94\x86\x33\x10\xc4\x11\x07\x04\xb5\xe7\x92\x0b\x5d\xac\xe3\x2c\x00\xcf\x40\x90\x4f\x57\x2b\x92\x00\x46\x40\xab\x24\x0e\x45\x09\x21\xa7\x53\x84\x7e\xa1\xe9\xaf\xd9\x12\xfd\x1c\xe0\xdb\x18\x74\x0f\xbd\xc5\xc9\x1f\x7e\x7c\x17\x21\x40\x16\x38\x08\xe2\x3b\xe2\x1b\x7a\x01\x6a\x14\xb2\xcb\xd5\x82\x24\xb7\xd4\x1b\x33\x8e\xdc\xeb\x0a\x62\x9c\x7b\x96\x93\x13\xa8\xb5\x5d\x8a\xe0\x32\x53\xec\xa5\x76\xea\x5a\x16\xd6\x52\x0a\xa0\x41\x30\xba\x76\x94\xca\xc2\xaa\xc2\x37\x1d\x7a\x83\x3b\x5b\x93\xf1\x53\x5e\x53\x32\x19\xa5\x34\x60\x60\x40\xd7\x24\x0d\xeb\x39\xfd\x0d\x73\x91\xc3\xb0\x91\x43\x48\x7d\x50\x30\xba\xda\x42\x59\x94\xa3\xba\x9c\xcb\x42\x12\x08\xda\x85\x80\x61\x0e\x91\x02\x8e\xe8\x7f\x44\xbf\x0c\x23\x9b\x25\xc1\x48\x5e\x7e\x7b\xf7\x06\x6d\x62\x0a\xfc\x00\x33\x05\x8e\xf3\x54\xb9\x9e\xca\x84\xf2\xe7\x9c\x06\xb8\x3b\x3d\x6b\x30\xe5\xe9\x58\xe6\x04\x0d\x04\xc3\x05\xde\x9e\x59\x49\xc9\xc0\x65\xce\x4c\x9b\xe5\x3d\x98\xb1\x97\x74\x5f\x9d\x4f\x46\xdd\xd7\xfb\x3c\xa1\x8d\x03\xfd\xdb\xfe\x14\xbc\xae\xd4\x45\x17\x05\xfc\x3d\x45\x17\xe9\x09\x43\x24\xf2\xe2\x2c\xc1\x37\x60\x44\x41\xe3\x32\xc6\xfd\x12\xba\x5c\x00\x28\x8e\x43\x18\x08\xba\x0c\xaa\x6a\x07\xd5\xfb\xaa\x4d\x2b\x5d\x3f\x16\x1d\x52\x42\x00\x4b\xeb\xf9\x8e\x04\x20\xeb\xdb\x3c\x84\x63\xa5\x0c\x68\xe4\xd3\x5b\xea\x67\x80\xc4\x80\x0d\x21\x21\x76\x8a\x40\x62\x5b\x14\x66\x10\xcd\x80\x8f\x4c\xca\x8a\x45\x95\x93\x32\xbc\x3c\x39\x55\xc2\xc8\x3d\x0a\xa3\xa6\x0e\x10\xa8\x5a\x11\xe3\x3d\xe5\xb0\xb8\x6d\x14\xdb\xe6\x8e\x4d\x00\x65\x92\xbe\x81\x6e\x27\xc2\x2f\x92\x49\x0a\x9f\x8d\xd1\xbc\x8c\x44\x72\x20\x04\x68\x92\xe7\xb4\xf2\xf6\x59\x81\x79\x96\x42\xcd\x61\xb0\x72\x72\x0c\xc6\x91\x3f\x29\x82\x69\xbf\x00\x86\x22\x1c\x95\x23\xe4\x86\xaa\x69\x22\xb8\x3d\xf6\xbd\x6a\xaf\x7f\xf7\x13\x02\x38\x97\x81\x9f\x15\x8e\x81\x09\x5c\x50\x0b\x56\xa5\x6e\xe9\x62\xc9\x3d\xf6\xaa\x6c\x6e\xbf\x9d\x32\x45\x79\x3d\x7b\x23\xfb\x8c\x06\x83\x6a\xac\x56\xb6\x5a\xe5\xda\xc4\xcb\x2e\x2f\xc6\xcd\xb9\xe2\xc4\x4c\xfe\xc9\x3e\x26\x70\xe1\x3a\x8e\xdd\xfa\x93\x3c\xdd\x36\x66\x88\x95\x04\x41\x48\x43\xf2\x3e\xa7\xd1\x99\x2e\xd4\xb8\xd6\x2a\xdb\x55\x42\x80\x5f\xdf\xbf\xbf\x42\x21\x40\x38\x70\xf9\x0d\x8b\xc2\xd9\xc0\x8d\xa1\xec\x09\x81\x76\x49\xa3\x81\x38\xe8\x88\xe2\x7c\x39\x3b\x24\x09\x43\xce\x10\x89\x57\x6a\x96\x48\x37\x54\xb5\x97\x0f\x52\x75\x43\x9a\xa8\x51\x70\x06\x0e\x22\xc4\xc9\x76\x54\xfc\xbd\x4c\x28\x81\x88\x35\xa7\x54\xaa\x45\x35\xf6\x8f\x16\xfc\x57\x1c\x7c\x3f\x22\xba\x37\x18\x5a\xf1\xce\x36\xa5\xd6\xa4\x59\x31\x76\xe1\xbb\x48\xfb\x14\x01\x27\xdd\xa5\x5c\xba\x64\xaf\x49\x6f\x1b\x84\xdb\x33\xc5\xdd\x22\x16\x4d\x9a\xbb\xc9\x96\x26\xf9\x3f\x88\xad\x82\x8e\x2b\xb6\xb4\x59\xf0\x16\x92\xbb\xf2\x66\x9a\xba\x5c\x78\x0b\x49\xc5\x0a\x36\x26\xb1\xb2\xee\xd2\x42\x4b\x59\x7b\x69\x52\xf3\x39\x0e\xf1\x70\x4a\x8c\xda\xb9\x8c\xe3\x80\xe0\xa8\xa9\x9e\x2b\x9c\x05\xa9\x84\xa6\x15\x46\xd5\xb4\x7d\x1b\xa7\x52\xea\x5e\xd0\x32\xc6\x48\x02\xf8\xbb\x02\x42\x47\xe4\x34\x0a\xc2\xbd\x81\xd0\x0d\xb1\xcc\x08\xee\x7c\xb4\x5e\xf9\x33\x47\x74\xe4\xe5\xd4\xe1\x84\x7c\x12\xc0\xdc\x72\x42\x2a\xde\x34\xa3\x81\xe1\xb4\xd6\x04\x2b\xd3\x65\x98\xa0\x70\xea\xad\x1d\x51\x72\x64\xb7\xb4\x93\x4e\xbb\x9a\x67\x9d\x9c\xc8\xeb\x56\x61\x2c\x4f\x29\x31\x61\xbb\x09\x05\x4b\x9e\xf0\x44\x04\x8e\xb6\xe8\x16\x07\xd4\xcf\x11\x26\x83\x60\x23\x83\x32\xb1\x2f\xc2\xa6\x93\xc2\xdc\xd4\xb3\x12\x21\x95\xa7\xec\x0f\x6e\x67\xfd\xd3\x0f\x2f\x9e\xff\xe5\xfa\xd3\xff\x3d\x3c\x7b\xf2\xdf\x8f\x4f\x8b\xf6\x9f\x3d\xe9\x67\xc1\xff\x89\x83\x8c\x18\xf2\x1c\x7b\x30\x2b\x51\x9c\x36\x40\xa8\x7e\x84\x2c\x65\xd4\x29\x25\x6d\x37\xfa\x77\x64\xd7\x95\x2e\xf5\xcb\xe5\x59\x53\xc1\x38\x22\x97\x2b\x29\x86\xe8\x31\x3a\xda\x81\xb1\xa8\xcf\xb7\x00\xbd\x23\x62\x6d\xc9\xd3\x2c\x89\x5c\x6b\x59\x1f\x1e\x14\xd5\xa7\x53\xd9\xc4\xbe\x23\xeb\x6a\xdb\x93\x54\x53\x95\x76\x53\x62\x2d\x52\x93\x93\x5f\x4a\x93\x3d\x28\xad\x68\x40\x16\x3a\x6a\xb5\x5f\xd7\x46\xbb\x6d\x6d\x21\xcb\xc2\x86\x48\x41\x89\xd5\x5b\x48\x55\xa5\x5b\x26\xef\x91\x61\x15\x49\x89\x55\xb9\x39\xcf\xa4\xe5\x4d\xcc\x5a\x9a\x77\x06\xf8\xf4\xd3\x4c\x90\xb4\x9e\x5f\xa9\x9c\x53\x91\x98\xd2\x85\x73\xca\x0e\x38\xf1\x54\x53\x92\x9b\x71\xb1\xa2\xde\x7c\x4a\xa3\x94\xdc\xa8\x8f\x75\xe8\x1c\x95\x29\x86\xce\x09\x51\xa5\xc4\x7a\x5b\x08\x5d\xc2\xc2\x04\x35\x12\x1a\x52\xbe\xca\xc0\xf2\x04\x85\x96\x9e\x17\x07\x01\x0c\x25\x54\xf8\x59\xcb\x93\x69\x85\xbb\x51\xcb\x80\x22\xcb\x60\xc5\x82\x64\x59\x58\x4b\x29\xc4\xf7\x34\xcc\x42\x3b\x4a\x65\x61\x83\x01\xf1\x82\x8c\x81\x50\xde\xf6\x21\xa9\xd4\xd2\x73\x09\xe5\xed\xb9\x2c\x0a\x77\x70\xd9\x87\xa4\x52\xcb\x24\xcb\x37\x24\xba\x49\x2d\xf1\xef\xae\xb8\xa9\xcf\xbd\xa8\x55\xc5\x4d\xb8\xbc\xd8\x39\x69\xb7\x14\x25\x0a\x9b\x7a\x79\x61\x3f\x55\xaa\xd2\xa6\x3e\xf6\xa1\x55\x96\xd6\xd2\x92\x33\x86\x16\xe4\xea\x15\xf4\xba\x12\x59\xeb\x47\x64\xd4\x09\x98\x79\x14\x3c\xe5\xa5\x12\x06\x1b\xfa\xb8\x2b\x6f\x98\xf9\xfd\x61\x90\xe2\x99\x1f\xc9\xe9\x36\x8b\xb7\xec\x4e\x85\xe0\xa9\x70\x54\x5b\x1e\x3a\x25\x62\x25\xfc\x0e\x82\x2b\x74\xff\x9c\x67\x3d\x45\x64\xd5\xbd\x6b\x86\xe7\x8d\x35\x65\x8c\xbb\x0f\x97\xb1\xbf\xbd\xaa\xd6\xf5\xc6\x6d\x7c\xa8\xbb\x16\x69\xdf\x9f\x8c\x1b\xaf\x8f\x31\x6d\xe3\x2a\xbb\x9d\xa7\xd6\x35\xc9\xed\x2a\x58\xe7\xcb\xf7\x94\xc7\xc5\x7c\x8f\x9b\xd8\x3d\x43\x21\x8a\x2e\xd0\x25\x2f\x9d\xb1\x71\xfb\xdb\x1c\xef\x18\xd9\x31\x6e\x40\x11\x63\x04\x76\xce\x09\x83\x95\x2b\x12\xc2\x41\xec\x61\xbd\xd0\x6c\xa0\x18\xd7\xe5\x6e\xbc\x54\x53\xe0\x3e\xb9\x52\x13\xdb\x77\x6b\x22\x12\x20\x71\x82\x20\x76\xcf\xbf\x6c\xa8\xd8\xe6\x83\x55\xb6\xc7\x4b\xe4\x09\x2c\x1c\x9c\x0e\xc8\xc4\x6a\xc3\x39\xbb\x38\x6d\xc4\xb6\x8a\x1c\xb7\x57\x16\x62\x91\x2d\x17\x4d\x46\x8e\x2d\xec\xe9\x9c\xeb\x9f\xa9\x06\x1c\xcf\x44\x93\x03\x3d\xfe\x4f\x3f\xd5\x26\xa3\x3a\xd4\xa8\x1e\x3e\x36\x35\x04\xa1\x86\x90\x75\x8a\x4d\xa7\xd8\x74\x8a\x4d\x5b\x7b\x3d\xc5\xa6\x5f\x68\x6c\xfa\x4d\xfd\xbf\x25\x4e\x02\xde\x93\xed\x04\x93\x26\x98\x54\x7b\x2a\x74\x62\x42\x49\xfb\x43\x49\x82\x99\xd7\xe1\x26\xdd\x36\x57\x15\xa5\x96\x6d\x76\xbf\xb4\xb1\x25\x9a\x61\x88\xc1\x94\xe2\x49\x19\x5c\x53\xdb\xe5\xb6\x60\x38\x0a\xb6\x5c\x6f\x45\xc2\x86\xaf\x8a\x73\xa6\x78\xce\x26\x33\x7d\x33\x31\x21\xbc\xa3\x44\x78\xff\x82\x01\x7c\xcb\xad\xfe\x04\xf5\xd0\x04\xf5\x26\xa8\x37\x41\x3d\xd4\x84\x7a\xdc\xe4\x9d\xe3\x14\x4f\x68\x6f\x42\x7b\xb5\xa7\xa5\x5a\x4c\x80\x6f\x02\x7c\x3a\xde\x3f\x0f\xc0\xd7\x78\xc8\xf7\x69\x4d\x20\x10\x4d\x20\x70\x02\x81\x5d\xbd\x9e\x40\xe0\xd7\x04\x02\xf9\x27\x2c\x9f\x27\x00\x34\x7d\xb6\x59\x3c\x2d\x1e\x75\x6f\x9f\x1c\x04\x18\xb5\x4e\x4d\xfa\xd6\xb1\xd6\xb4\xa8\xe1\x1c\x62\x1e\x39\x8c\xe4\x8a\x35\x41\xc8\x69\x65\xb5\xfa\xf7\x75\x40\xae\x09\x69\xa1\x09\x69\x4d\x48\x6b\x42\x5a\xa8\x89\xb4\xa2\x38\xfa\xeb\x21\x36\xa9\xea\x3f\x1e\x19\xf4\x75\x9a\x71\xd3\x9c\x4e\x74\x16\xf4\x5a\x32\x8e\x03\x29\x9a\x96\xab\x07\x92\x33\xa0\x61\x65\x64\xaf\x1b\x18\x5a\x33\xa4\x83\x04\x2e\xef\x62\x1e\xd8\x09\x45\xd1\x3a\xd8\x57\x76\x64\xda\x7e\x4d\x7b\x06\x80\x2b\x47\x8c\x94\xd5\x8f\xe1\x04\x04\x83\xa5\x13\xd0\x73\x3a\x07\x3d\xc6\x4b\x09\x17\x5c\x7f\xe7\x3e\x1c\xb8\x68\x8f\x5d\x2d\xfb\x67\x79\xb4\xfb\x7c\xd7\x9d\xb9\x74\x1a\xad\x35\xbc\x1e\xd1\xa0\xe6\x2b\xd0\x5e\x70\x67\x50\x93\x6d\x98\xa8\xd3\x66\x0f\x68\xb1\xeb\x73\x8e\x0e\x20\x36\xa4\x45\x17\x68\x6d\x40\xbb\x4e\x20\xdd\x90\xfe\xba\xc0\x7d\xa3\xfa\x3b\x0a\x1c\xda\xb6\x2c\xf9\x97\x98\x89\x38\xe4\xa2\x88\x99\x86\x01\x49\x07\x2d\x9f\xe7\xf3\xe9\xc5\x20\xf0\x39\x40\xe6\xa3\x10\xea\x3e\x25\xbd\xef\x86\xdb\x05\x6d\x81\x81\x07\x08\xbb\x13\x28\x83\xc0\xcd\xc7\x28\x1c\x42\xea\x07\x69\xbd\x5d\xf4\xa6\xb4\xdf\x18\x06\x72\xaf\x7f\x26\x67\x3e\x6c\x23\x94\x21\x96\xcc\x18\xc6\x74\x7e\xfa\xce\xcb\x44\xdb\xc3\x1e\xa1\xd0\xcc\xa8\xca\x95\x6b\xbf\x9a\x99\xd3\x0a\x4d\x3c\xe8\x01\x95\x26\x15\x36\x06\x4f\xd5\x02\x28\x8b\x94\xd3\xa3\x89\x51\xb7\xd0\x29\x1b\xb5\x1f\x94\x97\xfa\xb3\xfd\x7a\x32\x28\x0f\xd6\xa8\xa1\xc3\x41\xa0\xa2\xb6\x96\xb3\x09\x4d\x9d\x33\x1d\x5a\x68\xdb\x29\x3d\x77\x86\x98\xc1\x1c\x21\xe5\x7d\xea\x9e\x7b\x7d\x38\xeb\x27\x50\x9f\x72\x6c\x0e\x62\xc2\x69\x9c\x0c\x89\x4e\x12\x88\xf9\x2f\xa3\xc0\x78\x30\xe3\xe0\x23\xd8\xee\x43\xe5\x84\x54\xbd\x0c\x78\x41\x03\x26\x74\x7f\x24\x62\xb1\x02\x50\x17\xe8\x2e\x66\xb4\xfe\xba\xb0\x76\x0c\xcc\x17\x1e\x46\xbb\x38\xb0\x64\x0a\x9d\x8f\x26\x74\x7e\x14\x14\xe4\x66\xe9\xca\x6e\x4b\xcf\xde\xcc\xd9\xf1\x1a\xa3\xe6\x6a\x97\x85\x45\x1a\x75\xb3\xc3\x74\xfe\xd0\xb4\x12\xd9\x45\x69\x5a\x89\x9c\x56\x22\xa7\x95\xc8\xc7\x5b\x89\x7c\x04\xc8\x28\xf9\x24\xdd\xb5\x89\x63\x2f\x29\x2c\x69\xbe\xcb\x31\x0c\xbf\x16\x62\xa6\xf4\xb7\xe3\xd2\x42\x1d\x8d\xe1\xfe\x52\x75\x8a\x4a\x0c\xab\x77\x16\x56\x37\x4c\x98\xce\xd5\x97\x25\x2d\x87\x59\xfb\xf1\xf8\x16\x5b\x9d\xb4\x5d\x10\xa7\xed\x6e\x70\xe7\x65\x75\x7a\x3b\x04\x4a\x40\xef\x87\xd4\x04\x95\x4f\xe8\x32\x53\x0f\x6f\x1e\x0d\x02\xef\x12\xbc\xd9\xb8\x3a\xae\xfc\x58\xe6\x2a\xbf\xfc\xd3\x95\x06\xf5\xb9\x5e\xcc\xb5\xb6\x8d\x3c\x77\xd6\x19\xc0\x3f\x96\x71\xed\xb8\x7a\x76\xb8\xad\xd3\x9d\xc5\x6b\x95\xed\x5a\x62\x46\xbd\xb3\x2c\x5d\xf3\x7b\x24\xf2\xcd\xa6\x0b\xe5\xe8\xfd\x46\x0a\xcc\x8a\x30\xde\xd0\xbf\x93\xad\x1b\x5a\x31\x06\x06\x5f\x5e\x40\x60\x46\x3d\x9a\xba\xa4\x79\x85\x19\xbb\x8b\x13\xdf\x25\xcd\xb3\x0d\xe7\xd3\xa1\x28\x0b\xb2\x9e\x47\x18\xfb\x29\xf6\x89\x96\x6a\xf5\xf7\xb5\x56\xf3\xda\xc6\x79\xbf\x96\xe6\x31\x4e\xd2\x15\xbd\x75\xb9\xf5\xf9\xf8\x4c\x49\x63\x7e\x1d\x60\x0c\x1b\x28\xa2\xb1\xfd\xed\xc0\x23\x9c\x77\xbf\x7b\x88\x87\x7a\xae\x7e\xbb\xf8\x5b\xcf\x36\x6b\xe4\x42\x9c\x1f\xe5\x71\x7c\xba\x69\xb0\xd7\x87\xd5\xd1\x55\x10\xdf\x49\x77\x1c\x00\x4f\x71\x52\xdc\x27\xfb\x5b\x9f\x7b\xe9\xdc\x68\x6c\x2e\x14\x8b\x24\x18\xe7\x7b\x74\x6b\xb4\x10\x7e\x77\x7b\xcc\x83\x5e\xdb\x5e\x84\x22\xfa\xb0\xc8\x6b\x68\xa9\x29\x52\xee\xd1\x13\x8b\xbb\x87\x3f\xff\x59\xa1\x20\x8e\xc7\x9d\x15\x69\xfc\x07\xf9\xf2\x67\xc3\xa6\x10\xfa\xa1\x67\x43\x25\xdd\x69\x16\xc8\xb3\x40\x87\x91\xa7\x89\x50\xb4\xbc\xc7\x89\x80\x77\x72\x9f\xe6\xc2\xb1\xcc\x05\x35\xb0\x3b\x32\xa4\xf4\xf5\x4d\x93\x6a\x48\xbe\x30\xfc\x34\x4d\x42\xa4\x9f\x84\x8b\xe6\x28\x3a\x58\x78\x90\xbb\x2c\xb7\x2a\xdf\x3d\xea\x70\x49\xa6\xba\xe2\x59\x91\x6f\xc7\x3a\x4c\xe3\x0a\xc0\x6e\x96\x34\x5f\x4f\xef\x68\xa0\x88\x10\x9f\xf8\x28\x8d\xc5\xd9\x37\x08\x17\xf7\xf9\xe5\xf7\xb4\x06\x81\xf6\xfa\x89\x92\x37\xd9\x88\x69\xba\x3e\x38\xdd\xa9\xdc\x3b\x2f\x89\xc8\x9a\x8c\xe1\xce\x37\x6d\x1a\xce\x7a\x1d\xac\x76\x37\xeb\x20\xe1\xa7\x09\x8e\x18\xf0\xc4\x2f\xff\x48\x63\x2f\x0e\xca\xef\xd8\xc5\x75\xff\x6d\xe2\x34\xce\x7e\x9d\x79\x14\x1b\x92\x64\x0b\xc1\x9f\x30\xf9\xd1\x9d\xf2\xbb\x66\xf0\x7a\xcb\xa6\x65\x3b\x86\x89\x79\x95\xf5\x99\xc7\x6e\xa5\xab\x44\xe4\x9f\xa9\xfc\x73\x43\x37\xba\x8b\xc7\x77\x4b\x47\x82\x5c\x2b\x97\xbb\xb3\x7f\x0e\xc5\x6e\xed\x41\x58\x3f\x74\xc8\x8e\xff\xe6\xd6\x3e\x47\xdb\xfa\x4a\xf2\x7a\x27\xe1\x74\x2b\xdf\xae\xa9\xe6\x16\x1b\x67\xdb\xf7\x2a\x03\xae\xdb\x1b\xe0\xf2\x6b\xb7\xaa\x21\x65\x47\x8e\xb3\x2f\xdc\xca\x26\x5a\x76\xff\xb8\xff\xaa\xad\xea\x97\xb2\x87\xc7\xd9\x97\x6c\x6a\xbf\x9c\xb6\xa5\xdf\x50\x54\x1b\x2f\x65\xeb\x8f\xfb\x2f\x7a\x6a\x52\xdc\x6b\x6b\xf2\x17\x3c\x3b\xac\xd0\xdc\x90\xe4\xec\xcb\xb4\x9a\x18\x95\xbd\x93\xfb\x94\xe2\x3e\x1b\xd3\x0b\x51\xbf\xe7\xc9\xe9\x57\x67\xd5\x44\x88\xdc\x29\x7f\xd4\x54\x78\x19\x0c\x59\x20\x68\x7d\x54\x2a\x78\x52\xfc\xd5\xa8\x4d\x32\xbd\x3e\x2c\x97\x61\xfa\x37\xfc\x7f\x0f\xff\x0b\x00\x00\xff\xff\x31\x8b\xeb\xb6\x54\x9c\x00\x00")
-
-func v2SchemaJSONBytes() ([]byte, error) {
- return bindataRead(
- _v2SchemaJSON,
- "v2/schema.json",
- )
-}
-
-func v2SchemaJSON() (*asset, error) {
- bytes, err := v2SchemaJSONBytes()
- if err != nil {
- return nil, err
- }
-
- info := bindataFileInfo{name: "v2/schema.json", size: 40020, mode: os.FileMode(420), modTime: time.Unix(1446147817, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
-}
-
-// Asset loads and returns the asset for the given name.
-// It returns an error if the asset could not be found or
-// could not be loaded.
-func Asset(name string) ([]byte, error) {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- if f, ok := _bindata[cannonicalName]; ok {
- a, err := f()
- if err != nil {
- return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
- }
- return a.bytes, nil
- }
- return nil, fmt.Errorf("Asset %s not found", name)
-}
-
-// MustAsset is like Asset but panics when Asset would return an error.
-// It simplifies safe initialization of global variables.
-func MustAsset(name string) []byte {
- a, err := Asset(name)
- if err != nil {
- panic("asset: Asset(" + name + "): " + err.Error())
- }
-
- return a
-}
-
-// AssetInfo loads and returns the asset info for the given name.
-// It returns an error if the asset could not be found or
-// could not be loaded.
-func AssetInfo(name string) (os.FileInfo, error) {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- if f, ok := _bindata[cannonicalName]; ok {
- a, err := f()
- if err != nil {
- return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
- }
- return a.info, nil
- }
- return nil, fmt.Errorf("AssetInfo %s not found", name)
-}
-
-// AssetNames returns the names of the assets.
-func AssetNames() []string {
- names := make([]string, 0, len(_bindata))
- for name := range _bindata {
- names = append(names, name)
- }
- return names
-}
-
-// _bindata is a table, holding each asset generator, mapped to its name.
-var _bindata = map[string]func() (*asset, error){
- "jsonschema-draft-04.json": jsonschemaDraft04JSON,
- "v2/schema.json": v2SchemaJSON,
-}
-
-// AssetDir returns the file names below a certain
-// directory embedded in the file by go-bindata.
-// For example if you run go-bindata on data/... and data contains the
-// following hierarchy:
-// data/
-// foo.txt
-// img/
-// a.png
-// b.png
-// then AssetDir("data") would return []string{"foo.txt", "img"}
-// AssetDir("data/img") would return []string{"a.png", "b.png"}
-// AssetDir("foo.txt") and AssetDir("notexist") would return an error
-// AssetDir("") will return []string{"data"}.
-func AssetDir(name string) ([]string, error) {
- node := _bintree
- if len(name) != 0 {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- pathList := strings.Split(cannonicalName, "/")
- for _, p := range pathList {
- node = node.Children[p]
- if node == nil {
- return nil, fmt.Errorf("Asset %s not found", name)
- }
- }
- }
- if node.Func != nil {
- return nil, fmt.Errorf("Asset %s not found", name)
- }
- rv := make([]string, 0, len(node.Children))
- for childName := range node.Children {
- rv = append(rv, childName)
- }
- return rv, nil
-}
-
-type bintree struct {
- Func func() (*asset, error)
- Children map[string]*bintree
-}
-
-var _bintree = &bintree{nil, map[string]*bintree{
- "jsonschema-draft-04.json": &bintree{jsonschemaDraft04JSON, map[string]*bintree{}},
- "v2": &bintree{nil, map[string]*bintree{
- "schema.json": &bintree{v2SchemaJSON, map[string]*bintree{}},
- }},
-}}
-
-// RestoreAsset restores an asset under the given directory
-func RestoreAsset(dir, name string) error {
- data, err := Asset(name)
- if err != nil {
- return err
- }
- info, err := AssetInfo(name)
- if err != nil {
- return err
- }
- err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
- if err != nil {
- return err
- }
- err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
- if err != nil {
- return err
- }
- err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
- if err != nil {
- return err
- }
- return nil
-}
-
-// RestoreAssets restores an asset under the given directory recursively
-func RestoreAssets(dir, name string) error {
- children, err := AssetDir(name)
- // File
- if err != nil {
- return RestoreAsset(dir, name)
- }
- // Dir
- for _, child := range children {
- err = RestoreAssets(dir, filepath.Join(name, child))
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-func _filePath(dir, name string) string {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/contact_info.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/contact_info.go
deleted file mode 100644
index f285970aa..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/contact_info.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-// ContactInfo contact information for the exposed API.
-//
-// For more information: http://goo.gl/8us55a#contactObject
-type ContactInfo struct {
- Name string `json:"name,omitempty"`
- URL string `json:"url,omitempty"`
- Email string `json:"email,omitempty"`
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/expander.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/expander.go
deleted file mode 100644
index eb1490b05..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/expander.go
+++ /dev/null
@@ -1,626 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
- "reflect"
- "strings"
- "sync"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// ResolutionCache a cache for resolving urls
-type ResolutionCache interface {
- Get(string) (interface{}, bool)
- Set(string, interface{})
-}
-
-type simpleCache struct {
- lock sync.Mutex
- store map[string]interface{}
-}
-
-var resCache = initResolutionCache()
-
-func initResolutionCache() ResolutionCache {
- return &simpleCache{store: map[string]interface{}{
- "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(),
- "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(),
- }}
-}
-
-func (s *simpleCache) Get(uri string) (interface{}, bool) {
- s.lock.Lock()
- v, ok := s.store[uri]
- s.lock.Unlock()
- return v, ok
-}
-
-func (s *simpleCache) Set(uri string, data interface{}) {
- s.lock.Lock()
- s.store[uri] = data
- s.lock.Unlock()
-}
-
-// ResolveRef resolves a reference against a context root
-func ResolveRef(root interface{}, ref *Ref) (*Schema, error) {
- resolver, err := defaultSchemaLoader(root, nil, nil)
- if err != nil {
- return nil, err
- }
-
- result := new(Schema)
- if err := resolver.Resolve(ref, result); err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// ResolveParameter resolves a paramter reference against a context root
-func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) {
- resolver, err := defaultSchemaLoader(root, nil, nil)
- if err != nil {
- return nil, err
- }
-
- result := new(Parameter)
- if err := resolver.Resolve(&ref, result); err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// ResolveResponse resolves response a reference against a context root
-func ResolveResponse(root interface{}, ref Ref) (*Response, error) {
- resolver, err := defaultSchemaLoader(root, nil, nil)
- if err != nil {
- return nil, err
- }
-
- result := new(Response)
- if err := resolver.Resolve(&ref, result); err != nil {
- return nil, err
- }
- return result, nil
-}
-
-type schemaLoader struct {
- loadingRef *Ref
- startingRef *Ref
- currentRef *Ref
- root interface{}
- cache ResolutionCache
- loadDoc func(string) (json.RawMessage, error)
-}
-
-var idPtr, _ = jsonpointer.New("/id")
-var schemaPtr, _ = jsonpointer.New("/$schema")
-var refPtr, _ = jsonpointer.New("/$ref")
-
-func defaultSchemaLoader(root interface{}, ref *Ref, cache ResolutionCache) (*schemaLoader, error) {
- if cache == nil {
- cache = resCache
- }
-
- var ptr *jsonpointer.Pointer
- if ref != nil {
- ptr = ref.GetPointer()
- }
-
- currentRef := nextRef(root, ref, ptr)
-
- return &schemaLoader{
- root: root,
- loadingRef: ref,
- startingRef: ref,
- cache: cache,
- loadDoc: func(path string) (json.RawMessage, error) {
- data, err := swag.LoadFromFileOrHTTP(path)
- if err != nil {
- return nil, err
- }
- return json.RawMessage(data), nil
- },
- currentRef: currentRef,
- }, nil
-}
-
-func idFromNode(node interface{}) (*Ref, error) {
- if idValue, _, err := idPtr.Get(node); err == nil {
- if refStr, ok := idValue.(string); ok && refStr != "" {
- idRef, err := NewRef(refStr)
- if err != nil {
- return nil, err
- }
- return &idRef, nil
- }
- }
- return nil, nil
-}
-
-func nextRef(startingNode interface{}, startingRef *Ref, ptr *jsonpointer.Pointer) *Ref {
- if startingRef == nil {
- return nil
- }
- if ptr == nil {
- return startingRef
- }
-
- ret := startingRef
- var idRef *Ref
- node := startingNode
-
- for _, tok := range ptr.DecodedTokens() {
- node, _, _ = jsonpointer.GetForToken(node, tok)
- if node == nil {
- break
- }
-
- idRef, _ = idFromNode(node)
- if idRef != nil {
- nw, err := ret.Inherits(*idRef)
- if err != nil {
- break
- }
- ret = nw
- }
-
- refRef, _, _ := refPtr.Get(node)
- if refRef != nil {
- rf, _ := NewRef(refRef.(string))
- nw, err := ret.Inherits(rf)
- if err != nil {
- break
- }
- ret = nw
- }
-
- }
- return ret
-}
-
-func (r *schemaLoader) resolveRef(currentRef, ref *Ref, node, target interface{}) error {
- tgt := reflect.ValueOf(target)
- if tgt.Kind() != reflect.Ptr {
- return fmt.Errorf("resolve ref: target needs to be a pointer")
- }
-
- oldRef := currentRef
- if currentRef != nil {
- var err error
- currentRef, err = currentRef.Inherits(*nextRef(node, ref, currentRef.GetPointer()))
- if err != nil {
- return err
- }
- }
- if currentRef == nil {
- currentRef = ref
- }
-
- refURL := currentRef.GetURL()
- if refURL == nil {
- return nil
- }
- if currentRef.IsRoot() {
- nv := reflect.ValueOf(node)
- reflect.Indirect(tgt).Set(reflect.Indirect(nv))
- return nil
- }
-
- if strings.HasPrefix(refURL.String(), "#") {
- res, _, err := ref.GetPointer().Get(node)
- if err != nil {
- res, _, err = ref.GetPointer().Get(r.root)
- if err != nil {
- return err
- }
- }
- rv := reflect.Indirect(reflect.ValueOf(res))
- tgtType := reflect.Indirect(tgt).Type()
- if rv.Type().AssignableTo(tgtType) {
- reflect.Indirect(tgt).Set(reflect.Indirect(reflect.ValueOf(res)))
- } else {
- if err := swag.DynamicJSONToStruct(rv.Interface(), target); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- if refURL.Scheme != "" && refURL.Host != "" {
- // most definitely take the red pill
- data, _, _, err := r.load(refURL)
- if err != nil {
- return err
- }
-
- if ((oldRef == nil && currentRef != nil) ||
- (oldRef != nil && currentRef == nil) ||
- oldRef.String() != currentRef.String()) &&
- ((oldRef == nil && ref != nil) ||
- (oldRef != nil && ref == nil) ||
- (oldRef.String() != ref.String())) {
-
- return r.resolveRef(currentRef, ref, data, target)
- }
-
- var res interface{}
- if currentRef.String() != "" {
- res, _, err = currentRef.GetPointer().Get(data)
- if err != nil {
- return err
- }
- } else {
- res = data
- }
-
- if err := swag.DynamicJSONToStruct(res, target); err != nil {
- return err
- }
-
- }
- return nil
-}
-
-func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) {
- toFetch := *refURL
- toFetch.Fragment = ""
-
- data, fromCache := r.cache.Get(toFetch.String())
- if !fromCache {
- b, err := r.loadDoc(toFetch.String())
- if err != nil {
- return nil, url.URL{}, false, err
- }
-
- if err := json.Unmarshal(b, &data); err != nil {
- return nil, url.URL{}, false, err
- }
- r.cache.Set(toFetch.String(), data)
- }
-
- return data, toFetch, fromCache, nil
-}
-func (r *schemaLoader) Resolve(ref *Ref, target interface{}) error {
- if err := r.resolveRef(r.currentRef, ref, r.root, target); err != nil {
- return err
- }
-
- return nil
-}
-
-type specExpander struct {
- spec *Swagger
- resolver *schemaLoader
-}
-
-// ExpandSpec expands the references in a swagger spec
-func ExpandSpec(spec *Swagger) error {
- resolver, err := defaultSchemaLoader(spec, nil, nil)
- if err != nil {
- return err
- }
-
- for key, defintition := range spec.Definitions {
- var def *Schema
- var err error
- if def, err = expandSchema(defintition, []string{"#/definitions/" + key}, resolver); err != nil {
- return err
- }
- spec.Definitions[key] = *def
- }
-
- for key, parameter := range spec.Parameters {
- if err := expandParameter(¶meter, resolver); err != nil {
- return err
- }
- spec.Parameters[key] = parameter
- }
-
- for key, response := range spec.Responses {
- if err := expandResponse(&response, resolver); err != nil {
- return err
- }
- spec.Responses[key] = response
- }
-
- if spec.Paths != nil {
- for key, path := range spec.Paths.Paths {
- if err := expandPathItem(&path, resolver); err != nil {
- return err
- }
- spec.Paths.Paths[key] = path
- }
- }
-
- return nil
-}
-
-// ExpandSchema expands the refs in the schema object
-func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error {
-
- if schema == nil {
- return nil
- }
- if root == nil {
- root = schema
- }
-
- nrr, _ := NewRef(schema.ID)
- var rrr *Ref
- if nrr.String() != "" {
- switch root.(type) {
- case *Schema:
- rid, _ := NewRef(root.(*Schema).ID)
- rrr, _ = rid.Inherits(nrr)
- case *Swagger:
- rid, _ := NewRef(root.(*Swagger).ID)
- rrr, _ = rid.Inherits(nrr)
- }
-
- }
-
- resolver, err := defaultSchemaLoader(root, rrr, cache)
- if err != nil {
- return err
- }
-
- refs := []string{""}
- if rrr != nil {
- refs[0] = rrr.String()
- }
- var s *Schema
- if s, err = expandSchema(*schema, refs, resolver); err != nil {
- return nil
- }
- *schema = *s
- return nil
-}
-
-func expandItems(target Schema, parentRefs []string, resolver *schemaLoader) (*Schema, error) {
- if target.Items != nil {
- if target.Items.Schema != nil {
- t, err := expandSchema(*target.Items.Schema, parentRefs, resolver)
- if err != nil {
- return nil, err
- }
- *target.Items.Schema = *t
- }
- for i := range target.Items.Schemas {
- t, err := expandSchema(target.Items.Schemas[i], parentRefs, resolver)
- if err != nil {
- return nil, err
- }
- target.Items.Schemas[i] = *t
- }
- }
- return &target, nil
-}
-
-func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader) (schema *Schema, err error) {
- defer func() {
- schema = &target
- }()
- if target.Ref.String() == "" && target.Ref.IsRoot() {
- target = *resolver.root.(*Schema)
- return
- }
-
- // t is the new expanded schema
- var t *Schema
- for target.Ref.String() != "" {
- // var newTarget Schema
- pRefs := strings.Join(parentRefs, ",")
- pRefs += ","
- if strings.Contains(pRefs, target.Ref.String()+",") {
- err = nil
- return
- }
-
- if err = resolver.Resolve(&target.Ref, &t); err != nil {
- return
- }
- parentRefs = append(parentRefs, target.Ref.String())
- target = *t
- }
-
- if t, err = expandItems(target, parentRefs, resolver); err != nil {
- return
- }
- target = *t
-
- for i := range target.AllOf {
- if t, err = expandSchema(target.AllOf[i], parentRefs, resolver); err != nil {
- return
- }
- target.AllOf[i] = *t
- }
- for i := range target.AnyOf {
- if t, err = expandSchema(target.AnyOf[i], parentRefs, resolver); err != nil {
- return
- }
- target.AnyOf[i] = *t
- }
- for i := range target.OneOf {
- if t, err = expandSchema(target.OneOf[i], parentRefs, resolver); err != nil {
- return
- }
- target.OneOf[i] = *t
- }
- if target.Not != nil {
- if t, err = expandSchema(*target.Not, parentRefs, resolver); err != nil {
- return
- }
- *target.Not = *t
- }
- for k, _ := range target.Properties {
- if t, err = expandSchema(target.Properties[k], parentRefs, resolver); err != nil {
- return
- }
- target.Properties[k] = *t
- }
- if target.AdditionalProperties != nil && target.AdditionalProperties.Schema != nil {
- if t, err = expandSchema(*target.AdditionalProperties.Schema, parentRefs, resolver); err != nil {
- return
- }
- *target.AdditionalProperties.Schema = *t
- }
- for k, _ := range target.PatternProperties {
- if t, err = expandSchema(target.PatternProperties[k], parentRefs, resolver); err != nil {
- return
- }
- target.PatternProperties[k] = *t
- }
- for k, _ := range target.Dependencies {
- if target.Dependencies[k].Schema != nil {
- if t, err = expandSchema(*target.Dependencies[k].Schema, parentRefs, resolver); err != nil {
- return
- }
- *target.Dependencies[k].Schema = *t
- }
- }
- if target.AdditionalItems != nil && target.AdditionalItems.Schema != nil {
- if t, err = expandSchema(*target.AdditionalItems.Schema, parentRefs, resolver); err != nil {
- return
- }
- *target.AdditionalItems.Schema = *t
- }
- for k, _ := range target.Definitions {
- if t, err = expandSchema(target.Definitions[k], parentRefs, resolver); err != nil {
- return
- }
- target.Definitions[k] = *t
- }
- return
-}
-
-func expandPathItem(pathItem *PathItem, resolver *schemaLoader) error {
- if pathItem == nil {
- return nil
- }
- if pathItem.Ref.String() != "" {
- if err := resolver.Resolve(&pathItem.Ref, &pathItem); err != nil {
- return err
- }
- }
-
- for idx := range pathItem.Parameters {
- if err := expandParameter(&(pathItem.Parameters[idx]), resolver); err != nil {
- return err
- }
- }
- if err := expandOperation(pathItem.Get, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Head, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Options, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Put, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Post, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Patch, resolver); err != nil {
- return err
- }
- if err := expandOperation(pathItem.Delete, resolver); err != nil {
- return err
- }
- return nil
-}
-
-func expandOperation(op *Operation, resolver *schemaLoader) error {
- if op == nil {
- return nil
- }
- for i, param := range op.Parameters {
- if err := expandParameter(¶m, resolver); err != nil {
- return err
- }
- op.Parameters[i] = param
- }
-
- if op.Responses != nil {
- responses := op.Responses
- if err := expandResponse(responses.Default, resolver); err != nil {
- return err
- }
- for code, response := range responses.StatusCodeResponses {
- if err := expandResponse(&response, resolver); err != nil {
- return err
- }
- responses.StatusCodeResponses[code] = response
- }
- }
- return nil
-}
-
-func expandResponse(response *Response, resolver *schemaLoader) error {
- if response == nil {
- return nil
- }
-
- if response.Ref.String() != "" {
- if err := resolver.Resolve(&response.Ref, response); err != nil {
- return err
- }
- }
-
- if response.Schema != nil {
- parentRefs := []string{response.Schema.Ref.String()}
- if err := resolver.Resolve(&response.Schema.Ref, &response.Schema); err != nil {
- return err
- }
- if s, err := expandSchema(*response.Schema, parentRefs, resolver); err != nil {
- return err
- } else {
- *response.Schema = *s
- }
- }
- return nil
-}
-
-func expandParameter(parameter *Parameter, resolver *schemaLoader) error {
- if parameter == nil {
- return nil
- }
- if parameter.Ref.String() != "" {
- if err := resolver.Resolve(¶meter.Ref, parameter); err != nil {
- return err
- }
- }
- if parameter.Schema != nil {
- parentRefs := []string{parameter.Schema.Ref.String()}
- if err := resolver.Resolve(¶meter.Schema.Ref, ¶meter.Schema); err != nil {
- return err
- }
- if s, err := expandSchema(*parameter.Schema, parentRefs, resolver); err != nil {
- return err
- } else {
- *parameter.Schema = *s
- }
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/external_docs.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/external_docs.go
deleted file mode 100644
index 88add91b2..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/external_docs.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-// ExternalDocumentation allows referencing an external resource for
-// extended documentation.
-//
-// For more information: http://goo.gl/8us55a#externalDocumentationObject
-type ExternalDocumentation struct {
- Description string `json:"description,omitempty"`
- URL string `json:"url,omitempty"`
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/header.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/header.go
deleted file mode 100644
index 758b84531..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/header.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/swag"
-)
-
-type HeaderProps struct {
- Description string `json:"description,omitempty"`
-}
-
-// Header describes a header for a response of the API
-//
-// For more information: http://goo.gl/8us55a#headerObject
-type Header struct {
- CommonValidations
- SimpleSchema
- HeaderProps
-}
-
-// ResponseHeader creates a new header instance for use in a response
-func ResponseHeader() *Header {
- return new(Header)
-}
-
-// WithDescription sets the description on this response, allows for chaining
-func (h *Header) WithDescription(description string) *Header {
- h.Description = description
- return h
-}
-
-// Typed a fluent builder method for the type of parameter
-func (h *Header) Typed(tpe, format string) *Header {
- h.Type = tpe
- h.Format = format
- return h
-}
-
-// CollectionOf a fluent builder method for an array item
-func (h *Header) CollectionOf(items *Items, format string) *Header {
- h.Type = "array"
- h.Items = items
- h.CollectionFormat = format
- return h
-}
-
-// WithDefault sets the default value on this item
-func (h *Header) WithDefault(defaultValue interface{}) *Header {
- h.Default = defaultValue
- return h
-}
-
-// WithMaxLength sets a max length value
-func (h *Header) WithMaxLength(max int64) *Header {
- h.MaxLength = &max
- return h
-}
-
-// WithMinLength sets a min length value
-func (h *Header) WithMinLength(min int64) *Header {
- h.MinLength = &min
- return h
-}
-
-// WithPattern sets a pattern value
-func (h *Header) WithPattern(pattern string) *Header {
- h.Pattern = pattern
- return h
-}
-
-// WithMultipleOf sets a multiple of value
-func (h *Header) WithMultipleOf(number float64) *Header {
- h.MultipleOf = &number
- return h
-}
-
-// WithMaximum sets a maximum number value
-func (h *Header) WithMaximum(max float64, exclusive bool) *Header {
- h.Maximum = &max
- h.ExclusiveMaximum = exclusive
- return h
-}
-
-// WithMinimum sets a minimum number value
-func (h *Header) WithMinimum(min float64, exclusive bool) *Header {
- h.Minimum = &min
- h.ExclusiveMinimum = exclusive
- return h
-}
-
-// WithEnum sets a the enum values (replace)
-func (h *Header) WithEnum(values ...interface{}) *Header {
- h.Enum = append([]interface{}{}, values...)
- return h
-}
-
-// WithMaxItems sets the max items
-func (h *Header) WithMaxItems(size int64) *Header {
- h.MaxItems = &size
- return h
-}
-
-// WithMinItems sets the min items
-func (h *Header) WithMinItems(size int64) *Header {
- h.MinItems = &size
- return h
-}
-
-// UniqueValues dictates that this array can only have unique items
-func (h *Header) UniqueValues() *Header {
- h.UniqueItems = true
- return h
-}
-
-// AllowDuplicates this array can have duplicates
-func (h *Header) AllowDuplicates() *Header {
- h.UniqueItems = false
- return h
-}
-
-// MarshalJSON marshal this to JSON
-func (h Header) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(h.CommonValidations)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(h.SimpleSchema)
- if err != nil {
- return nil, err
- }
- b3, err := json.Marshal(h.HeaderProps)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2, b3), nil
-}
-
-// UnmarshalJSON marshal this from JSON
-func (h *Header) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &h.CommonValidations); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &h.SimpleSchema); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &h.HeaderProps); err != nil {
- return err
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/info.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/info.go
deleted file mode 100644
index fb8b7c4ac..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/info.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// Extensions vendor specific extensions
-type Extensions map[string]interface{}
-
-// Add adds a value to these extensions
-func (e Extensions) Add(key string, value interface{}) {
- realKey := strings.ToLower(key)
- e[realKey] = value
-}
-
-// GetString gets a string value from the extensions
-func (e Extensions) GetString(key string) (string, bool) {
- if v, ok := e[strings.ToLower(key)]; ok {
- str, ok := v.(string)
- return str, ok
- }
- return "", false
-}
-
-// GetBool gets a string value from the extensions
-func (e Extensions) GetBool(key string) (bool, bool) {
- if v, ok := e[strings.ToLower(key)]; ok {
- str, ok := v.(bool)
- return str, ok
- }
- return false, false
-}
-
-// GetStringSlice gets a string value from the extensions
-func (e Extensions) GetStringSlice(key string) ([]string, bool) {
- if v, ok := e[strings.ToLower(key)]; ok {
- arr, ok := v.([]interface{})
- if !ok {
- return nil, false
- }
- var strs []string
- for _, iface := range arr {
- str, ok := iface.(string)
- if !ok {
- return nil, false
- }
- strs = append(strs, str)
- }
- return strs, ok
- }
- return nil, false
-}
-
-// VendorExtensible composition block.
-type VendorExtensible struct {
- Extensions Extensions
-}
-
-// AddExtension adds an extension to this extensible object
-func (v *VendorExtensible) AddExtension(key string, value interface{}) {
- if value == nil {
- return
- }
- if v.Extensions == nil {
- v.Extensions = make(map[string]interface{})
- }
- v.Extensions.Add(key, value)
-}
-
-// MarshalJSON marshals the extensions to json
-func (v VendorExtensible) MarshalJSON() ([]byte, error) {
- toser := make(map[string]interface{})
- for k, v := range v.Extensions {
- lk := strings.ToLower(k)
- if strings.HasPrefix(lk, "x-") {
- toser[k] = v
- }
- }
- return json.Marshal(toser)
-}
-
-// UnmarshalJSON for this extensible object
-func (v *VendorExtensible) UnmarshalJSON(data []byte) error {
- var d map[string]interface{}
- if err := json.Unmarshal(data, &d); err != nil {
- return err
- }
- for k, vv := range d {
- lk := strings.ToLower(k)
- if strings.HasPrefix(lk, "x-") {
- if v.Extensions == nil {
- v.Extensions = map[string]interface{}{}
- }
- v.Extensions[k] = vv
- }
- }
- return nil
-}
-
-// InfoProps the properties for an info definition
-type InfoProps struct {
- Description string `json:"description,omitempty"`
- Title string `json:"title,omitempty"`
- TermsOfService string `json:"termsOfService,omitempty"`
- Contact *ContactInfo `json:"contact,omitempty"`
- License *License `json:"license,omitempty"`
- Version string `json:"version,omitempty"`
-}
-
-// Info object provides metadata about the API.
-// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
-//
-// For more information: http://goo.gl/8us55a#infoObject
-type Info struct {
- VendorExtensible
- InfoProps
-}
-
-// JSONLookup look up a value by the json property name
-func (i Info) JSONLookup(token string) (interface{}, error) {
- if ex, ok := i.Extensions[token]; ok {
- return &ex, nil
- }
- r, _, err := jsonpointer.GetForToken(i.InfoProps, token)
- return r, err
-}
-
-// MarshalJSON marshal this to JSON
-func (i Info) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(i.InfoProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(i.VendorExtensible)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// UnmarshalJSON marshal this from JSON
-func (i *Info) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &i.InfoProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &i.VendorExtensible); err != nil {
- return err
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/items.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/items.go
deleted file mode 100644
index 4d57ea5ca..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/items.go
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/swag"
-)
-
-type SimpleSchema struct {
- Type string `json:"type,omitempty"`
- Format string `json:"format,omitempty"`
- Items *Items `json:"items,omitempty"`
- CollectionFormat string `json:"collectionFormat,omitempty"`
- Default interface{} `json:"default,omitempty"`
-}
-
-func (s *SimpleSchema) TypeName() string {
- if s.Format != "" {
- return s.Format
- }
- return s.Type
-}
-
-func (s *SimpleSchema) ItemsTypeName() string {
- if s.Items == nil {
- return ""
- }
- return s.Items.TypeName()
-}
-
-type CommonValidations struct {
- Maximum *float64 `json:"maximum,omitempty"`
- ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
- Minimum *float64 `json:"minimum,omitempty"`
- ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
- MaxLength *int64 `json:"maxLength,omitempty"`
- MinLength *int64 `json:"minLength,omitempty"`
- Pattern string `json:"pattern,omitempty"`
- MaxItems *int64 `json:"maxItems,omitempty"`
- MinItems *int64 `json:"minItems,omitempty"`
- UniqueItems bool `json:"uniqueItems,omitempty"`
- MultipleOf *float64 `json:"multipleOf,omitempty"`
- Enum []interface{} `json:"enum,omitempty"`
-}
-
-// Items a limited subset of JSON-Schema's items object.
-// It is used by parameter definitions that are not located in "body".
-//
-// For more information: http://goo.gl/8us55a#items-object-
-type Items struct {
- Refable
- CommonValidations
- SimpleSchema
-}
-
-// NewItems creates a new instance of items
-func NewItems() *Items {
- return &Items{}
-}
-
-// Typed a fluent builder method for the type of item
-func (i *Items) Typed(tpe, format string) *Items {
- i.Type = tpe
- i.Format = format
- return i
-}
-
-// CollectionOf a fluent builder method for an array item
-func (i *Items) CollectionOf(items *Items, format string) *Items {
- i.Type = "array"
- i.Items = items
- i.CollectionFormat = format
- return i
-}
-
-// WithDefault sets the default value on this item
-func (i *Items) WithDefault(defaultValue interface{}) *Items {
- i.Default = defaultValue
- return i
-}
-
-// WithMaxLength sets a max length value
-func (i *Items) WithMaxLength(max int64) *Items {
- i.MaxLength = &max
- return i
-}
-
-// WithMinLength sets a min length value
-func (i *Items) WithMinLength(min int64) *Items {
- i.MinLength = &min
- return i
-}
-
-// WithPattern sets a pattern value
-func (i *Items) WithPattern(pattern string) *Items {
- i.Pattern = pattern
- return i
-}
-
-// WithMultipleOf sets a multiple of value
-func (i *Items) WithMultipleOf(number float64) *Items {
- i.MultipleOf = &number
- return i
-}
-
-// WithMaximum sets a maximum number value
-func (i *Items) WithMaximum(max float64, exclusive bool) *Items {
- i.Maximum = &max
- i.ExclusiveMaximum = exclusive
- return i
-}
-
-// WithMinimum sets a minimum number value
-func (i *Items) WithMinimum(min float64, exclusive bool) *Items {
- i.Minimum = &min
- i.ExclusiveMinimum = exclusive
- return i
-}
-
-// WithEnum sets a the enum values (replace)
-func (i *Items) WithEnum(values ...interface{}) *Items {
- i.Enum = append([]interface{}{}, values...)
- return i
-}
-
-// WithMaxItems sets the max items
-func (i *Items) WithMaxItems(size int64) *Items {
- i.MaxItems = &size
- return i
-}
-
-// WithMinItems sets the min items
-func (i *Items) WithMinItems(size int64) *Items {
- i.MinItems = &size
- return i
-}
-
-// UniqueValues dictates that this array can only have unique items
-func (i *Items) UniqueValues() *Items {
- i.UniqueItems = true
- return i
-}
-
-// AllowDuplicates this array can have duplicates
-func (i *Items) AllowDuplicates() *Items {
- i.UniqueItems = false
- return i
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (i *Items) UnmarshalJSON(data []byte) error {
- var validations CommonValidations
- if err := json.Unmarshal(data, &validations); err != nil {
- return err
- }
- var ref Refable
- if err := json.Unmarshal(data, &ref); err != nil {
- return err
- }
- var simpleSchema SimpleSchema
- if err := json.Unmarshal(data, &simpleSchema); err != nil {
- return err
- }
- i.Refable = ref
- i.CommonValidations = validations
- i.SimpleSchema = simpleSchema
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (i Items) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(i.CommonValidations)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(i.SimpleSchema)
- if err != nil {
- return nil, err
- }
- b3, err := json.Marshal(i.Refable)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b3, b1, b2), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/license.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/license.go
deleted file mode 100644
index f20961b4f..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/license.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-// License information for the exposed API.
-//
-// For more information: http://goo.gl/8us55a#licenseObject
-type License struct {
- Name string `json:"name,omitempty"`
- URL string `json:"url,omitempty"`
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/operation.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/operation.go
deleted file mode 100644
index de1db6f02..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/operation.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-type OperationProps struct {
- Description string `json:"description,omitempty"`
- Consumes []string `json:"consumes,omitempty"`
- Produces []string `json:"produces,omitempty"`
- Schemes []string `json:"schemes,omitempty"` // the scheme, when present must be from [http, https, ws, wss]
- Tags []string `json:"tags,omitempty"`
- Summary string `json:"summary,omitempty"`
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
- ID string `json:"operationId,omitempty"`
- Deprecated bool `json:"deprecated,omitempty"`
- Security []map[string][]string `json:"security,omitempty"`
- Parameters []Parameter `json:"parameters,omitempty"`
- Responses *Responses `json:"responses,omitempty"`
-}
-
-// Operation describes a single API operation on a path.
-//
-// For more information: http://goo.gl/8us55a#operationObject
-type Operation struct {
- VendorExtensible
- OperationProps
-}
-
-// SuccessResponse gets a success response model
-func (o *Operation) SuccessResponse() (*Response, int, bool) {
- if o.Responses == nil {
- return nil, 0, false
- }
-
- for k, v := range o.Responses.StatusCodeResponses {
- if k/100 == 2 {
- return &v, k, true
- }
- }
-
- return o.Responses.Default, 0, false
-}
-
-// JSONLookup look up a value by the json property name
-func (o Operation) JSONLookup(token string) (interface{}, error) {
- if ex, ok := o.Extensions[token]; ok {
- return &ex, nil
- }
- r, _, err := jsonpointer.GetForToken(o.OperationProps, token)
- return r, err
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (o *Operation) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &o.OperationProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &o.VendorExtensible); err != nil {
- return err
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (o Operation) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(o.OperationProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(o.VendorExtensible)
- if err != nil {
- return nil, err
- }
- concated := swag.ConcatJSON(b1, b2)
- return concated, nil
-}
-
-// NewOperation creates a new operation instance.
-// It expects an ID as parameter but not passing an ID is also valid.
-func NewOperation(id string) *Operation {
- op := new(Operation)
- op.ID = id
- return op
-}
-
-// WithID sets the ID property on this operation, allows for chaining.
-func (o *Operation) WithID(id string) *Operation {
- o.ID = id
- return o
-}
-
-// WithDescription sets the description on this operation, allows for chaining
-func (o *Operation) WithDescription(description string) *Operation {
- o.Description = description
- return o
-}
-
-// WithSummary sets the summary on this operation, allows for chaining
-func (o *Operation) WithSummary(summary string) *Operation {
- o.Summary = summary
- return o
-}
-
-// WithExternalDocs sets/removes the external docs for/from this operation.
-// When you pass empty strings as params the external documents will be removed.
-// When you pass non-empty string as one value then those values will be used on the external docs object.
-// So when you pass a non-empty description, you should also pass the url and vice versa.
-func (o *Operation) WithExternalDocs(description, url string) *Operation {
- if description == "" && url == "" {
- o.ExternalDocs = nil
- return o
- }
-
- if o.ExternalDocs == nil {
- o.ExternalDocs = &ExternalDocumentation{}
- }
- o.ExternalDocs.Description = description
- o.ExternalDocs.URL = url
- return o
-}
-
-// Deprecate marks the operation as deprecated
-func (o *Operation) Deprecate() *Operation {
- o.Deprecated = true
- return o
-}
-
-// Undeprecate marks the operation as not deprected
-func (o *Operation) Undeprecate() *Operation {
- o.Deprecated = false
- return o
-}
-
-// WithConsumes adds media types for incoming body values
-func (o *Operation) WithConsumes(mediaTypes ...string) *Operation {
- o.Consumes = append(o.Consumes, mediaTypes...)
- return o
-}
-
-// WithProduces adds media types for outgoing body values
-func (o *Operation) WithProduces(mediaTypes ...string) *Operation {
- o.Produces = append(o.Produces, mediaTypes...)
- return o
-}
-
-// WithTags adds tags for this operation
-func (o *Operation) WithTags(tags ...string) *Operation {
- o.Tags = append(o.Tags, tags...)
- return o
-}
-
-// AddParam adds a parameter to this operation, when a parameter for that location
-// and with that name already exists it will be replaced
-func (o *Operation) AddParam(param *Parameter) *Operation {
- if param == nil {
- return o
- }
-
- for i, p := range o.Parameters {
- if p.Name == param.Name && p.In == param.In {
- params := append(o.Parameters[:i], *param)
- params = append(params, o.Parameters[i+1:]...)
- o.Parameters = params
- return o
- }
- }
-
- o.Parameters = append(o.Parameters, *param)
- return o
-}
-
-// RemoveParam removes a parameter from the operation
-func (o *Operation) RemoveParam(name, in string) *Operation {
- for i, p := range o.Parameters {
- if p.Name == name && p.In == name {
- o.Parameters = append(o.Parameters[:i], o.Parameters[i+1:]...)
- return o
- }
- }
- return o
-}
-
-// SecuredWith adds a security scope to this operation.
-func (o *Operation) SecuredWith(name string, scopes ...string) *Operation {
- o.Security = append(o.Security, map[string][]string{name: scopes})
- return o
-}
-
-// WithDefaultResponse adds a default response to the operation.
-// Passing a nil value will remove the response
-func (o *Operation) WithDefaultResponse(response *Response) *Operation {
- return o.RespondsWith(0, response)
-}
-
-// RespondsWith adds a status code response to the operation.
-// When the code is 0 the value of the response will be used as default response value.
-// When the value of the response is nil it will be removed from the operation
-func (o *Operation) RespondsWith(code int, response *Response) *Operation {
- if o.Responses == nil {
- o.Responses = new(Responses)
- }
- if code == 0 {
- o.Responses.Default = response
- return o
- }
- if response == nil {
- delete(o.Responses.StatusCodeResponses, code)
- return o
- }
- if o.Responses.StatusCodeResponses == nil {
- o.Responses.StatusCodeResponses = make(map[int]Response)
- }
- o.Responses.StatusCodeResponses[code] = *response
- return o
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/parameter.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/parameter.go
deleted file mode 100644
index 8fb66d12a..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/parameter.go
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// QueryParam creates a query parameter
-func QueryParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "query"}}
-}
-
-// HeaderParam creates a header parameter, this is always required by default
-func HeaderParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "header", Required: true}}
-}
-
-// PathParam creates a path parameter, this is always required
-func PathParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "path", Required: true}}
-}
-
-// BodyParam creates a body parameter
-func BodyParam(name string, schema *Schema) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema}, SimpleSchema: SimpleSchema{Type: "object"}}
-}
-
-// FormDataParam creates a body parameter
-func FormDataParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}}
-}
-
-// FileParam creates a body parameter
-func FileParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}, SimpleSchema: SimpleSchema{Type: "file"}}
-}
-
-// SimpleArrayParam creates a param for a simple array (string, int, date etc)
-func SimpleArrayParam(name, tpe, fmt string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name}, SimpleSchema: SimpleSchema{Type: "array", CollectionFormat: "csv", Items: &Items{SimpleSchema: SimpleSchema{Type: "string", Format: fmt}}}}
-}
-
-// ParamRef creates a parameter that's a json reference
-func ParamRef(uri string) *Parameter {
- p := new(Parameter)
- p.Ref = MustCreateRef(uri)
- return p
-}
-
-type ParamProps struct {
- Description string `json:"description,omitempty"`
- Name string `json:"name,omitempty"`
- In string `json:"in,omitempty"`
- Required bool `json:"required,omitempty"`
- Schema *Schema `json:"schema,omitempty"` // when in == "body"
- AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // when in == "query" || "formData"
-}
-
-// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
-//
-// There are five possible parameter types.
-// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`.
-// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
-// * Header - Custom headers that are expected as part of the request.
-// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
-// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or `multipart/form-data` are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4):
-// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred.
-// * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers.
-//
-// For more information: http://goo.gl/8us55a#parameterObject
-type Parameter struct {
- Refable
- CommonValidations
- SimpleSchema
- VendorExtensible
- ParamProps
-}
-
-// JSONLookup look up a value by the json property name
-func (p Parameter) JSONLookup(token string) (interface{}, error) {
- if ex, ok := p.Extensions[token]; ok {
- return &ex, nil
- }
- if token == "$ref" {
- return &p.Ref, nil
- }
- r, _, err := jsonpointer.GetForToken(p.CommonValidations, token)
- if err != nil {
- return nil, err
- }
- if r != nil {
- return r, nil
- }
- r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token)
- if err != nil {
- return nil, err
- }
- if r != nil {
- return r, nil
- }
- r, _, err = jsonpointer.GetForToken(p.ParamProps, token)
- return r, err
-}
-
-// WithDescription a fluent builder method for the description of the parameter
-func (p *Parameter) WithDescription(description string) *Parameter {
- p.Description = description
- return p
-}
-
-// Named a fluent builder method to override the name of the parameter
-func (p *Parameter) Named(name string) *Parameter {
- p.Name = name
- return p
-}
-
-// WithLocation a fluent builder method to override the location of the parameter
-func (p *Parameter) WithLocation(in string) *Parameter {
- p.In = in
- return p
-}
-
-// Typed a fluent builder method for the type of the parameter value
-func (p *Parameter) Typed(tpe, format string) *Parameter {
- p.Type = tpe
- p.Format = format
- return p
-}
-
-// CollectionOf a fluent builder method for an array parameter
-func (p *Parameter) CollectionOf(items *Items, format string) *Parameter {
- p.Type = "array"
- p.Items = items
- p.CollectionFormat = format
- return p
-}
-
-// WithDefault sets the default value on this parameter
-func (p *Parameter) WithDefault(defaultValue interface{}) *Parameter {
- p.AsOptional() // with default implies optional
- p.Default = defaultValue
- return p
-}
-
-// AllowsEmptyValues flags this parameter as being ok with empty values
-func (p *Parameter) AllowsEmptyValues() *Parameter {
- p.AllowEmptyValue = true
- return p
-}
-
-// NoEmptyValues flags this parameter as not liking empty values
-func (p *Parameter) NoEmptyValues() *Parameter {
- p.AllowEmptyValue = false
- return p
-}
-
-// AsOptional flags this parameter as optional
-func (p *Parameter) AsOptional() *Parameter {
- p.Required = false
- return p
-}
-
-// AsRequired flags this parameter as required
-func (p *Parameter) AsRequired() *Parameter {
- if p.Default != nil { // with a default required makes no sense
- return p
- }
- p.Required = true
- return p
-}
-
-// WithMaxLength sets a max length value
-func (p *Parameter) WithMaxLength(max int64) *Parameter {
- p.MaxLength = &max
- return p
-}
-
-// WithMinLength sets a min length value
-func (p *Parameter) WithMinLength(min int64) *Parameter {
- p.MinLength = &min
- return p
-}
-
-// WithPattern sets a pattern value
-func (p *Parameter) WithPattern(pattern string) *Parameter {
- p.Pattern = pattern
- return p
-}
-
-// WithMultipleOf sets a multiple of value
-func (p *Parameter) WithMultipleOf(number float64) *Parameter {
- p.MultipleOf = &number
- return p
-}
-
-// WithMaximum sets a maximum number value
-func (p *Parameter) WithMaximum(max float64, exclusive bool) *Parameter {
- p.Maximum = &max
- p.ExclusiveMaximum = exclusive
- return p
-}
-
-// WithMinimum sets a minimum number value
-func (p *Parameter) WithMinimum(min float64, exclusive bool) *Parameter {
- p.Minimum = &min
- p.ExclusiveMinimum = exclusive
- return p
-}
-
-// WithEnum sets a the enum values (replace)
-func (p *Parameter) WithEnum(values ...interface{}) *Parameter {
- p.Enum = append([]interface{}{}, values...)
- return p
-}
-
-// WithMaxItems sets the max items
-func (p *Parameter) WithMaxItems(size int64) *Parameter {
- p.MaxItems = &size
- return p
-}
-
-// WithMinItems sets the min items
-func (p *Parameter) WithMinItems(size int64) *Parameter {
- p.MinItems = &size
- return p
-}
-
-// UniqueValues dictates that this array can only have unique items
-func (p *Parameter) UniqueValues() *Parameter {
- p.UniqueItems = true
- return p
-}
-
-// AllowDuplicates this array can have duplicates
-func (p *Parameter) AllowDuplicates() *Parameter {
- p.UniqueItems = false
- return p
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (p *Parameter) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &p.CommonValidations); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.Refable); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.SimpleSchema); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.ParamProps); err != nil {
- return err
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (p Parameter) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(p.CommonValidations)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(p.SimpleSchema)
- if err != nil {
- return nil, err
- }
- b3, err := json.Marshal(p.Refable)
- if err != nil {
- return nil, err
- }
- b4, err := json.Marshal(p.VendorExtensible)
- if err != nil {
- return nil, err
- }
- b5, err := json.Marshal(p.ParamProps)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b3, b1, b2, b4, b5), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/path_item.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/path_item.go
deleted file mode 100644
index 9ab3ec538..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/path_item.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// pathItemProps the path item specific properties
-type PathItemProps struct {
- Get *Operation `json:"get,omitempty"`
- Put *Operation `json:"put,omitempty"`
- Post *Operation `json:"post,omitempty"`
- Delete *Operation `json:"delete,omitempty"`
- Options *Operation `json:"options,omitempty"`
- Head *Operation `json:"head,omitempty"`
- Patch *Operation `json:"patch,omitempty"`
- Parameters []Parameter `json:"parameters,omitempty"`
-}
-
-// PathItem describes the operations available on a single path.
-// A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
-// The path itself is still exposed to the documentation viewer but they will
-// not know which operations and parameters are available.
-//
-// For more information: http://goo.gl/8us55a#pathItemObject
-type PathItem struct {
- Refable
- VendorExtensible
- PathItemProps
-}
-
-// JSONLookup look up a value by the json property name
-func (p PathItem) JSONLookup(token string) (interface{}, error) {
- if ex, ok := p.Extensions[token]; ok {
- return &ex, nil
- }
- if token == "$ref" {
- return &p.Ref, nil
- }
- r, _, err := jsonpointer.GetForToken(p.PathItemProps, token)
- return r, err
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (p *PathItem) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &p.Refable); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &p.PathItemProps); err != nil {
- return err
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (p PathItem) MarshalJSON() ([]byte, error) {
- b3, err := json.Marshal(p.Refable)
- if err != nil {
- return nil, err
- }
- b4, err := json.Marshal(p.VendorExtensible)
- if err != nil {
- return nil, err
- }
- b5, err := json.Marshal(p.PathItemProps)
- if err != nil {
- return nil, err
- }
- concated := swag.ConcatJSON(b3, b4, b5)
- return concated, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/paths.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/paths.go
deleted file mode 100644
index 9dc82a290..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/paths.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-
- "github.com/go-openapi/swag"
-)
-
-// Paths holds the relative paths to the individual endpoints.
-// The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order
-// to construct the full URL.
-// The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
-//
-// For more information: http://goo.gl/8us55a#pathsObject
-type Paths struct {
- VendorExtensible
- Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/"
-}
-
-// JSONLookup look up a value by the json property name
-func (p Paths) JSONLookup(token string) (interface{}, error) {
- if pi, ok := p.Paths[token]; ok {
- return &pi, nil
- }
- if ex, ok := p.Extensions[token]; ok {
- return &ex, nil
- }
- return nil, fmt.Errorf("object has no field %q", token)
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (p *Paths) UnmarshalJSON(data []byte) error {
- var res map[string]json.RawMessage
- if err := json.Unmarshal(data, &res); err != nil {
- return err
- }
- for k, v := range res {
- if strings.HasPrefix(strings.ToLower(k), "x-") {
- if p.Extensions == nil {
- p.Extensions = make(map[string]interface{})
- }
- var d interface{}
- if err := json.Unmarshal(v, &d); err != nil {
- return err
- }
- p.Extensions[k] = d
- }
- if strings.HasPrefix(k, "/") {
- if p.Paths == nil {
- p.Paths = make(map[string]PathItem)
- }
- var pi PathItem
- if err := json.Unmarshal(v, &pi); err != nil {
- return err
- }
- p.Paths[k] = pi
- }
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (p Paths) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(p.VendorExtensible)
- if err != nil {
- return nil, err
- }
-
- pths := make(map[string]PathItem)
- for k, v := range p.Paths {
- if strings.HasPrefix(k, "/") {
- pths[k] = v
- }
- }
- b2, err := json.Marshal(pths)
- if err != nil {
- return nil, err
- }
- concated := swag.ConcatJSON(b1, b2)
- return concated, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/ref.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/ref.go
deleted file mode 100644
index 68631df8b..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/ref.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "net/http"
- "os"
- "path/filepath"
-
- "github.com/go-openapi/jsonreference"
-)
-
-// Refable is a struct for things that accept a $ref property
-type Refable struct {
- Ref Ref
-}
-
-// MarshalJSON marshals the ref to json
-func (r Refable) MarshalJSON() ([]byte, error) {
- return r.Ref.MarshalJSON()
-}
-
-// UnmarshalJSON unmarshalss the ref from json
-func (r *Refable) UnmarshalJSON(d []byte) error {
- return json.Unmarshal(d, &r.Ref)
-}
-
-// Ref represents a json reference that is potentially resolved
-type Ref struct {
- jsonreference.Ref
-}
-
-// RemoteURI gets the remote uri part of the ref
-func (r *Ref) RemoteURI() string {
- if r.String() == "" {
- return r.String()
- }
-
- u := *r.GetURL()
- u.Fragment = ""
- return u.String()
-}
-
-// IsValidURI returns true when the url the ref points to can be found
-func (r *Ref) IsValidURI() bool {
- if r.String() == "" {
- return true
- }
-
- v := r.RemoteURI()
- if v == "" {
- return true
- }
-
- if r.HasFullURL {
- rr, err := http.Get(v)
- if err != nil {
- return false
- }
-
- return rr.StatusCode/100 == 2
- }
-
- if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) {
- return false
- }
-
- // check for local file
- pth := v
- if r.HasURLPathOnly {
- p, e := filepath.Abs(pth)
- if e != nil {
- return false
- }
- pth = p
- }
-
- fi, err := os.Stat(pth)
- if err != nil {
- return false
- }
-
- return !fi.IsDir()
-}
-
-// Inherits creates a new reference from a parent and a child
-// If the child cannot inherit from the parent, an error is returned
-func (r *Ref) Inherits(child Ref) (*Ref, error) {
- ref, err := r.Ref.Inherits(child.Ref)
- if err != nil {
- return nil, err
- }
- return &Ref{Ref: *ref}, nil
-}
-
-// NewRef creates a new instance of a ref object
-// returns an error when the reference uri is an invalid uri
-func NewRef(refURI string) (Ref, error) {
- ref, err := jsonreference.New(refURI)
- if err != nil {
- return Ref{}, err
- }
- return Ref{Ref: ref}, nil
-}
-
-// MustCreateRef creates a ref object but
-func MustCreateRef(refURI string) Ref {
- return Ref{Ref: jsonreference.MustCreateRef(refURI)}
-}
-
-// // NewResolvedRef creates a resolved ref
-// func NewResolvedRef(refURI string, data interface{}) Ref {
-// return Ref{
-// Ref: jsonreference.MustCreateRef(refURI),
-// Resolved: data,
-// }
-// }
-
-// MarshalJSON marshals this ref into a JSON object
-func (r Ref) MarshalJSON() ([]byte, error) {
- str := r.String()
- if str == "" {
- if r.IsRoot() {
- return []byte(`{"$ref":"#"}`), nil
- }
- return []byte("{}"), nil
- }
- v := map[string]interface{}{"$ref": str}
- return json.Marshal(v)
-}
-
-// UnmarshalJSON unmarshals this ref from a JSON object
-func (r *Ref) UnmarshalJSON(d []byte) error {
- var v map[string]interface{}
- if err := json.Unmarshal(d, &v); err != nil {
- return err
- }
-
- if v == nil {
- return nil
- }
-
- if vv, ok := v["$ref"]; ok {
- if str, ok := vv.(string); ok {
- ref, err := jsonreference.New(str)
- if err != nil {
- return err
- }
- *r = Ref{Ref: ref}
- }
- }
-
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/response.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/response.go
deleted file mode 100644
index 308cc8478..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/response.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/swag"
-)
-
-// ResponseProps properties specific to a response
-type ResponseProps struct {
- Description string `json:"description,omitempty"`
- Schema *Schema `json:"schema,omitempty"`
- Headers map[string]Header `json:"headers,omitempty"`
- Examples map[string]interface{} `json:"examples,omitempty"`
-}
-
-// Response describes a single response from an API Operation.
-//
-// For more information: http://goo.gl/8us55a#responseObject
-type Response struct {
- Refable
- ResponseProps
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (r *Response) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &r.ResponseProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &r.Refable); err != nil {
- return err
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (r Response) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(r.ResponseProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(r.Refable)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// NewResponse creates a new response instance
-func NewResponse() *Response {
- return new(Response)
-}
-
-// ResponseRef creates a response as a json reference
-func ResponseRef(url string) *Response {
- resp := NewResponse()
- resp.Ref = MustCreateRef(url)
- return resp
-}
-
-// WithDescription sets the description on this response, allows for chaining
-func (r *Response) WithDescription(description string) *Response {
- r.Description = description
- return r
-}
-
-// WithSchema sets the schema on this response, allows for chaining.
-// Passing a nil argument removes the schema from this response
-func (r *Response) WithSchema(schema *Schema) *Response {
- r.Schema = schema
- return r
-}
-
-// AddHeader adds a header to this response
-func (r *Response) AddHeader(name string, header *Header) *Response {
- if header == nil {
- return r.RemoveHeader(name)
- }
- if r.Headers == nil {
- r.Headers = make(map[string]Header)
- }
- r.Headers[name] = *header
- return r
-}
-
-// RemoveHeader removes a header from this response
-func (r *Response) RemoveHeader(name string) *Response {
- delete(r.Headers, name)
- return r
-}
-
-// AddExample adds an example to this response
-func (r *Response) AddExample(mediaType string, example interface{}) *Response {
- if r.Examples == nil {
- r.Examples = make(map[string]interface{})
- }
- r.Examples[mediaType] = example
- return r
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/responses.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/responses.go
deleted file mode 100644
index ea071ca63..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/responses.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
-
- "github.com/go-openapi/swag"
-)
-
-// Responses is a container for the expected responses of an operation.
-// The container maps a HTTP response code to the expected response.
-// It is not expected from the documentation to necessarily cover all possible HTTP response codes,
-// since they may not be known in advance. However, it is expected from the documentation to cover
-// a successful operation response and any known errors.
-//
-// The `default` can be used a default response object for all HTTP codes that are not covered
-// individually by the specification.
-//
-// The `Responses Object` MUST contain at least one response code, and it SHOULD be the response
-// for a successful operation call.
-//
-// For more information: http://goo.gl/8us55a#responsesObject
-type Responses struct {
- VendorExtensible
- ResponsesProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (r Responses) JSONLookup(token string) (interface{}, error) {
- if token == "default" {
- return r.Default, nil
- }
- if ex, ok := r.Extensions[token]; ok {
- return &ex, nil
- }
- if i, err := strconv.Atoi(token); err == nil {
- if scr, ok := r.StatusCodeResponses[i]; ok {
- return &scr, nil
- }
- }
- return nil, fmt.Errorf("object has no field %q", token)
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (r *Responses) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &r.ResponsesProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
- return err
- }
- if reflect.DeepEqual(ResponsesProps{}, r.ResponsesProps) {
- r.ResponsesProps = ResponsesProps{}
- }
- return nil
-}
-
-// MarshalJSON converts this items object to JSON
-func (r Responses) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(r.ResponsesProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(r.VendorExtensible)
- if err != nil {
- return nil, err
- }
- concated := swag.ConcatJSON(b1, b2)
- return concated, nil
-}
-
-type ResponsesProps struct {
- Default *Response
- StatusCodeResponses map[int]Response
-}
-
-func (r ResponsesProps) MarshalJSON() ([]byte, error) {
- toser := map[string]Response{}
- if r.Default != nil {
- toser["default"] = *r.Default
- }
- for k, v := range r.StatusCodeResponses {
- toser[strconv.Itoa(k)] = v
- }
- return json.Marshal(toser)
-}
-
-func (r *ResponsesProps) UnmarshalJSON(data []byte) error {
- var res map[string]Response
- if err := json.Unmarshal(data, &res); err != nil {
- return nil
- }
- if v, ok := res["default"]; ok {
- r.Default = &v
- delete(res, "default")
- }
- for k, v := range res {
- if nk, err := strconv.Atoi(k); err == nil {
- if r.StatusCodeResponses == nil {
- r.StatusCodeResponses = map[int]Response{}
- }
- r.StatusCodeResponses[nk] = v
- }
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/schema.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/schema.go
deleted file mode 100644
index eb88f005c..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/schema.go
+++ /dev/null
@@ -1,628 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "fmt"
- "net/url"
- "strings"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// BooleanProperty creates a boolean property
-func BooleanProperty() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"boolean"}}}
-}
-
-// BoolProperty creates a boolean property
-func BoolProperty() *Schema { return BooleanProperty() }
-
-// StringProperty creates a string property
-func StringProperty() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
-}
-
-// CharProperty creates a string property
-func CharProperty() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}}
-}
-
-// Float64Property creates a float64/double property
-func Float64Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "double"}}
-}
-
-// Float32Property creates a float32/float property
-func Float32Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "float"}}
-}
-
-// Int8Property creates an int8 property
-func Int8Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int8"}}
-}
-
-// Int16Property creates an int16 property
-func Int16Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int16"}}
-}
-
-// Int32Property creates an int32 property
-func Int32Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int32"}}
-}
-
-// Int64Property creates an int64 property
-func Int64Property() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int64"}}
-}
-
-// StrFmtProperty creates a property for the named string format
-func StrFmtProperty(format string) *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: format}}
-}
-
-// DateProperty creates a date property
-func DateProperty() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date"}}
-}
-
-// DateTimeProperty creates a date time property
-func DateTimeProperty() *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date-time"}}
-}
-
-// MapProperty creates a map property
-func MapProperty(property *Schema) *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"object"}, AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}}
-}
-
-// RefProperty creates a ref property
-func RefProperty(name string) *Schema {
- return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
-}
-
-// RefSchema creates a ref property
-func RefSchema(name string) *Schema {
- return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}}
-}
-
-// ArrayProperty creates an array property
-func ArrayProperty(items *Schema) *Schema {
- if items == nil {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"array"}}}
- }
- return &Schema{SchemaProps: SchemaProps{Items: &SchemaOrArray{Schema: items}, Type: []string{"array"}}}
-}
-
-// ComposedSchema creates a schema with allOf
-func ComposedSchema(schemas ...Schema) *Schema {
- s := new(Schema)
- s.AllOf = schemas
- return s
-}
-
-// SchemaURL represents a schema url
-type SchemaURL string
-
-// MarshalJSON marshal this to JSON
-func (r SchemaURL) MarshalJSON() ([]byte, error) {
- if r == "" {
- return []byte("{}"), nil
- }
- v := map[string]interface{}{"$schema": string(r)}
- return json.Marshal(v)
-}
-
-// UnmarshalJSON unmarshal this from JSON
-func (r *SchemaURL) UnmarshalJSON(data []byte) error {
- var v map[string]interface{}
- if err := json.Unmarshal(data, &v); err != nil {
- return err
- }
- if v == nil {
- return nil
- }
- if vv, ok := v["$schema"]; ok {
- if str, ok := vv.(string); ok {
- u, err := url.Parse(str)
- if err != nil {
- return err
- }
-
- *r = SchemaURL(u.String())
- }
- }
- return nil
-}
-
-// type ExtraSchemaProps map[string]interface{}
-
-// // JSONSchema represents a structure that is a json schema draft 04
-// type JSONSchema struct {
-// SchemaProps
-// ExtraSchemaProps
-// }
-
-// // MarshalJSON marshal this to JSON
-// func (s JSONSchema) MarshalJSON() ([]byte, error) {
-// b1, err := json.Marshal(s.SchemaProps)
-// if err != nil {
-// return nil, err
-// }
-// b2, err := s.Ref.MarshalJSON()
-// if err != nil {
-// return nil, err
-// }
-// b3, err := s.Schema.MarshalJSON()
-// if err != nil {
-// return nil, err
-// }
-// b4, err := json.Marshal(s.ExtraSchemaProps)
-// if err != nil {
-// return nil, err
-// }
-// return swag.ConcatJSON(b1, b2, b3, b4), nil
-// }
-
-// // UnmarshalJSON marshal this from JSON
-// func (s *JSONSchema) UnmarshalJSON(data []byte) error {
-// var sch JSONSchema
-// if err := json.Unmarshal(data, &sch.SchemaProps); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.Ref); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.Schema); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.ExtraSchemaProps); err != nil {
-// return err
-// }
-// *s = sch
-// return nil
-// }
-
-type SchemaProps struct {
- ID string `json:"id,omitempty"`
- Ref Ref `json:"-,omitempty"`
- Schema SchemaURL `json:"-,omitempty"`
- Description string `json:"description,omitempty"`
- Type StringOrArray `json:"type,omitempty"`
- Format string `json:"format,omitempty"`
- Title string `json:"title,omitempty"`
- Default interface{} `json:"default,omitempty"`
- Maximum *float64 `json:"maximum,omitempty"`
- ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
- Minimum *float64 `json:"minimum,omitempty"`
- ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
- MaxLength *int64 `json:"maxLength,omitempty"`
- MinLength *int64 `json:"minLength,omitempty"`
- Pattern string `json:"pattern,omitempty"`
- MaxItems *int64 `json:"maxItems,omitempty"`
- MinItems *int64 `json:"minItems,omitempty"`
- UniqueItems bool `json:"uniqueItems,omitempty"`
- MultipleOf *float64 `json:"multipleOf,omitempty"`
- Enum []interface{} `json:"enum,omitempty"`
- MaxProperties *int64 `json:"maxProperties,omitempty"`
- MinProperties *int64 `json:"minProperties,omitempty"`
- Required []string `json:"required,omitempty"`
- Items *SchemaOrArray `json:"items,omitempty"`
- AllOf []Schema `json:"allOf,omitempty"`
- OneOf []Schema `json:"oneOf,omitempty"`
- AnyOf []Schema `json:"anyOf,omitempty"`
- Not *Schema `json:"not,omitempty"`
- Properties map[string]Schema `json:"properties,omitempty"`
- AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"`
- PatternProperties map[string]Schema `json:"patternProperties,omitempty"`
- Dependencies Dependencies `json:"dependencies,omitempty"`
- AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"`
- Definitions Definitions `json:"definitions,omitempty"`
-}
-
-type SwaggerSchemaProps struct {
- Discriminator string `json:"discriminator,omitempty"`
- ReadOnly bool `json:"readOnly,omitempty"`
- XML *XMLObject `json:"xml,omitempty"`
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
- Example interface{} `json:"example,omitempty"`
-}
-
-// Schema the schema object allows the definition of input and output data types.
-// These types can be objects, but also primitives and arrays.
-// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/)
-// and uses a predefined subset of it.
-// On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
-//
-// For more information: http://goo.gl/8us55a#schemaObject
-type Schema struct {
- VendorExtensible
- SchemaProps
- SwaggerSchemaProps
- ExtraProps map[string]interface{} `json:"-"`
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (s Schema) JSONLookup(token string) (interface{}, error) {
- if ex, ok := s.Extensions[token]; ok {
- return &ex, nil
- }
-
- if ex, ok := s.ExtraProps[token]; ok {
- return &ex, nil
- }
-
- r, _, err := jsonpointer.GetForToken(s.SchemaProps, token)
- if r != nil || err != nil {
- return r, err
- }
- r, _, err = jsonpointer.GetForToken(s.SwaggerSchemaProps, token)
- return r, err
-}
-
-// WithID sets the id for this schema, allows for chaining
-func (s *Schema) WithID(id string) *Schema {
- s.ID = id
- return s
-}
-
-// WithTitle sets the title for this schema, allows for chaining
-func (s *Schema) WithTitle(title string) *Schema {
- s.Title = title
- return s
-}
-
-// WithDescription sets the description for this schema, allows for chaining
-func (s *Schema) WithDescription(description string) *Schema {
- s.Description = description
- return s
-}
-
-// WithProperties sets the properties for this schema
-func (s *Schema) WithProperties(schemas map[string]Schema) *Schema {
- s.Properties = schemas
- return s
-}
-
-// SetProperty sets a property on this schema
-func (s *Schema) SetProperty(name string, schema Schema) *Schema {
- if s.Properties == nil {
- s.Properties = make(map[string]Schema)
- }
- s.Properties[name] = schema
- return s
-}
-
-// WithAllOf sets the all of property
-func (s *Schema) WithAllOf(schemas ...Schema) *Schema {
- s.AllOf = schemas
- return s
-}
-
-// WithMaxProperties sets the max number of properties an object can have
-func (s *Schema) WithMaxProperties(max int64) *Schema {
- s.MaxProperties = &max
- return s
-}
-
-// WithMinProperties sets the min number of properties an object must have
-func (s *Schema) WithMinProperties(min int64) *Schema {
- s.MinProperties = &min
- return s
-}
-
-// Typed sets the type of this schema for a single value item
-func (s *Schema) Typed(tpe, format string) *Schema {
- s.Type = []string{tpe}
- s.Format = format
- return s
-}
-
-// AddType adds a type with potential format to the types for this schema
-func (s *Schema) AddType(tpe, format string) *Schema {
- s.Type = append(s.Type, tpe)
- if format != "" {
- s.Format = format
- }
- return s
-}
-
-// CollectionOf a fluent builder method for an array parameter
-func (s *Schema) CollectionOf(items Schema) *Schema {
- s.Type = []string{"array"}
- s.Items = &SchemaOrArray{Schema: &items}
- return s
-}
-
-// WithDefault sets the default value on this parameter
-func (s *Schema) WithDefault(defaultValue interface{}) *Schema {
- s.Default = defaultValue
- return s
-}
-
-// WithRequired flags this parameter as required
-func (s *Schema) WithRequired(items ...string) *Schema {
- s.Required = items
- return s
-}
-
-// AddRequired adds field names to the required properties array
-func (s *Schema) AddRequired(items ...string) *Schema {
- s.Required = append(s.Required, items...)
- return s
-}
-
-// WithMaxLength sets a max length value
-func (s *Schema) WithMaxLength(max int64) *Schema {
- s.MaxLength = &max
- return s
-}
-
-// WithMinLength sets a min length value
-func (s *Schema) WithMinLength(min int64) *Schema {
- s.MinLength = &min
- return s
-}
-
-// WithPattern sets a pattern value
-func (s *Schema) WithPattern(pattern string) *Schema {
- s.Pattern = pattern
- return s
-}
-
-// WithMultipleOf sets a multiple of value
-func (s *Schema) WithMultipleOf(number float64) *Schema {
- s.MultipleOf = &number
- return s
-}
-
-// WithMaximum sets a maximum number value
-func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema {
- s.Maximum = &max
- s.ExclusiveMaximum = exclusive
- return s
-}
-
-// WithMinimum sets a minimum number value
-func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema {
- s.Minimum = &min
- s.ExclusiveMinimum = exclusive
- return s
-}
-
-// WithEnum sets a the enum values (replace)
-func (s *Schema) WithEnum(values ...interface{}) *Schema {
- s.Enum = append([]interface{}{}, values...)
- return s
-}
-
-// WithMaxItems sets the max items
-func (s *Schema) WithMaxItems(size int64) *Schema {
- s.MaxItems = &size
- return s
-}
-
-// WithMinItems sets the min items
-func (s *Schema) WithMinItems(size int64) *Schema {
- s.MinItems = &size
- return s
-}
-
-// UniqueValues dictates that this array can only have unique items
-func (s *Schema) UniqueValues() *Schema {
- s.UniqueItems = true
- return s
-}
-
-// AllowDuplicates this array can have duplicates
-func (s *Schema) AllowDuplicates() *Schema {
- s.UniqueItems = false
- return s
-}
-
-// AddToAllOf adds a schema to the allOf property
-func (s *Schema) AddToAllOf(schemas ...Schema) *Schema {
- s.AllOf = append(s.AllOf, schemas...)
- return s
-}
-
-// WithDiscriminator sets the name of the discriminator field
-func (s *Schema) WithDiscriminator(discriminator string) *Schema {
- s.Discriminator = discriminator
- return s
-}
-
-// AsReadOnly flags this schema as readonly
-func (s *Schema) AsReadOnly() *Schema {
- s.ReadOnly = true
- return s
-}
-
-// AsWritable flags this schema as writeable (not read-only)
-func (s *Schema) AsWritable() *Schema {
- s.ReadOnly = false
- return s
-}
-
-// WithExample sets the example for this schema
-func (s *Schema) WithExample(example interface{}) *Schema {
- s.Example = example
- return s
-}
-
-// WithExternalDocs sets/removes the external docs for/from this schema.
-// When you pass empty strings as params the external documents will be removed.
-// When you pass non-empty string as one value then those values will be used on the external docs object.
-// So when you pass a non-empty description, you should also pass the url and vice versa.
-func (s *Schema) WithExternalDocs(description, url string) *Schema {
- if description == "" && url == "" {
- s.ExternalDocs = nil
- return s
- }
-
- if s.ExternalDocs == nil {
- s.ExternalDocs = &ExternalDocumentation{}
- }
- s.ExternalDocs.Description = description
- s.ExternalDocs.URL = url
- return s
-}
-
-// WithXMLName sets the xml name for the object
-func (s *Schema) WithXMLName(name string) *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Name = name
- return s
-}
-
-// WithXMLNamespace sets the xml namespace for the object
-func (s *Schema) WithXMLNamespace(namespace string) *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Namespace = namespace
- return s
-}
-
-// WithXMLPrefix sets the xml prefix for the object
-func (s *Schema) WithXMLPrefix(prefix string) *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Prefix = prefix
- return s
-}
-
-// AsXMLAttribute flags this object as xml attribute
-func (s *Schema) AsXMLAttribute() *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Attribute = true
- return s
-}
-
-// AsXMLElement flags this object as an xml node
-func (s *Schema) AsXMLElement() *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Attribute = false
- return s
-}
-
-// AsWrappedXML flags this object as wrapped, this is mostly useful for array types
-func (s *Schema) AsWrappedXML() *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Wrapped = true
- return s
-}
-
-// AsUnwrappedXML flags this object as an xml node
-func (s *Schema) AsUnwrappedXML() *Schema {
- if s.XML == nil {
- s.XML = new(XMLObject)
- }
- s.XML.Wrapped = false
- return s
-}
-
-// MarshalJSON marshal this to JSON
-func (s Schema) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(s.SchemaProps)
- if err != nil {
- return nil, fmt.Errorf("schema props %v", err)
- }
- b2, err := json.Marshal(s.VendorExtensible)
- if err != nil {
- return nil, fmt.Errorf("vendor props %v", err)
- }
- b3, err := s.Ref.MarshalJSON()
- if err != nil {
- return nil, fmt.Errorf("ref prop %v", err)
- }
- b4, err := s.Schema.MarshalJSON()
- if err != nil {
- return nil, fmt.Errorf("schema prop %v", err)
- }
- b5, err := json.Marshal(s.SwaggerSchemaProps)
- if err != nil {
- return nil, fmt.Errorf("common validations %v", err)
- }
- var b6 []byte
- if s.ExtraProps != nil {
- jj, err := json.Marshal(s.ExtraProps)
- if err != nil {
- return nil, fmt.Errorf("extra props %v", err)
- }
- b6 = jj
- }
- return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil
-}
-
-// UnmarshalJSON marshal this from JSON
-func (s *Schema) UnmarshalJSON(data []byte) error {
- var sch Schema
- if err := json.Unmarshal(data, &sch.SchemaProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &sch.Ref); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &sch.Schema); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &sch.SwaggerSchemaProps); err != nil {
- return err
- }
-
- var d map[string]interface{}
- if err := json.Unmarshal(data, &d); err != nil {
- return err
- }
-
- delete(d, "$ref")
- delete(d, "$schema")
- for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) {
- delete(d, pn)
- }
-
- for k, vv := range d {
- lk := strings.ToLower(k)
- if strings.HasPrefix(lk, "x-") {
- if sch.Extensions == nil {
- sch.Extensions = map[string]interface{}{}
- }
- sch.Extensions[k] = vv
- continue
- }
- if sch.ExtraProps == nil {
- sch.ExtraProps = map[string]interface{}{}
- }
- sch.ExtraProps[k] = vv
- }
-
- *s = sch
-
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/security_scheme.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/security_scheme.go
deleted file mode 100644
index 22d4f10af..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/security_scheme.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-const (
- basic = "basic"
- apiKey = "apiKey"
- oauth2 = "oauth2"
- implicit = "implicit"
- password = "password"
- application = "application"
- accessCode = "accessCode"
-)
-
-// BasicAuth creates a basic auth security scheme
-func BasicAuth() *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: basic}}
-}
-
-// APIKeyAuth creates an api key auth security scheme
-func APIKeyAuth(fieldName, valueSource string) *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: apiKey, Name: fieldName, In: valueSource}}
-}
-
-// OAuth2Implicit creates an implicit flow oauth2 security scheme
-func OAuth2Implicit(authorizationURL string) *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
- Type: oauth2,
- Flow: implicit,
- AuthorizationURL: authorizationURL,
- }}
-}
-
-// OAuth2Password creates a password flow oauth2 security scheme
-func OAuth2Password(tokenURL string) *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
- Type: oauth2,
- Flow: password,
- TokenURL: tokenURL,
- }}
-}
-
-// OAuth2Application creates an application flow oauth2 security scheme
-func OAuth2Application(tokenURL string) *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
- Type: oauth2,
- Flow: application,
- TokenURL: tokenURL,
- }}
-}
-
-// OAuth2AccessToken creates an access token flow oauth2 security scheme
-func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme {
- return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{
- Type: oauth2,
- Flow: accessCode,
- AuthorizationURL: authorizationURL,
- TokenURL: tokenURL,
- }}
-}
-
-type SecuritySchemeProps struct {
- Description string `json:"description,omitempty"`
- Type string `json:"type"`
- Name string `json:"name,omitempty"` // api key
- In string `json:"in,omitempty"` // api key
- Flow string `json:"flow,omitempty"` // oauth2
- AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2
- TokenURL string `json:"tokenUrl,omitempty"` // oauth2
- Scopes map[string]string `json:"scopes,omitempty"` // oauth2
-}
-
-// AddScope adds a scope to this security scheme
-func (s *SecuritySchemeProps) AddScope(scope, description string) {
- if s.Scopes == nil {
- s.Scopes = make(map[string]string)
- }
- s.Scopes[scope] = description
-}
-
-// SecurityScheme allows the definition of a security scheme that can be used by the operations.
-// Supported schemes are basic authentication, an API key (either as a header or as a query parameter)
-// and OAuth2's common flows (implicit, password, application and access code).
-//
-// For more information: http://goo.gl/8us55a#securitySchemeObject
-type SecurityScheme struct {
- VendorExtensible
- SecuritySchemeProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (s SecurityScheme) JSONLookup(token string) (interface{}, error) {
- if ex, ok := s.Extensions[token]; ok {
- return &ex, nil
- }
-
- r, _, err := jsonpointer.GetForToken(s.SecuritySchemeProps, token)
- return r, err
-}
-
-// MarshalJSON marshal this to JSON
-func (s SecurityScheme) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(s.SecuritySchemeProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(s.VendorExtensible)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// UnmarshalJSON marshal this from JSON
-func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &s.VendorExtensible); err != nil {
- return err
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/spec.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/spec.go
deleted file mode 100644
index cc2ae56b2..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/spec.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import "encoding/json"
-
-//go:generate go-bindata -pkg=spec -prefix=./schemas -ignore=.*\.md ./schemas/...
-//go:generate perl -pi -e s,Json,JSON,g bindata.go
-
-const (
- // SwaggerSchemaURL the url for the swagger 2.0 schema to validate specs
- SwaggerSchemaURL = "http://swagger.io/v2/schema.json#"
- // JSONSchemaURL the url for the json schema schema
- JSONSchemaURL = "http://json-schema.org/draft-04/schema#"
-)
-
-var (
- jsonSchema = MustLoadJSONSchemaDraft04()
- swaggerSchema = MustLoadSwagger20Schema()
-)
-
-// MustLoadJSONSchemaDraft04 panics when Swagger20Schema returns an error
-func MustLoadJSONSchemaDraft04() *Schema {
- d, e := JSONSchemaDraft04()
- if e != nil {
- panic(e)
- }
- return d
-}
-
-// JSONSchemaDraft04 loads the json schema document for json shema draft04
-func JSONSchemaDraft04() (*Schema, error) {
- b, err := Asset("jsonschema-draft-04.json")
- if err != nil {
- return nil, err
- }
-
- schema := new(Schema)
- if err := json.Unmarshal(b, schema); err != nil {
- return nil, err
- }
- return schema, nil
-}
-
-// MustLoadSwagger20Schema panics when Swagger20Schema returns an error
-func MustLoadSwagger20Schema() *Schema {
- d, e := Swagger20Schema()
- if e != nil {
- panic(e)
- }
- return d
-}
-
-// Swagger20Schema loads the swagger 2.0 schema from the embedded assets
-func Swagger20Schema() (*Schema, error) {
-
- b, err := Asset("v2/schema.json")
- if err != nil {
- return nil, err
- }
-
- schema := new(Schema)
- if err := json.Unmarshal(b, schema); err != nil {
- return nil, err
- }
- return schema, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/swagger.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/swagger.go
deleted file mode 100644
index ff3ef875e..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/swagger.go
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-// Swagger this is the root document object for the API specification.
-// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
-//
-// For more information: http://goo.gl/8us55a#swagger-object-
-type Swagger struct {
- VendorExtensible
- SwaggerProps
-}
-
-// JSONLookup look up a value by the json property name
-func (s Swagger) JSONLookup(token string) (interface{}, error) {
- if ex, ok := s.Extensions[token]; ok {
- return &ex, nil
- }
- r, _, err := jsonpointer.GetForToken(s.SwaggerProps, token)
- return r, err
-}
-
-// MarshalJSON marshals this swagger structure to json
-func (s Swagger) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(s.SwaggerProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(s.VendorExtensible)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// UnmarshalJSON unmarshals a swagger spec from json
-func (s *Swagger) UnmarshalJSON(data []byte) error {
- var sw Swagger
- if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil {
- return err
- }
- if err := json.Unmarshal(data, &sw.VendorExtensible); err != nil {
- return err
- }
- *s = sw
- return nil
-}
-
-type SwaggerProps struct {
- ID string `json:"id,omitempty"`
- Consumes []string `json:"consumes,omitempty"`
- Produces []string `json:"produces,omitempty"`
- Schemes []string `json:"schemes,omitempty"` // the scheme, when present must be from [http, https, ws, wss]
- Swagger string `json:"swagger,omitempty"`
- Info *Info `json:"info,omitempty"`
- Host string `json:"host,omitempty"`
- BasePath string `json:"basePath,omitempty"` // must start with a leading "/"
- Paths *Paths `json:"paths"` // required
- Definitions Definitions `json:"definitions"`
- Parameters map[string]Parameter `json:"parameters,omitempty"`
- Responses map[string]Response `json:"responses,omitempty"`
- SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"`
- Security []map[string][]string `json:"security,omitempty"`
- Tags []Tag `json:"tags,omitempty"`
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-}
-
-// Dependencies represent a dependencies property
-type Dependencies map[string]SchemaOrStringArray
-
-// SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property
-type SchemaOrBool struct {
- Allows bool
- Schema *Schema
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (s SchemaOrBool) JSONLookup(token string) (interface{}, error) {
- if token == "allows" {
- return s.Allows, nil
- }
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
- return r, err
-}
-
-var jsTrue = []byte("true")
-var jsFalse = []byte("false")
-
-// MarshalJSON convert this object to JSON
-func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
- if s.Schema != nil {
- return json.Marshal(s.Schema)
- }
-
- if s.Schema == nil && !s.Allows {
- return jsFalse, nil
- }
- return jsTrue, nil
-}
-
-// UnmarshalJSON converts this bool or schema object from a JSON structure
-func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
- var nw SchemaOrBool
- if len(data) >= 4 {
- if data[0] == '{' {
- var sch Schema
- if err := json.Unmarshal(data, &sch); err != nil {
- return err
- }
- nw.Schema = &sch
- }
- nw.Allows = !(data[0] == 'f' && data[1] == 'a' && data[2] == 'l' && data[3] == 's' && data[4] == 'e')
- }
- *s = nw
- return nil
-}
-
-// SchemaOrStringArray represents a schema or a string array
-type SchemaOrStringArray struct {
- Schema *Schema
- Property []string
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error) {
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
- return r, err
-}
-
-// MarshalJSON converts this schema object or array into JSON structure
-func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
- if len(s.Property) > 0 {
- return json.Marshal(s.Property)
- }
- if s.Schema != nil {
- return json.Marshal(s.Schema)
- }
- return nil, nil
-}
-
-// UnmarshalJSON converts this schema object or array from a JSON structure
-func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
- var first byte
- if len(data) > 1 {
- first = data[0]
- }
- var nw SchemaOrStringArray
- if first == '{' {
- var sch Schema
- if err := json.Unmarshal(data, &sch); err != nil {
- return err
- }
- nw.Schema = &sch
- }
- if first == '[' {
- if err := json.Unmarshal(data, &nw.Property); err != nil {
- return err
- }
- }
- *s = nw
- return nil
-}
-
-// Definitions contains the models explicitly defined in this spec
-// An object to hold data types that can be consumed and produced by operations.
-// These data types can be primitives, arrays or models.
-//
-// For more information: http://goo.gl/8us55a#definitionsObject
-type Definitions map[string]Schema
-
-// SecurityDefinitions a declaration of the security schemes available to be used in the specification.
-// This does not enforce the security schemes on the operations and only serves to provide
-// the relevant details for each scheme.
-//
-// For more information: http://goo.gl/8us55a#securityDefinitionsObject
-type SecurityDefinitions map[string]*SecurityScheme
-
-// StringOrArray represents a value that can either be a string
-// or an array of strings. Mainly here for serialization purposes
-type StringOrArray []string
-
-// Contains returns true when the value is contained in the slice
-func (s StringOrArray) Contains(value string) bool {
- for _, str := range s {
- if str == value {
- return true
- }
- }
- return false
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (s SchemaOrArray) JSONLookup(token string) (interface{}, error) {
- if _, err := strconv.Atoi(token); err == nil {
- r, _, err := jsonpointer.GetForToken(s.Schemas, token)
- return r, err
- }
- r, _, err := jsonpointer.GetForToken(s.Schema, token)
- return r, err
-}
-
-// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string
-func (s *StringOrArray) UnmarshalJSON(data []byte) error {
- var first byte
- if len(data) > 1 {
- first = data[0]
- }
-
- if first == '[' {
- var parsed []string
- if err := json.Unmarshal(data, &parsed); err != nil {
- return err
- }
- *s = StringOrArray(parsed)
- return nil
- }
-
- var single interface{}
- if err := json.Unmarshal(data, &single); err != nil {
- return err
- }
- if single == nil {
- return nil
- }
- switch single.(type) {
- case string:
- *s = StringOrArray([]string{single.(string)})
- return nil
- default:
- return fmt.Errorf("only string or array is allowed, not %T", single)
- }
-}
-
-// MarshalJSON converts this string or array to a JSON array or JSON string
-func (s StringOrArray) MarshalJSON() ([]byte, error) {
- if len(s) == 1 {
- return json.Marshal([]string(s)[0])
- }
- return json.Marshal([]string(s))
-}
-
-// SchemaOrArray represents a value that can either be a Schema
-// or an array of Schema. Mainly here for serialization purposes
-type SchemaOrArray struct {
- Schema *Schema
- Schemas []Schema
-}
-
-// Len returns the number of schemas in this property
-func (s SchemaOrArray) Len() int {
- if s.Schema != nil {
- return 1
- }
- return len(s.Schemas)
-}
-
-// ContainsType returns true when one of the schemas is of the specified type
-func (s *SchemaOrArray) ContainsType(name string) bool {
- if s.Schema != nil {
- return s.Schema.Type != nil && s.Schema.Type.Contains(name)
- }
- return false
-}
-
-// MarshalJSON converts this schema object or array into JSON structure
-func (s SchemaOrArray) MarshalJSON() ([]byte, error) {
- if len(s.Schemas) > 0 {
- return json.Marshal(s.Schemas)
- }
- return json.Marshal(s.Schema)
-}
-
-// UnmarshalJSON converts this schema object or array from a JSON structure
-func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
- var nw SchemaOrArray
- var first byte
- if len(data) > 1 {
- first = data[0]
- }
- if first == '{' {
- var sch Schema
- if err := json.Unmarshal(data, &sch); err != nil {
- return err
- }
- nw.Schema = &sch
- }
- if first == '[' {
- if err := json.Unmarshal(data, &nw.Schemas); err != nil {
- return err
- }
- }
- *s = nw
- return nil
-}
-
-// vim:set ft=go noet sts=2 sw=2 ts=2:
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/tag.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/tag.go
deleted file mode 100644
index 97f555840..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/tag.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
-)
-
-type TagProps struct {
- Description string `json:"description,omitempty"`
- Name string `json:"name,omitempty"`
- ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
-}
-
-// NewTag creates a new tag
-func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag {
- return Tag{TagProps: TagProps{description, name, externalDocs}}
-}
-
-// Tag allows adding meta data to a single tag that is used by the [Operation Object](http://goo.gl/8us55a#operationObject).
-// It is not mandatory to have a Tag Object per tag used there.
-//
-// For more information: http://goo.gl/8us55a#tagObject
-type Tag struct {
- VendorExtensible
- TagProps
-}
-
-// JSONLookup implements an interface to customize json pointer lookup
-func (t Tag) JSONLookup(token string) (interface{}, error) {
- if ex, ok := t.Extensions[token]; ok {
- return &ex, nil
- }
-
- r, _, err := jsonpointer.GetForToken(t.TagProps, token)
- return r, err
-}
-
-// MarshalJSON marshal this to JSON
-func (t Tag) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(t.TagProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(t.VendorExtensible)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// UnmarshalJSON marshal this from JSON
-func (t *Tag) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &t.TagProps); err != nil {
- return err
- }
- return json.Unmarshal(data, &t.VendorExtensible)
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/spec/xml_object.go b/archived/event-adapter/vendor/github.com/go-openapi/spec/xml_object.go
deleted file mode 100644
index 945a46703..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/spec/xml_object.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package spec
-
-// XMLObject a metadata object that allows for more fine-tuned XML model definitions.
-//
-// For more information: http://goo.gl/8us55a#xmlObject
-type XMLObject struct {
- Name string `json:"name,omitempty"`
- Namespace string `json:"namespace,omitempty"`
- Prefix string `json:"prefix,omitempty"`
- Attribute bool `json:"attribute,omitempty"`
- Wrapped bool `json:"wrapped,omitempty"`
-}
-
-// WithName sets the xml name for the object
-func (x *XMLObject) WithName(name string) *XMLObject {
- x.Name = name
- return x
-}
-
-// WithNamespace sets the xml namespace for the object
-func (x *XMLObject) WithNamespace(namespace string) *XMLObject {
- x.Namespace = namespace
- return x
-}
-
-// WithPrefix sets the xml prefix for the object
-func (x *XMLObject) WithPrefix(prefix string) *XMLObject {
- x.Prefix = prefix
- return x
-}
-
-// AsAttribute flags this object as xml attribute
-func (x *XMLObject) AsAttribute() *XMLObject {
- x.Attribute = true
- return x
-}
-
-// AsElement flags this object as an xml node
-func (x *XMLObject) AsElement() *XMLObject {
- x.Attribute = false
- return x
-}
-
-// AsWrapped flags this object as wrapped, this is mostly useful for array types
-func (x *XMLObject) AsWrapped() *XMLObject {
- x.Wrapped = true
- return x
-}
-
-// AsUnwrapped flags this object as an xml node
-func (x *XMLObject) AsUnwrapped() *XMLObject {
- x.Wrapped = false
- return x
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/.drone.yml b/archived/event-adapter/vendor/github.com/go-openapi/swag/.drone.yml
deleted file mode 100644
index acf10fdfb..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/.drone.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-clone:
- path: github.com/go-openapi/swag
-
-matrix:
- GO_VERSION:
- - "1.6"
-
-build:
- integration:
- image: golang:$$GO_VERSION
- pull: true
- commands:
- - go get -u github.com/stretchr/testify
- - go get -u github.com/mailru/easyjson
- - go test -race
- - go test -v -cover -coverprofile=coverage.out -covermode=count ./...
-
-notify:
- slack:
- channel: bots
- webhook_url: $$SLACK_URL
- username: drone
-
-publish:
- coverage:
- server: https://coverage.vmware.run
- token: $$GITHUB_TOKEN
- # threshold: 70
- # must_increase: true
- when:
- matrix:
- GO_VERSION: "1.6"
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/.gitignore b/archived/event-adapter/vendor/github.com/go-openapi/swag/.gitignore
deleted file mode 100644
index 769c24400..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-secrets.yml
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/.pullapprove.yml b/archived/event-adapter/vendor/github.com/go-openapi/swag/.pullapprove.yml
deleted file mode 100644
index 5ec183e22..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/.pullapprove.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-approve_by_comment: true
-approve_regex: '^(:shipit:|:\+1:|\+1|LGTM|lgtm|Approved)'
-reject_regex: ^[Rr]ejected
-reset_on_push: false
-reviewers:
- members:
- - casualjim
- - chancez
- - frapposelli
- - vburenin
- - pytlesk4
- name: pullapprove
- required: 1
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md b/archived/event-adapter/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9322b065e..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at ivan+abuse@flanders.co.nz. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/LICENSE b/archived/event-adapter/vendor/github.com/go-openapi/swag/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/README.md b/archived/event-adapter/vendor/github.com/go-openapi/swag/README.md
deleted file mode 100644
index c1d3c196c..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Swag [![Build Status](https://ci.vmware.run/api/badges/go-openapi/swag/status.svg)](https://ci.vmware.run/go-openapi/swag) [![Coverage](https://coverage.vmware.run/badges/go-openapi/swag/coverage.svg)](https://coverage.vmware.run/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
-
-[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag)
-
-Contains a bunch of helper functions:
-
-* convert between value and pointers for builtins
-* convert from string to builtin
-* fast json concatenation
-* search in path
-* load from file or http
-* name manglin
\ No newline at end of file
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/convert.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/convert.go
deleted file mode 100644
index 28d912410..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/convert.go
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package swag
-
-import (
- "math"
- "strconv"
- "strings"
-)
-
-// same as ECMA Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER
-const (
- maxJSONFloat = float64(1<<53 - 1) // 9007199254740991.0 2^53 - 1
- minJSONFloat = -float64(1<<53 - 1) //-9007199254740991.0 -2^53 - 1
-)
-
-// IsFloat64AJSONInteger allow for integers [-2^53, 2^53-1] inclusive
-func IsFloat64AJSONInteger(f float64) bool {
- if math.IsNaN(f) || math.IsInf(f, 0) || f < minJSONFloat || f > maxJSONFloat {
- return false
- }
-
- return f == float64(int64(f)) || f == float64(uint64(f))
-}
-
-var evaluatesAsTrue = map[string]struct{}{
- "true": struct{}{},
- "1": struct{}{},
- "yes": struct{}{},
- "ok": struct{}{},
- "y": struct{}{},
- "on": struct{}{},
- "selected": struct{}{},
- "checked": struct{}{},
- "t": struct{}{},
- "enabled": struct{}{},
-}
-
-// ConvertBool turn a string into a boolean
-func ConvertBool(str string) (bool, error) {
- _, ok := evaluatesAsTrue[strings.ToLower(str)]
- return ok, nil
-}
-
-// ConvertFloat32 turn a string into a float32
-func ConvertFloat32(str string) (float32, error) {
- f, err := strconv.ParseFloat(str, 32)
- if err != nil {
- return 0, err
- }
- return float32(f), nil
-}
-
-// ConvertFloat64 turn a string into a float64
-func ConvertFloat64(str string) (float64, error) {
- return strconv.ParseFloat(str, 64)
-}
-
-// ConvertInt8 turn a string into int8 boolean
-func ConvertInt8(str string) (int8, error) {
- i, err := strconv.ParseInt(str, 10, 8)
- if err != nil {
- return 0, err
- }
- return int8(i), nil
-}
-
-// ConvertInt16 turn a string into a int16
-func ConvertInt16(str string) (int16, error) {
- i, err := strconv.ParseInt(str, 10, 16)
- if err != nil {
- return 0, err
- }
- return int16(i), nil
-}
-
-// ConvertInt32 turn a string into a int32
-func ConvertInt32(str string) (int32, error) {
- i, err := strconv.ParseInt(str, 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(i), nil
-}
-
-// ConvertInt64 turn a string into a int64
-func ConvertInt64(str string) (int64, error) {
- return strconv.ParseInt(str, 10, 64)
-}
-
-// ConvertUint8 turn a string into a uint8
-func ConvertUint8(str string) (uint8, error) {
- i, err := strconv.ParseUint(str, 10, 8)
- if err != nil {
- return 0, err
- }
- return uint8(i), nil
-}
-
-// ConvertUint16 turn a string into a uint16
-func ConvertUint16(str string) (uint16, error) {
- i, err := strconv.ParseUint(str, 10, 16)
- if err != nil {
- return 0, err
- }
- return uint16(i), nil
-}
-
-// ConvertUint32 turn a string into a uint32
-func ConvertUint32(str string) (uint32, error) {
- i, err := strconv.ParseUint(str, 10, 32)
- if err != nil {
- return 0, err
- }
- return uint32(i), nil
-}
-
-// ConvertUint64 turn a string into a uint64
-func ConvertUint64(str string) (uint64, error) {
- return strconv.ParseUint(str, 10, 64)
-}
-
-// FormatBool turns a boolean into a string
-func FormatBool(value bool) string {
- return strconv.FormatBool(value)
-}
-
-// FormatFloat32 turns a float32 into a string
-func FormatFloat32(value float32) string {
- return strconv.FormatFloat(float64(value), 'f', -1, 32)
-}
-
-// FormatFloat64 turns a float64 into a string
-func FormatFloat64(value float64) string {
- return strconv.FormatFloat(value, 'f', -1, 64)
-}
-
-// FormatInt8 turns an int8 into a string
-func FormatInt8(value int8) string {
- return strconv.FormatInt(int64(value), 10)
-}
-
-// FormatInt16 turns an int16 into a string
-func FormatInt16(value int16) string {
- return strconv.FormatInt(int64(value), 10)
-}
-
-// FormatInt32 turns an int32 into a string
-func FormatInt32(value int32) string {
- return strconv.FormatInt(int64(value), 10)
-}
-
-// FormatInt64 turns an int64 into a string
-func FormatInt64(value int64) string {
- return strconv.FormatInt(value, 10)
-}
-
-// FormatUint8 turns an uint8 into a string
-func FormatUint8(value uint8) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint16 turns an uint16 into a string
-func FormatUint16(value uint16) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint32 turns an uint32 into a string
-func FormatUint32(value uint32) string {
- return strconv.FormatUint(uint64(value), 10)
-}
-
-// FormatUint64 turns an uint64 into a string
-func FormatUint64(value uint64) string {
- return strconv.FormatUint(value, 10)
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/convert_types.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/convert_types.go
deleted file mode 100644
index c95e4e78b..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/convert_types.go
+++ /dev/null
@@ -1,595 +0,0 @@
-package swag
-
-import "time"
-
-// This file was taken from the aws go sdk
-
-// String returns a pointer to of the string value passed in.
-func String(v string) *string {
- return &v
-}
-
-// StringValue returns the value of the string pointer passed in or
-// "" if the pointer is nil.
-func StringValue(v *string) string {
- if v != nil {
- return *v
- }
- return ""
-}
-
-// StringSlice converts a slice of string values into a slice of
-// string pointers
-func StringSlice(src []string) []*string {
- dst := make([]*string, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// StringValueSlice converts a slice of string pointers into a slice of
-// string values
-func StringValueSlice(src []*string) []string {
- dst := make([]string, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// StringMap converts a string map of string values into a string
-// map of string pointers
-func StringMap(src map[string]string) map[string]*string {
- dst := make(map[string]*string)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// StringValueMap converts a string map of string pointers into a string
-// map of string values
-func StringValueMap(src map[string]*string) map[string]string {
- dst := make(map[string]string)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Bool returns a pointer to of the bool value passed in.
-func Bool(v bool) *bool {
- return &v
-}
-
-// BoolValue returns the value of the bool pointer passed in or
-// false if the pointer is nil.
-func BoolValue(v *bool) bool {
- if v != nil {
- return *v
- }
- return false
-}
-
-// BoolSlice converts a slice of bool values into a slice of
-// bool pointers
-func BoolSlice(src []bool) []*bool {
- dst := make([]*bool, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// BoolValueSlice converts a slice of bool pointers into a slice of
-// bool values
-func BoolValueSlice(src []*bool) []bool {
- dst := make([]bool, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// BoolMap converts a string map of bool values into a string
-// map of bool pointers
-func BoolMap(src map[string]bool) map[string]*bool {
- dst := make(map[string]*bool)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// BoolValueMap converts a string map of bool pointers into a string
-// map of bool values
-func BoolValueMap(src map[string]*bool) map[string]bool {
- dst := make(map[string]bool)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int returns a pointer to of the int value passed in.
-func Int(v int) *int {
- return &v
-}
-
-// IntValue returns the value of the int pointer passed in or
-// 0 if the pointer is nil.
-func IntValue(v *int) int {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// IntSlice converts a slice of int values into a slice of
-// int pointers
-func IntSlice(src []int) []*int {
- dst := make([]*int, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// IntValueSlice converts a slice of int pointers into a slice of
-// int values
-func IntValueSlice(src []*int) []int {
- dst := make([]int, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// IntMap converts a string map of int values into a string
-// map of int pointers
-func IntMap(src map[string]int) map[string]*int {
- dst := make(map[string]*int)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// IntValueMap converts a string map of int pointers into a string
-// map of int values
-func IntValueMap(src map[string]*int) map[string]int {
- dst := make(map[string]int)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int32 returns a pointer to of the int64 value passed in.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int32Value returns the value of the int64 pointer passed in or
-// 0 if the pointer is nil.
-func Int32Value(v *int32) int32 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Int32Slice converts a slice of int64 values into a slice of
-// int32 pointers
-func Int32Slice(src []int32) []*int32 {
- dst := make([]*int32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Int32ValueSlice converts a slice of int32 pointers into a slice of
-// int32 values
-func Int32ValueSlice(src []*int32) []int32 {
- dst := make([]int32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Int32Map converts a string map of int32 values into a string
-// map of int32 pointers
-func Int32Map(src map[string]int32) map[string]*int32 {
- dst := make(map[string]*int32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Int32ValueMap converts a string map of int32 pointers into a string
-// map of int32 values
-func Int32ValueMap(src map[string]*int32) map[string]int32 {
- dst := make(map[string]int32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Int64 returns a pointer to of the int64 value passed in.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Int64Value returns the value of the int64 pointer passed in or
-// 0 if the pointer is nil.
-func Int64Value(v *int64) int64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Int64Slice converts a slice of int64 values into a slice of
-// int64 pointers
-func Int64Slice(src []int64) []*int64 {
- dst := make([]*int64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Int64ValueSlice converts a slice of int64 pointers into a slice of
-// int64 values
-func Int64ValueSlice(src []*int64) []int64 {
- dst := make([]int64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Int64Map converts a string map of int64 values into a string
-// map of int64 pointers
-func Int64Map(src map[string]int64) map[string]*int64 {
- dst := make(map[string]*int64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Int64ValueMap converts a string map of int64 pointers into a string
-// map of int64 values
-func Int64ValueMap(src map[string]*int64) map[string]int64 {
- dst := make(map[string]int64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint returns a pouinter to of the uint value passed in.
-func Uint(v uint) *uint {
- return &v
-}
-
-// UintValue returns the value of the uint pouinter passed in or
-// 0 if the pouinter is nil.
-func UintValue(v *uint) uint {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// UintSlice converts a slice of uint values uinto a slice of
-// uint pouinters
-func UintSlice(src []uint) []*uint {
- dst := make([]*uint, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// UintValueSlice converts a slice of uint pouinters uinto a slice of
-// uint values
-func UintValueSlice(src []*uint) []uint {
- dst := make([]uint, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// UintMap converts a string map of uint values uinto a string
-// map of uint pouinters
-func UintMap(src map[string]uint) map[string]*uint {
- dst := make(map[string]*uint)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// UintValueMap converts a string map of uint pouinters uinto a string
-// map of uint values
-func UintValueMap(src map[string]*uint) map[string]uint {
- dst := make(map[string]uint)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint32 returns a pouinter to of the uint64 value passed in.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint32Value returns the value of the uint64 pouinter passed in or
-// 0 if the pouinter is nil.
-func Uint32Value(v *uint32) uint32 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Uint32Slice converts a slice of uint64 values uinto a slice of
-// uint32 pouinters
-func Uint32Slice(src []uint32) []*uint32 {
- dst := make([]*uint32, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Uint32ValueSlice converts a slice of uint32 pouinters uinto a slice of
-// uint32 values
-func Uint32ValueSlice(src []*uint32) []uint32 {
- dst := make([]uint32, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Uint32Map converts a string map of uint32 values uinto a string
-// map of uint32 pouinters
-func Uint32Map(src map[string]uint32) map[string]*uint32 {
- dst := make(map[string]*uint32)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Uint32ValueMap converts a string map of uint32 pouinters uinto a string
-// map of uint32 values
-func Uint32ValueMap(src map[string]*uint32) map[string]uint32 {
- dst := make(map[string]uint32)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Uint64 returns a pouinter to of the uint64 value passed in.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// Uint64Value returns the value of the uint64 pouinter passed in or
-// 0 if the pouinter is nil.
-func Uint64Value(v *uint64) uint64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Uint64Slice converts a slice of uint64 values uinto a slice of
-// uint64 pouinters
-func Uint64Slice(src []uint64) []*uint64 {
- dst := make([]*uint64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Uint64ValueSlice converts a slice of uint64 pouinters uinto a slice of
-// uint64 values
-func Uint64ValueSlice(src []*uint64) []uint64 {
- dst := make([]uint64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Uint64Map converts a string map of uint64 values uinto a string
-// map of uint64 pouinters
-func Uint64Map(src map[string]uint64) map[string]*uint64 {
- dst := make(map[string]*uint64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Uint64ValueMap converts a string map of uint64 pouinters uinto a string
-// map of uint64 values
-func Uint64ValueMap(src map[string]*uint64) map[string]uint64 {
- dst := make(map[string]uint64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Float64 returns a pointer to of the float64 value passed in.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Float64Value returns the value of the float64 pointer passed in or
-// 0 if the pointer is nil.
-func Float64Value(v *float64) float64 {
- if v != nil {
- return *v
- }
- return 0
-}
-
-// Float64Slice converts a slice of float64 values into a slice of
-// float64 pointers
-func Float64Slice(src []float64) []*float64 {
- dst := make([]*float64, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// Float64ValueSlice converts a slice of float64 pointers into a slice of
-// float64 values
-func Float64ValueSlice(src []*float64) []float64 {
- dst := make([]float64, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// Float64Map converts a string map of float64 values into a string
-// map of float64 pointers
-func Float64Map(src map[string]float64) map[string]*float64 {
- dst := make(map[string]*float64)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// Float64ValueMap converts a string map of float64 pointers into a string
-// map of float64 values
-func Float64ValueMap(src map[string]*float64) map[string]float64 {
- dst := make(map[string]float64)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
-
-// Time returns a pointer to of the time.Time value passed in.
-func Time(v time.Time) *time.Time {
- return &v
-}
-
-// TimeValue returns the value of the time.Time pointer passed in or
-// time.Time{} if the pointer is nil.
-func TimeValue(v *time.Time) time.Time {
- if v != nil {
- return *v
- }
- return time.Time{}
-}
-
-// TimeSlice converts a slice of time.Time values into a slice of
-// time.Time pointers
-func TimeSlice(src []time.Time) []*time.Time {
- dst := make([]*time.Time, len(src))
- for i := 0; i < len(src); i++ {
- dst[i] = &(src[i])
- }
- return dst
-}
-
-// TimeValueSlice converts a slice of time.Time pointers into a slice of
-// time.Time values
-func TimeValueSlice(src []*time.Time) []time.Time {
- dst := make([]time.Time, len(src))
- for i := 0; i < len(src); i++ {
- if src[i] != nil {
- dst[i] = *(src[i])
- }
- }
- return dst
-}
-
-// TimeMap converts a string map of time.Time values into a string
-// map of time.Time pointers
-func TimeMap(src map[string]time.Time) map[string]*time.Time {
- dst := make(map[string]*time.Time)
- for k, val := range src {
- v := val
- dst[k] = &v
- }
- return dst
-}
-
-// TimeValueMap converts a string map of time.Time pointers into a string
-// map of time.Time values
-func TimeValueMap(src map[string]*time.Time) map[string]time.Time {
- dst := make(map[string]time.Time)
- for k, val := range src {
- if val != nil {
- dst[k] = *val
- }
- }
- return dst
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/json.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/json.go
deleted file mode 100644
index 6e9ec20fc..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/json.go
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package swag
-
-import (
- "bytes"
- "encoding/json"
- "reflect"
- "strings"
- "sync"
-
- "github.com/mailru/easyjson/jlexer"
- "github.com/mailru/easyjson/jwriter"
-)
-
-// DefaultJSONNameProvider the default cache for types
-var DefaultJSONNameProvider = NewNameProvider()
-
-const comma = byte(',')
-
-var closers = map[byte]byte{
- '{': '}',
- '[': ']',
-}
-
-type ejMarshaler interface {
- MarshalEasyJSON(w *jwriter.Writer)
-}
-
-type ejUnmarshaler interface {
- UnmarshalEasyJSON(w *jlexer.Lexer)
-}
-
-// WriteJSON writes json data, prefers finding an appropriate interface to short-circuit the marshaller
-// so it takes the fastest option available.
-func WriteJSON(data interface{}) ([]byte, error) {
- if d, ok := data.(ejMarshaler); ok {
- jw := new(jwriter.Writer)
- d.MarshalEasyJSON(jw)
- return jw.BuildBytes()
- }
- if d, ok := data.(json.Marshaler); ok {
- return d.MarshalJSON()
- }
- return json.Marshal(data)
-}
-
-// ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaller
-// so it takes the fastes option available
-func ReadJSON(data []byte, value interface{}) error {
- if d, ok := value.(ejUnmarshaler); ok {
- jl := &jlexer.Lexer{Data: data}
- d.UnmarshalEasyJSON(jl)
- return jl.Error()
- }
- if d, ok := value.(json.Unmarshaler); ok {
- return d.UnmarshalJSON(data)
- }
- return json.Unmarshal(data, value)
-}
-
-// DynamicJSONToStruct converts an untyped json structure into a struct
-func DynamicJSONToStruct(data interface{}, target interface{}) error {
- // TODO: convert straight to a json typed map (mergo + iterate?)
- b, err := WriteJSON(data)
- if err != nil {
- return err
- }
- if err := ReadJSON(b, target); err != nil {
- return err
- }
- return nil
-}
-
-// ConcatJSON concatenates multiple json objects efficiently
-func ConcatJSON(blobs ...[]byte) []byte {
- if len(blobs) == 0 {
- return nil
- }
- if len(blobs) == 1 {
- return blobs[0]
- }
-
- last := len(blobs) - 1
- var opening, closing byte
- a := 0
- idx := 0
- buf := bytes.NewBuffer(nil)
-
- for i, b := range blobs {
- if len(b) > 0 && opening == 0 { // is this an array or an object?
- opening, closing = b[0], closers[b[0]]
- }
-
- if opening != '{' && opening != '[' {
- continue // don't know how to concatenate non container objects
- }
-
- if len(b) < 3 { // yep empty but also the last one, so closing this thing
- if i == last && a > 0 {
- buf.WriteByte(closing)
- }
- continue
- }
-
- idx = 0
- if a > 0 { // we need to join with a comma for everything beyond the first non-empty item
- buf.WriteByte(comma)
- idx = 1 // this is not the first or the last so we want to drop the leading bracket
- }
-
- if i != last { // not the last one, strip brackets
- buf.Write(b[idx : len(b)-1])
- } else { // last one, strip only the leading bracket
- buf.Write(b[idx:])
- }
- a++
- }
- // somehow it ended up being empty, so provide a default value
- if buf.Len() == 0 {
- buf.WriteByte(opening)
- buf.WriteByte(closing)
- }
- return buf.Bytes()
-}
-
-// ToDynamicJSON turns an object into a properly JSON typed structure
-func ToDynamicJSON(data interface{}) interface{} {
- // TODO: convert straight to a json typed map (mergo + iterate?)
- b, _ := json.Marshal(data)
- var res interface{}
- json.Unmarshal(b, &res)
- return res
-}
-
-// FromDynamicJSON turns an object into a properly JSON typed structure
-func FromDynamicJSON(data, target interface{}) error {
- b, _ := json.Marshal(data)
- return json.Unmarshal(b, target)
-}
-
-// NameProvider represents an object capabale of translating from go property names
-// to json property names
-// This type is thread-safe.
-type NameProvider struct {
- lock *sync.Mutex
- index map[reflect.Type]nameIndex
-}
-
-type nameIndex struct {
- jsonNames map[string]string
- goNames map[string]string
-}
-
-// NewNameProvider creates a new name provider
-func NewNameProvider() *NameProvider {
- return &NameProvider{
- lock: &sync.Mutex{},
- index: make(map[reflect.Type]nameIndex),
- }
-}
-
-func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) {
- for i := 0; i < tpe.NumField(); i++ {
- targetDes := tpe.Field(i)
-
- if targetDes.PkgPath != "" { // unexported
- continue
- }
-
- if targetDes.Anonymous { // walk embedded structures tree down first
- buildnameIndex(targetDes.Type, idx, reverseIdx)
- continue
- }
-
- if tag := targetDes.Tag.Get("json"); tag != "" {
-
- parts := strings.Split(tag, ",")
- if len(parts) == 0 {
- continue
- }
-
- nm := parts[0]
- if nm == "-" {
- continue
- }
- if nm == "" { // empty string means we want to use the Go name
- nm = targetDes.Name
- }
-
- idx[nm] = targetDes.Name
- reverseIdx[targetDes.Name] = nm
- }
- }
-}
-
-func newNameIndex(tpe reflect.Type) nameIndex {
- var idx = make(map[string]string, tpe.NumField())
- var reverseIdx = make(map[string]string, tpe.NumField())
-
- buildnameIndex(tpe, idx, reverseIdx)
- return nameIndex{jsonNames: idx, goNames: reverseIdx}
-}
-
-// GetJSONNames gets all the json property names for a type
-func (n *NameProvider) GetJSONNames(subject interface{}) []string {
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
-
- var res []string
- for k := range names.jsonNames {
- res = append(res, k)
- }
- return res
-}
-
-// GetJSONName gets the json name for a go property name
-func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool) {
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- return n.GetJSONNameForType(tpe, name)
-}
-
-// GetJSONNameForType gets the json name for a go property name on a given type
-func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) {
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
- nme, ok := names.goNames[name]
- return nme, ok
-}
-
-func (n *NameProvider) makeNameIndex(tpe reflect.Type) nameIndex {
- n.lock.Lock()
- defer n.lock.Unlock()
- names := newNameIndex(tpe)
- n.index[tpe] = names
- return names
-}
-
-// GetGoName gets the go name for a json property name
-func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool) {
- tpe := reflect.Indirect(reflect.ValueOf(subject)).Type()
- return n.GetGoNameForType(tpe, name)
-}
-
-// GetGoNameForType gets the go name for a given type for a json property name
-func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) {
- names, ok := n.index[tpe]
- if !ok {
- names = n.makeNameIndex(tpe)
- }
- nme, ok := names.jsonNames[name]
- return nme, ok
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/loading.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/loading.go
deleted file mode 100644
index 6dbc31330..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/loading.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package swag
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "strings"
-)
-
-// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in
-func LoadFromFileOrHTTP(path string) ([]byte, error) {
- return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes)(path)
-}
-
-// LoadStrategy returns a loader function for a given path or uri
-func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) {
- if strings.HasPrefix(path, "http") {
- return remote
- }
- return local
-}
-
-func loadHTTPBytes(path string) ([]byte, error) {
- resp, err := http.Get(path)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode != http.StatusOK {
- return nil, fmt.Errorf("could not access document at %q [%s] ", path, resp.Status)
- }
-
- return ioutil.ReadAll(resp.Body)
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/net.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/net.go
deleted file mode 100644
index 8323fa37b..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/net.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package swag
-
-import (
- "net"
- "strconv"
-)
-
-// SplitHostPort splits a network address into a host and a port.
-// The port is -1 when there is no port to be found
-func SplitHostPort(addr string) (host string, port int, err error) {
- h, p, err := net.SplitHostPort(addr)
- if err != nil {
- return "", -1, err
- }
- if p == "" {
- return "", -1, &net.AddrError{Err: "missing port in address", Addr: addr}
- }
-
- pi, err := strconv.Atoi(p)
- if err != nil {
- return "", -1, err
- }
- return h, pi, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/path.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/path.go
deleted file mode 100644
index 273e9fbed..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/path.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package swag
-
-import (
- "os"
- "path/filepath"
- "runtime"
- "strings"
-)
-
-const (
- // GOPATHKey represents the env key for gopath
- GOPATHKey = "GOPATH"
-)
-
-// FindInSearchPath finds a package in a provided lists of paths
-func FindInSearchPath(searchPath, pkg string) string {
- pathsList := filepath.SplitList(searchPath)
- for _, path := range pathsList {
- if evaluatedPath, err := filepath.EvalSymlinks(filepath.Join(path, "src", pkg)); err == nil {
- if _, err := os.Stat(evaluatedPath); err == nil {
- return evaluatedPath
- }
- }
- }
- return ""
-}
-
-// FindInGoSearchPath finds a package in the $GOPATH:$GOROOT
-func FindInGoSearchPath(pkg string) string {
- return FindInSearchPath(FullGoSearchPath(), pkg)
-}
-
-// FullGoSearchPath gets the search paths for finding packages
-func FullGoSearchPath() string {
- allPaths := os.Getenv(GOPATHKey)
- if allPaths != "" {
- allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":")
- } else {
- allPaths = runtime.GOROOT()
- }
- return allPaths
-}
diff --git a/archived/event-adapter/vendor/github.com/go-openapi/swag/util.go b/archived/event-adapter/vendor/github.com/go-openapi/swag/util.go
deleted file mode 100644
index d8b54ee61..000000000
--- a/archived/event-adapter/vendor/github.com/go-openapi/swag/util.go
+++ /dev/null
@@ -1,318 +0,0 @@
-// Copyright 2015 go-swagger maintainers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package swag
-
-import (
- "math"
- "reflect"
- "regexp"
- "sort"
- "strings"
-)
-
-// Taken from https://github.com/golang/lint/blob/1fab560e16097e5b69afb66eb93aab843ef77845/lint.go#L663-L698
-var commonInitialisms = map[string]bool{
- "API": true,
- "ASCII": true,
- "CPU": true,
- "CSS": true,
- "DNS": true,
- "EOF": true,
- "GUID": true,
- "HTML": true,
- "HTTPS": true,
- "HTTP": true,
- "ID": true,
- "IP": true,
- "JSON": true,
- "LHS": true,
- "QPS": true,
- "RAM": true,
- "RHS": true,
- "RPC": true,
- "SLA": true,
- "SMTP": true,
- "SSH": true,
- "TCP": true,
- "TLS": true,
- "TTL": true,
- "UDP": true,
- "UUID": true,
- "UID": true,
- "UI": true,
- "URI": true,
- "URL": true,
- "UTF8": true,
- "VM": true,
- "XML": true,
- "XSRF": true,
- "XSS": true,
-}
-var initialisms []string
-
-func init() {
- for k := range commonInitialisms {
- initialisms = append(initialisms, k)
- }
- sort.Sort(sort.Reverse(byLength(initialisms)))
-}
-
-// JoinByFormat joins a string array by a known format:
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
-func JoinByFormat(data []string, format string) []string {
- if len(data) == 0 {
- return data
- }
- var sep string
- switch format {
- case "ssv":
- sep = " "
- case "tsv":
- sep = "\t"
- case "pipes":
- sep = "|"
- case "multi":
- return data
- default:
- sep = ","
- }
- return []string{strings.Join(data, sep)}
-}
-
-// SplitByFormat splits a string by a known format:
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
-func SplitByFormat(data, format string) []string {
- if data == "" {
- return nil
- }
- var sep string
- switch format {
- case "ssv":
- sep = " "
- case "tsv":
- sep = "\t"
- case "pipes":
- sep = "|"
- case "multi":
- return nil
- default:
- sep = ","
- }
- var result []string
- for _, s := range strings.Split(data, sep) {
- if ts := strings.TrimSpace(s); ts != "" {
- result = append(result, ts)
- }
- }
- return result
-}
-
-type byLength []string
-
-func (s byLength) Len() int {
- return len(s)
-}
-func (s byLength) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-func (s byLength) Less(i, j int) bool {
- return len(s[i]) < len(s[j])
-}
-
-// Prepares strings by splitting by caps, spaces, dashes, and underscore
-func split(str string) (words []string) {
- repl := strings.NewReplacer(
- "@", "At ",
- "&", "And ",
- "|", "Pipe ",
- "$", "Dollar ",
- "!", "Bang ",
- "-", " ",
- "_", " ",
- )
-
- rex1 := regexp.MustCompile(`(\p{Lu})`)
- rex2 := regexp.MustCompile(`(\pL|\pM|\pN|\p{Pc})+`)
-
- str = trim(str)
-
- // Convert dash and underscore to spaces
- str = repl.Replace(str)
-
- // Split when uppercase is found (needed for Snake)
- str = rex1.ReplaceAllString(str, " $1")
- // check if consecutive single char things make up an initialism
-
- for _, k := range initialisms {
- str = strings.Replace(str, rex1.ReplaceAllString(k, " $1"), " "+k, -1)
- }
- // Get the final list of words
- words = rex2.FindAllString(str, -1)
-
- return
-}
-
-// Removes leading whitespaces
-func trim(str string) string {
- return strings.Trim(str, " ")
-}
-
-// Shortcut to strings.ToUpper()
-func upper(str string) string {
- return strings.ToUpper(trim(str))
-}
-
-// Shortcut to strings.ToLower()
-func lower(str string) string {
- return strings.ToLower(trim(str))
-}
-
-// ToFileName lowercases and underscores a go type name
-func ToFileName(name string) string {
- var out []string
- for _, w := range split(name) {
- out = append(out, lower(w))
- }
- return strings.Join(out, "_")
-}
-
-// ToCommandName lowercases and underscores a go type name
-func ToCommandName(name string) string {
- var out []string
- for _, w := range split(name) {
- out = append(out, lower(w))
- }
- return strings.Join(out, "-")
-}
-
-// ToHumanNameLower represents a code name as a human series of words
-func ToHumanNameLower(name string) string {
- var out []string
- for _, w := range split(name) {
- if !commonInitialisms[upper(w)] {
- out = append(out, lower(w))
- } else {
- out = append(out, w)
- }
- }
- return strings.Join(out, " ")
-}
-
-// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized
-func ToHumanNameTitle(name string) string {
- var out []string
- for _, w := range split(name) {
- uw := upper(w)
- if !commonInitialisms[uw] {
- out = append(out, upper(w[:1])+lower(w[1:]))
- } else {
- out = append(out, w)
- }
- }
- return strings.Join(out, " ")
-}
-
-// ToJSONName camelcases a name which can be underscored or pascal cased
-func ToJSONName(name string) string {
- var out []string
- for i, w := range split(name) {
- if i == 0 {
- out = append(out, lower(w))
- continue
- }
- out = append(out, upper(w[:1])+lower(w[1:]))
- }
- return strings.Join(out, "")
-}
-
-// ToVarName camelcases a name which can be underscored or pascal cased
-func ToVarName(name string) string {
- res := ToGoName(name)
- if len(res) <= 1 {
- return lower(res)
- }
- return lower(res[:1]) + res[1:]
-}
-
-// ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes
-func ToGoName(name string) string {
- var out []string
- for _, w := range split(name) {
- uw := upper(w)
- mod := int(math.Min(float64(len(uw)), 2))
- if !commonInitialisms[uw] && !commonInitialisms[uw[:len(uw)-mod]] {
- uw = upper(w[:1]) + lower(w[1:])
- }
- out = append(out, uw)
- }
- return strings.Join(out, "")
-}
-
-// ContainsStringsCI searches a slice of strings for a case-insensitive match
-func ContainsStringsCI(coll []string, item string) bool {
- for _, a := range coll {
- if strings.EqualFold(a, item) {
- return true
- }
- }
- return false
-}
-
-type zeroable interface {
- IsZero() bool
-}
-
-// IsZero returns true when the value passed into the function is a zero value.
-// This allows for safer checking of interface values.
-func IsZero(data interface{}) bool {
- // check for things that have an IsZero method instead
- if vv, ok := data.(zeroable); ok {
- return vv.IsZero()
- }
- // continue with slightly more complex reflection
- v := reflect.ValueOf(data)
- switch v.Kind() {
- case reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
- case reflect.Struct, reflect.Array:
- return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface())
- case reflect.Invalid:
- return true
- }
- return false
-}
-
-// CommandLineOptionsGroup represents a group of user-defined command line options
-type CommandLineOptionsGroup struct {
- ShortDescription string
- LongDescription string
- Options interface{}
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/archived/event-adapter/vendor/github.com/gogo/protobuf/CONTRIBUTORS
deleted file mode 100644
index d2c3b418f..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/CONTRIBUTORS
+++ /dev/null
@@ -1,15 +0,0 @@
-Anton Povarov
-Clayton Coleman
-Denis Smirnov
-DongYun Kang
-Dwayne Schultz
-Georg Apitz
-Gustav Paul
-John Tuley
-Laurent
-Patrick Lee
-Stephen J Day
-Tamir Duberstein
-Todd Eisenberger
-Tormod Erevik Lea
-Walter Schulze
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/LICENSE b/archived/event-adapter/vendor/github.com/gogo/protobuf/LICENSE
deleted file mode 100644
index 335e38e19..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/LICENSE
+++ /dev/null
@@ -1,36 +0,0 @@
-Extensions for Protocol Buffers to create more go like structures.
-
-Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-http://github.com/gogo/protobuf/gogoproto
-
-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
-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.
-
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/Makefile b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/Makefile
deleted file mode 100644
index 23a6b1734..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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
-# 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.
-
-install:
- go install
-
-test: install generate-test-pbs
- go test
-
-
-generate-test-pbs:
- make install
- make -C testdata
- protoc-min-version --version="3.0.0" --proto_path=.:../../../../ --gogo_out=. proto3_proto/proto3.proto
- make
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/clone.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/clone.go
deleted file mode 100644
index 79edb8611..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/clone.go
+++ /dev/null
@@ -1,228 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 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
-// 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.
-
-// Protocol buffer deep copy and merge.
-// TODO: RawMessage.
-
-package proto
-
-import (
- "log"
- "reflect"
- "strings"
-)
-
-// Clone returns a deep copy of a protocol buffer.
-func Clone(pb Message) Message {
- in := reflect.ValueOf(pb)
- if in.IsNil() {
- return pb
- }
-
- out := reflect.New(in.Type().Elem())
- // out is empty so a merge is a deep copy.
- mergeStruct(out.Elem(), in.Elem())
- return out.Interface().(Message)
-}
-
-// Merge merges src into dst.
-// Required and optional fields that are set in src will be set to that value in dst.
-// Elements of repeated fields will be appended.
-// Merge panics if src and dst are not the same type, or if dst is nil.
-func Merge(dst, src Message) {
- in := reflect.ValueOf(src)
- out := reflect.ValueOf(dst)
- if out.IsNil() {
- panic("proto: nil destination")
- }
- if in.Type() != out.Type() {
- // Explicit test prior to mergeStruct so that mistyped nils will fail
- panic("proto: type mismatch")
- }
- if in.IsNil() {
- // Merging nil into non-nil is a quiet no-op
- return
- }
- mergeStruct(out.Elem(), in.Elem())
-}
-
-func mergeStruct(out, in reflect.Value) {
- sprop := GetProperties(in.Type())
- for i := 0; i < in.NumField(); i++ {
- f := in.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
- }
-
- if emIn, ok := in.Addr().Interface().(extensionsMap); ok {
- emOut := out.Addr().Interface().(extensionsMap)
- mergeExtension(emOut.ExtensionMap(), emIn.ExtensionMap())
- } else if emIn, ok := in.Addr().Interface().(extensionsBytes); ok {
- emOut := out.Addr().Interface().(extensionsBytes)
- bIn := emIn.GetExtensions()
- bOut := emOut.GetExtensions()
- *bOut = append(*bOut, *bIn...)
- }
-
- uf := in.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return
- }
- uin := uf.Bytes()
- if len(uin) > 0 {
- out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
- }
-}
-
-// mergeAny performs a merge between two values of the same type.
-// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
-// prop is set if this is a struct field (it may be nil).
-func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
- if in.Type() == protoMessageType {
- if !in.IsNil() {
- if out.IsNil() {
- out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
- } else {
- Merge(out.Interface().(Message), in.Interface().(Message))
- }
- }
- return
- }
- switch in.Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- if !viaPtr && isProto3Zero(in) {
- return
- }
- out.Set(in)
- case reflect.Interface:
- // Probably a oneof field; copy non-nil values.
- if in.IsNil() {
- return
- }
- // Allocate destination if it is not set, or set to a different type.
- // Otherwise we will merge as normal.
- if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
- out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
- }
- mergeAny(out.Elem(), in.Elem(), false, nil)
- case reflect.Map:
- if in.Len() == 0 {
- return
- }
- if out.IsNil() {
- out.Set(reflect.MakeMap(in.Type()))
- }
- // For maps with value types of *T or []byte we need to deep copy each value.
- elemKind := in.Type().Elem().Kind()
- for _, key := range in.MapKeys() {
- var val reflect.Value
- switch elemKind {
- case reflect.Ptr:
- val = reflect.New(in.Type().Elem().Elem())
- mergeAny(val, in.MapIndex(key), false, nil)
- case reflect.Slice:
- val = in.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- default:
- val = in.MapIndex(key)
- }
- out.SetMapIndex(key, val)
- }
- case reflect.Ptr:
- if in.IsNil() {
- return
- }
- if out.IsNil() {
- out.Set(reflect.New(in.Elem().Type()))
- }
- mergeAny(out.Elem(), in.Elem(), true, nil)
- case reflect.Slice:
- if in.IsNil() {
- return
- }
- if in.Type().Elem().Kind() == reflect.Uint8 {
- // []byte is a scalar bytes field, not a repeated field.
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value, and should not
- // be merged.
- if prop != nil && prop.proto3 && in.Len() == 0 {
- return
- }
-
- // Make a deep copy.
- // Append to []byte{} instead of []byte(nil) so that we never end up
- // with a nil result.
- out.SetBytes(append([]byte{}, in.Bytes()...))
- return
- }
- n := in.Len()
- if out.IsNil() {
- out.Set(reflect.MakeSlice(in.Type(), 0, n))
- }
- switch in.Type().Elem().Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- out.Set(reflect.AppendSlice(out, in))
- default:
- for i := 0; i < n; i++ {
- x := reflect.Indirect(reflect.New(in.Type().Elem()))
- mergeAny(x, in.Index(i), false, nil)
- out.Set(reflect.Append(out, x))
- }
- }
- case reflect.Struct:
- mergeStruct(out, in)
- default:
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to copy %v", in)
- }
-}
-
-func mergeExtension(out, in map[int32]Extension) {
- for extNum, eIn := range in {
- eOut := Extension{desc: eIn.desc}
- if eIn.value != nil {
- v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
- mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
- eOut.value = v.Interface()
- }
- if eIn.enc != nil {
- eOut.enc = make([]byte, len(eIn.enc))
- copy(eOut.enc, eIn.enc)
- }
-
- out[extNum] = eOut
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode.go
deleted file mode 100644
index 7b06266d1..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode.go
+++ /dev/null
@@ -1,873 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for decoding protocol buffer data to construct in-memory representations.
- */
-
-import (
- "errors"
- "fmt"
- "io"
- "os"
- "reflect"
-)
-
-// errOverflow is returned when an integer is too large to be represented.
-var errOverflow = errors.New("proto: integer overflow")
-
-// ErrInternalBadWireType is returned by generated code when an incorrect
-// wire type is encountered. It does not get returned to user code.
-var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
-
-// The fundamental decoders that interpret bytes on the wire.
-// Those that take integer types all return uint64 and are
-// therefore of type valueDecoder.
-
-// DecodeVarint reads a varint-encoded integer from the slice.
-// It returns the integer and the number of bytes consumed, or
-// zero if there is not enough.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func DecodeVarint(buf []byte) (x uint64, n int) {
- // x, n already 0
- for shift := uint(0); shift < 64; shift += 7 {
- if n >= len(buf) {
- return 0, 0
- }
- b := uint64(buf[n])
- n++
- x |= (b & 0x7F) << shift
- if (b & 0x80) == 0 {
- return x, n
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- return 0, 0
-}
-
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
- // x, err already 0
-
- i := p.index
- l := len(p.buf)
-
- for shift := uint(0); shift < 64; shift += 7 {
- if i >= l {
- err = io.ErrUnexpectedEOF
- return
- }
- b := p.buf[i]
- i++
- x |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- p.index = i
- return
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- err = errOverflow
- return
-}
-
-// DecodeFixed64 reads a 64-bit integer from the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) DecodeFixed64() (x uint64, err error) {
- // x, err already 0
- i := p.index + 8
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-8])
- x |= uint64(p.buf[i-7]) << 8
- x |= uint64(p.buf[i-6]) << 16
- x |= uint64(p.buf[i-5]) << 24
- x |= uint64(p.buf[i-4]) << 32
- x |= uint64(p.buf[i-3]) << 40
- x |= uint64(p.buf[i-2]) << 48
- x |= uint64(p.buf[i-1]) << 56
- return
-}
-
-// DecodeFixed32 reads a 32-bit integer from the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) DecodeFixed32() (x uint64, err error) {
- // x, err already 0
- i := p.index + 4
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-4])
- x |= uint64(p.buf[i-3]) << 8
- x |= uint64(p.buf[i-2]) << 16
- x |= uint64(p.buf[i-1]) << 24
- return
-}
-
-// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
-// from the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
- return
-}
-
-// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
-// from the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
- return
-}
-
-// These are not ValueDecoders: they produce an array of bytes or a string.
-// bytes, embedded messages
-
-// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
- n, err := p.DecodeVarint()
- if err != nil {
- return nil, err
- }
-
- nb := int(n)
- if nb < 0 {
- return nil, fmt.Errorf("proto: bad byte length %d", nb)
- }
- end := p.index + nb
- if end < p.index || end > len(p.buf) {
- return nil, io.ErrUnexpectedEOF
- }
-
- if !alloc {
- // todo: check if can get more uses of alloc=false
- buf = p.buf[p.index:end]
- p.index += nb
- return
- }
-
- buf = make([]byte, nb)
- copy(buf, p.buf[p.index:])
- p.index += nb
- return
-}
-
-// DecodeStringBytes reads an encoded string from the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) DecodeStringBytes() (s string, err error) {
- buf, err := p.DecodeRawBytes(false)
- if err != nil {
- return
- }
- return string(buf), nil
-}
-
-// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.
-// If the protocol buffer has extensions, and the field matches, add it as an extension.
-// Otherwise, if the XXX_unrecognized field exists, append the skipped data there.
-func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error {
- oi := o.index
-
- err := o.skip(t, tag, wire)
- if err != nil {
- return err
- }
-
- if !unrecField.IsValid() {
- return nil
- }
-
- ptr := structPointer_Bytes(base, unrecField)
-
- // Add the skipped field to struct field
- obuf := o.buf
-
- o.buf = *ptr
- o.EncodeVarint(uint64(tag<<3 | wire))
- *ptr = append(o.buf, obuf[oi:o.index]...)
-
- o.buf = obuf
-
- return nil
-}
-
-// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.
-func (o *Buffer) skip(t reflect.Type, tag, wire int) error {
-
- var u uint64
- var err error
-
- switch wire {
- case WireVarint:
- _, err = o.DecodeVarint()
- case WireFixed64:
- _, err = o.DecodeFixed64()
- case WireBytes:
- _, err = o.DecodeRawBytes(false)
- case WireFixed32:
- _, err = o.DecodeFixed32()
- case WireStartGroup:
- for {
- u, err = o.DecodeVarint()
- if err != nil {
- break
- }
- fwire := int(u & 0x7)
- if fwire == WireEndGroup {
- break
- }
- ftag := int(u >> 3)
- err = o.skip(t, ftag, fwire)
- if err != nil {
- break
- }
- }
- default:
- err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t)
- }
- return err
-}
-
-// Unmarshaler is the interface representing objects that can
-// unmarshal themselves. The method should reset the receiver before
-// decoding starts. The argument points to data that may be
-// overwritten, so implementations should not keep references to the
-// buffer.
-type Unmarshaler interface {
- Unmarshal([]byte) error
-}
-
-// Unmarshal parses the protocol buffer representation in buf and places the
-// decoded result in pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// Unmarshal resets pb before starting to unmarshal, so any
-// existing data in pb is always removed. Use UnmarshalMerge
-// to preserve and append to existing data.
-func Unmarshal(buf []byte, pb Message) error {
- pb.Reset()
- return UnmarshalMerge(buf, pb)
-}
-
-// UnmarshalMerge parses the protocol buffer representation in buf and
-// writes the decoded result to pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// UnmarshalMerge merges into existing data in pb.
-// Most code should use Unmarshal instead.
-func UnmarshalMerge(buf []byte, pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(Unmarshaler); ok {
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// DecodeMessage reads a count-delimited message from the Buffer.
-func (p *Buffer) DecodeMessage(pb Message) error {
- enc, err := p.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- return NewBuffer(enc).Unmarshal(pb)
-}
-
-// DecodeGroup reads a tag-delimited group from the Buffer.
-func (p *Buffer) DecodeGroup(pb Message) error {
- typ, base, err := getbase(pb)
- if err != nil {
- return err
- }
- return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base)
-}
-
-// Unmarshal parses the protocol buffer representation in the
-// Buffer and places the decoded result in pb. If the struct
-// underlying pb does not match the data in the buffer, the results can be
-// unpredictable.
-func (p *Buffer) Unmarshal(pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(Unmarshaler); ok {
- err := u.Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
-
- typ, base, err := getbase(pb)
- if err != nil {
- return err
- }
-
- err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base)
-
- if collectStats {
- stats.Decode++
- }
-
- return err
-}
-
-// unmarshalType does the work of unmarshaling a structure.
-func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error {
- var state errorState
- required, reqFields := prop.reqCount, uint64(0)
-
- var err error
- for err == nil && o.index < len(o.buf) {
- oi := o.index
- var u uint64
- u, err = o.DecodeVarint()
- if err != nil {
- break
- }
- wire := int(u & 0x7)
- if wire == WireEndGroup {
- if is_group {
- return nil // input is satisfied
- }
- return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
- }
- tag := int(u >> 3)
- if tag <= 0 {
- return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire)
- }
- fieldnum, ok := prop.decoderTags.get(tag)
- if !ok {
- // Maybe it's an extension?
- if prop.extendable {
- if e := structPointer_Interface(base, st).(extendableProto); isExtensionField(e, int32(tag)) {
- if err = o.skip(st, tag, wire); err == nil {
- if ee, eok := e.(extensionsMap); eok {
- ext := ee.ExtensionMap()[int32(tag)] // may be missing
- ext.enc = append(ext.enc, o.buf[oi:o.index]...)
- ee.ExtensionMap()[int32(tag)] = ext
- } else if ee, eok := e.(extensionsBytes); eok {
- ext := ee.GetExtensions()
- *ext = append(*ext, o.buf[oi:o.index]...)
- }
- }
- continue
- }
- }
- // Maybe it's a oneof?
- if prop.oneofUnmarshaler != nil {
- m := structPointer_Interface(base, st).(Message)
- // First return value indicates whether tag is a oneof field.
- ok, err = prop.oneofUnmarshaler(m, tag, wire, o)
- if err == ErrInternalBadWireType {
- // Map the error to something more descriptive.
- // Do the formatting here to save generated code space.
- err = fmt.Errorf("bad wiretype for oneof field in %T", m)
- }
- if ok {
- continue
- }
- }
- err = o.skipAndSave(st, tag, wire, base, prop.unrecField)
- continue
- }
- p := prop.Prop[fieldnum]
-
- if p.dec == nil {
- fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name)
- continue
- }
- dec := p.dec
- if wire != WireStartGroup && wire != p.WireType {
- if wire == WireBytes && p.packedDec != nil {
- // a packable field
- dec = p.packedDec
- } else {
- err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType)
- continue
- }
- }
- decErr := dec(o, p, base)
- if decErr != nil && !state.shouldContinue(decErr, p) {
- err = decErr
- }
- if err == nil && p.Required {
- // Successfully decoded a required field.
- if tag <= 64 {
- // use bitmap for fields 1-64 to catch field reuse.
- var mask uint64 = 1 << uint64(tag-1)
- if reqFields&mask == 0 {
- // new required field
- reqFields |= mask
- required--
- }
- } else {
- // This is imprecise. It can be fooled by a required field
- // with a tag > 64 that is encoded twice; that's very rare.
- // A fully correct implementation would require allocating
- // a data structure, which we would like to avoid.
- required--
- }
- }
- }
- if err == nil {
- if is_group {
- return io.ErrUnexpectedEOF
- }
- if state.err != nil {
- return state.err
- }
- if required > 0 {
- // Not enough information to determine the exact field. If we use extra
- // CPU, we could determine the field only if the missing required field
- // has a tag <= 64 and we check reqFields.
- return &RequiredNotSetError{"{Unknown}"}
- }
- }
- return err
-}
-
-// Individual type decoders
-// For each,
-// u is the decoded value,
-// v is a pointer to the field (pointer) in the struct
-
-// Sizes of the pools to allocate inside the Buffer.
-// The goal is modest amortization and allocation
-// on at least 16-byte boundaries.
-const (
- boolPoolSize = 16
- uint32PoolSize = 8
- uint64PoolSize = 4
-)
-
-// Decode a bool.
-func (o *Buffer) dec_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- if len(o.bools) == 0 {
- o.bools = make([]bool, boolPoolSize)
- }
- o.bools[0] = u != 0
- *structPointer_Bool(base, p.field) = &o.bools[0]
- o.bools = o.bools[1:]
- return nil
-}
-
-func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- *structPointer_BoolVal(base, p.field) = u != 0
- return nil
-}
-
-// Decode an int32.
-func (o *Buffer) dec_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word32_Set(structPointer_Word32(base, p.field), o, uint32(u))
- return nil
-}
-
-func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u))
- return nil
-}
-
-// Decode an int64.
-func (o *Buffer) dec_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word64_Set(structPointer_Word64(base, p.field), o, u)
- return nil
-}
-
-func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word64Val_Set(structPointer_Word64Val(base, p.field), o, u)
- return nil
-}
-
-// Decode a string.
-func (o *Buffer) dec_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- *structPointer_String(base, p.field) = &s
- return nil
-}
-
-func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- *structPointer_StringVal(base, p.field) = s
- return nil
-}
-
-// Decode a slice of bytes ([]byte).
-func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- *structPointer_Bytes(base, p.field) = b
- return nil
-}
-
-// Decode a slice of bools ([]bool).
-func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v := structPointer_BoolSlice(base, p.field)
- *v = append(*v, u != 0)
- return nil
-}
-
-// Decode a slice of bools ([]bool) in packed format.
-func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error {
- v := structPointer_BoolSlice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded bools
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
-
- y := *v
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- y = append(y, u != 0)
- }
-
- *v = y
- return nil
-}
-
-// Decode a slice of int32s ([]int32).
-func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- structPointer_Word32Slice(base, p.field).Append(uint32(u))
- return nil
-}
-
-// Decode a slice of int32s ([]int32) in packed format.
-func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32Slice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded int32s
-
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v.Append(uint32(u))
- }
- return nil
-}
-
-// Decode a slice of int64s ([]int64).
-func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
-
- structPointer_Word64Slice(base, p.field).Append(u)
- return nil
-}
-
-// Decode a slice of int64s ([]int64) in packed format.
-func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64Slice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded int64s
-
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v.Append(u)
- }
- return nil
-}
-
-// Decode a slice of strings ([]string).
-func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- v := structPointer_StringSlice(base, p.field)
- *v = append(*v, s)
- return nil
-}
-
-// Decode a slice of slice of bytes ([][]byte).
-func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- v := structPointer_BytesSlice(base, p.field)
- *v = append(*v, b)
- return nil
-}
-
-// Decode a map field.
-func (o *Buffer) dec_new_map(p *Properties, base structPointer) error {
- raw, err := o.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- oi := o.index // index at the end of this map entry
- o.index -= len(raw) // move buffer back to start of map entry
-
- mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V
- if mptr.Elem().IsNil() {
- mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem()))
- }
- v := mptr.Elem() // map[K]V
-
- // Prepare addressable doubly-indirect placeholders for the key and value types.
- // See enc_new_map for why.
- keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K
- keybase := toStructPointer(keyptr.Addr()) // **K
-
- var valbase structPointer
- var valptr reflect.Value
- switch p.mtype.Elem().Kind() {
- case reflect.Slice:
- // []byte
- var dummy []byte
- valptr = reflect.ValueOf(&dummy) // *[]byte
- valbase = toStructPointer(valptr) // *[]byte
- case reflect.Ptr:
- // message; valptr is **Msg; need to allocate the intermediate pointer
- valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V
- valptr.Set(reflect.New(valptr.Type().Elem()))
- valbase = toStructPointer(valptr)
- default:
- // everything else
- valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V
- valbase = toStructPointer(valptr.Addr()) // **V
- }
-
- // Decode.
- // This parses a restricted wire format, namely the encoding of a message
- // with two fields. See enc_new_map for the format.
- for o.index < oi {
- // tagcode for key and value properties are always a single byte
- // because they have tags 1 and 2.
- tagcode := o.buf[o.index]
- o.index++
- switch tagcode {
- case p.mkeyprop.tagcode[0]:
- if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil {
- return err
- }
- case p.mvalprop.tagcode[0]:
- if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil {
- return err
- }
- default:
- // TODO: Should we silently skip this instead?
- return fmt.Errorf("proto: bad map data tag %d", raw[0])
- }
- }
- keyelem, valelem := keyptr.Elem(), valptr.Elem()
- if !keyelem.IsValid() {
- keyelem = reflect.Zero(p.mtype.Key())
- }
- if !valelem.IsValid() {
- valelem = reflect.Zero(p.mtype.Elem())
- }
-
- v.SetMapIndex(keyelem, valelem)
- return nil
-}
-
-// Decode a group.
-func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error {
- bas := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(bas) {
- // allocate new nested message
- bas = toStructPointer(reflect.New(p.stype))
- structPointer_SetStructPointer(base, p.field, bas)
- }
- return o.unmarshalType(p.stype, p.sprop, true, bas)
-}
-
-// Decode an embedded message.
-func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) {
- raw, e := o.DecodeRawBytes(false)
- if e != nil {
- return e
- }
-
- bas := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(bas) {
- // allocate new nested message
- bas = toStructPointer(reflect.New(p.stype))
- structPointer_SetStructPointer(base, p.field, bas)
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- iv := structPointer_Interface(bas, p.stype)
- return iv.(Unmarshaler).Unmarshal(raw)
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- err = o.unmarshalType(p.stype, p.sprop, false, bas)
- o.buf = obuf
- o.index = oi
-
- return err
-}
-
-// Decode a slice of embedded messages.
-func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error {
- return o.dec_slice_struct(p, false, base)
-}
-
-// Decode a slice of embedded groups.
-func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error {
- return o.dec_slice_struct(p, true, base)
-}
-
-// Decode a slice of structs ([]*struct).
-func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error {
- v := reflect.New(p.stype)
- bas := toStructPointer(v)
- structPointer_StructPointerSlice(base, p.field).Append(bas)
-
- if is_group {
- err := o.unmarshalType(p.stype, p.sprop, is_group, bas)
- return err
- }
-
- raw, err := o.DecodeRawBytes(false)
- if err != nil {
- return err
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- iv := v.Interface()
- return iv.(Unmarshaler).Unmarshal(raw)
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- err = o.unmarshalType(p.stype, p.sprop, is_group, bas)
-
- o.buf = obuf
- o.index = oi
-
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode_gogo.go
deleted file mode 100644
index 603dabec3..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/decode_gogo.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "reflect"
-)
-
-// Decode a reference to a struct pointer.
-func (o *Buffer) dec_ref_struct_message(p *Properties, base structPointer) (err error) {
- raw, e := o.DecodeRawBytes(false)
- if e != nil {
- return e
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- panic("not supported, since this is a pointer receiver")
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- bas := structPointer_FieldPointer(base, p.field)
-
- err = o.unmarshalType(p.stype, p.sprop, false, bas)
- o.buf = obuf
- o.index = oi
-
- return err
-}
-
-// Decode a slice of references to struct pointers ([]struct).
-func (o *Buffer) dec_slice_ref_struct(p *Properties, is_group bool, base structPointer) error {
- newBas := appendStructPointer(base, p.field, p.sstype)
-
- if is_group {
- panic("not supported, maybe in future, if requested.")
- }
-
- raw, err := o.DecodeRawBytes(false)
- if err != nil {
- return err
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- panic("not supported, since this is not a pointer receiver.")
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- err = o.unmarshalType(p.stype, p.sprop, is_group, newBas)
-
- o.buf = obuf
- o.index = oi
-
- return err
-}
-
-// Decode a slice of references to struct pointers.
-func (o *Buffer) dec_slice_ref_struct_message(p *Properties, base structPointer) error {
- return o.dec_slice_ref_struct(p, false, base)
-}
-
-func setPtrCustomType(base structPointer, f field, v interface{}) {
- if v == nil {
- return
- }
- structPointer_SetStructPointer(base, f, structPointer(reflect.ValueOf(v).Pointer()))
-}
-
-func setCustomType(base structPointer, f field, value interface{}) {
- if value == nil {
- return
- }
- v := reflect.ValueOf(value).Elem()
- t := reflect.TypeOf(value).Elem()
- kind := t.Kind()
- switch kind {
- case reflect.Slice:
- slice := reflect.MakeSlice(t, v.Len(), v.Cap())
- reflect.Copy(slice, v)
- oldHeader := structPointer_GetSliceHeader(base, f)
- oldHeader.Data = slice.Pointer()
- oldHeader.Len = v.Len()
- oldHeader.Cap = v.Cap()
- default:
- size := reflect.TypeOf(value).Elem().Size()
- structPointer_Copy(toStructPointer(reflect.ValueOf(value)), structPointer_Add(base, f), int(size))
- }
-}
-
-func (o *Buffer) dec_custom_bytes(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- i := reflect.New(p.ctype.Elem()).Interface()
- custom := (i).(Unmarshaler)
- if err := custom.Unmarshal(b); err != nil {
- return err
- }
- setPtrCustomType(base, p.field, custom)
- return nil
-}
-
-func (o *Buffer) dec_custom_ref_bytes(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- i := reflect.New(p.ctype).Interface()
- custom := (i).(Unmarshaler)
- if err := custom.Unmarshal(b); err != nil {
- return err
- }
- if custom != nil {
- setCustomType(base, p.field, custom)
- }
- return nil
-}
-
-// Decode a slice of bytes ([]byte) into a slice of custom types.
-func (o *Buffer) dec_custom_slice_bytes(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- i := reflect.New(p.ctype.Elem()).Interface()
- custom := (i).(Unmarshaler)
- if err := custom.Unmarshal(b); err != nil {
- return err
- }
- newBas := appendStructPointer(base, p.field, p.ctype)
-
- setCustomType(newBas, 0, custom)
-
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode.go
deleted file mode 100644
index eb7e0474e..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode.go
+++ /dev/null
@@ -1,1331 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "errors"
- "fmt"
- "reflect"
- "sort"
-)
-
-// 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.
- errRepeatedHasNil = errors.New("proto: repeated field has nil element")
-
- // errOneofHasNil is the error returned if Marshal is called with
- // a struct with a oneof field containing a nil element.
- errOneofHasNil = errors.New("proto: oneof field has nil value")
-
- // ErrNil is the error returned if Marshal is called with nil.
- ErrNil = errors.New("proto: Marshal called with nil")
-)
-
-// The fundamental encoders that put bytes on the wire.
-// Those that take integer types all accept uint64 and are
-// therefore of type valueEncoder.
-
-const maxVarintBytes = 10 // maximum length of a varint
-
-// EncodeVarint returns the varint encoding of x.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-// Not used by the package itself, but helpful to clients
-// wishing to use the same encoding.
-func EncodeVarint(x uint64) []byte {
- var buf [maxVarintBytes]byte
- var n int
- for n = 0; x > 127; n++ {
- buf[n] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- buf[n] = uint8(x)
- n++
- return buf[0:n]
-}
-
-// EncodeVarint writes a varint-encoded integer to the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) EncodeVarint(x uint64) error {
- for x >= 1<<7 {
- p.buf = append(p.buf, uint8(x&0x7f|0x80))
- x >>= 7
- }
- p.buf = append(p.buf, uint8(x))
- return nil
-}
-
-// SizeVarint returns the varint encoding size of an integer.
-func SizeVarint(x uint64) int {
- return sizeVarint(x)
-}
-
-func sizeVarint(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-
-// EncodeFixed64 writes a 64-bit integer to the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) EncodeFixed64(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24),
- uint8(x>>32),
- uint8(x>>40),
- uint8(x>>48),
- uint8(x>>56))
- return nil
-}
-
-func sizeFixed64(x uint64) int {
- return 8
-}
-
-// EncodeFixed32 writes a 32-bit integer to the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) EncodeFixed32(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24))
- return nil
-}
-
-func sizeFixed32(x uint64) int {
- return 4
-}
-
-// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
-// to the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) EncodeZigzag64(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-func sizeZigzag64(x uint64) int {
- return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
-// to the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) EncodeZigzag32(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-func sizeZigzag32(x uint64) int {
- return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) EncodeRawBytes(b []byte) error {
- p.EncodeVarint(uint64(len(b)))
- p.buf = append(p.buf, b...)
- return nil
-}
-
-func sizeRawBytes(b []byte) int {
- return sizeVarint(uint64(len(b))) +
- len(b)
-}
-
-// EncodeStringBytes writes an encoded string to the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) EncodeStringBytes(s string) error {
- p.EncodeVarint(uint64(len(s)))
- p.buf = append(p.buf, s...)
- return nil
-}
-
-func sizeStringBytes(s string) int {
- return sizeVarint(uint64(len(s))) +
- len(s)
-}
-
-// Marshaler is the interface representing objects that can marshal themselves.
-type Marshaler interface {
- Marshal() ([]byte, error)
-}
-
-// Marshal takes the protocol buffer
-// and encodes it into the wire format, returning the data.
-func Marshal(pb Message) ([]byte, error) {
- // Can the object marshal itself?
- if m, ok := pb.(Marshaler); ok {
- return m.Marshal()
- }
- p := NewBuffer(nil)
- err := p.Marshal(pb)
- var state errorState
- if err != nil && !state.shouldContinue(err, nil) {
- return nil, err
- }
- if p.buf == nil && err == nil {
- // Return a non-nil slice on success.
- return []byte{}, nil
- }
- return p.buf, err
-}
-
-// EncodeMessage writes the protocol buffer to the Buffer,
-// prefixed by a varint-encoded length.
-func (p *Buffer) EncodeMessage(pb Message) error {
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return ErrNil
- }
- if err == nil {
- var state errorState
- err = p.enc_len_struct(GetProperties(t.Elem()), base, &state)
- }
- return err
-}
-
-// Marshal takes the protocol buffer
-// and encodes it into the wire format, writing the result to the
-// Buffer.
-func (p *Buffer) Marshal(pb Message) error {
- // Can the object marshal itself?
- if m, ok := pb.(Marshaler); ok {
- data, err := m.Marshal()
- if err != nil {
- return err
- }
- p.buf = append(p.buf, data...)
- return nil
- }
-
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return ErrNil
- }
- if err == nil {
- err = p.enc_struct(GetProperties(t.Elem()), base)
- }
-
- if collectStats {
- stats.Encode++
- }
-
- return err
-}
-
-// Size returns the encoded size of a protocol buffer.
-func Size(pb Message) (n int) {
- // Can the object marshal itself? If so, Size is slow.
- // TODO: add Size to Marshaler, or add a Sizer interface.
- if m, ok := pb.(Marshaler); ok {
- b, _ := m.Marshal()
- return len(b)
- }
-
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return 0
- }
- if err == nil {
- n = size_struct(GetProperties(t.Elem()), base)
- }
-
- if collectStats {
- stats.Size++
- }
-
- return
-}
-
-// Individual type encoders.
-
-// Encode a bool.
-func (o *Buffer) enc_bool(p *Properties, base structPointer) error {
- v := *structPointer_Bool(base, p.field)
- if v == nil {
- return ErrNil
- }
- x := 0
- if *v {
- x = 1
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error {
- v := *structPointer_BoolVal(base, p.field)
- if !v {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, 1)
- return nil
-}
-
-func size_bool(p *Properties, base structPointer) int {
- v := *structPointer_Bool(base, p.field)
- if v == nil {
- return 0
- }
- return len(p.tagcode) + 1 // each bool takes exactly one byte
-}
-
-func size_proto3_bool(p *Properties, base structPointer) int {
- v := *structPointer_BoolVal(base, p.field)
- if !v && !p.oneof {
- return 0
- }
- return len(p.tagcode) + 1 // each bool takes exactly one byte
-}
-
-// Encode an int32.
-func (o *Buffer) enc_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return ErrNil
- }
- x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_int32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return 0
- }
- x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-func size_proto3_int32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-// Encode a uint32.
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_uint32(p *Properties, base structPointer) error {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return ErrNil
- }
- x := word32_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_uint32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return 0
- }
- x := word32_Get(v)
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-func size_proto3_uint32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-// Encode an int64.
-func (o *Buffer) enc_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64(base, p.field)
- if word64_IsNil(v) {
- return ErrNil
- }
- x := word64_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, x)
- return nil
-}
-
-func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, x)
- return nil
-}
-
-func size_int64(p *Properties, base structPointer) (n int) {
- v := structPointer_Word64(base, p.field)
- if word64_IsNil(v) {
- return 0
- }
- x := word64_Get(v)
- n += len(p.tagcode)
- n += p.valSize(x)
- return
-}
-
-func size_proto3_int64(p *Properties, base structPointer) (n int) {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(x)
- return
-}
-
-// Encode a string.
-func (o *Buffer) enc_string(p *Properties, base structPointer) error {
- v := *structPointer_String(base, p.field)
- if v == nil {
- return ErrNil
- }
- x := *v
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(x)
- return nil
-}
-
-func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error {
- v := *structPointer_StringVal(base, p.field)
- if v == "" {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(v)
- return nil
-}
-
-func size_string(p *Properties, base structPointer) (n int) {
- v := *structPointer_String(base, p.field)
- if v == nil {
- return 0
- }
- x := *v
- n += len(p.tagcode)
- n += sizeStringBytes(x)
- return
-}
-
-func size_proto3_string(p *Properties, base structPointer) (n int) {
- v := *structPointer_StringVal(base, p.field)
- if v == "" && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeStringBytes(v)
- return
-}
-
-// All protocol buffer fields are nillable, but be careful.
-func isNil(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
- }
- return false
-}
-
-// Encode a message struct.
-func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error {
- var state errorState
- structp := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return ErrNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- return state.err
- }
-
- o.buf = append(o.buf, p.tagcode...)
- return o.enc_len_struct(p.sprop, structp, &state)
-}
-
-func size_struct_message(p *Properties, base structPointer) int {
- structp := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return 0
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n0 := len(p.tagcode)
- n1 := sizeRawBytes(data)
- return n0 + n1
- }
-
- n0 := len(p.tagcode)
- n1 := size_struct(p.sprop, structp)
- n2 := sizeVarint(uint64(n1)) // size of encoded length
- return n0 + n1 + n2
-}
-
-// Encode a group struct.
-func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error {
- var state errorState
- b := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(b) {
- return ErrNil
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
- err := o.enc_struct(p.sprop, b)
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))
- return state.err
-}
-
-func size_struct_group(p *Properties, base structPointer) (n int) {
- b := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(b) {
- return 0
- }
-
- n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup))
- n += size_struct(p.sprop, b)
- n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup))
- return
-}
-
-// Encode a slice of bools ([]bool).
-func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return ErrNil
- }
- for _, x := range s {
- o.buf = append(o.buf, p.tagcode...)
- v := uint64(0)
- if x {
- v = 1
- }
- p.valEnc(o, v)
- }
- return nil
-}
-
-func size_slice_bool(p *Properties, base structPointer) int {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return 0
- }
- return l * (len(p.tagcode) + 1) // each bool takes exactly one byte
-}
-
-// Encode a slice of bools ([]bool) in packed format.
-func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(l)) // each bool takes exactly one byte
- for _, x := range s {
- v := uint64(0)
- if x {
- v = 1
- }
- p.valEnc(o, v)
- }
- return nil
-}
-
-func size_slice_packed_bool(p *Properties, base structPointer) (n int) {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return 0
- }
- n += len(p.tagcode)
- n += sizeVarint(uint64(l))
- n += l // each bool takes exactly one byte
- return
-}
-
-// Encode a slice of bytes ([]byte).
-func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error {
- s := *structPointer_Bytes(base, p.field)
- if s == nil {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(s)
- return nil
-}
-
-func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error {
- s := *structPointer_Bytes(base, p.field)
- if len(s) == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(s)
- return nil
-}
-
-func size_slice_byte(p *Properties, base structPointer) (n int) {
- s := *structPointer_Bytes(base, p.field)
- if s == nil && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeRawBytes(s)
- return
-}
-
-func size_proto3_slice_byte(p *Properties, base structPointer) (n int) {
- s := *structPointer_Bytes(base, p.field)
- if len(s) == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeRawBytes(s)
- return
-}
-
-// Encode a slice of int32s ([]int32).
-func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- p.valEnc(o, uint64(x))
- }
- return nil
-}
-
-func size_slice_int32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- n += p.valSize(uint64(x))
- }
- return
-}
-
-// Encode a slice of int32s ([]int32) in packed format.
-func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- p.valEnc(buf, uint64(x))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_int32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- bufSize += p.valSize(uint64(x))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of uint32s ([]uint32).
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- x := s.Index(i)
- p.valEnc(o, uint64(x))
- }
- return nil
-}
-
-func size_slice_uint32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- x := s.Index(i)
- n += p.valSize(uint64(x))
- }
- return
-}
-
-// Encode a slice of uint32s ([]uint32) in packed format.
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- p.valEnc(buf, uint64(s.Index(i)))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_uint32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- bufSize += p.valSize(uint64(s.Index(i)))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of int64s ([]int64).
-func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, s.Index(i))
- }
- return nil
-}
-
-func size_slice_int64(p *Properties, base structPointer) (n int) {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- n += p.valSize(s.Index(i))
- }
- return
-}
-
-// Encode a slice of int64s ([]int64) in packed format.
-func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- p.valEnc(buf, s.Index(i))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_int64(p *Properties, base structPointer) (n int) {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- bufSize += p.valSize(s.Index(i))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of slice of bytes ([][]byte).
-func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error {
- ss := *structPointer_BytesSlice(base, p.field)
- l := len(ss)
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(ss[i])
- }
- return nil
-}
-
-func size_slice_slice_byte(p *Properties, base structPointer) (n int) {
- ss := *structPointer_BytesSlice(base, p.field)
- l := len(ss)
- if l == 0 {
- return 0
- }
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- n += sizeRawBytes(ss[i])
- }
- return
-}
-
-// Encode a slice of strings ([]string).
-func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error {
- ss := *structPointer_StringSlice(base, p.field)
- l := len(ss)
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(ss[i])
- }
- return nil
-}
-
-func size_slice_string(p *Properties, base structPointer) (n int) {
- ss := *structPointer_StringSlice(base, p.field)
- l := len(ss)
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- n += sizeStringBytes(ss[i])
- }
- return
-}
-
-// Encode a slice of message structs ([]*struct).
-func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error {
- var state errorState
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- for i := 0; i < l; i++ {
- structp := s.Index(i)
- if structPointer_IsNil(structp) {
- return errRepeatedHasNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- continue
- }
-
- o.buf = append(o.buf, p.tagcode...)
- err := o.enc_len_struct(p.sprop, structp, &state)
- if err != nil && !state.shouldContinue(err, nil) {
- if err == ErrNil {
- return errRepeatedHasNil
- }
- return err
- }
- }
- return state.err
-}
-
-func size_slice_struct_message(p *Properties, base structPointer) (n int) {
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- structp := s.Index(i)
- if structPointer_IsNil(structp) {
- return // return the size up to this point
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n += len(p.tagcode)
- n += sizeRawBytes(data)
- continue
- }
-
- n0 := size_struct(p.sprop, structp)
- n1 := sizeVarint(uint64(n0)) // size of encoded length
- n += n0 + n1
- }
- return
-}
-
-// Encode a slice of group structs ([]*struct).
-func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error {
- var state errorState
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- for i := 0; i < l; i++ {
- b := s.Index(i)
- if structPointer_IsNil(b) {
- return errRepeatedHasNil
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
-
- err := o.enc_struct(p.sprop, b)
-
- if err != nil && !state.shouldContinue(err, nil) {
- if err == ErrNil {
- return errRepeatedHasNil
- }
- return err
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))
- }
- return state.err
-}
-
-func size_slice_struct_group(p *Properties, base structPointer) (n int) {
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup))
- n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup))
- for i := 0; i < l; i++ {
- b := s.Index(i)
- if structPointer_IsNil(b) {
- return // return size up to this point
- }
-
- n += size_struct(p.sprop, b)
- }
- return
-}
-
-// Encode an extension map.
-func (o *Buffer) enc_map(p *Properties, base structPointer) error {
- v := *structPointer_ExtMap(base, p.field)
- if err := encodeExtensionMap(v); err != nil {
- return err
- }
- // Fast-path for common cases: zero or one extensions.
- if len(v) <= 1 {
- for _, e := range v {
- o.buf = append(o.buf, e.enc...)
- }
- return nil
- }
-
- // Sort keys to provide a deterministic encoding.
- keys := make([]int, 0, len(v))
- for k := range v {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, k := range keys {
- o.buf = append(o.buf, v[int32(k)].enc...)
- }
- return nil
-}
-
-func size_map(p *Properties, base structPointer) int {
- v := *structPointer_ExtMap(base, p.field)
- return sizeExtensionMap(v)
-}
-
-// Encode a map field.
-func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
- var state errorState // XXX: or do we need to plumb this through?
-
- /*
- A map defined as
- map map_field = N;
- is encoded in the same way as
- message MapFieldEntry {
- key_type key = 1;
- value_type value = 2;
- }
- repeated MapFieldEntry map_field = N;
- */
-
- v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V
- if v.Len() == 0 {
- return nil
- }
-
- keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)
-
- enc := func() error {
- if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {
- return err
- }
- if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil {
- return err
- }
- return nil
- }
-
- // Don't sort map keys. It is not required by the spec, and C++ doesn't do it.
- for _, key := range v.MapKeys() {
- val := v.MapIndex(key)
-
- // The only illegal map entry values are nil message pointers.
- if val.Kind() == reflect.Ptr && val.IsNil() {
- return errors.New("proto: map has nil element")
- }
-
- keycopy.Set(key)
- valcopy.Set(val)
-
- o.buf = append(o.buf, p.tagcode...)
- if err := o.enc_len_thing(enc, &state); err != nil {
- return err
- }
- }
- return nil
-}
-
-func size_new_map(p *Properties, base structPointer) int {
- v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V
-
- keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)
-
- n := 0
- for _, key := range v.MapKeys() {
- val := v.MapIndex(key)
- keycopy.Set(key)
- valcopy.Set(val)
-
- // Tag codes for key and val are the responsibility of the sub-sizer.
- keysize := p.mkeyprop.size(p.mkeyprop, keybase)
- valsize := p.mvalprop.size(p.mvalprop, valbase)
- entry := keysize + valsize
- // Add on tag code and length of map entry itself.
- n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry
- }
- return n
-}
-
-// mapEncodeScratch returns a new reflect.Value matching the map's value type,
-// and a structPointer suitable for passing to an encoder or sizer.
-func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) {
- // Prepare addressable doubly-indirect placeholders for the key and value types.
- // This is needed because the element-type encoders expect **T, but the map iteration produces T.
-
- keycopy = reflect.New(mapType.Key()).Elem() // addressable K
- keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K
- keyptr.Set(keycopy.Addr()) //
- keybase = toStructPointer(keyptr.Addr()) // **K
-
- // Value types are more varied and require special handling.
- switch mapType.Elem().Kind() {
- case reflect.Slice:
- // []byte
- var dummy []byte
- valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte
- valbase = toStructPointer(valcopy.Addr())
- case reflect.Ptr:
- // message; the generated field type is map[K]*Msg (so V is *Msg),
- // so we only need one level of indirection.
- valcopy = reflect.New(mapType.Elem()).Elem() // addressable V
- valbase = toStructPointer(valcopy.Addr())
- default:
- // everything else
- valcopy = reflect.New(mapType.Elem()).Elem() // addressable V
- valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V
- valptr.Set(valcopy.Addr()) //
- valbase = toStructPointer(valptr.Addr()) // **V
- }
- return
-}
-
-// Encode a struct.
-func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
- var state errorState
- // Encode fields in tag order so that decoders may use optimizations
- // that depend on the ordering.
- // https://developers.google.com/protocol-buffers/docs/encoding#order
- for _, i := range prop.order {
- p := prop.Prop[i]
- if p.enc != nil {
- err := p.enc(o, p, base)
- if err != nil {
- if err == ErrNil {
- if p.Required && state.err == nil {
- state.err = &RequiredNotSetError{p.Name}
- }
- } else if err == errRepeatedHasNil {
- // Give more context to nil values in repeated fields.
- return errors.New("repeated field " + p.OrigName + " has nil element")
- } else if !state.shouldContinue(err, p) {
- return err
- }
- }
- }
- }
-
- // Do oneof fields.
- if prop.oneofMarshaler != nil {
- m := structPointer_Interface(base, prop.stype).(Message)
- if err := prop.oneofMarshaler(m, o); err == ErrNil {
- return errOneofHasNil
- } else if err != nil {
- return err
- }
- }
-
- // Add unrecognized fields at the end.
- if prop.unrecField.IsValid() {
- v := *structPointer_Bytes(base, prop.unrecField)
- if len(v) > 0 {
- o.buf = append(o.buf, v...)
- }
- }
-
- return state.err
-}
-
-func size_struct(prop *StructProperties, base structPointer) (n int) {
- for _, i := range prop.order {
- p := prop.Prop[i]
- if p.size != nil {
- n += p.size(p, base)
- }
- }
-
- // Add unrecognized fields at the end.
- if prop.unrecField.IsValid() {
- v := *structPointer_Bytes(base, prop.unrecField)
- n += len(v)
- }
-
- // Factor in any oneof fields.
- if prop.oneofSizer != nil {
- m := structPointer_Interface(base, prop.stype).(Message)
- n += prop.oneofSizer(m)
- }
-
- return
-}
-
-var zeroes [20]byte // longer than any conceivable sizeVarint
-
-// Encode a struct, preceded by its encoded length (as a varint).
-func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error {
- return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state)
-}
-
-// Encode something, preceded by its encoded length (as a varint).
-func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error {
- iLen := len(o.buf)
- o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length
- iMsg := len(o.buf)
- err := enc()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- lMsg := len(o.buf) - iMsg
- lLen := sizeVarint(uint64(lMsg))
- switch x := lLen - (iMsg - iLen); {
- case x > 0: // actual length is x bytes larger than the space we reserved
- // Move msg x bytes right.
- o.buf = append(o.buf, zeroes[:x]...)
- copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])
- case x < 0: // actual length is x bytes smaller than the space we reserved
- // Move msg x bytes left.
- copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])
- o.buf = o.buf[:len(o.buf)+x] // x is negative
- }
- // Encode the length in the reserved space.
- o.buf = o.buf[:iLen]
- o.EncodeVarint(uint64(lMsg))
- o.buf = o.buf[:len(o.buf)+lMsg]
- return state.err
-}
-
-// errorState maintains the first error that occurs and updates that error
-// with additional context.
-type errorState struct {
- err error
-}
-
-// shouldContinue reports whether encoding should continue upon encountering the
-// given error. If the error is RequiredNotSetError, shouldContinue returns true
-// and, if this is the first appearance of that error, remembers it for future
-// reporting.
-//
-// If prop is not nil, it may update any error with additional context about the
-// field with the error.
-func (s *errorState) shouldContinue(err error, prop *Properties) bool {
- // Ignore unset required fields.
- reqNotSet, ok := err.(*RequiredNotSetError)
- if !ok {
- return false
- }
- if s.err == nil {
- if prop != nil {
- err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field}
- }
- s.err = err
- }
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode_gogo.go
deleted file mode 100644
index f77cfb1ee..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/encode_gogo.go
+++ /dev/null
@@ -1,354 +0,0 @@
-// Extensions for Protocol Buffers to create more go like structures.
-//
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// http://github.com/golang/protobuf/
-//
-// 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.
-
-package proto
-
-import (
- "reflect"
-)
-
-func NewRequiredNotSetError(field string) *RequiredNotSetError {
- return &RequiredNotSetError{field}
-}
-
-type Sizer interface {
- Size() int
-}
-
-func (o *Buffer) enc_ext_slice_byte(p *Properties, base structPointer) error {
- s := *structPointer_Bytes(base, p.field)
- if s == nil {
- return ErrNil
- }
- o.buf = append(o.buf, s...)
- return nil
-}
-
-func size_ext_slice_byte(p *Properties, base structPointer) (n int) {
- s := *structPointer_Bytes(base, p.field)
- if s == nil {
- return 0
- }
- n += len(s)
- return
-}
-
-// Encode a reference to bool pointer.
-func (o *Buffer) enc_ref_bool(p *Properties, base structPointer) error {
- v := *structPointer_BoolVal(base, p.field)
- x := 0
- if v {
- x = 1
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_ref_bool(p *Properties, base structPointer) int {
- return len(p.tagcode) + 1 // each bool takes exactly one byte
-}
-
-// Encode a reference to int32 pointer.
-func (o *Buffer) enc_ref_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v))
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_ref_int32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v))
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-func (o *Buffer) enc_ref_uint32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_ref_uint32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-// Encode a reference to an int64 pointer.
-func (o *Buffer) enc_ref_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, x)
- return nil
-}
-
-func size_ref_int64(p *Properties, base structPointer) (n int) {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- n += len(p.tagcode)
- n += p.valSize(x)
- return
-}
-
-// Encode a reference to a string pointer.
-func (o *Buffer) enc_ref_string(p *Properties, base structPointer) error {
- v := *structPointer_StringVal(base, p.field)
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(v)
- return nil
-}
-
-func size_ref_string(p *Properties, base structPointer) (n int) {
- v := *structPointer_StringVal(base, p.field)
- n += len(p.tagcode)
- n += sizeStringBytes(v)
- return
-}
-
-// Encode a reference to a message struct.
-func (o *Buffer) enc_ref_struct_message(p *Properties, base structPointer) error {
- var state errorState
- structp := structPointer_GetRefStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return ErrNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- return nil
- }
-
- o.buf = append(o.buf, p.tagcode...)
- return o.enc_len_struct(p.sprop, structp, &state)
-}
-
-//TODO this is only copied, please fix this
-func size_ref_struct_message(p *Properties, base structPointer) int {
- structp := structPointer_GetRefStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return 0
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n0 := len(p.tagcode)
- n1 := sizeRawBytes(data)
- return n0 + n1
- }
-
- n0 := len(p.tagcode)
- n1 := size_struct(p.sprop, structp)
- n2 := sizeVarint(uint64(n1)) // size of encoded length
- return n0 + n1 + n2
-}
-
-// Encode a slice of references to message struct pointers ([]struct).
-func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error {
- var state errorState
- ss := structPointer_GetStructPointer(base, p.field)
- ss1 := structPointer_GetRefStructPointer(ss, field(0))
- size := p.stype.Size()
- l := structPointer_Len(base, p.field)
- for i := 0; i < l; i++ {
- structp := structPointer_Add(ss1, field(uintptr(i)*size))
- if structPointer_IsNil(structp) {
- return errRepeatedHasNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- continue
- }
-
- o.buf = append(o.buf, p.tagcode...)
- err := o.enc_len_struct(p.sprop, structp, &state)
- if err != nil && !state.shouldContinue(err, nil) {
- if err == ErrNil {
- return errRepeatedHasNil
- }
- return err
- }
-
- }
- return state.err
-}
-
-//TODO this is only copied, please fix this
-func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) {
- ss := structPointer_GetStructPointer(base, p.field)
- ss1 := structPointer_GetRefStructPointer(ss, field(0))
- size := p.stype.Size()
- l := structPointer_Len(base, p.field)
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- structp := structPointer_Add(ss1, field(uintptr(i)*size))
- if structPointer_IsNil(structp) {
- return // return the size up to this point
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n += len(p.tagcode)
- n += sizeRawBytes(data)
- continue
- }
-
- n0 := size_struct(p.sprop, structp)
- n1 := sizeVarint(uint64(n0)) // size of encoded length
- n += n0 + n1
- }
- return
-}
-
-func (o *Buffer) enc_custom_bytes(p *Properties, base structPointer) error {
- i := structPointer_InterfaceRef(base, p.field, p.ctype)
- if i == nil {
- return ErrNil
- }
- custom := i.(Marshaler)
- data, err := custom.Marshal()
- if err != nil {
- return err
- }
- if data == nil {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- return nil
-}
-
-func size_custom_bytes(p *Properties, base structPointer) (n int) {
- n += len(p.tagcode)
- i := structPointer_InterfaceRef(base, p.field, p.ctype)
- if i == nil {
- return 0
- }
- custom := i.(Marshaler)
- data, _ := custom.Marshal()
- n += sizeRawBytes(data)
- return
-}
-
-func (o *Buffer) enc_custom_ref_bytes(p *Properties, base structPointer) error {
- custom := structPointer_InterfaceAt(base, p.field, p.ctype).(Marshaler)
- data, err := custom.Marshal()
- if err != nil {
- return err
- }
- if data == nil {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- return nil
-}
-
-func size_custom_ref_bytes(p *Properties, base structPointer) (n int) {
- n += len(p.tagcode)
- i := structPointer_InterfaceAt(base, p.field, p.ctype)
- if i == nil {
- return 0
- }
- custom := i.(Marshaler)
- data, _ := custom.Marshal()
- n += sizeRawBytes(data)
- return
-}
-
-func (o *Buffer) enc_custom_slice_bytes(p *Properties, base structPointer) error {
- inter := structPointer_InterfaceRef(base, p.field, p.ctype)
- if inter == nil {
- return ErrNil
- }
- slice := reflect.ValueOf(inter)
- l := slice.Len()
- for i := 0; i < l; i++ {
- v := slice.Index(i)
- custom := v.Interface().(Marshaler)
- data, err := custom.Marshal()
- if err != nil {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- }
- return nil
-}
-
-func size_custom_slice_bytes(p *Properties, base structPointer) (n int) {
- inter := structPointer_InterfaceRef(base, p.field, p.ctype)
- if inter == nil {
- return 0
- }
- slice := reflect.ValueOf(inter)
- l := slice.Len()
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- v := slice.Index(i)
- custom := v.Interface().(Marshaler)
- data, _ := custom.Marshal()
- n += sizeRawBytes(data)
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/equal.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/equal.go
deleted file mode 100644
index f5db1def3..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/equal.go
+++ /dev/null
@@ -1,276 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 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
-// 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.
-
-// Protocol buffer comparison.
-
-package proto
-
-import (
- "bytes"
- "log"
- "reflect"
- "strings"
-)
-
-/*
-Equal returns true iff protocol buffers a and b are equal.
-The arguments must both be pointers to protocol buffer structs.
-
-Equality is defined in this way:
- - Two messages are equal iff they are the same type,
- corresponding fields are equal, unknown field sets
- are equal, and extensions sets are equal.
- - Two set scalar fields are equal iff their values are equal.
- If the fields are of a floating-point type, remember that
- NaN != x for all x, including NaN. If the message is defined
- in a proto3 .proto file, fields are not "set"; specifically,
- zero length proto3 "bytes" fields are equal (nil == {}).
- - Two repeated fields are equal iff their lengths are the same,
- and their corresponding elements are equal (a "bytes" field,
- although represented by []byte, is not a repeated field)
- - Two unset fields are equal.
- - Two unknown field sets are equal if their current
- encoded state is equal.
- - Two extension sets are equal iff they have corresponding
- elements that are pairwise equal.
- - Every other combination of things are not equal.
-
-The return value is undefined if a and b are not protocol buffers.
-*/
-func Equal(a, b Message) bool {
- if a == nil || b == nil {
- return a == b
- }
- v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
- if v1.Type() != v2.Type() {
- return false
- }
- if v1.Kind() == reflect.Ptr {
- if v1.IsNil() {
- return v2.IsNil()
- }
- if v2.IsNil() {
- return false
- }
- v1, v2 = v1.Elem(), v2.Elem()
- }
- if v1.Kind() != reflect.Struct {
- return false
- }
- return equalStruct(v1, v2)
-}
-
-// v1 and v2 are known to have the same type.
-func equalStruct(v1, v2 reflect.Value) bool {
- sprop := GetProperties(v1.Type())
- for i := 0; i < v1.NumField(); i++ {
- f := v1.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- f1, f2 := v1.Field(i), v2.Field(i)
- if f.Type.Kind() == reflect.Ptr {
- if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
- // both unset
- continue
- } else if n1 != n2 {
- // set/unset mismatch
- return false
- }
- b1, ok := f1.Interface().(raw)
- if ok {
- b2 := f2.Interface().(raw)
- // RawMessage
- if !bytes.Equal(b1.Bytes(), b2.Bytes()) {
- return false
- }
- continue
- }
- f1, f2 = f1.Elem(), f2.Elem()
- }
- if !equalAny(f1, f2, sprop.Prop[i]) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_extensions")
- if !equalExtensions(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
- return false
- }
- }
-
- uf := v1.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return true
- }
-
- u1 := uf.Bytes()
- u2 := v2.FieldByName("XXX_unrecognized").Bytes()
- if !bytes.Equal(u1, u2) {
- return false
- }
-
- return true
-}
-
-// v1 and v2 are known to have the same type.
-// prop may be nil.
-func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
- if v1.Type() == protoMessageType {
- m1, _ := v1.Interface().(Message)
- m2, _ := v2.Interface().(Message)
- return Equal(m1, m2)
- }
- switch v1.Kind() {
- case reflect.Bool:
- return v1.Bool() == v2.Bool()
- case reflect.Float32, reflect.Float64:
- return v1.Float() == v2.Float()
- case reflect.Int32, reflect.Int64:
- return v1.Int() == v2.Int()
- case reflect.Interface:
- // Probably a oneof field; compare the inner values.
- n1, n2 := v1.IsNil(), v2.IsNil()
- if n1 || n2 {
- return n1 == n2
- }
- e1, e2 := v1.Elem(), v2.Elem()
- if e1.Type() != e2.Type() {
- return false
- }
- return equalAny(e1, e2, nil)
- case reflect.Map:
- if v1.Len() != v2.Len() {
- return false
- }
- for _, key := range v1.MapKeys() {
- val2 := v2.MapIndex(key)
- if !val2.IsValid() {
- // This key was not found in the second map.
- return false
- }
- if !equalAny(v1.MapIndex(key), val2, nil) {
- return false
- }
- }
- return true
- case reflect.Ptr:
- return equalAny(v1.Elem(), v2.Elem(), prop)
- case reflect.Slice:
- if v1.Type().Elem().Kind() == reflect.Uint8 {
- // short circuit: []byte
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value.
- if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
- }
-
- if v1.Len() != v2.Len() {
- return false
- }
- for i := 0; i < v1.Len(); i++ {
- if !equalAny(v1.Index(i), v2.Index(i), prop) {
- return false
- }
- }
- return true
- case reflect.String:
- return v1.Interface().(string) == v2.Interface().(string)
- case reflect.Struct:
- return equalStruct(v1, v2)
- case reflect.Uint32, reflect.Uint64:
- return v1.Uint() == v2.Uint()
- }
-
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to compare %v", v1)
- return false
-}
-
-// base is the struct type that the extensions are based on.
-// em1 and em2 are extension maps.
-func equalExtensions(base reflect.Type, em1, em2 map[int32]Extension) bool {
- if len(em1) != len(em2) {
- return false
- }
-
- for extNum, e1 := range em1 {
- e2, ok := em2[extNum]
- if !ok {
- return false
- }
-
- m1, m2 := e1.value, e2.value
-
- if m1 != nil && m2 != nil {
- // Both are unencoded.
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- continue
- }
-
- // At least one is encoded. To do a semantically correct comparison
- // we need to unmarshal them first.
- var desc *ExtensionDesc
- if m := extensionMaps[base]; m != nil {
- desc = m[extNum]
- }
- if desc == nil {
- log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
- continue
- }
- var err error
- if m1 == nil {
- m1, err = decodeExtension(e1.enc, desc)
- }
- if m2 == nil && err == nil {
- m2, err = decodeExtension(e2.enc, desc)
- }
- if err != nil {
- // The encoded form is invalid.
- log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
- return false
- }
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- }
-
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions.go
deleted file mode 100644
index 6180347e3..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions.go
+++ /dev/null
@@ -1,518 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Types and routines for supporting protocol buffer extensions.
- */
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "sync"
-)
-
-// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
-var ErrMissingExtension = errors.New("proto: missing extension")
-
-// ExtensionRange represents a range of message extensions for a protocol buffer.
-// Used in code generated by the protocol compiler.
-type ExtensionRange struct {
- Start, End int32 // both inclusive
-}
-
-// extendableProto is an interface implemented by any protocol buffer that may be extended.
-type extendableProto interface {
- Message
- ExtensionRangeArray() []ExtensionRange
-}
-
-type extensionsMap interface {
- extendableProto
- ExtensionMap() map[int32]Extension
-}
-
-type extensionsBytes interface {
- extendableProto
- GetExtensions() *[]byte
-}
-
-var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()
-
-// ExtensionDesc represents an extension specification.
-// Used in generated code from the protocol compiler.
-type ExtensionDesc struct {
- ExtendedType Message // nil pointer to the type that is being extended
- ExtensionType interface{} // nil pointer to the extension type
- Field int32 // field number
- Name string // fully-qualified name of extension, for text formatting
- Tag string // protobuf tag style
-}
-
-func (ed *ExtensionDesc) repeated() bool {
- t := reflect.TypeOf(ed.ExtensionType)
- return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
-}
-
-// Extension represents an extension in a message.
-type Extension struct {
- // When an extension is stored in a message using SetExtension
- // only desc and value are set. When the message is marshaled
- // enc will be set to the encoded form of the message.
- //
- // When a message is unmarshaled and contains extensions, each
- // extension will have only enc set. When such an extension is
- // accessed using GetExtension (or GetExtensions) desc and value
- // will be set.
- desc *ExtensionDesc
- value interface{}
- enc []byte
-}
-
-// SetRawExtension is for testing only.
-func SetRawExtension(base extendableProto, id int32, b []byte) {
- if ebase, ok := base.(extensionsMap); ok {
- ebase.ExtensionMap()[id] = Extension{enc: b}
- } else if ebase, ok := base.(extensionsBytes); ok {
- clearExtension(base, id)
- ext := ebase.GetExtensions()
- *ext = append(*ext, b...)
- } else {
- panic("unreachable")
- }
-}
-
-// isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
- for _, er := range pb.ExtensionRangeArray() {
- if er.Start <= field && field <= er.End {
- return true
- }
- }
- return false
-}
-
-// checkExtensionTypes checks that the given extension is valid for pb.
-func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
- // Check the extended type.
- if a, b := reflect.TypeOf(pb), reflect.TypeOf(extension.ExtendedType); a != b {
- return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String())
- }
- // Check the range.
- if !isExtensionField(pb, extension.Field) {
- return errors.New("proto: bad extension number; not in declared ranges")
- }
- return nil
-}
-
-// extPropKey is sufficient to uniquely identify an extension.
-type extPropKey struct {
- base reflect.Type
- field int32
-}
-
-var extProp = struct {
- sync.RWMutex
- m map[extPropKey]*Properties
-}{
- m: make(map[extPropKey]*Properties),
-}
-
-func extensionProperties(ed *ExtensionDesc) *Properties {
- key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}
-
- extProp.RLock()
- if prop, ok := extProp.m[key]; ok {
- extProp.RUnlock()
- return prop
- }
- extProp.RUnlock()
-
- extProp.Lock()
- defer extProp.Unlock()
- // Check again.
- if prop, ok := extProp.m[key]; ok {
- return prop
- }
-
- prop := new(Properties)
- prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
- extProp.m[key] = prop
- return prop
-}
-
-// encodeExtensionMap encodes any unmarshaled (unencoded) extensions in m.
-func encodeExtensionMap(m map[int32]Extension) error {
- for k, e := range m {
- err := encodeExtension(&e)
- if err != nil {
- return err
- }
- m[k] = e
- }
- return nil
-}
-
-func encodeExtension(e *Extension) error {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- return nil
- }
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- et := reflect.TypeOf(e.desc.ExtensionType)
- props := extensionProperties(e.desc)
-
- p := NewBuffer(nil)
- // If e.value has type T, the encoder expects a *struct{ X T }.
- // Pass a *T with a zero field and hope it all works out.
- x := reflect.New(et)
- x.Elem().Set(reflect.ValueOf(e.value))
- if err := props.enc(p, props, toStructPointer(x)); err != nil {
- return err
- }
- e.enc = p.buf
- return nil
-}
-
-func sizeExtensionMap(m map[int32]Extension) (n int) {
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- et := reflect.TypeOf(e.desc.ExtensionType)
- props := extensionProperties(e.desc)
-
- // If e.value has type T, the encoder expects a *struct{ X T }.
- // Pass a *T with a zero field and hope it all works out.
- x := reflect.New(et)
- x.Elem().Set(reflect.ValueOf(e.value))
- n += props.size(props, toStructPointer(x))
- }
- return
-}
-
-// HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb extendableProto, extension *ExtensionDesc) bool {
- // TODO: Check types, field numbers, etc.?
- if epb, doki := pb.(extensionsMap); doki {
- _, ok := epb.ExtensionMap()[extension.Field]
- return ok
- } else if epb, doki := pb.(extensionsBytes); doki {
- ext := epb.GetExtensions()
- buf := *ext
- o := 0
- for o < len(buf) {
- tag, n := DecodeVarint(buf[o:])
- fieldNum := int32(tag >> 3)
- if int32(fieldNum) == extension.Field {
- return true
- }
- wireType := int(tag & 0x7)
- o += n
- l, err := size(buf[o:], wireType)
- if err != nil {
- return false
- }
- o += l
- }
- return false
- }
- panic("unreachable")
-}
-
-func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
- ext := pb.GetExtensions()
- for offset < len(*ext) {
- tag, n1 := DecodeVarint((*ext)[offset:])
- fieldNum := int32(tag >> 3)
- wireType := int(tag & 0x7)
- n2, err := size((*ext)[offset+n1:], wireType)
- if err != nil {
- panic(err)
- }
- newOffset := offset + n1 + n2
- if fieldNum == theFieldNum {
- *ext = append((*ext)[:offset], (*ext)[newOffset:]...)
- return offset
- }
- offset = newOffset
- }
- return -1
-}
-
-func clearExtension(pb extendableProto, fieldNum int32) {
- if epb, doki := pb.(extensionsMap); doki {
- delete(epb.ExtensionMap(), fieldNum)
- } else if epb, doki := pb.(extensionsBytes); doki {
- offset := 0
- for offset != -1 {
- offset = deleteExtension(epb, fieldNum, offset)
- }
- } else {
- panic("unreachable")
- }
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb extendableProto, extension *ExtensionDesc) {
- // TODO: Check types, field numbers, etc.?
- clearExtension(pb, extension.Field)
-}
-
-// GetExtension parses and returns the given extension of pb.
-// If the extension is not present it returns ErrMissingExtension.
-func GetExtension(pb extendableProto, extension *ExtensionDesc) (interface{}, error) {
- if err := checkExtensionTypes(pb, extension); err != nil {
- return nil, err
- }
-
- if epb, doki := pb.(extensionsMap); doki {
- emap := epb.ExtensionMap()
- e, ok := emap[extension.Field]
- if !ok {
- // defaultExtensionValue returns the default value or
- // ErrMissingExtension if there is no default.
- return defaultExtensionValue(extension)
- }
- if e.value != nil {
- // Already decoded. Check the descriptor, though.
- if e.desc != extension {
- // This shouldn't happen. If it does, it means that
- // GetExtension was called twice with two different
- // descriptors with the same field number.
- return nil, errors.New("proto: descriptor conflict")
- }
- return e.value, nil
- }
-
- v, err := decodeExtension(e.enc, extension)
- if err != nil {
- return nil, err
- }
-
- // Remember the decoded version and drop the encoded version.
- // That way it is safe to mutate what we return.
- e.value = v
- e.desc = extension
- e.enc = nil
- emap[extension.Field] = e
- return e.value, nil
- } else if epb, doki := pb.(extensionsBytes); doki {
- ext := epb.GetExtensions()
- o := 0
- for o < len(*ext) {
- tag, n := DecodeVarint((*ext)[o:])
- fieldNum := int32(tag >> 3)
- wireType := int(tag & 0x7)
- l, err := size((*ext)[o+n:], wireType)
- if err != nil {
- return nil, err
- }
- if int32(fieldNum) == extension.Field {
- v, err := decodeExtension((*ext)[o:o+n+l], extension)
- if err != nil {
- return nil, err
- }
- return v, nil
- }
- o += n + l
- }
- return defaultExtensionValue(extension)
- }
- panic("unreachable")
-}
-
-// defaultExtensionValue returns the default value for extension.
-// If no default for an extension is defined ErrMissingExtension is returned.
-func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
- t := reflect.TypeOf(extension.ExtensionType)
- props := extensionProperties(extension)
-
- sf, _, err := fieldDefault(t, props)
- if err != nil {
- return nil, err
- }
-
- if sf == nil || sf.value == nil {
- // There is no default value.
- return nil, ErrMissingExtension
- }
-
- if t.Kind() != reflect.Ptr {
- // We do not need to return a Ptr, we can directly return sf.value.
- return sf.value, nil
- }
-
- // We need to return an interface{} that is a pointer to sf.value.
- value := reflect.New(t).Elem()
- value.Set(reflect.New(value.Type().Elem()))
- if sf.kind == reflect.Int32 {
- // We may have an int32 or an enum, but the underlying data is int32.
- // Since we can't set an int32 into a non int32 reflect.value directly
- // set it as a int32.
- value.Elem().SetInt(int64(sf.value.(int32)))
- } else {
- value.Elem().Set(reflect.ValueOf(sf.value))
- }
- return value.Interface(), nil
-}
-
-// decodeExtension decodes an extension encoded in b.
-func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
- o := NewBuffer(b)
-
- t := reflect.TypeOf(extension.ExtensionType)
-
- props := extensionProperties(extension)
-
- // t is a pointer to a struct, pointer to basic type or a slice.
- // Allocate a "field" to store the pointer/slice itself; the
- // pointer/slice will be stored here. We pass
- // the address of this field to props.dec.
- // This passes a zero field and a *t and lets props.dec
- // interpret it as a *struct{ x t }.
- value := reflect.New(t).Elem()
-
- for {
- // Discard wire type and field number varint. It isn't needed.
- if _, err := o.DecodeVarint(); err != nil {
- return nil, err
- }
-
- if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil {
- return nil, err
- }
-
- if o.index >= len(o.buf) {
- break
- }
- }
- return value.Interface(), nil
-}
-
-// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
-// The returned slice has the same length as es; missing extensions will appear as nil elements.
-func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
- epb, ok := pb.(extendableProto)
- if !ok {
- err = errors.New("proto: not an extendable proto")
- return
- }
- extensions = make([]interface{}, len(es))
- for i, e := range es {
- extensions[i], err = GetExtension(epb, e)
- if err == ErrMissingExtension {
- err = nil
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
- if err := checkExtensionTypes(pb, extension); err != nil {
- return err
- }
- typ := reflect.TypeOf(extension.ExtensionType)
- if typ != reflect.TypeOf(value) {
- return errors.New("proto: bad extension value type")
- }
- // nil extension values need to be caught early, because the
- // encoder can't distinguish an ErrNil due to a nil extension
- // from an ErrNil due to a missing field. Extensions are
- // always optional, so the encoder would just swallow the error
- // and drop all the extensions from the encoded message.
- if reflect.ValueOf(value).IsNil() {
- return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
- }
- return setExtension(pb, extension, value)
-}
-
-func setExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
- if epb, doki := pb.(extensionsMap); doki {
- epb.ExtensionMap()[extension.Field] = Extension{desc: extension, value: value}
- } else if epb, doki := pb.(extensionsBytes); doki {
- ClearExtension(pb, extension)
- ext := epb.GetExtensions()
- et := reflect.TypeOf(extension.ExtensionType)
- props := extensionProperties(extension)
- p := NewBuffer(nil)
- x := reflect.New(et)
- x.Elem().Set(reflect.ValueOf(value))
- if err := props.enc(p, props, toStructPointer(x)); err != nil {
- return err
- }
- *ext = append(*ext, p.buf...)
- }
- return nil
-}
-
-// A global registry of extensions.
-// The generated code will register the generated descriptors by calling RegisterExtension.
-
-var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)
-
-// RegisterExtension is called from the generated code.
-func RegisterExtension(desc *ExtensionDesc) {
- st := reflect.TypeOf(desc.ExtendedType).Elem()
- m := extensionMaps[st]
- if m == nil {
- m = make(map[int32]*ExtensionDesc)
- extensionMaps[st] = m
- }
- if _, ok := m[desc.Field]; ok {
- panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field)))
- }
- m[desc.Field] = desc
-}
-
-// RegisteredExtensions returns a map of the registered extensions of a
-// protocol buffer struct, indexed by the extension number.
-// The argument pb should be a nil pointer to the struct type.
-func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
- return extensionMaps[reflect.TypeOf(pb).Elem()]
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
deleted file mode 100644
index 86b1fa234..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
- "sort"
- "strings"
-)
-
-func GetBoolExtension(pb extendableProto, extension *ExtensionDesc, ifnotset bool) bool {
- if reflect.ValueOf(pb).IsNil() {
- return ifnotset
- }
- value, err := GetExtension(pb, extension)
- if err != nil {
- return ifnotset
- }
- if value == nil {
- return ifnotset
- }
- if value.(*bool) == nil {
- return ifnotset
- }
- return *(value.(*bool))
-}
-
-func (this *Extension) Equal(that *Extension) bool {
- return bytes.Equal(this.enc, that.enc)
-}
-
-func (this *Extension) Compare(that *Extension) int {
- return bytes.Compare(this.enc, that.enc)
-}
-
-func SizeOfExtensionMap(m map[int32]Extension) (n int) {
- return sizeExtensionMap(m)
-}
-
-type sortableMapElem struct {
- field int32
- ext Extension
-}
-
-func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions {
- s := make(sortableExtensions, 0, len(m))
- for k, v := range m {
- s = append(s, &sortableMapElem{field: k, ext: v})
- }
- return s
-}
-
-type sortableExtensions []*sortableMapElem
-
-func (this sortableExtensions) Len() int { return len(this) }
-
-func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] }
-
-func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field }
-
-func (this sortableExtensions) String() string {
- sort.Sort(this)
- ss := make([]string, len(this))
- for i := range this {
- ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext)
- }
- return "map[" + strings.Join(ss, ",") + "]"
-}
-
-func StringFromExtensionsMap(m map[int32]Extension) string {
- return newSortableExtensionsFromMap(m).String()
-}
-
-func StringFromExtensionsBytes(ext []byte) string {
- m, err := BytesToExtensionsMap(ext)
- if err != nil {
- panic(err)
- }
- return StringFromExtensionsMap(m)
-}
-
-func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
- if err := encodeExtensionMap(m); err != nil {
- return 0, err
- }
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
- for _, k := range keys {
- n += copy(data[n:], m[int32(k)].enc)
- }
- return n, nil
-}
-
-func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) {
- if m[id].value == nil || m[id].desc == nil {
- return m[id].enc, nil
- }
- if err := encodeExtensionMap(m); err != nil {
- return nil, err
- }
- return m[id].enc, nil
-}
-
-func size(buf []byte, wire int) (int, error) {
- switch wire {
- case WireVarint:
- _, n := DecodeVarint(buf)
- return n, nil
- case WireFixed64:
- return 8, nil
- case WireBytes:
- v, n := DecodeVarint(buf)
- return int(v) + n, nil
- case WireFixed32:
- return 4, nil
- case WireStartGroup:
- offset := 0
- for {
- u, n := DecodeVarint(buf[offset:])
- fwire := int(u & 0x7)
- offset += n
- if fwire == WireEndGroup {
- return offset, nil
- }
- s, err := size(buf[offset:], wire)
- if err != nil {
- return 0, err
- }
- offset += s
- }
- }
- return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire)
-}
-
-func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) {
- m := make(map[int32]Extension)
- i := 0
- for i < len(buf) {
- tag, n := DecodeVarint(buf[i:])
- if n <= 0 {
- return nil, fmt.Errorf("unable to decode varint")
- }
- fieldNum := int32(tag >> 3)
- wireType := int(tag & 0x7)
- l, err := size(buf[i+n:], wireType)
- if err != nil {
- return nil, err
- }
- end := i + int(l) + n
- m[int32(fieldNum)] = Extension{enc: buf[i:end]}
- i = end
- }
- return m, nil
-}
-
-func NewExtension(e []byte) Extension {
- ee := Extension{enc: make([]byte, len(e))}
- copy(ee.enc, e)
- return ee
-}
-
-func AppendExtension(e extendableProto, tag int32, buf []byte) {
- if ee, eok := e.(extensionsMap); eok {
- ext := ee.ExtensionMap()[int32(tag)] // may be missing
- ext.enc = append(ext.enc, buf...)
- ee.ExtensionMap()[int32(tag)] = ext
- } else if ee, eok := e.(extensionsBytes); eok {
- ext := ee.GetExtensions()
- *ext = append(*ext, buf...)
- }
-}
-
-func (this Extension) GoString() string {
- if this.enc == nil {
- if err := encodeExtension(&this); err != nil {
- panic(err)
- }
- }
- return fmt.Sprintf("proto.NewExtension(%#v)", this.enc)
-}
-
-func SetUnsafeExtension(pb extendableProto, fieldNum int32, value interface{}) error {
- typ := reflect.TypeOf(pb).Elem()
- ext, ok := extensionMaps[typ]
- if !ok {
- return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String())
- }
- desc, ok := ext[fieldNum]
- if !ok {
- return errors.New("proto: bad extension number; not in declared ranges")
- }
- return setExtension(pb, desc, value)
-}
-
-func GetUnsafeExtension(pb extendableProto, fieldNum int32) (interface{}, error) {
- typ := reflect.TypeOf(pb).Elem()
- ext, ok := extensionMaps[typ]
- if !ok {
- return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String())
- }
- desc, ok := ext[fieldNum]
- if !ok {
- return nil, fmt.Errorf("unregistered field number %d", fieldNum)
- }
- return GetExtension(pb, desc)
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib.go
deleted file mode 100644
index 2e35ae2d2..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib.go
+++ /dev/null
@@ -1,894 +0,0 @@
-// 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
-// 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.
-
-/*
-Package proto converts data structures to and from the wire format of
-protocol buffers. It works in concert with the Go source code generated
-for .proto files by the protocol compiler.
-
-A summary of the properties of the protocol buffer interface
-for a protocol buffer variable v:
-
- - Names are turned from camel_case to CamelCase for export.
- - There are no methods on v to set fields; just treat
- them as structure fields.
- - There are getters that return a field's value if set,
- and return the field's default value if unset.
- The getters work even if the receiver is a nil message.
- - The zero value for a struct is its correct initialization state.
- All desired fields must be set before marshaling.
- - A Reset() method will restore a protobuf struct to its zero state.
- - Non-repeated fields are pointers to the values; nil means unset.
- That is, optional or required field int32 f becomes F *int32.
- - Repeated fields are slices.
- - Helper functions are available to aid the setting of fields.
- msg.Foo = proto.String("hello") // set field
- - Constants are defined to hold the default values of all fields that
- have them. They have the form Default_StructName_FieldName.
- Because the getter methods handle defaulted values,
- direct use of these constants should be rare.
- - Enums are given type names and maps from names to values.
- Enum values are prefixed by the enclosing message's name, or by the
- enum's type name if it is a top-level enum. Enum types have a String
- method, and a Enum method to assist in message construction.
- - Nested messages, groups and enums have type names prefixed with the name of
- the surrounding message type.
- - Extensions are given descriptor names that start with E_,
- followed by an underscore-delimited list of the nested messages
- that contain it (if any) followed by the CamelCased name of the
- extension field itself. HasExtension, ClearExtension, GetExtension
- and SetExtension are functions for manipulating extensions.
- - Oneof field sets are given a single field in their message,
- with distinguished wrapper types for each possible field value.
- - Marshal and Unmarshal are functions to encode and decode the wire format.
-
-When the .proto file specifies `syntax="proto3"`, there are some differences:
-
- - Non-repeated fields of non-message type are values instead of pointers.
- - Getters are only generated for message and oneof fields.
- - Enum types do not get an Enum method.
-
-The simplest way to describe this is to see an example.
-Given file test.proto, containing
-
- package example;
-
- enum FOO { X = 17; }
-
- message Test {
- required string label = 1;
- optional int32 type = 2 [default=77];
- repeated int64 reps = 3;
- optional group OptionalGroup = 4 {
- required string RequiredField = 5;
- }
- oneof union {
- int32 number = 6;
- string name = 7;
- }
- }
-
-The resulting file, test.pb.go, is:
-
- package example
-
- import proto "github.com/gogo/protobuf/proto"
- import math "math"
-
- type FOO int32
- const (
- FOO_X FOO = 17
- )
- var FOO_name = map[int32]string{
- 17: "X",
- }
- var FOO_value = map[string]int32{
- "X": 17,
- }
-
- func (x FOO) Enum() *FOO {
- p := new(FOO)
- *p = x
- return p
- }
- func (x FOO) String() string {
- return proto.EnumName(FOO_name, int32(x))
- }
- func (x *FOO) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FOO_value, data)
- if err != nil {
- return err
- }
- *x = FOO(value)
- return nil
- }
-
- type Test struct {
- Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
- Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
- Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
- Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"`
- // Types that are valid to be assigned to Union:
- // *Test_Number
- // *Test_Name
- Union isTest_Union `protobuf_oneof:"union"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Test) Reset() { *m = Test{} }
- func (m *Test) String() string { return proto.CompactTextString(m) }
- func (*Test) ProtoMessage() {}
-
- type isTest_Union interface {
- isTest_Union()
- }
-
- type Test_Number struct {
- Number int32 `protobuf:"varint,6,opt,name=number"`
- }
- type Test_Name struct {
- Name string `protobuf:"bytes,7,opt,name=name"`
- }
-
- func (*Test_Number) isTest_Union() {}
- func (*Test_Name) isTest_Union() {}
-
- func (m *Test) GetUnion() isTest_Union {
- if m != nil {
- return m.Union
- }
- return nil
- }
- const Default_Test_Type int32 = 77
-
- func (m *Test) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
- }
-
- func (m *Test) GetType() int32 {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return Default_Test_Type
- }
-
- func (m *Test) GetOptionalgroup() *Test_OptionalGroup {
- if m != nil {
- return m.Optionalgroup
- }
- return nil
- }
-
- type Test_OptionalGroup struct {
- RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"`
- }
- func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} }
- func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }
-
- func (m *Test_OptionalGroup) GetRequiredField() string {
- if m != nil && m.RequiredField != nil {
- return *m.RequiredField
- }
- return ""
- }
-
- func (m *Test) GetNumber() int32 {
- if x, ok := m.GetUnion().(*Test_Number); ok {
- return x.Number
- }
- return 0
- }
-
- func (m *Test) GetName() string {
- if x, ok := m.GetUnion().(*Test_Name); ok {
- return x.Name
- }
- return ""
- }
-
- func init() {
- proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
- }
-
-To create and play with a Test object:
-
- package main
-
- import (
- "log"
-
- "github.com/gogo/protobuf/proto"
- pb "./example.pb"
- )
-
- func main() {
- test := &pb.Test{
- Label: proto.String("hello"),
- Type: proto.Int32(17),
- Reps: []int64{1, 2, 3},
- Optionalgroup: &pb.Test_OptionalGroup{
- RequiredField: proto.String("good bye"),
- },
- Union: &pb.Test_Name{"fred"},
- }
- data, err := proto.Marshal(test)
- if err != nil {
- log.Fatal("marshaling error: ", err)
- }
- newTest := &pb.Test{}
- err = proto.Unmarshal(data, newTest)
- if err != nil {
- log.Fatal("unmarshaling error: ", err)
- }
- // Now test and newTest contain the same data.
- if test.GetLabel() != newTest.GetLabel() {
- log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
- }
- // Use a type switch to determine which oneof was set.
- switch u := test.Union.(type) {
- case *pb.Test_Number: // u.Number contains the number.
- case *pb.Test_Name: // u.Name contains the string.
- }
- // etc.
- }
-*/
-package proto
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "reflect"
- "sort"
- "strconv"
- "sync"
-)
-
-// Message is implemented by generated protocol buffer messages.
-type Message interface {
- Reset()
- String() string
- ProtoMessage()
-}
-
-// Stats records allocation details about the protocol buffer encoders
-// and decoders. Useful for tuning the library itself.
-type Stats struct {
- Emalloc uint64 // mallocs in encode
- Dmalloc uint64 // mallocs in decode
- Encode uint64 // number of encodes
- Decode uint64 // number of decodes
- Chit uint64 // number of cache hits
- Cmiss uint64 // number of cache misses
- Size uint64 // number of sizes
-}
-
-// Set to true to enable stats collection.
-const collectStats = false
-
-var stats Stats
-
-// GetStats returns a copy of the global Stats structure.
-func GetStats() Stats { return stats }
-
-// A Buffer is a buffer manager for marshaling and unmarshaling
-// protocol buffers. It may be reused between invocations to
-// reduce memory usage. It is not necessary to use a Buffer;
-// the global functions Marshal and Unmarshal create a
-// temporary Buffer and are fine for most applications.
-type Buffer struct {
- buf []byte // encode/decode byte stream
- index int // write point
-
- // pools of basic types to amortize allocation.
- bools []bool
- uint32s []uint32
- uint64s []uint64
-
- // extra pools, only used with pointer_reflect.go
- int32s []int32
- int64s []int64
- float32s []float32
- float64s []float64
-}
-
-// NewBuffer allocates a new Buffer and initializes its internal data to
-// the contents of the argument slice.
-func NewBuffer(e []byte) *Buffer {
- return &Buffer{buf: e}
-}
-
-// Reset resets the Buffer, ready for marshaling a new protocol buffer.
-func (p *Buffer) Reset() {
- p.buf = p.buf[0:0] // for reading/writing
- p.index = 0 // for reading
-}
-
-// SetBuf replaces the internal buffer with the slice,
-// ready for unmarshaling the contents of the slice.
-func (p *Buffer) SetBuf(s []byte) {
- p.buf = s
- p.index = 0
-}
-
-// Bytes returns the contents of the Buffer.
-func (p *Buffer) Bytes() []byte { return p.buf }
-
-/*
- * Helper routines for simplifying the creation of optional fields of basic type.
- */
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
- return &v
-}
-
-// Int32 is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int32 {
- p := new(int32)
- *p = int32(v)
- return p
-}
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Float32 is a helper routine that allocates a new float32 value
-// to store v and returns a pointer to it.
-func Float32(v float32) *float32 {
- return &v
-}
-
-// Float64 is a helper routine that allocates a new float64 value
-// to store v and returns a pointer to it.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Uint32 is a helper routine that allocates a new uint32 value
-// to store v and returns a pointer to it.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint64 is a helper routine that allocates a new uint64 value
-// to store v and returns a pointer to it.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
- return &v
-}
-
-// EnumName is a helper function to simplify printing protocol buffer enums
-// by name. Given an enum map and a value, it returns a useful string.
-func EnumName(m map[int32]string, v int32) string {
- s, ok := m[v]
- if ok {
- return s
- }
- return strconv.Itoa(int(v))
-}
-
-// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
-// from their JSON-encoded representation. Given a map from the enum's symbolic
-// names to its int values, and a byte buffer containing the JSON-encoded
-// value, it returns an int32 that can be cast to the enum type by the caller.
-//
-// The function can deal with both JSON representations, numeric and symbolic.
-func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
- if data[0] == '"' {
- // New style: enums are strings.
- var repr string
- if err := json.Unmarshal(data, &repr); err != nil {
- return -1, err
- }
- val, ok := m[repr]
- if !ok {
- return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
- }
- return val, nil
- }
- // Old style: enums are ints.
- var val int32
- if err := json.Unmarshal(data, &val); err != nil {
- return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
- }
- return val, nil
-}
-
-// DebugPrint dumps the encoded data in b in a debugging format with a header
-// including the string s. Used in testing but made available for general debugging.
-func (p *Buffer) DebugPrint(s string, b []byte) {
- var u uint64
-
- obuf := p.buf
- sindex := p.index
- p.buf = b
- p.index = 0
- depth := 0
-
- fmt.Printf("\n--- %s ---\n", s)
-
-out:
- for {
- for i := 0; i < depth; i++ {
- fmt.Print(" ")
- }
-
- index := p.index
- if index == len(p.buf) {
- break
- }
-
- op, err := p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: fetching op err %v\n", index, err)
- break out
- }
- tag := op >> 3
- wire := op & 7
-
- switch wire {
- default:
- fmt.Printf("%3d: t=%3d unknown wire=%d\n",
- index, tag, wire)
- break out
-
- case WireBytes:
- var r []byte
-
- r, err = p.DecodeRawBytes(false)
- if err != nil {
- break out
- }
- fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r))
- if len(r) <= 6 {
- for i := 0; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- } else {
- for i := 0; i < 3; i++ {
- fmt.Printf(" %.2x", r[i])
- }
- fmt.Printf(" ..")
- for i := len(r) - 3; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- }
- fmt.Printf("\n")
-
- case WireFixed32:
- u, err = p.DecodeFixed32()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u)
-
- case WireFixed64:
- u, err = p.DecodeFixed64()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u)
-
- case WireVarint:
- u, err = p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u)
-
- case WireStartGroup:
- fmt.Printf("%3d: t=%3d start\n", index, tag)
- depth++
-
- case WireEndGroup:
- depth--
- fmt.Printf("%3d: t=%3d end\n", index, tag)
- }
- }
-
- if depth != 0 {
- fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth)
- }
- fmt.Printf("\n")
-
- p.buf = obuf
- p.index = sindex
-}
-
-// SetDefaults sets unset protocol buffer fields to their default values.
-// It only modifies fields that are both unset and have defined defaults.
-// It recursively sets default values in any non-nil sub-messages.
-func SetDefaults(pb Message) {
- setDefaults(reflect.ValueOf(pb), true, false)
-}
-
-// v is a pointer to a struct.
-func setDefaults(v reflect.Value, recur, zeros bool) {
- v = v.Elem()
-
- defaultMu.RLock()
- dm, ok := defaults[v.Type()]
- defaultMu.RUnlock()
- if !ok {
- dm = buildDefaultMessage(v.Type())
- defaultMu.Lock()
- defaults[v.Type()] = dm
- defaultMu.Unlock()
- }
-
- for _, sf := range dm.scalars {
- f := v.Field(sf.index)
- if !f.IsNil() {
- // field already set
- continue
- }
- dv := sf.value
- if dv == nil && !zeros {
- // no explicit default, and don't want to set zeros
- continue
- }
- fptr := f.Addr().Interface() // **T
- // TODO: Consider batching the allocations we do here.
- switch sf.kind {
- case reflect.Bool:
- b := new(bool)
- if dv != nil {
- *b = dv.(bool)
- }
- *(fptr.(**bool)) = b
- case reflect.Float32:
- f := new(float32)
- if dv != nil {
- *f = dv.(float32)
- }
- *(fptr.(**float32)) = f
- case reflect.Float64:
- f := new(float64)
- if dv != nil {
- *f = dv.(float64)
- }
- *(fptr.(**float64)) = f
- case reflect.Int32:
- // might be an enum
- if ft := f.Type(); ft != int32PtrType {
- // enum
- f.Set(reflect.New(ft.Elem()))
- if dv != nil {
- f.Elem().SetInt(int64(dv.(int32)))
- }
- } else {
- // int32 field
- i := new(int32)
- if dv != nil {
- *i = dv.(int32)
- }
- *(fptr.(**int32)) = i
- }
- case reflect.Int64:
- i := new(int64)
- if dv != nil {
- *i = dv.(int64)
- }
- *(fptr.(**int64)) = i
- case reflect.String:
- s := new(string)
- if dv != nil {
- *s = dv.(string)
- }
- *(fptr.(**string)) = s
- case reflect.Uint8:
- // exceptional case: []byte
- var b []byte
- if dv != nil {
- db := dv.([]byte)
- b = make([]byte, len(db))
- copy(b, db)
- } else {
- b = []byte{}
- }
- *(fptr.(*[]byte)) = b
- case reflect.Uint32:
- u := new(uint32)
- if dv != nil {
- *u = dv.(uint32)
- }
- *(fptr.(**uint32)) = u
- case reflect.Uint64:
- u := new(uint64)
- if dv != nil {
- *u = dv.(uint64)
- }
- *(fptr.(**uint64)) = u
- default:
- log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind)
- }
- }
-
- for _, ni := range dm.nested {
- f := v.Field(ni)
- // f is *T or []*T or map[T]*T
- switch f.Kind() {
- case reflect.Ptr:
- if f.IsNil() {
- continue
- }
- setDefaults(f, recur, zeros)
-
- case reflect.Slice:
- for i := 0; i < f.Len(); i++ {
- e := f.Index(i)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
-
- case reflect.Map:
- for _, k := range f.MapKeys() {
- e := f.MapIndex(k)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
- }
- }
-}
-
-var (
- // defaults maps a protocol buffer struct type to a slice of the fields,
- // with its scalar fields set to their proto-declared non-zero default values.
- defaultMu sync.RWMutex
- defaults = make(map[reflect.Type]defaultMessage)
-
- int32PtrType = reflect.TypeOf((*int32)(nil))
-)
-
-// defaultMessage represents information about the default values of a message.
-type defaultMessage struct {
- scalars []scalarField
- nested []int // struct field index of nested messages
-}
-
-type scalarField struct {
- index int // struct field index
- kind reflect.Kind // element type (the T in *T or []T)
- value interface{} // the proto-declared default value, or nil
-}
-
-// t is a struct type.
-func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
- sprop := GetProperties(t)
- for _, prop := range sprop.Prop {
- fi, ok := sprop.decoderTags.get(prop.Tag)
- if !ok {
- // XXX_unrecognized
- continue
- }
- ft := t.Field(fi).Type
-
- sf, nested, err := fieldDefault(ft, prop)
- switch {
- case err != nil:
- log.Print(err)
- case nested:
- dm.nested = append(dm.nested, fi)
- case sf != nil:
- sf.index = fi
- dm.scalars = append(dm.scalars, *sf)
- }
- }
-
- return dm
-}
-
-// fieldDefault returns the scalarField for field type ft.
-// sf will be nil if the field can not have a default.
-// nestedMessage will be true if this is a nested message.
-// Note that sf.index is not set on return.
-func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
- var canHaveDefault bool
- switch ft.Kind() {
- case reflect.Ptr:
- if ft.Elem().Kind() == reflect.Struct {
- nestedMessage = true
- } else {
- canHaveDefault = true // proto2 scalar field
- }
-
- case reflect.Slice:
- switch ft.Elem().Kind() {
- case reflect.Ptr:
- nestedMessage = true // repeated message
- case reflect.Uint8:
- canHaveDefault = true // bytes field
- }
-
- case reflect.Map:
- if ft.Elem().Kind() == reflect.Ptr {
- nestedMessage = true // map with message values
- }
- }
-
- if !canHaveDefault {
- if nestedMessage {
- return nil, true, nil
- }
- return nil, false, nil
- }
-
- // We now know that ft is a pointer or slice.
- sf = &scalarField{kind: ft.Elem().Kind()}
-
- // scalar fields without defaults
- if !prop.HasDefault {
- return sf, false, nil
- }
-
- // a scalar field: either *T or []byte
- switch ft.Elem().Kind() {
- case reflect.Bool:
- x, err := strconv.ParseBool(prop.Default)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Float32:
- x, err := strconv.ParseFloat(prop.Default, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
- }
- sf.value = float32(x)
- case reflect.Float64:
- x, err := strconv.ParseFloat(prop.Default, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Int32:
- x, err := strconv.ParseInt(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
- }
- sf.value = int32(x)
- case reflect.Int64:
- x, err := strconv.ParseInt(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.String:
- sf.value = prop.Default
- case reflect.Uint8:
- // []byte (not *uint8)
- sf.value = []byte(prop.Default)
- case reflect.Uint32:
- x, err := strconv.ParseUint(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
- }
- sf.value = uint32(x)
- case reflect.Uint64:
- x, err := strconv.ParseUint(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
- }
- sf.value = x
- default:
- return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
- }
-
- return sf, false, nil
-}
-
-// Map fields may have key types of non-float scalars, strings and enums.
-// The easiest way to sort them in some deterministic order is to use fmt.
-// If this turns out to be inefficient we can always consider other options,
-// such as doing a Schwartzian transform.
-
-func mapKeys(vs []reflect.Value) sort.Interface {
- s := mapKeySorter{
- vs: vs,
- // default Less function: textual comparison
- less: func(a, b reflect.Value) bool {
- return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface())
- },
- }
-
- // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps;
- // numeric keys are sorted numerically.
- if len(vs) == 0 {
- return s
- }
- switch vs[0].Kind() {
- case reflect.Int32, reflect.Int64:
- s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }
- case reflect.Uint32, reflect.Uint64:
- s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }
- }
-
- return s
-}
-
-type mapKeySorter struct {
- vs []reflect.Value
- less func(a, b reflect.Value) bool
-}
-
-func (s mapKeySorter) Len() int { return len(s.vs) }
-func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }
-func (s mapKeySorter) Less(i, j int) bool {
- return s.less(s.vs[i], s.vs[j])
-}
-
-// isProto3Zero reports whether v is a zero proto3 value.
-func isProto3Zero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint32, reflect.Uint64:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.String:
- return v.String() == ""
- }
- return false
-}
-
-// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const GoGoProtoPackageIsVersion1 = true
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib_gogo.go
deleted file mode 100644
index a6c2c06b2..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/lib_gogo.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "encoding/json"
- "strconv"
-)
-
-func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) {
- s, ok := m[value]
- if !ok {
- s = strconv.Itoa(int(value))
- }
- return json.Marshal(s)
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/message_set.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/message_set.go
deleted file mode 100644
index e25e01e63..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/message_set.go
+++ /dev/null
@@ -1,280 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Support for message sets.
- */
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "sort"
-)
-
-// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
-// A message type ID is required for storing a protocol buffer in a message set.
-var errNoMessageTypeID = errors.New("proto does not have a message type ID")
-
-// The first two types (_MessageSet_Item and messageSet)
-// model what the protocol compiler produces for the following protocol message:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-// That is the MessageSet wire format. We can't use a proto to generate these
-// because that would introduce a circular dependency between it and this package.
-
-type _MessageSet_Item struct {
- TypeId *int32 `protobuf:"varint,2,req,name=type_id"`
- Message []byte `protobuf:"bytes,3,req,name=message"`
-}
-
-type messageSet struct {
- Item []*_MessageSet_Item `protobuf:"group,1,rep"`
- XXX_unrecognized []byte
- // TODO: caching?
-}
-
-// Make sure messageSet is a Message.
-var _ Message = (*messageSet)(nil)
-
-// messageTypeIder is an interface satisfied by a protocol buffer type
-// that may be stored in a MessageSet.
-type messageTypeIder interface {
- MessageTypeId() int32
-}
-
-func (ms *messageSet) find(pb Message) *_MessageSet_Item {
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return nil
- }
- id := mti.MessageTypeId()
- for _, item := range ms.Item {
- if *item.TypeId == id {
- return item
- }
- }
- return nil
-}
-
-func (ms *messageSet) Has(pb Message) bool {
- if ms.find(pb) != nil {
- return true
- }
- return false
-}
-
-func (ms *messageSet) Unmarshal(pb Message) error {
- if item := ms.find(pb); item != nil {
- return Unmarshal(item.Message, pb)
- }
- if _, ok := pb.(messageTypeIder); !ok {
- return errNoMessageTypeID
- }
- return nil // TODO: return error instead?
-}
-
-func (ms *messageSet) Marshal(pb Message) error {
- msg, err := Marshal(pb)
- if err != nil {
- return err
- }
- if item := ms.find(pb); item != nil {
- // reuse existing item
- item.Message = msg
- return nil
- }
-
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return errNoMessageTypeID
- }
-
- mtid := mti.MessageTypeId()
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: &mtid,
- Message: msg,
- })
- return nil
-}
-
-func (ms *messageSet) Reset() { *ms = messageSet{} }
-func (ms *messageSet) String() string { return CompactTextString(ms) }
-func (*messageSet) ProtoMessage() {}
-
-// Support for the message_set_wire_format message option.
-
-func skipVarint(buf []byte) []byte {
- i := 0
- for ; buf[i]&0x80 != 0; i++ {
- }
- return buf[i+1:]
-}
-
-// MarshalMessageSet encodes the extension map represented by m in the message set wire format.
-// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSet(m map[int32]Extension) ([]byte, error) {
- if err := encodeExtensionMap(m); err != nil {
- return nil, err
- }
-
- // Sort extension IDs to provide a deterministic encoding.
- // See also enc_map in encode.go.
- ids := make([]int, 0, len(m))
- for id := range m {
- ids = append(ids, int(id))
- }
- sort.Ints(ids)
-
- ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))}
- for _, id := range ids {
- e := m[int32(id)]
- // Remove the wire type and field number varint, as well as the length varint.
- msg := skipVarint(skipVarint(e.enc))
-
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: Int32(int32(id)),
- Message: msg,
- })
- }
- return Marshal(ms)
-}
-
-// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
-// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error {
- ms := new(messageSet)
- if err := Unmarshal(buf, ms); err != nil {
- return err
- }
- for _, item := range ms.Item {
- id := *item.TypeId
- msg := item.Message
-
- // Restore wire type and field number varint, plus length varint.
- // Be careful to preserve duplicate items.
- b := EncodeVarint(uint64(id)<<3 | WireBytes)
- if ext, ok := m[id]; ok {
- // Existing data; rip off the tag and length varint
- // so we join the new data correctly.
- // We can assume that ext.enc is set because we are unmarshaling.
- o := ext.enc[len(b):] // skip wire type and field number
- _, n := DecodeVarint(o) // calculate length of length varint
- o = o[n:] // skip length varint
- msg = append(o, msg...) // join old data and new data
- }
- b = append(b, EncodeVarint(uint64(len(msg)))...)
- b = append(b, msg...)
-
- m[id] = Extension{enc: b}
- }
- return nil
-}
-
-// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
-// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) {
- var b bytes.Buffer
- b.WriteByte('{')
-
- // Process the map in key order for deterministic output.
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids)) // int32Slice defined in text.go
-
- for i, id := range ids {
- ext := m[id]
- if i > 0 {
- b.WriteByte(',')
- }
-
- msd, ok := messageSetMap[id]
- if !ok {
- // Unknown type; we can't render it, so skip it.
- continue
- }
- fmt.Fprintf(&b, `"[%s]":`, msd.name)
-
- x := ext.value
- if x == nil {
- x = reflect.New(msd.t.Elem()).Interface()
- if err := Unmarshal(ext.enc, x.(Message)); err != nil {
- return nil, err
- }
- }
- d, err := json.Marshal(x)
- if err != nil {
- return nil, err
- }
- b.Write(d)
- }
- b.WriteByte('}')
- return b.Bytes(), nil
-}
-
-// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
-// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSetJSON(buf []byte, m map[int32]Extension) error {
- // Common-case fast path.
- if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
- return nil
- }
-
- // This is fairly tricky, and it's not clear that it is needed.
- return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented")
-}
-
-// A global registry of types that can be used in a MessageSet.
-
-var messageSetMap = make(map[int32]messageSetDesc)
-
-type messageSetDesc struct {
- t reflect.Type // pointer to struct
- name string
-}
-
-// RegisterMessageSetType is called from the generated code.
-func RegisterMessageSetType(m Message, fieldNum int32, name string) {
- messageSetMap[fieldNum] = messageSetDesc{
- t: reflect.TypeOf(m),
- name: name,
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
deleted file mode 100644
index 749919d25..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
+++ /dev/null
@@ -1,479 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 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
-// 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.
-
-// +build appengine
-
-// This file contains an implementation of proto field accesses using package reflect.
-// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
-// be used on App Engine.
-
-package proto
-
-import (
- "math"
- "reflect"
-)
-
-// A structPointer is a pointer to a struct.
-type structPointer struct {
- v reflect.Value
-}
-
-// toStructPointer returns a structPointer equivalent to the given reflect value.
-// The reflect value must itself be a pointer to a struct.
-func toStructPointer(v reflect.Value) structPointer {
- return structPointer{v}
-}
-
-// IsNil reports whether p is nil.
-func structPointer_IsNil(p structPointer) bool {
- return p.v.IsNil()
-}
-
-// Interface returns the struct pointer as an interface value.
-func structPointer_Interface(p structPointer, _ reflect.Type) interface{} {
- return p.v.Interface()
-}
-
-// A field identifies a field in a struct, accessible from a structPointer.
-// In this implementation, a field is identified by the sequence of field indices
-// passed to reflect's FieldByIndex.
-type field []int
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return f.Index
-}
-
-// invalidField is an invalid field identifier.
-var invalidField = field(nil)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool { return f != nil }
-
-// field returns the given field in the struct as a reflect value.
-func structPointer_field(p structPointer, f field) reflect.Value {
- // Special case: an extension map entry with a value of type T
- // passes a *T to the struct-handling code with a zero field,
- // expecting that it will be treated as equivalent to *struct{ X T },
- // which has the same memory layout. We have to handle that case
- // specially, because reflect will panic if we call FieldByIndex on a
- // non-struct.
- if f == nil {
- return p.v.Elem()
- }
-
- return p.v.Elem().FieldByIndex(f)
-}
-
-// ifield returns the given field in the struct as an interface value.
-func structPointer_ifield(p structPointer, f field) interface{} {
- return structPointer_field(p, f).Addr().Interface()
-}
-
-// Bytes returns the address of a []byte field in the struct.
-func structPointer_Bytes(p structPointer, f field) *[]byte {
- return structPointer_ifield(p, f).(*[]byte)
-}
-
-// BytesSlice returns the address of a [][]byte field in the struct.
-func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
- return structPointer_ifield(p, f).(*[][]byte)
-}
-
-// Bool returns the address of a *bool field in the struct.
-func structPointer_Bool(p structPointer, f field) **bool {
- return structPointer_ifield(p, f).(**bool)
-}
-
-// BoolVal returns the address of a bool field in the struct.
-func structPointer_BoolVal(p structPointer, f field) *bool {
- return structPointer_ifield(p, f).(*bool)
-}
-
-// BoolSlice returns the address of a []bool field in the struct.
-func structPointer_BoolSlice(p structPointer, f field) *[]bool {
- return structPointer_ifield(p, f).(*[]bool)
-}
-
-// String returns the address of a *string field in the struct.
-func structPointer_String(p structPointer, f field) **string {
- return structPointer_ifield(p, f).(**string)
-}
-
-// StringVal returns the address of a string field in the struct.
-func structPointer_StringVal(p structPointer, f field) *string {
- return structPointer_ifield(p, f).(*string)
-}
-
-// StringSlice returns the address of a []string field in the struct.
-func structPointer_StringSlice(p structPointer, f field) *[]string {
- return structPointer_ifield(p, f).(*[]string)
-}
-
-// ExtMap returns the address of an extension map field in the struct.
-func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
- return structPointer_ifield(p, f).(*map[int32]Extension)
-}
-
-// NewAt returns the reflect.Value for a pointer to a field in the struct.
-func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {
- return structPointer_field(p, f).Addr()
-}
-
-// SetStructPointer writes a *struct field in the struct.
-func structPointer_SetStructPointer(p structPointer, f field, q structPointer) {
- structPointer_field(p, f).Set(q.v)
-}
-
-// GetStructPointer reads a *struct field in the struct.
-func structPointer_GetStructPointer(p structPointer, f field) structPointer {
- return structPointer{structPointer_field(p, f)}
-}
-
-// StructPointerSlice the address of a []*struct field in the struct.
-func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice {
- return structPointerSlice{structPointer_field(p, f)}
-}
-
-// A structPointerSlice represents the address of a slice of pointers to structs
-// (themselves messages or groups). That is, v.Type() is *[]*struct{...}.
-type structPointerSlice struct {
- v reflect.Value
-}
-
-func (p structPointerSlice) Len() int { return p.v.Len() }
-func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} }
-func (p structPointerSlice) Append(q structPointer) {
- p.v.Set(reflect.Append(p.v, q.v))
-}
-
-var (
- int32Type = reflect.TypeOf(int32(0))
- uint32Type = reflect.TypeOf(uint32(0))
- float32Type = reflect.TypeOf(float32(0))
- int64Type = reflect.TypeOf(int64(0))
- uint64Type = reflect.TypeOf(uint64(0))
- float64Type = reflect.TypeOf(float64(0))
-)
-
-// A word32 represents a field of type *int32, *uint32, *float32, or *enum.
-// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable.
-type word32 struct {
- v reflect.Value
-}
-
-// IsNil reports whether p is nil.
-func word32_IsNil(p word32) bool {
- return p.v.IsNil()
-}
-
-// Set sets p to point at a newly allocated word with bits set to x.
-func word32_Set(p word32, o *Buffer, x uint32) {
- t := p.v.Type().Elem()
- switch t {
- case int32Type:
- if len(o.int32s) == 0 {
- o.int32s = make([]int32, uint32PoolSize)
- }
- o.int32s[0] = int32(x)
- p.v.Set(reflect.ValueOf(&o.int32s[0]))
- o.int32s = o.int32s[1:]
- return
- case uint32Type:
- if len(o.uint32s) == 0 {
- o.uint32s = make([]uint32, uint32PoolSize)
- }
- o.uint32s[0] = x
- p.v.Set(reflect.ValueOf(&o.uint32s[0]))
- o.uint32s = o.uint32s[1:]
- return
- case float32Type:
- if len(o.float32s) == 0 {
- o.float32s = make([]float32, uint32PoolSize)
- }
- o.float32s[0] = math.Float32frombits(x)
- p.v.Set(reflect.ValueOf(&o.float32s[0]))
- o.float32s = o.float32s[1:]
- return
- }
-
- // must be enum
- p.v.Set(reflect.New(t))
- p.v.Elem().SetInt(int64(int32(x)))
-}
-
-// Get gets the bits pointed at by p, as a uint32.
-func word32_Get(p word32) uint32 {
- elem := p.v.Elem()
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32(p structPointer, f field) word32 {
- return word32{structPointer_field(p, f)}
-}
-
-// A word32Val represents a field of type int32, uint32, float32, or enum.
-// That is, v.Type() is int32, uint32, float32, or enum and v is assignable.
-type word32Val struct {
- v reflect.Value
-}
-
-// Set sets *p to x.
-func word32Val_Set(p word32Val, x uint32) {
- switch p.v.Type() {
- case int32Type:
- p.v.SetInt(int64(x))
- return
- case uint32Type:
- p.v.SetUint(uint64(x))
- return
- case float32Type:
- p.v.SetFloat(float64(math.Float32frombits(x)))
- return
- }
-
- // must be enum
- p.v.SetInt(int64(int32(x)))
-}
-
-// Get gets the bits pointed at by p, as a uint32.
-func word32Val_Get(p word32Val) uint32 {
- elem := p.v
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct.
-func structPointer_Word32Val(p structPointer, f field) word32Val {
- return word32Val{structPointer_field(p, f)}
-}
-
-// A word32Slice is a slice of 32-bit values.
-// That is, v.Type() is []int32, []uint32, []float32, or []enum.
-type word32Slice struct {
- v reflect.Value
-}
-
-func (p word32Slice) Append(x uint32) {
- n, m := p.v.Len(), p.v.Cap()
- if n < m {
- p.v.SetLen(n + 1)
- } else {
- t := p.v.Type().Elem()
- p.v.Set(reflect.Append(p.v, reflect.Zero(t)))
- }
- elem := p.v.Index(n)
- switch elem.Kind() {
- case reflect.Int32:
- elem.SetInt(int64(int32(x)))
- case reflect.Uint32:
- elem.SetUint(uint64(x))
- case reflect.Float32:
- elem.SetFloat(float64(math.Float32frombits(x)))
- }
-}
-
-func (p word32Slice) Len() int {
- return p.v.Len()
-}
-
-func (p word32Slice) Index(i int) uint32 {
- elem := p.v.Index(i)
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct.
-func structPointer_Word32Slice(p structPointer, f field) word32Slice {
- return word32Slice{structPointer_field(p, f)}
-}
-
-// word64 is like word32 but for 64-bit values.
-type word64 struct {
- v reflect.Value
-}
-
-func word64_Set(p word64, o *Buffer, x uint64) {
- t := p.v.Type().Elem()
- switch t {
- case int64Type:
- if len(o.int64s) == 0 {
- o.int64s = make([]int64, uint64PoolSize)
- }
- o.int64s[0] = int64(x)
- p.v.Set(reflect.ValueOf(&o.int64s[0]))
- o.int64s = o.int64s[1:]
- return
- case uint64Type:
- if len(o.uint64s) == 0 {
- o.uint64s = make([]uint64, uint64PoolSize)
- }
- o.uint64s[0] = x
- p.v.Set(reflect.ValueOf(&o.uint64s[0]))
- o.uint64s = o.uint64s[1:]
- return
- case float64Type:
- if len(o.float64s) == 0 {
- o.float64s = make([]float64, uint64PoolSize)
- }
- o.float64s[0] = math.Float64frombits(x)
- p.v.Set(reflect.ValueOf(&o.float64s[0]))
- o.float64s = o.float64s[1:]
- return
- }
- panic("unreachable")
-}
-
-func word64_IsNil(p word64) bool {
- return p.v.IsNil()
-}
-
-func word64_Get(p word64) uint64 {
- elem := p.v.Elem()
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return elem.Uint()
- case reflect.Float64:
- return math.Float64bits(elem.Float())
- }
- panic("unreachable")
-}
-
-func structPointer_Word64(p structPointer, f field) word64 {
- return word64{structPointer_field(p, f)}
-}
-
-// word64Val is like word32Val but for 64-bit values.
-type word64Val struct {
- v reflect.Value
-}
-
-func word64Val_Set(p word64Val, o *Buffer, x uint64) {
- switch p.v.Type() {
- case int64Type:
- p.v.SetInt(int64(x))
- return
- case uint64Type:
- p.v.SetUint(x)
- return
- case float64Type:
- p.v.SetFloat(math.Float64frombits(x))
- return
- }
- panic("unreachable")
-}
-
-func word64Val_Get(p word64Val) uint64 {
- elem := p.v
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return elem.Uint()
- case reflect.Float64:
- return math.Float64bits(elem.Float())
- }
- panic("unreachable")
-}
-
-func structPointer_Word64Val(p structPointer, f field) word64Val {
- return word64Val{structPointer_field(p, f)}
-}
-
-type word64Slice struct {
- v reflect.Value
-}
-
-func (p word64Slice) Append(x uint64) {
- n, m := p.v.Len(), p.v.Cap()
- if n < m {
- p.v.SetLen(n + 1)
- } else {
- t := p.v.Type().Elem()
- p.v.Set(reflect.Append(p.v, reflect.Zero(t)))
- }
- elem := p.v.Index(n)
- switch elem.Kind() {
- case reflect.Int64:
- elem.SetInt(int64(int64(x)))
- case reflect.Uint64:
- elem.SetUint(uint64(x))
- case reflect.Float64:
- elem.SetFloat(float64(math.Float64frombits(x)))
- }
-}
-
-func (p word64Slice) Len() int {
- return p.v.Len()
-}
-
-func (p word64Slice) Index(i int) uint64 {
- elem := p.v.Index(i)
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return uint64(elem.Uint())
- case reflect.Float64:
- return math.Float64bits(float64(elem.Float()))
- }
- panic("unreachable")
-}
-
-func structPointer_Word64Slice(p structPointer, f field) word64Slice {
- return word64Slice{structPointer_field(p, f)}
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
deleted file mode 100644
index e9be0fe92..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 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
-// 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.
-
-// +build !appengine
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
- "reflect"
- "unsafe"
-)
-
-// NOTE: These type_Foo functions would more idiomatically be methods,
-// but Go does not allow methods on pointer types, and we must preserve
-// some pointer type for the garbage collector. We use these
-// funcs with clunky names as our poor approximation to methods.
-//
-// An alternative would be
-// type structPointer struct { p unsafe.Pointer }
-// but that does not registerize as well.
-
-// A structPointer is a pointer to a struct.
-type structPointer unsafe.Pointer
-
-// toStructPointer returns a structPointer equivalent to the given reflect value.
-func toStructPointer(v reflect.Value) structPointer {
- return structPointer(unsafe.Pointer(v.Pointer()))
-}
-
-// IsNil reports whether p is nil.
-func structPointer_IsNil(p structPointer) bool {
- return p == nil
-}
-
-// Interface returns the struct pointer, assumed to have element type t,
-// as an interface value.
-func structPointer_Interface(p structPointer, t reflect.Type) interface{} {
- return reflect.NewAt(t, unsafe.Pointer(p)).Interface()
-}
-
-// A field identifies a field in a struct, accessible from a structPointer.
-// In this implementation, a field is identified by its byte offset from the start of the struct.
-type field uintptr
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return field(f.Offset)
-}
-
-// invalidField is an invalid field identifier.
-const invalidField = ^field(0)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool {
- return f != ^field(0)
-}
-
-// Bytes returns the address of a []byte field in the struct.
-func structPointer_Bytes(p structPointer, f field) *[]byte {
- return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BytesSlice returns the address of a [][]byte field in the struct.
-func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
- return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// Bool returns the address of a *bool field in the struct.
-func structPointer_Bool(p structPointer, f field) **bool {
- return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BoolVal returns the address of a bool field in the struct.
-func structPointer_BoolVal(p structPointer, f field) *bool {
- return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BoolSlice returns the address of a []bool field in the struct.
-func structPointer_BoolSlice(p structPointer, f field) *[]bool {
- return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// String returns the address of a *string field in the struct.
-func structPointer_String(p structPointer, f field) **string {
- return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StringVal returns the address of a string field in the struct.
-func structPointer_StringVal(p structPointer, f field) *string {
- return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StringSlice returns the address of a []string field in the struct.
-func structPointer_StringSlice(p structPointer, f field) *[]string {
- return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// ExtMap returns the address of an extension map field in the struct.
-func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
- return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// NewAt returns the reflect.Value for a pointer to a field in the struct.
-func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {
- return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f)))
-}
-
-// SetStructPointer writes a *struct field in the struct.
-func structPointer_SetStructPointer(p structPointer, f field, q structPointer) {
- *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q
-}
-
-// GetStructPointer reads a *struct field in the struct.
-func structPointer_GetStructPointer(p structPointer, f field) structPointer {
- return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StructPointerSlice the address of a []*struct field in the struct.
-func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice {
- return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups).
-type structPointerSlice []structPointer
-
-func (v *structPointerSlice) Len() int { return len(*v) }
-func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] }
-func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) }
-
-// A word32 is the address of a "pointer to 32-bit value" field.
-type word32 **uint32
-
-// IsNil reports whether *v is nil.
-func word32_IsNil(p word32) bool {
- return *p == nil
-}
-
-// Set sets *v to point at a newly allocated word set to x.
-func word32_Set(p word32, o *Buffer, x uint32) {
- if len(o.uint32s) == 0 {
- o.uint32s = make([]uint32, uint32PoolSize)
- }
- o.uint32s[0] = x
- *p = &o.uint32s[0]
- o.uint32s = o.uint32s[1:]
-}
-
-// Get gets the value pointed at by *v.
-func word32_Get(p word32) uint32 {
- return **p
-}
-
-// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32(p structPointer, f field) word32 {
- return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// A word32Val is the address of a 32-bit value field.
-type word32Val *uint32
-
-// Set sets *p to x.
-func word32Val_Set(p word32Val, x uint32) {
- *p = x
-}
-
-// Get gets the value pointed at by p.
-func word32Val_Get(p word32Val) uint32 {
- return *p
-}
-
-// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32Val(p structPointer, f field) word32Val {
- return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// A word32Slice is a slice of 32-bit values.
-type word32Slice []uint32
-
-func (v *word32Slice) Append(x uint32) { *v = append(*v, x) }
-func (v *word32Slice) Len() int { return len(*v) }
-func (v *word32Slice) Index(i int) uint32 { return (*v)[i] }
-
-// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct.
-func structPointer_Word32Slice(p structPointer, f field) *word32Slice {
- return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// word64 is like word32 but for 64-bit values.
-type word64 **uint64
-
-func word64_Set(p word64, o *Buffer, x uint64) {
- if len(o.uint64s) == 0 {
- o.uint64s = make([]uint64, uint64PoolSize)
- }
- o.uint64s[0] = x
- *p = &o.uint64s[0]
- o.uint64s = o.uint64s[1:]
-}
-
-func word64_IsNil(p word64) bool {
- return *p == nil
-}
-
-func word64_Get(p word64) uint64 {
- return **p
-}
-
-func structPointer_Word64(p structPointer, f field) word64 {
- return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// word64Val is like word32Val but for 64-bit values.
-type word64Val *uint64
-
-func word64Val_Set(p word64Val, o *Buffer, x uint64) {
- *p = x
-}
-
-func word64Val_Get(p word64Val) uint64 {
- return *p
-}
-
-func structPointer_Word64Val(p structPointer, f field) word64Val {
- return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// word64Slice is like word32Slice but for 64-bit values.
-type word64Slice []uint64
-
-func (v *word64Slice) Append(x uint64) { *v = append(*v, x) }
-func (v *word64Slice) Len() int { return len(*v) }
-func (v *word64Slice) Index(i int) uint64 { return (*v)[i] }
-
-func structPointer_Word64Slice(p structPointer, f field) *word64Slice {
- return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
deleted file mode 100644
index 6bc85fa98..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-// +build !appengine
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
- "reflect"
- "unsafe"
-)
-
-func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} {
- point := unsafe.Pointer(uintptr(p) + uintptr(f))
- r := reflect.NewAt(t, point)
- return r.Interface()
-}
-
-func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} {
- point := unsafe.Pointer(uintptr(p) + uintptr(f))
- r := reflect.NewAt(t, point)
- if r.Elem().IsNil() {
- return nil
- }
- return r.Elem().Interface()
-}
-
-func copyUintPtr(oldptr, newptr uintptr, size int) {
- oldbytes := make([]byte, 0)
- oldslice := (*reflect.SliceHeader)(unsafe.Pointer(&oldbytes))
- oldslice.Data = oldptr
- oldslice.Len = size
- oldslice.Cap = size
- newbytes := make([]byte, 0)
- newslice := (*reflect.SliceHeader)(unsafe.Pointer(&newbytes))
- newslice.Data = newptr
- newslice.Len = size
- newslice.Cap = size
- copy(newbytes, oldbytes)
-}
-
-func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) {
- copyUintPtr(uintptr(oldptr), uintptr(newptr), size)
-}
-
-func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer {
- size := typ.Elem().Size()
- oldHeader := structPointer_GetSliceHeader(base, f)
- newLen := oldHeader.Len + 1
- slice := reflect.MakeSlice(typ, newLen, newLen)
- bas := toStructPointer(slice)
- for i := 0; i < oldHeader.Len; i++ {
- newElemptr := uintptr(bas) + uintptr(i)*size
- oldElemptr := oldHeader.Data + uintptr(i)*size
- copyUintPtr(oldElemptr, newElemptr, int(size))
- }
-
- oldHeader.Data = uintptr(bas)
- oldHeader.Len = newLen
- oldHeader.Cap = newLen
-
- return structPointer(unsafe.Pointer(uintptr(unsafe.Pointer(bas)) + uintptr(uintptr(newLen-1)*size)))
-}
-
-func structPointer_FieldPointer(p structPointer, f field) structPointer {
- return structPointer(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-func structPointer_GetRefStructPointer(p structPointer, f field) structPointer {
- return structPointer((*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader {
- return (*reflect.SliceHeader)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-func structPointer_Add(p structPointer, size field) structPointer {
- return structPointer(unsafe.Pointer(uintptr(p) + uintptr(size)))
-}
-
-func structPointer_Len(p structPointer, f field) int {
- return len(*(*[]interface{})(unsafe.Pointer(structPointer_GetRefStructPointer(p, f))))
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties.go
deleted file mode 100644
index 5e6a0b3ba..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties.go
+++ /dev/null
@@ -1,923 +0,0 @@
-// Extensions for Protocol Buffers to create more go like structures.
-//
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "fmt"
- "log"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
-)
-
-const debug bool = false
-
-// Constants that identify the encoding of a value on the wire.
-const (
- WireVarint = 0
- WireFixed64 = 1
- WireBytes = 2
- WireStartGroup = 3
- WireEndGroup = 4
- WireFixed32 = 5
-)
-
-const startSize = 10 // initial slice/string sizes
-
-// Encoders are defined in encode.go
-// An encoder outputs the full representation of a field, including its
-// tag and encoder type.
-type encoder func(p *Buffer, prop *Properties, base structPointer) error
-
-// A valueEncoder encodes a single integer in a particular encoding.
-type valueEncoder func(o *Buffer, x uint64) error
-
-// Sizers are defined in encode.go
-// A sizer returns the encoded size of a field, including its tag and encoder
-// type.
-type sizer func(prop *Properties, base structPointer) int
-
-// A valueSizer returns the encoded size of a single integer in a particular
-// encoding.
-type valueSizer func(x uint64) int
-
-// Decoders are defined in decode.go
-// A decoder creates a value from its wire representation.
-// Unrecognized subelements are saved in unrec.
-type decoder func(p *Buffer, prop *Properties, base structPointer) error
-
-// A valueDecoder decodes a single integer in a particular encoding.
-type valueDecoder func(o *Buffer) (x uint64, err error)
-
-// A oneofMarshaler does the marshaling for all oneof fields in a message.
-type oneofMarshaler func(Message, *Buffer) error
-
-// A oneofUnmarshaler does the unmarshaling for a oneof field in a message.
-type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error)
-
-// A oneofSizer does the sizing for all oneof fields in a message.
-type oneofSizer func(Message) int
-
-// tagMap is an optimization over map[int]int for typical protocol buffer
-// use-cases. Encoded protocol buffers are often in tag order with small tag
-// numbers.
-type tagMap struct {
- fastTags []int
- slowTags map[int]int
-}
-
-// tagMapFastLimit is the upper bound on the tag number that will be stored in
-// the tagMap slice rather than its map.
-const tagMapFastLimit = 1024
-
-func (p *tagMap) get(t int) (int, bool) {
- if t > 0 && t < tagMapFastLimit {
- if t >= len(p.fastTags) {
- return 0, false
- }
- fi := p.fastTags[t]
- return fi, fi >= 0
- }
- fi, ok := p.slowTags[t]
- return fi, ok
-}
-
-func (p *tagMap) put(t int, fi int) {
- if t > 0 && t < tagMapFastLimit {
- for len(p.fastTags) < t+1 {
- p.fastTags = append(p.fastTags, -1)
- }
- p.fastTags[t] = fi
- return
- }
- if p.slowTags == nil {
- p.slowTags = make(map[int]int)
- }
- p.slowTags[t] = fi
-}
-
-// StructProperties represents properties for all the fields of a struct.
-// decoderTags and decoderOrigNames should only be used by the decoder.
-type StructProperties struct {
- Prop []*Properties // properties for each field
- reqCount int // required count
- decoderTags tagMap // map from proto tag to struct field number
- decoderOrigNames map[string]int // map from original name to struct field number
- order []int // list of struct field numbers in tag order
- unrecField field // field id of the XXX_unrecognized []byte field
- extendable bool // is this an extendable proto
-
- oneofMarshaler oneofMarshaler
- oneofUnmarshaler oneofUnmarshaler
- oneofSizer oneofSizer
- stype reflect.Type
-
- // OneofTypes contains information about the oneof fields in this message.
- // It is keyed by the original name of a field.
- OneofTypes map[string]*OneofProperties
-}
-
-// OneofProperties represents information about a specific field in a oneof.
-type OneofProperties struct {
- Type reflect.Type // pointer to generated struct type for this oneof field
- Field int // struct field number of the containing oneof in the message
- Prop *Properties
-}
-
-// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.
-// See encode.go, (*Buffer).enc_struct.
-
-func (sp *StructProperties) Len() int { return len(sp.order) }
-func (sp *StructProperties) Less(i, j int) bool {
- return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag
-}
-func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }
-
-// Properties represents the protocol-specific behavior of a single struct field.
-type Properties struct {
- Name string // name of the field, for error messages
- OrigName string // original name before protocol compiler (always set)
- JSONName string // name to use for JSON; determined by protoc
- Wire string
- WireType int
- Tag int
- Required bool
- Optional bool
- 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
- oneof bool // whether this is a oneof field
-
- Default string // default value
- HasDefault bool // whether an explicit default was provided
- CustomType string
- def_uint64 uint64
-
- enc encoder
- valEnc valueEncoder // set for bool and numeric types only
- field field
- tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType)
- tagbuf [8]byte
- stype reflect.Type // set for struct types only
- sstype reflect.Type // set for slices of structs types only
- ctype reflect.Type // set for custom types only
- sprop *StructProperties // set for struct types only
- isMarshaler bool
- isUnmarshaler bool
-
- mtype reflect.Type // set for map types only
- mkeyprop *Properties // set for map types only
- mvalprop *Properties // set for map types only
-
- size sizer
- valSize valueSizer // set for bool and numeric types only
-
- dec decoder
- valDec valueDecoder // set for bool and numeric types only
-
- // If this is a packable field, this will be the decoder for the packed version of the field.
- packedDec decoder
-}
-
-// String formats the properties in the protobuf struct field tag style.
-func (p *Properties) String() string {
- s := p.Wire
- s = ","
- s += strconv.Itoa(p.Tag)
- if p.Required {
- s += ",req"
- }
- if p.Optional {
- s += ",opt"
- }
- if p.Repeated {
- s += ",rep"
- }
- if p.Packed {
- s += ",packed"
- }
- s += ",name=" + p.OrigName
- if p.JSONName != p.OrigName {
- s += ",json=" + p.JSONName
- }
- if p.proto3 {
- s += ",proto3"
- }
- if p.oneof {
- s += ",oneof"
- }
- if len(p.Enum) > 0 {
- s += ",enum=" + p.Enum
- }
- if p.HasDefault {
- s += ",def=" + p.Default
- }
- return s
-}
-
-// Parse populates p by parsing a string in the protobuf struct field tag style.
-func (p *Properties) Parse(s string) {
- // "bytes,49,opt,name=foo,def=hello!"
- fields := strings.Split(s, ",") // breaks def=, but handled below.
- if len(fields) < 2 {
- fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
- return
- }
-
- p.Wire = fields[0]
- switch p.Wire {
- case "varint":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeVarint
- p.valDec = (*Buffer).DecodeVarint
- p.valSize = sizeVarint
- case "fixed32":
- p.WireType = WireFixed32
- p.valEnc = (*Buffer).EncodeFixed32
- p.valDec = (*Buffer).DecodeFixed32
- p.valSize = sizeFixed32
- case "fixed64":
- p.WireType = WireFixed64
- p.valEnc = (*Buffer).EncodeFixed64
- p.valDec = (*Buffer).DecodeFixed64
- p.valSize = sizeFixed64
- case "zigzag32":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeZigzag32
- p.valDec = (*Buffer).DecodeZigzag32
- p.valSize = sizeZigzag32
- case "zigzag64":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeZigzag64
- p.valDec = (*Buffer).DecodeZigzag64
- p.valSize = sizeZigzag64
- case "bytes", "group":
- p.WireType = WireBytes
- // no numeric converter for non-numeric types
- default:
- fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s)
- return
- }
-
- var err error
- p.Tag, err = strconv.Atoi(fields[1])
- if err != nil {
- return
- }
-
- for i := 2; i < len(fields); i++ {
- f := fields[i]
- switch {
- case f == "req":
- p.Required = true
- case f == "opt":
- p.Optional = true
- case f == "rep":
- p.Repeated = true
- case f == "packed":
- p.Packed = true
- case strings.HasPrefix(f, "name="):
- p.OrigName = f[5:]
- case strings.HasPrefix(f, "json="):
- p.JSONName = f[5:]
- case strings.HasPrefix(f, "enum="):
- p.Enum = f[5:]
- case f == "proto3":
- p.proto3 = true
- case f == "oneof":
- p.oneof = true
- case strings.HasPrefix(f, "def="):
- p.HasDefault = true
- p.Default = f[4:] // rest of string
- if i+1 < len(fields) {
- // Commas aren't escaped, and def is always last.
- p.Default += "," + strings.Join(fields[i+1:], ",")
- break
- }
- case strings.HasPrefix(f, "embedded="):
- p.OrigName = strings.Split(f, "=")[1]
- case strings.HasPrefix(f, "customtype="):
- p.CustomType = strings.Split(f, "=")[1]
- }
- }
-}
-
-func logNoSliceEnc(t1, t2 reflect.Type) {
- fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2)
-}
-
-var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()
-
-// Initialize the fields for encoding and decoding.
-func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {
- p.enc = nil
- p.dec = nil
- p.size = nil
- if len(p.CustomType) > 0 {
- p.setCustomEncAndDec(typ)
- p.setTag(lockGetProp)
- return
- }
- switch t1 := typ; t1.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1)
-
- // proto3 scalar types
-
- case reflect.Bool:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_bool
- p.dec = (*Buffer).dec_proto3_bool
- p.size = size_proto3_bool
- } else {
- p.enc = (*Buffer).enc_ref_bool
- p.dec = (*Buffer).dec_proto3_bool
- p.size = size_ref_bool
- }
- case reflect.Int32:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_int32
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_proto3_int32
- } else {
- p.enc = (*Buffer).enc_ref_int32
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_ref_int32
- }
- case reflect.Uint32:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_uint32
- p.dec = (*Buffer).dec_proto3_int32 // can reuse
- p.size = size_proto3_uint32
- } else {
- p.enc = (*Buffer).enc_ref_uint32
- p.dec = (*Buffer).dec_proto3_int32 // can reuse
- p.size = size_ref_uint32
- }
- case reflect.Int64, reflect.Uint64:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_int64
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_proto3_int64
- } else {
- p.enc = (*Buffer).enc_ref_int64
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_ref_int64
- }
- case reflect.Float32:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_proto3_uint32
- } else {
- p.enc = (*Buffer).enc_ref_uint32 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_ref_uint32
- }
- case reflect.Float64:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_proto3_int64
- } else {
- p.enc = (*Buffer).enc_ref_int64 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_ref_int64
- }
- case reflect.String:
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_string
- p.dec = (*Buffer).dec_proto3_string
- p.size = size_proto3_string
- } else {
- p.enc = (*Buffer).enc_ref_string
- p.dec = (*Buffer).dec_proto3_string
- p.size = size_ref_string
- }
- case reflect.Struct:
- p.stype = typ
- p.isMarshaler = isMarshaler(typ)
- p.isUnmarshaler = isUnmarshaler(typ)
- if p.Wire == "bytes" {
- p.enc = (*Buffer).enc_ref_struct_message
- p.dec = (*Buffer).dec_ref_struct_message
- p.size = size_ref_struct_message
- } else {
- fmt.Fprintf(os.Stderr, "proto: no coders for struct %T\n", typ)
- }
-
- case reflect.Ptr:
- switch t2 := t1.Elem(); t2.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2)
- break
- case reflect.Bool:
- p.enc = (*Buffer).enc_bool
- p.dec = (*Buffer).dec_bool
- p.size = size_bool
- case reflect.Int32:
- p.enc = (*Buffer).enc_int32
- p.dec = (*Buffer).dec_int32
- p.size = size_int32
- case reflect.Uint32:
- p.enc = (*Buffer).enc_uint32
- p.dec = (*Buffer).dec_int32 // can reuse
- p.size = size_uint32
- case reflect.Int64, reflect.Uint64:
- p.enc = (*Buffer).enc_int64
- p.dec = (*Buffer).dec_int64
- p.size = size_int64
- case reflect.Float32:
- p.enc = (*Buffer).enc_uint32 // can just treat them as bits
- p.dec = (*Buffer).dec_int32
- p.size = size_uint32
- case reflect.Float64:
- p.enc = (*Buffer).enc_int64 // can just treat them as bits
- p.dec = (*Buffer).dec_int64
- p.size = size_int64
- case reflect.String:
- p.enc = (*Buffer).enc_string
- p.dec = (*Buffer).dec_string
- p.size = size_string
- case reflect.Struct:
- p.stype = t1.Elem()
- p.isMarshaler = isMarshaler(t1)
- p.isUnmarshaler = isUnmarshaler(t1)
- if p.Wire == "bytes" {
- p.enc = (*Buffer).enc_struct_message
- p.dec = (*Buffer).dec_struct_message
- p.size = size_struct_message
- } else {
- p.enc = (*Buffer).enc_struct_group
- p.dec = (*Buffer).dec_struct_group
- p.size = size_struct_group
- }
- }
-
- case reflect.Slice:
- switch t2 := t1.Elem(); t2.Kind() {
- default:
- logNoSliceEnc(t1, t2)
- break
- case reflect.Bool:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_bool
- p.size = size_slice_packed_bool
- } else {
- p.enc = (*Buffer).enc_slice_bool
- p.size = size_slice_bool
- }
- p.dec = (*Buffer).dec_slice_bool
- p.packedDec = (*Buffer).dec_slice_packed_bool
- case reflect.Int32:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int32
- p.size = size_slice_packed_int32
- } else {
- p.enc = (*Buffer).enc_slice_int32
- p.size = size_slice_int32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case reflect.Uint32:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_uint32
- p.size = size_slice_packed_uint32
- } else {
- p.enc = (*Buffer).enc_slice_uint32
- p.size = size_slice_uint32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case reflect.Int64, reflect.Uint64:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int64
- p.size = size_slice_packed_int64
- } else {
- p.enc = (*Buffer).enc_slice_int64
- p.size = size_slice_int64
- }
- p.dec = (*Buffer).dec_slice_int64
- p.packedDec = (*Buffer).dec_slice_packed_int64
- case reflect.Uint8:
- p.enc = (*Buffer).enc_slice_byte
- p.dec = (*Buffer).dec_slice_byte
- p.size = size_slice_byte
- // This is a []byte, which is either a bytes field,
- // or the value of a map field. In the latter case,
- // we always encode an empty []byte, so we should not
- // use the proto3 enc/size funcs.
- // f == nil iff this is the key/value of a map field.
- if p.proto3 && f != nil {
- p.enc = (*Buffer).enc_proto3_slice_byte
- p.size = size_proto3_slice_byte
- }
- case reflect.Float32, reflect.Float64:
- switch t2.Bits() {
- case 32:
- // can just treat them as bits
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_uint32
- p.size = size_slice_packed_uint32
- } else {
- p.enc = (*Buffer).enc_slice_uint32
- p.size = size_slice_uint32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case 64:
- // can just treat them as bits
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int64
- p.size = size_slice_packed_int64
- } else {
- p.enc = (*Buffer).enc_slice_int64
- p.size = size_slice_int64
- }
- p.dec = (*Buffer).dec_slice_int64
- p.packedDec = (*Buffer).dec_slice_packed_int64
- default:
- logNoSliceEnc(t1, t2)
- break
- }
- case reflect.String:
- p.enc = (*Buffer).enc_slice_string
- p.dec = (*Buffer).dec_slice_string
- p.size = size_slice_string
- case reflect.Ptr:
- switch t3 := t2.Elem(); t3.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3)
- break
- case reflect.Struct:
- p.stype = t2.Elem()
- p.isMarshaler = isMarshaler(t2)
- p.isUnmarshaler = isUnmarshaler(t2)
- if p.Wire == "bytes" {
- p.enc = (*Buffer).enc_slice_struct_message
- p.dec = (*Buffer).dec_slice_struct_message
- p.size = size_slice_struct_message
- } else {
- p.enc = (*Buffer).enc_slice_struct_group
- p.dec = (*Buffer).dec_slice_struct_group
- p.size = size_slice_struct_group
- }
- }
- case reflect.Slice:
- switch t2.Elem().Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem())
- break
- case reflect.Uint8:
- p.enc = (*Buffer).enc_slice_slice_byte
- p.dec = (*Buffer).dec_slice_slice_byte
- p.size = size_slice_slice_byte
- }
- case reflect.Struct:
- p.setSliceOfNonPointerStructs(t1)
- }
-
- case reflect.Map:
- p.enc = (*Buffer).enc_new_map
- p.dec = (*Buffer).dec_new_map
- p.size = size_new_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{}
- 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.setTag(lockGetProp)
-}
-
-func (p *Properties) setTag(lockGetProp bool) {
- // precalculate tag code
- wire := p.WireType
- if p.Packed {
- wire = WireBytes
- }
- x := uint32(p.Tag)<<3 | uint32(wire)
- i := 0
- for i = 0; x > 127; i++ {
- p.tagbuf[i] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- p.tagbuf[i] = uint8(x)
- p.tagcode = p.tagbuf[0 : i+1]
-
- if p.stype != nil {
- if lockGetProp {
- p.sprop = GetProperties(p.stype)
- } else {
- p.sprop = getPropertiesLocked(p.stype)
- }
- }
-}
-
-var (
- marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
- unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem()
-)
-
-// isMarshaler reports whether type t implements Marshaler.
-func isMarshaler(t reflect.Type) bool {
- return t.Implements(marshalerType)
-}
-
-// isUnmarshaler reports whether type t implements Unmarshaler.
-func isUnmarshaler(t reflect.Type) bool {
- return t.Implements(unmarshalerType)
-}
-
-// Init populates the properties from a protocol buffer struct tag.
-func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
- p.init(typ, name, tag, f, true)
-}
-
-func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {
- // "bytes,49,opt,def=hello!"
- p.Name = name
- p.OrigName = name
- if f != nil {
- p.field = toField(f)
- }
- if tag == "" {
- return
- }
- p.Parse(tag)
- p.setEncAndDec(typ, f, lockGetProp)
-}
-
-var (
- propertiesMu sync.RWMutex
- propertiesMap = make(map[reflect.Type]*StructProperties)
-)
-
-// GetProperties returns the list of properties for the type represented by t.
-// t must represent a generated struct type of a protocol message.
-func GetProperties(t reflect.Type) *StructProperties {
- if t.Kind() != reflect.Struct {
- panic("proto: type must have kind struct")
- }
-
- // Most calls to GetProperties in a long-running program will be
- // retrieving details for types we have seen before.
- propertiesMu.RLock()
- sprop, ok := propertiesMap[t]
- propertiesMu.RUnlock()
- if ok {
- if collectStats {
- stats.Chit++
- }
- return sprop
- }
-
- propertiesMu.Lock()
- sprop = getPropertiesLocked(t)
- propertiesMu.Unlock()
- return sprop
-}
-
-// getPropertiesLocked requires that propertiesMu is held.
-func getPropertiesLocked(t reflect.Type) *StructProperties {
- if prop, ok := propertiesMap[t]; ok {
- if collectStats {
- stats.Chit++
- }
- return prop
- }
- if collectStats {
- stats.Cmiss++
- }
-
- prop := new(StructProperties)
- // in case of recursive protos, fill this in now.
- propertiesMap[t] = prop
-
- // build properties
- prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType)
- prop.unrecField = invalidField
- prop.Prop = make([]*Properties, t.NumField())
- prop.order = make([]int, t.NumField())
-
- isOneofMessage := false
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- p := new(Properties)
- name := f.Name
- p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
-
- if f.Name == "XXX_extensions" { // special case
- if len(f.Tag.Get("protobuf")) > 0 {
- p.enc = (*Buffer).enc_ext_slice_byte
- p.dec = nil // not needed
- p.size = size_ext_slice_byte
- } else {
- p.enc = (*Buffer).enc_map
- p.dec = nil // not needed
- p.size = size_map
- }
- }
- if f.Name == "XXX_unrecognized" { // special case
- prop.unrecField = toField(&f)
- }
- oneof := f.Tag.Get("protobuf_oneof") != "" // special case
- if oneof {
- isOneofMessage = true
- }
- prop.Prop[i] = p
- prop.order[i] = i
- if debug {
- print(i, " ", f.Name, " ", t.String(), " ")
- if p.Tag > 0 {
- print(p.String())
- }
- print("\n")
- }
- if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && !oneof {
- fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]")
- }
- }
-
- // Re-order prop.order.
- sort.Sort(prop)
-
- type oneofMessage interface {
- XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
- }
- if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok {
- var oots []interface{}
- prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs()
- prop.stype = t
-
- // Interpret oneof metadata.
- prop.OneofTypes = make(map[string]*OneofProperties)
- for _, oot := range oots {
- oop := &OneofProperties{
- Type: reflect.ValueOf(oot).Type(), // *T
- Prop: new(Properties),
- }
- sft := oop.Type.Elem().Field(0)
- oop.Prop.Name = sft.Name
- oop.Prop.Parse(sft.Tag.Get("protobuf"))
- // There will be exactly one interface field that
- // this new value is assignable to.
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if f.Type.Kind() != reflect.Interface {
- continue
- }
- if !oop.Type.AssignableTo(f.Type) {
- continue
- }
- oop.Field = i
- break
- }
- prop.OneofTypes[oop.Prop.OrigName] = oop
- }
- }
-
- // build required counts
- // build tags
- reqCount := 0
- prop.decoderOrigNames = make(map[string]int)
- for i, p := range prop.Prop {
- if strings.HasPrefix(p.Name, "XXX_") {
- // Internal fields should not appear in tags/origNames maps.
- // They are handled specially when encoding and decoding.
- continue
- }
- if p.Required {
- reqCount++
- }
- prop.decoderTags.put(p.Tag, i)
- prop.decoderOrigNames[p.OrigName] = i
- }
- prop.reqCount = reqCount
-
- return prop
-}
-
-// Return the Properties object for the x[0]'th field of the structure.
-func propByIndex(t reflect.Type, x []int) *Properties {
- if len(x) != 1 {
- fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t)
- return nil
- }
- prop := GetProperties(t)
- return prop.Prop[x[0]]
-}
-
-// Get the address and type of a pointer to a struct from an interface.
-func getbase(pb Message) (t reflect.Type, b structPointer, err error) {
- if pb == nil {
- err = ErrNil
- return
- }
- // get the reflect type of the pointer to the struct.
- t = reflect.TypeOf(pb)
- // get the address of the struct.
- value := reflect.ValueOf(pb)
- b = toStructPointer(value)
- return
-}
-
-// A global registry of enum types.
-// The generated code will register the generated maps by calling RegisterEnum.
-
-var enumValueMaps = make(map[string]map[string]int32)
-var enumStringMaps = make(map[string]map[int32]string)
-
-// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing text format protocol buffers.
-func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
- if _, ok := enumValueMaps[typeName]; ok {
- panic("proto: duplicate enum registered: " + typeName)
- }
- enumValueMaps[typeName] = valueMap
- if _, ok := enumStringMaps[typeName]; ok {
- panic("proto: duplicate enum registered: " + typeName)
- }
- enumStringMaps[typeName] = unusedNameMap
-}
-
-// EnumValueMap returns the mapping from names to integers of the
-// enum type enumType, or a nil if not found.
-func EnumValueMap(enumType string) map[string]int32 {
- return enumValueMaps[enumType]
-}
-
-// A registry of all linked message types.
-// The string is a fully-qualified proto name ("pkg.Message").
-var (
- protoTypes = make(map[string]reflect.Type)
- revProtoTypes = make(map[reflect.Type]string)
-)
-
-// RegisterType is called from generated code and maps from the fully qualified
-// proto name to the type (pointer to struct) of the protocol buffer.
-func RegisterType(x Message, name string) {
- if _, ok := protoTypes[name]; ok {
- // TODO: Some day, make this a panic.
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- protoTypes[name] = t
- revProtoTypes[t] = name
-}
-
-// MessageName returns the fully-qualified proto name for the given message type.
-func MessageName(x Message) string { return revProtoTypes[reflect.TypeOf(x)] }
-
-// MessageType returns the message type (pointer to struct) for a named message.
-func MessageType(name string) reflect.Type { return protoTypes[name] }
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties_gogo.go
deleted file mode 100644
index 8daf9f776..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/properties_gogo.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "fmt"
- "os"
- "reflect"
-)
-
-func (p *Properties) setCustomEncAndDec(typ reflect.Type) {
- p.ctype = typ
- if p.Repeated {
- p.enc = (*Buffer).enc_custom_slice_bytes
- p.dec = (*Buffer).dec_custom_slice_bytes
- p.size = size_custom_slice_bytes
- } else if typ.Kind() == reflect.Ptr {
- p.enc = (*Buffer).enc_custom_bytes
- p.dec = (*Buffer).dec_custom_bytes
- p.size = size_custom_bytes
- } else {
- p.enc = (*Buffer).enc_custom_ref_bytes
- p.dec = (*Buffer).dec_custom_ref_bytes
- p.size = size_custom_ref_bytes
- }
-}
-
-func (p *Properties) setSliceOfNonPointerStructs(typ reflect.Type) {
- t2 := typ.Elem()
- p.sstype = typ
- p.stype = t2
- p.isMarshaler = isMarshaler(t2)
- p.isUnmarshaler = isUnmarshaler(t2)
- p.enc = (*Buffer).enc_slice_ref_struct_message
- p.dec = (*Buffer).dec_slice_ref_struct_message
- p.size = size_slice_ref_struct_message
- if p.Wire != "bytes" {
- fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T \n", typ, t2)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/skip_gogo.go
deleted file mode 100644
index 4fe7e0815..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/skip_gogo.go
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "fmt"
- "io"
-)
-
-func Skip(data []byte) (n int, err error) {
- l := len(data)
- index := 0
- for index < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if index >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[index]
- index++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for {
- if index >= l {
- return 0, io.ErrUnexpectedEOF
- }
- index++
- if data[index-1] < 0x80 {
- break
- }
- }
- return index, nil
- case 1:
- index += 8
- return index, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if index >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[index]
- index++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- index += length
- return index, nil
- case 3:
- for {
- var innerWire uint64
- var start int = index
- for shift := uint(0); ; shift += 7 {
- if index >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := data[index]
- index++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := Skip(data[start:])
- if err != nil {
- return 0, err
- }
- index = start + next
- }
- return index, nil
- case 4:
- return index, nil
- case 5:
- index += 4
- return index, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text.go
deleted file mode 100644
index b60be28ab..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text.go
+++ /dev/null
@@ -1,805 +0,0 @@
-// Extensions for Protocol Buffers to create more go like structures.
-//
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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
-// 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.
-
-package proto
-
-// Functions for writing the text protocol buffer format.
-
-import (
- "bufio"
- "bytes"
- "encoding"
- "errors"
- "fmt"
- "io"
- "log"
- "math"
- "reflect"
- "sort"
- "strings"
-)
-
-var (
- newline = []byte("\n")
- spaces = []byte(" ")
- gtNewline = []byte(">\n")
- endBraceNewline = []byte("}\n")
- backslashN = []byte{'\\', 'n'}
- backslashR = []byte{'\\', 'r'}
- backslashT = []byte{'\\', 't'}
- backslashDQ = []byte{'\\', '"'}
- backslashBS = []byte{'\\', '\\'}
- posInf = []byte("inf")
- negInf = []byte("-inf")
- nan = []byte("nan")
-)
-
-type writer interface {
- io.Writer
- WriteByte(byte) error
-}
-
-// textWriter is an io.Writer that tracks its indentation level.
-type textWriter struct {
- ind int
- complete bool // if the current position is a complete line
- compact bool // whether to write out as a one-liner
- w writer
-}
-
-func (w *textWriter) WriteString(s string) (n int, err error) {
- if !strings.Contains(s, "\n") {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- w.complete = false
- return io.WriteString(w.w, s)
- }
- // WriteString is typically called without newlines, so this
- // codepath and its copy are rare. We copy to avoid
- // duplicating all of Write's logic here.
- return w.Write([]byte(s))
-}
-
-func (w *textWriter) Write(p []byte) (n int, err error) {
- newlines := bytes.Count(p, newline)
- if newlines == 0 {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- n, err = w.w.Write(p)
- w.complete = false
- return n, err
- }
-
- frags := bytes.SplitN(p, newline, newlines+1)
- if w.compact {
- for i, frag := range frags {
- if i > 0 {
- if err := w.w.WriteByte(' '); err != nil {
- return n, err
- }
- n++
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- }
- return n, nil
- }
-
- for i, frag := range frags {
- if w.complete {
- w.writeIndent()
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- if i+1 < len(frags) {
- if err := w.w.WriteByte('\n'); err != nil {
- return n, err
- }
- n++
- }
- }
- w.complete = len(frags[len(frags)-1]) == 0
- return n, nil
-}
-
-func (w *textWriter) WriteByte(c byte) error {
- if w.compact && c == '\n' {
- c = ' '
- }
- if !w.compact && w.complete {
- w.writeIndent()
- }
- err := w.w.WriteByte(c)
- w.complete = c == '\n'
- return err
-}
-
-func (w *textWriter) indent() { w.ind++ }
-
-func (w *textWriter) unindent() {
- if w.ind == 0 {
- log.Printf("proto: textWriter unindented too far")
- return
- }
- w.ind--
-}
-
-func writeName(w *textWriter, props *Properties) error {
- if _, err := w.WriteString(props.OrigName); err != nil {
- return err
- }
- if props.Wire != "group" {
- return w.WriteByte(':')
- }
- return nil
-}
-
-// raw is the interface satisfied by RawMessage.
-type raw interface {
- Bytes() []byte
-}
-
-func writeStruct(w *textWriter, sv reflect.Value) error {
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < sv.NumField(); i++ {
- fv := sv.Field(i)
- props := sprops.Prop[i]
- name := st.Field(i).Name
-
- if strings.HasPrefix(name, "XXX_") {
- // There are two XXX_ fields:
- // XXX_unrecognized []byte
- // XXX_extensions map[int32]proto.Extension
- // The first is handled here;
- // the second is handled at the bottom of this function.
- if name == "XXX_unrecognized" && !fv.IsNil() {
- if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Field not filled in. This could be an optional field or
- // a required field that wasn't filled in. Either way, there
- // isn't anything we can show for it.
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- // Repeated field that is empty, or a bytes field that is unused.
- continue
- }
-
- if props.Repeated && fv.Kind() == reflect.Slice {
- // Repeated field.
- for j := 0; j < fv.Len(); j++ {
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- v := fv.Index(j)
- if v.Kind() == reflect.Ptr && v.IsNil() {
- // A nil message in a repeated field is not valid,
- // but we can handle that more gracefully than panicking.
- if _, err := w.Write([]byte("\n")); err != nil {
- return err
- }
- continue
- }
- if len(props.Enum) > 0 {
- if err := writeEnum(w, v, props); err != nil {
- return err
- }
- } else if err := writeAny(w, v, props); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Map {
- // Map fields are rendered as a repeated struct with key/value fields.
- keys := fv.MapKeys()
- sort.Sort(mapKeys(keys))
- for _, key := range keys {
- val := fv.MapIndex(key)
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- // open struct
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- // key
- if _, err := w.WriteString("key:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := writeAny(w, key, props.mkeyprop); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- // nil values aren't legal, but we can avoid panicking because of them.
- if val.Kind() != reflect.Ptr || !val.IsNil() {
- // value
- if _, err := w.WriteString("value:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := writeAny(w, val, props.mvalprop); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- // close struct
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {
- // empty bytes field
- continue
- }
- if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {
- // proto3 non-repeated scalar field; skip if zero value
- if isProto3Zero(fv) {
- continue
- }
- }
-
- if fv.Kind() == reflect.Interface {
- // Check if it is a oneof.
- if st.Field(i).Tag.Get("protobuf_oneof") != "" {
- // fv is nil, or holds a pointer to generated struct.
- // That generated struct has exactly one field,
- // which has a protobuf struct tag.
- if fv.IsNil() {
- continue
- }
- inner := fv.Elem().Elem() // interface -> *T -> T
- tag := inner.Type().Field(0).Tag.Get("protobuf")
- props = new(Properties) // Overwrite the outer props var, but not its pointee.
- props.Parse(tag)
- // Write the value in the oneof, not the oneof itself.
- fv = inner.Field(0)
-
- // Special case to cope with malformed messages gracefully:
- // If the value in the oneof is a nil pointer, don't panic
- // in writeAny.
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Use errors.New so writeAny won't render quotes.
- msg := errors.New("/* nil */")
- fv = reflect.ValueOf(&msg).Elem()
- }
- }
- }
-
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if b, ok := fv.Interface().(raw); ok {
- if err := writeRaw(w, b.Bytes()); err != nil {
- return err
- }
- continue
- }
-
- if len(props.Enum) > 0 {
- if err := writeEnum(w, fv, props); err != nil {
- return err
- }
- } else if err := writeAny(w, fv, props); err != nil {
- return err
- }
-
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
-
- // Extensions (the XXX_extensions field).
- pv := sv
- if pv.CanAddr() {
- pv = sv.Addr()
- } else {
- pv = reflect.New(sv.Type())
- pv.Elem().Set(sv)
- }
- if pv.Type().Implements(extendableProtoType) {
- if err := writeExtensions(w, pv); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// writeRaw writes an uninterpreted raw message.
-func writeRaw(w *textWriter, b []byte) error {
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if err := writeUnknownStruct(w, b); err != nil {
- return err
- }
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- return nil
-}
-
-// writeAny writes an arbitrary field.
-func writeAny(w *textWriter, v reflect.Value, props *Properties) error {
- v = reflect.Indirect(v)
-
- if props != nil && len(props.CustomType) > 0 {
- custom, ok := v.Interface().(Marshaler)
- if ok {
- data, err := custom.Marshal()
- if err != nil {
- return err
- }
- if err := writeString(w, string(data)); err != nil {
- return err
- }
- return nil
- }
- }
-
- // Floats have special cases.
- if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {
- x := v.Float()
- var b []byte
- switch {
- case math.IsInf(x, 1):
- b = posInf
- case math.IsInf(x, -1):
- b = negInf
- case math.IsNaN(x):
- b = nan
- }
- if b != nil {
- _, err := w.Write(b)
- return err
- }
- // Other values are handled below.
- }
-
- // We don't attempt to serialise every possible value type; only those
- // that can occur in protocol buffers.
- switch v.Kind() {
- case reflect.Slice:
- // Should only be a []byte; repeated fields are handled in writeStruct.
- if err := writeString(w, string(v.Bytes())); err != nil {
- return err
- }
- case reflect.String:
- if err := writeString(w, v.String()); err != nil {
- return err
- }
- case reflect.Struct:
- // Required/optional group/message.
- var bra, ket byte = '<', '>'
- if props != nil && props.Wire == "group" {
- bra, ket = '{', '}'
- }
- if err := w.WriteByte(bra); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if tm, ok := v.Interface().(encoding.TextMarshaler); ok {
- text, err := tm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = w.Write(text); err != nil {
- return err
- }
- } else if err := writeStruct(w, v); err != nil {
- return err
- }
- w.unindent()
- if err := w.WriteByte(ket); err != nil {
- return err
- }
- default:
- _, err := fmt.Fprint(w, v.Interface())
- return err
- }
- return nil
-}
-
-// equivalent to C's isprint.
-func isprint(c byte) bool {
- return c >= 0x20 && c < 0x7f
-}
-
-// writeString writes a string in the protocol buffer text format.
-// It is similar to strconv.Quote except we don't use Go escape sequences,
-// we treat the string as a byte sequence, and we use octal escapes.
-// These differences are to maintain interoperability with the other
-// languages' implementations of the text format.
-func writeString(w *textWriter, s string) error {
- // use WriteByte here to get any needed indent
- if err := w.WriteByte('"'); err != nil {
- return err
- }
- // Loop over the bytes, not the runes.
- for i := 0; i < len(s); i++ {
- var err error
- // Divergence from C++: we don't escape apostrophes.
- // There's no need to escape them, and the C++ parser
- // copes with a naked apostrophe.
- switch c := s[i]; c {
- case '\n':
- _, err = w.w.Write(backslashN)
- case '\r':
- _, err = w.w.Write(backslashR)
- case '\t':
- _, err = w.w.Write(backslashT)
- case '"':
- _, err = w.w.Write(backslashDQ)
- case '\\':
- _, err = w.w.Write(backslashBS)
- default:
- if isprint(c) {
- err = w.w.WriteByte(c)
- } else {
- _, err = fmt.Fprintf(w.w, "\\%03o", c)
- }
- }
- if err != nil {
- return err
- }
- }
- return w.WriteByte('"')
-}
-
-func writeUnknownStruct(w *textWriter, data []byte) (err error) {
- if !w.compact {
- if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil {
- return err
- }
- }
- b := NewBuffer(data)
- for b.index < len(b.buf) {
- x, err := b.DecodeVarint()
- if err != nil {
- _, ferr := fmt.Fprintf(w, "/* %v */\n", err)
- return ferr
- }
- wire, tag := x&7, x>>3
- if wire == WireEndGroup {
- w.unindent()
- if _, werr := w.Write(endBraceNewline); werr != nil {
- return werr
- }
- continue
- }
- if _, ferr := fmt.Fprint(w, tag); ferr != nil {
- return ferr
- }
- if wire != WireStartGroup {
- if err = w.WriteByte(':'); err != nil {
- return err
- }
- }
- if !w.compact || wire == WireStartGroup {
- if err = w.WriteByte(' '); err != nil {
- return err
- }
- }
- switch wire {
- case WireBytes:
- buf, e := b.DecodeRawBytes(false)
- if e == nil {
- _, err = fmt.Fprintf(w, "%q", buf)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", e)
- }
- case WireFixed32:
- x, err = b.DecodeFixed32()
- err = writeUnknownInt(w, x, err)
- case WireFixed64:
- x, err = b.DecodeFixed64()
- err = writeUnknownInt(w, x, err)
- case WireStartGroup:
- err = w.WriteByte('{')
- w.indent()
- case WireVarint:
- x, err = b.DecodeVarint()
- err = writeUnknownInt(w, x, err)
- default:
- _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire)
- }
- if err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- return nil
-}
-
-func writeUnknownInt(w *textWriter, x uint64, err error) error {
- if err == nil {
- _, err = fmt.Fprint(w, x)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", err)
- }
- return err
-}
-
-type int32Slice []int32
-
-func (s int32Slice) Len() int { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-// writeExtensions writes all the extensions in pv.
-// pv is assumed to be a pointer to a protocol message struct that is extendable.
-func writeExtensions(w *textWriter, pv reflect.Value) error {
- emap := extensionMaps[pv.Type().Elem()]
- ep := pv.Interface().(extendableProto)
-
- // Order the extensions by ID.
- // This isn't strictly necessary, but it will give us
- // canonical output, which will also make testing easier.
- var m map[int32]Extension
- if em, ok := ep.(extensionsMap); ok {
- m = em.ExtensionMap()
- } else if em, ok := ep.(extensionsBytes); ok {
- eb := em.GetExtensions()
- var err error
- m, err = BytesToExtensionsMap(*eb)
- if err != nil {
- return err
- }
- }
-
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids))
-
- for _, extNum := range ids {
- ext := m[extNum]
- var desc *ExtensionDesc
- if emap != nil {
- desc = emap[extNum]
- }
- if desc == nil {
- // Unknown extension.
- if err := writeUnknownStruct(w, ext.enc); err != nil {
- return err
- }
- continue
- }
-
- pb, err := GetExtension(ep, desc)
- if err != nil {
- return fmt.Errorf("failed getting extension: %v", err)
- }
-
- // Repeated extensions will appear as a slice.
- if !desc.repeated() {
- if err := writeExtension(w, desc.Name, pb); err != nil {
- return err
- }
- } else {
- v := reflect.ValueOf(pb)
- for i := 0; i < v.Len(); i++ {
- if err := writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {
- return err
- }
- }
- }
- }
- return nil
-}
-
-func writeExtension(w *textWriter, name string, pb interface{}) error {
- if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := writeAny(w, reflect.ValueOf(pb), nil); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- return nil
-}
-
-func (w *textWriter) writeIndent() {
- if !w.complete {
- return
- }
- remain := w.ind * 2
- for remain > 0 {
- n := remain
- if n > len(spaces) {
- n = len(spaces)
- }
- w.w.Write(spaces[:n])
- remain -= n
- }
- w.complete = false
-}
-
-// TextMarshaler is a configurable text format marshaler.
-type TextMarshaler struct {
- Compact bool // use compact text format (one line).
-}
-
-// Marshal writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func (m *TextMarshaler) Marshal(w io.Writer, pb Message) error {
- val := reflect.ValueOf(pb)
- if pb == nil || val.IsNil() {
- w.Write([]byte(""))
- return nil
- }
- var bw *bufio.Writer
- ww, ok := w.(writer)
- if !ok {
- bw = bufio.NewWriter(w)
- ww = bw
- }
- aw := &textWriter{
- w: ww,
- complete: true,
- compact: m.Compact,
- }
-
- if tm, ok := pb.(encoding.TextMarshaler); ok {
- text, err := tm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = aw.Write(text); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
- }
- // Dereference the received pointer so we don't have outer < and >.
- v := reflect.Indirect(val)
- if err := writeStruct(aw, v); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
-}
-
-// Text is the same as Marshal, but returns the string directly.
-func (m *TextMarshaler) Text(pb Message) string {
- var buf bytes.Buffer
- m.Marshal(&buf, pb)
- return buf.String()
-}
-
-var (
- defaultTextMarshaler = TextMarshaler{}
- compactTextMarshaler = TextMarshaler{Compact: true}
-)
-
-// TODO: consider removing some of the Marshal functions below.
-
-// MarshalText writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
-
-// MarshalTextString is the same as MarshalText, but returns the string directly.
-func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
-
-// CompactText writes a given protocol buffer in compact text format (one line).
-func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
-
-// CompactTextString is the same as CompactText, but returns the string directly.
-func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_gogo.go
deleted file mode 100644
index cdb23373c..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_gogo.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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.
-//
-// 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.
-
-package proto
-
-import (
- "fmt"
- "reflect"
-)
-
-func writeEnum(w *textWriter, v reflect.Value, props *Properties) error {
- m, ok := enumStringMaps[props.Enum]
- if !ok {
- if err := writeAny(w, v, props); err != nil {
- return err
- }
- }
- key := int32(0)
- if v.Kind() == reflect.Ptr {
- key = int32(v.Elem().Int())
- } else {
- key = int32(v.Int())
- }
- s, ok := m[key]
- if !ok {
- if err := writeAny(w, v, props); err != nil {
- return err
- }
- }
- _, err := fmt.Fprint(w, s)
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_parser.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_parser.go
deleted file mode 100644
index 61b4bc8cc..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/proto/text_parser.go
+++ /dev/null
@@ -1,849 +0,0 @@
-// Extensions for Protocol Buffers to create more go like structures.
-//
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf/gogoproto
-//
-// 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
-// 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.
-
-package proto
-
-// Functions for parsing the Text protocol buffer format.
-// TODO: message sets.
-
-import (
- "encoding"
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-type ParseError struct {
- Message string
- Line int // 1-based line number
- Offset int // 0-based byte offset from start of input
-}
-
-func (p *ParseError) Error() string {
- if p.Line == 1 {
- // show offset only for first line
- return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message)
- }
- return fmt.Sprintf("line %d: %v", p.Line, p.Message)
-}
-
-type token struct {
- value string
- err *ParseError
- line int // line number
- offset int // byte number from start of input, not start of line
- unquoted string // the unquoted version of value, if it was a quoted string
-}
-
-func (t *token) String() string {
- if t.err == nil {
- return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset)
- }
- return fmt.Sprintf("parse error: %v", t.err)
-}
-
-type textParser struct {
- s string // remaining input
- done bool // whether the parsing is finished (success or error)
- backed bool // whether back() was called
- offset, line int
- cur token
-}
-
-func newTextParser(s string) *textParser {
- p := new(textParser)
- p.s = s
- p.line = 1
- p.cur.line = 1
- return p
-}
-
-func (p *textParser) errorf(format string, a ...interface{}) *ParseError {
- pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}
- p.cur.err = pe
- p.done = true
- return pe
-}
-
-// Numbers and identifiers are matched by [-+._A-Za-z0-9]
-func isIdentOrNumberChar(c byte) bool {
- switch {
- case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':
- return true
- case '0' <= c && c <= '9':
- return true
- }
- switch c {
- case '-', '+', '.', '_':
- return true
- }
- return false
-}
-
-func isWhitespace(c byte) bool {
- switch c {
- case ' ', '\t', '\n', '\r':
- return true
- }
- return false
-}
-
-func isQuote(c byte) bool {
- switch c {
- case '"', '\'':
- return true
- }
- return false
-}
-
-func (p *textParser) skipWhitespace() {
- i := 0
- for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {
- if p.s[i] == '#' {
- // comment; skip to end of line or input
- for i < len(p.s) && p.s[i] != '\n' {
- i++
- }
- if i == len(p.s) {
- break
- }
- }
- if p.s[i] == '\n' {
- p.line++
- }
- i++
- }
- p.offset += i
- p.s = p.s[i:len(p.s)]
- if len(p.s) == 0 {
- p.done = true
- }
-}
-
-func (p *textParser) advance() {
- // Skip whitespace
- p.skipWhitespace()
- if p.done {
- return
- }
-
- // Start of non-whitespace
- p.cur.err = nil
- p.cur.offset, p.cur.line = p.offset, p.line
- p.cur.unquoted = ""
- switch p.s[0] {
- case '<', '>', '{', '}', ':', '[', ']', ';', ',':
- // Single symbol
- p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
- case '"', '\'':
- // Quoted string
- i := 1
- for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' {
- if p.s[i] == '\\' && i+1 < len(p.s) {
- // skip escaped char
- i++
- }
- i++
- }
- if i >= len(p.s) || p.s[i] != p.s[0] {
- p.errorf("unmatched quote")
- return
- }
- unq, err := unquoteC(p.s[1:i], rune(p.s[0]))
- if err != nil {
- p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err)
- return
- }
- p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]
- p.cur.unquoted = unq
- default:
- i := 0
- for i < len(p.s) && isIdentOrNumberChar(p.s[i]) {
- i++
- }
- if i == 0 {
- p.errorf("unexpected byte %#x", p.s[0])
- return
- }
- p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]
- }
- p.offset += len(p.cur.value)
-}
-
-var (
- errBadUTF8 = errors.New("proto: bad UTF-8")
- errBadHex = errors.New("proto: bad hexadecimal")
-)
-
-func unquoteC(s string, quote rune) (string, error) {
- // This is based on C++'s tokenizer.cc.
- // Despite its name, this is *not* parsing C syntax.
- // For instance, "\0" is an invalid quoted string.
-
- // Avoid allocation in trivial cases.
- simple := true
- for _, r := range s {
- if r == '\\' || r == quote {
- simple = false
- break
- }
- }
- if simple {
- return s, nil
- }
-
- buf := make([]byte, 0, 3*len(s)/2)
- for len(s) > 0 {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", errBadUTF8
- }
- s = s[n:]
- if r != '\\' {
- if r < utf8.RuneSelf {
- buf = append(buf, byte(r))
- } else {
- buf = append(buf, string(r)...)
- }
- continue
- }
-
- ch, tail, err := unescape(s)
- if err != nil {
- return "", err
- }
- buf = append(buf, ch...)
- s = tail
- }
- return string(buf), nil
-}
-
-func unescape(s string) (ch string, tail string, err error) {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", "", errBadUTF8
- }
- s = s[n:]
- switch r {
- case 'a':
- return "\a", s, nil
- case 'b':
- return "\b", s, nil
- case 'f':
- return "\f", s, nil
- case 'n':
- return "\n", s, nil
- case 'r':
- return "\r", s, nil
- case 't':
- return "\t", s, nil
- case 'v':
- return "\v", s, nil
- case '?':
- return "?", s, nil // trigraph workaround
- case '\'', '"', '\\':
- return string(r), s, nil
- case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X':
- if len(s) < 2 {
- return "", "", fmt.Errorf(`\%c requires 2 following digits`, r)
- }
- base := 8
- ss := s[:2]
- s = s[2:]
- if r == 'x' || r == 'X' {
- base = 16
- } else {
- ss = string(r) + ss
- }
- i, err := strconv.ParseUint(ss, base, 8)
- if err != nil {
- return "", "", err
- }
- return string([]byte{byte(i)}), s, nil
- case 'u', 'U':
- n := 4
- if r == 'U' {
- n = 8
- }
- if len(s) < n {
- return "", "", fmt.Errorf(`\%c requires %d digits`, r, n)
- }
-
- bs := make([]byte, n/2)
- for i := 0; i < n; i += 2 {
- a, ok1 := unhex(s[i])
- b, ok2 := unhex(s[i+1])
- if !ok1 || !ok2 {
- return "", "", errBadHex
- }
- bs[i/2] = a<<4 | b
- }
- s = s[n:]
- return string(bs), s, nil
- }
- return "", "", fmt.Errorf(`unknown escape \%c`, r)
-}
-
-// Adapted from src/pkg/strconv/quote.go.
-func unhex(b byte) (v byte, ok bool) {
- switch {
- case '0' <= b && b <= '9':
- return b - '0', true
- case 'a' <= b && b <= 'f':
- return b - 'a' + 10, true
- case 'A' <= b && b <= 'F':
- return b - 'A' + 10, true
- }
- return 0, false
-}
-
-// Back off the parser by one token. Can only be done between calls to next().
-// It makes the next advance() a no-op.
-func (p *textParser) back() { p.backed = true }
-
-// Advances the parser and returns the new current token.
-func (p *textParser) next() *token {
- if p.backed || p.done {
- p.backed = false
- return &p.cur
- }
- p.advance()
- if p.done {
- p.cur.value = ""
- } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
- // Look for multiple quoted strings separated by whitespace,
- // and concatenate them.
- cat := p.cur
- for {
- p.skipWhitespace()
- if p.done || !isQuote(p.s[0]) {
- break
- }
- p.advance()
- if p.cur.err != nil {
- return &p.cur
- }
- cat.value += " " + p.cur.value
- cat.unquoted += p.cur.unquoted
- }
- p.done = false // parser may have seen EOF, but we want to return cat
- p.cur = cat
- }
- return &p.cur
-}
-
-func (p *textParser) consumeToken(s string) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != s {
- p.back()
- return p.errorf("expected %q, found %q", s, tok.value)
- }
- return nil
-}
-
-// Return a RequiredNotSetError indicating which required field was not set.
-func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < st.NumField(); i++ {
- if !isNil(sv.Field(i)) {
- continue
- }
-
- props := sprops.Prop[i]
- if props.Required {
- return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)}
- }
- }
- return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen
-}
-
-// Returns the index in the struct for the named field, as well as the parsed tag properties.
-func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
- i, ok := sprops.decoderOrigNames[name]
- if ok {
- return i, sprops.Prop[i], true
- }
- return -1, nil, false
-}
-
-// Consume a ':' from the input stream (if the next token is a colon),
-// returning an error if a colon is needed but not present.
-func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ":" {
- // Colon is optional when the field is a group or message.
- needColon := true
- switch props.Wire {
- case "group":
- needColon = false
- case "bytes":
- // A "bytes" field is either a message, a string, or a repeated field;
- // those three become *T, *string and []T respectively, so we can check for
- // this field being a pointer to a non-string.
- if typ.Kind() == reflect.Ptr {
- // *T or *string
- if typ.Elem().Kind() == reflect.String {
- break
- }
- } else if typ.Kind() == reflect.Slice {
- // []T or []*T
- if typ.Elem().Kind() != reflect.Ptr {
- break
- }
- } else if typ.Kind() == reflect.String {
- // The proto3 exception is for a string field,
- // which requires a colon.
- break
- }
- needColon = false
- }
- if needColon {
- return p.errorf("expected ':', found %q", tok.value)
- }
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
- st := sv.Type()
- sprops := GetProperties(st)
- reqCount := sprops.reqCount
- var reqFieldErr error
- fieldSet := make(map[string]bool)
- // A struct is a sequence of "name: value", terminated by one of
- // '>' or '}', or the end of the input. A name may also be
- // "[extension]".
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- if tok.value == "[" {
- // Looks like an extension.
- //
- // TODO: Check whether we need to handle
- // namespace rooted names (e.g. ".something.Foo").
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- var desc *ExtensionDesc
- // This could be faster, but it's functional.
- // TODO: Do something smarter than a linear scan.
- for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {
- if d.Name == tok.value {
- desc = d
- break
- }
- }
- if desc == nil {
- return p.errorf("unrecognized extension %q", tok.value)
- }
- // Check the extension terminator.
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != "]" {
- return p.errorf("unrecognized extension terminator %q", tok.value)
- }
-
- props := &Properties{}
- props.Parse(desc.Tag)
-
- typ := reflect.TypeOf(desc.ExtensionType)
- if err := p.checkForColon(props, typ); err != nil {
- return err
- }
-
- rep := desc.repeated()
-
- // Read the extension structure, and set it in
- // the value we're constructing.
- var ext reflect.Value
- if !rep {
- ext = reflect.New(typ).Elem()
- } else {
- ext = reflect.New(typ.Elem()).Elem()
- }
- if err := p.readAny(ext, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- ep := sv.Addr().Interface().(extendableProto)
- if !rep {
- SetExtension(ep, desc, ext.Interface())
- } else {
- old, err := GetExtension(ep, desc)
- var sl reflect.Value
- if err == nil {
- sl = reflect.ValueOf(old) // existing slice
- } else {
- sl = reflect.MakeSlice(typ, 0, 1)
- }
- sl = reflect.Append(sl, ext)
- SetExtension(ep, desc, sl.Interface())
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- continue
- }
-
- // This is a normal, non-extension field.
- name := tok.value
- var dst reflect.Value
- fi, props, ok := structFieldByName(sprops, name)
- if ok {
- dst = sv.Field(fi)
- } else if oop, ok := sprops.OneofTypes[name]; ok {
- // It is a oneof.
- props = oop.Prop
- nv := reflect.New(oop.Type.Elem())
- dst = nv.Elem().Field(0)
- sv.Field(oop.Field).Set(nv)
- }
- if !dst.IsValid() {
- return p.errorf("unknown field name %q in %v", name, st)
- }
-
- if dst.Kind() == reflect.Map {
- // Consume any colon.
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Construct the map if it doesn't already exist.
- if dst.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- key := reflect.New(dst.Type().Key()).Elem()
- val := reflect.New(dst.Type().Elem()).Elem()
-
- // The map entry should be this sequence of tokens:
- // < key : KEY value : VALUE >
- // Technically the "key" and "value" could come in any order,
- // but in practice they won't.
-
- tok := p.next()
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- if err := p.consumeToken("key"); err != nil {
- return err
- }
- if err := p.consumeToken(":"); err != nil {
- return err
- }
- if err := p.readAny(key, props.mkeyprop); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- if err := p.consumeToken("value"); err != nil {
- return err
- }
- if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil {
- return err
- }
- if err := p.readAny(val, props.mvalprop); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- if err := p.consumeToken(terminator); err != nil {
- return err
- }
-
- dst.SetMapIndex(key, val)
- continue
- }
-
- // Check that it's not already set if it's not a repeated field.
- if !props.Repeated && fieldSet[name] {
- return p.errorf("non-repeated field %q was repeated", name)
- }
-
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Parse into the field.
- fieldSet[name] = true
- if err := p.readAny(dst, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- } else if props.Required {
- reqCount--
- }
-
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
-
- }
-
- if reqCount > 0 {
- return p.missingRequiredFieldError(sv)
- }
- return reqFieldErr
-}
-
-// consumeOptionalSeparator consumes an optional semicolon or comma.
-// It is used in readStruct to provide backward compatibility.
-func (p *textParser) consumeOptionalSeparator() error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ";" && tok.value != "," {
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readAny(v reflect.Value, props *Properties) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "" {
- return p.errorf("unexpected EOF")
- }
- if len(props.CustomType) > 0 {
- if props.Repeated {
- t := reflect.TypeOf(v.Interface())
- if t.Kind() == reflect.Slice {
- tc := reflect.TypeOf(new(Marshaler))
- ok := t.Elem().Implements(tc.Elem())
- if ok {
- fv := v
- flen := fv.Len()
- if flen == fv.Cap() {
- nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1)
- reflect.Copy(nav, fv)
- fv.Set(nav)
- }
- fv.SetLen(flen + 1)
-
- // Read one.
- p.back()
- return p.readAny(fv.Index(flen), props)
- }
- }
- }
- if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr {
- custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler)
- err := custom.Unmarshal([]byte(tok.unquoted))
- if err != nil {
- return p.errorf("%v %v: %v", err, v.Type(), tok.value)
- }
- v.Set(reflect.ValueOf(custom))
- } else {
- custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler)
- err := custom.Unmarshal([]byte(tok.unquoted))
- if err != nil {
- return p.errorf("%v %v: %v", err, v.Type(), tok.value)
- }
- v.Set(reflect.Indirect(reflect.ValueOf(custom)))
- }
- return nil
- }
- switch fv := v; fv.Kind() {
- case reflect.Slice:
- at := v.Type()
- if at.Elem().Kind() == reflect.Uint8 {
- // Special case for []byte
- if tok.value[0] != '"' && tok.value[0] != '\'' {
- // Deliberately written out here, as the error after
- // this switch statement would write "invalid []byte: ...",
- // which is not as user-friendly.
- return p.errorf("invalid string: %v", tok.value)
- }
- bytes := []byte(tok.unquoted)
- fv.Set(reflect.ValueOf(bytes))
- return nil
- }
- // Repeated field.
- if tok.value == "[" {
- // Repeated field with list notation, like [1,2,3].
- for {
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- err := p.readAny(fv.Index(fv.Len()-1), props)
- if err != nil {
- return err
- }
- ntok := p.next()
- if ntok.err != nil {
- return ntok.err
- }
- if ntok.value == "]" {
- break
- }
- if ntok.value != "," {
- return p.errorf("Expected ']' or ',' found %q", ntok.value)
- }
- }
- return nil
- }
- // One value of the repeated field.
- p.back()
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- return p.readAny(fv.Index(fv.Len()-1), props)
- case reflect.Bool:
- // Either "true", "false", 1 or 0.
- switch tok.value {
- case "true", "1":
- fv.SetBool(true)
- return nil
- case "false", "0":
- fv.SetBool(false)
- return nil
- }
- case reflect.Float32, reflect.Float64:
- v := tok.value
- // Ignore 'f' for compatibility with output generated by C++, but don't
- // remove 'f' when the value is "-inf" or "inf".
- if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
- v = v[:len(v)-1]
- }
- if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
- fv.SetFloat(f)
- return nil
- }
- case reflect.Int32:
- if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- if len(props.Enum) == 0 {
- break
- }
- m, ok := enumValueMaps[props.Enum]
- if !ok {
- break
- }
- x, ok := m[tok.value]
- if !ok {
- break
- }
- fv.SetInt(int64(x))
- return nil
- case reflect.Int64:
- if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- case reflect.Ptr:
- // A basic field (indirected through pointer), or a repeated message/group
- p.back()
- fv.Set(reflect.New(fv.Type().Elem()))
- return p.readAny(fv.Elem(), props)
- case reflect.String:
- if tok.value[0] == '"' || tok.value[0] == '\'' {
- fv.SetString(tok.unquoted)
- return nil
- }
- case reflect.Struct:
- var terminator string
- switch tok.value {
- case "{":
- terminator = "}"
- case "<":
- terminator = ">"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- // TODO: Handle nested messages which implement encoding.TextUnmarshaler.
- return p.readStruct(fv, terminator)
- case reflect.Uint32:
- if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {
- fv.SetUint(uint64(x))
- return nil
- }
- case reflect.Uint64:
- if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {
- fv.SetUint(x)
- return nil
- }
- }
- return p.errorf("invalid %v: %v", v.Type(), tok.value)
-}
-
-// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb
-// before starting to unmarshal, so any existing data in pb is always removed.
-// If a required field is not set and no other error occurs,
-// UnmarshalText returns *RequiredNotSetError.
-func UnmarshalText(s string, pb Message) error {
- if um, ok := pb.(encoding.TextUnmarshaler); ok {
- err := um.UnmarshalText([]byte(s))
- return err
- }
- pb.Reset()
- v := reflect.ValueOf(pb)
- if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil {
- return pe
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/archived/event-adapter/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go
deleted file mode 100644
index c52878dd5..000000000
--- a/archived/event-adapter/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
-// http://github.com/gogo/protobuf
-//
-// 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.
-//
-// 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.
-
-package sortkeys
-
-import (
- "sort"
-)
-
-func Strings(l []string) {
- sort.Strings(l)
-}
-
-func Float64s(l []float64) {
- sort.Float64s(l)
-}
-
-func Float32s(l []float32) {
- sort.Sort(Float32Slice(l))
-}
-
-func Int64s(l []int64) {
- sort.Sort(Int64Slice(l))
-}
-
-func Int32s(l []int32) {
- sort.Sort(Int32Slice(l))
-}
-
-func Uint64s(l []uint64) {
- sort.Sort(Uint64Slice(l))
-}
-
-func Uint32s(l []uint32) {
- sort.Sort(Uint32Slice(l))
-}
-
-func Bools(l []bool) {
- sort.Sort(BoolSlice(l))
-}
-
-type BoolSlice []bool
-
-func (p BoolSlice) Len() int { return len(p) }
-func (p BoolSlice) Less(i, j int) bool { return p[j] }
-func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type Int64Slice []int64
-
-func (p Int64Slice) Len() int { return len(p) }
-func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type Int32Slice []int32
-
-func (p Int32Slice) Len() int { return len(p) }
-func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type Uint64Slice []uint64
-
-func (p Uint64Slice) Len() int { return len(p) }
-func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type Uint32Slice []uint32
-
-func (p Uint32Slice) Len() int { return len(p) }
-func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-type Float32Slice []float32
-
-func (p Float32Slice) Len() int { return len(p) }
-func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
diff --git a/archived/event-adapter/vendor/github.com/golang/glog/LICENSE b/archived/event-adapter/vendor/github.com/golang/glog/LICENSE
deleted file mode 100644
index 37ec93a14..000000000
--- a/archived/event-adapter/vendor/github.com/golang/glog/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/golang/glog/README b/archived/event-adapter/vendor/github.com/golang/glog/README
deleted file mode 100644
index 5f9c11485..000000000
--- a/archived/event-adapter/vendor/github.com/golang/glog/README
+++ /dev/null
@@ -1,44 +0,0 @@
-glog
-====
-
-Leveled execution logs for Go.
-
-This is an efficient pure Go implementation of leveled logs in the
-manner of the open source C++ package
- http://code.google.com/p/google-glog
-
-By binding methods to booleans it is possible to use the log package
-without paying the expense of evaluating the arguments to the log.
-Through the -vmodule flag, the package also provides fine-grained
-control over logging at the file level.
-
-The comment from glog.go introduces the ideas:
-
- Package glog implements logging analogous to the Google-internal
- C++ INFO/ERROR/V setup. It provides functions Info, Warning,
- Error, Fatal, plus formatting variants such as Infof. It
- also provides V-style logging controlled by the -v and
- -vmodule=file=2 flags.
-
- Basic examples:
-
- glog.Info("Prepare to repel boarders")
-
- glog.Fatalf("Initialization failed: %s", err)
-
- See the documentation for the V function for an explanation
- of these examples:
-
- if glog.V(2) {
- glog.Info("Starting transaction...")
- }
-
- glog.V(2).Infoln("Processed", nItems, "elements")
-
-
-The repository contains an open source version of the log package
-used inside Google. The master copy of the source lives inside
-Google, not here. The code in this repo is for export only and is not itself
-under development. Feature requests will be ignored.
-
-Send bug reports to golang-nuts@googlegroups.com.
diff --git a/archived/event-adapter/vendor/github.com/golang/glog/glog.go b/archived/event-adapter/vendor/github.com/golang/glog/glog.go
deleted file mode 100644
index 3e63fffd5..000000000
--- a/archived/event-adapter/vendor/github.com/golang/glog/glog.go
+++ /dev/null
@@ -1,1177 +0,0 @@
-// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
-//
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
-// It provides functions Info, Warning, Error, Fatal, plus formatting variants such as
-// Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags.
-//
-// Basic examples:
-//
-// glog.Info("Prepare to repel boarders")
-//
-// glog.Fatalf("Initialization failed: %s", err)
-//
-// See the documentation for the V function for an explanation of these examples:
-//
-// if glog.V(2) {
-// glog.Info("Starting transaction...")
-// }
-//
-// glog.V(2).Infoln("Processed", nItems, "elements")
-//
-// Log output is buffered and written periodically using Flush. Programs
-// should call Flush before exiting to guarantee all log output is written.
-//
-// By default, all log statements write to files in a temporary directory.
-// This package provides several flags that modify this behavior.
-// As a result, flag.Parse must be called before any logging is done.
-//
-// -logtostderr=false
-// Logs are written to standard error instead of to files.
-// -alsologtostderr=false
-// Logs are written to standard error as well as to files.
-// -stderrthreshold=ERROR
-// Log events at or above this severity are logged to standard
-// error as well as to files.
-// -log_dir=""
-// Log files will be written to this directory instead of the
-// default temporary directory.
-//
-// Other flags provide aids to debugging.
-//
-// -log_backtrace_at=""
-// When set to a file and line number holding a logging statement,
-// such as
-// -log_backtrace_at=gopherflakes.go:234
-// a stack trace will be written to the Info log whenever execution
-// hits that statement. (Unlike with -vmodule, the ".go" must be
-// present.)
-// -v=0
-// Enable V-leveled logging at the specified level.
-// -vmodule=""
-// The syntax of the argument is a comma-separated list of pattern=N,
-// where pattern is a literal file name (minus the ".go" suffix) or
-// "glob" pattern and N is a V level. For instance,
-// -vmodule=gopher*=3
-// sets the V level to 3 in all Go files whose names begin "gopher".
-//
-package glog
-
-import (
- "bufio"
- "bytes"
- "errors"
- "flag"
- "fmt"
- "io"
- stdLog "log"
- "os"
- "path/filepath"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "time"
-)
-
-// severity identifies the sort of log: info, warning etc. It also implements
-// the flag.Value interface. The -stderrthreshold flag is of type severity and
-// should be modified only through the flag.Value interface. The values match
-// the corresponding constants in C++.
-type severity int32 // sync/atomic int32
-
-// These constants identify the log levels in order of increasing severity.
-// A message written to a high-severity log file is also written to each
-// lower-severity log file.
-const (
- infoLog severity = iota
- warningLog
- errorLog
- fatalLog
- numSeverity = 4
-)
-
-const severityChar = "IWEF"
-
-var severityName = []string{
- infoLog: "INFO",
- warningLog: "WARNING",
- errorLog: "ERROR",
- fatalLog: "FATAL",
-}
-
-// get returns the value of the severity.
-func (s *severity) get() severity {
- return severity(atomic.LoadInt32((*int32)(s)))
-}
-
-// set sets the value of the severity.
-func (s *severity) set(val severity) {
- atomic.StoreInt32((*int32)(s), int32(val))
-}
-
-// String is part of the flag.Value interface.
-func (s *severity) String() string {
- return strconv.FormatInt(int64(*s), 10)
-}
-
-// Get is part of the flag.Value interface.
-func (s *severity) Get() interface{} {
- return *s
-}
-
-// Set is part of the flag.Value interface.
-func (s *severity) Set(value string) error {
- var threshold severity
- // Is it a known name?
- if v, ok := severityByName(value); ok {
- threshold = v
- } else {
- v, err := strconv.Atoi(value)
- if err != nil {
- return err
- }
- threshold = severity(v)
- }
- logging.stderrThreshold.set(threshold)
- return nil
-}
-
-func severityByName(s string) (severity, bool) {
- s = strings.ToUpper(s)
- for i, name := range severityName {
- if name == s {
- return severity(i), true
- }
- }
- return 0, false
-}
-
-// OutputStats tracks the number of output lines and bytes written.
-type OutputStats struct {
- lines int64
- bytes int64
-}
-
-// Lines returns the number of lines written.
-func (s *OutputStats) Lines() int64 {
- return atomic.LoadInt64(&s.lines)
-}
-
-// Bytes returns the number of bytes written.
-func (s *OutputStats) Bytes() int64 {
- return atomic.LoadInt64(&s.bytes)
-}
-
-// Stats tracks the number of lines of output and number of bytes
-// per severity level. Values must be read with atomic.LoadInt64.
-var Stats struct {
- Info, Warning, Error OutputStats
-}
-
-var severityStats = [numSeverity]*OutputStats{
- infoLog: &Stats.Info,
- warningLog: &Stats.Warning,
- errorLog: &Stats.Error,
-}
-
-// Level is exported because it appears in the arguments to V and is
-// the type of the v flag, which can be set programmatically.
-// It's a distinct type because we want to discriminate it from logType.
-// Variables of type level are only changed under logging.mu.
-// The -v flag is read only with atomic ops, so the state of the logging
-// module is consistent.
-
-// Level is treated as a sync/atomic int32.
-
-// Level specifies a level of verbosity for V logs. *Level implements
-// flag.Value; the -v flag is of type Level and should be modified
-// only through the flag.Value interface.
-type Level int32
-
-// get returns the value of the Level.
-func (l *Level) get() Level {
- return Level(atomic.LoadInt32((*int32)(l)))
-}
-
-// set sets the value of the Level.
-func (l *Level) set(val Level) {
- atomic.StoreInt32((*int32)(l), int32(val))
-}
-
-// String is part of the flag.Value interface.
-func (l *Level) String() string {
- return strconv.FormatInt(int64(*l), 10)
-}
-
-// Get is part of the flag.Value interface.
-func (l *Level) Get() interface{} {
- return *l
-}
-
-// Set is part of the flag.Value interface.
-func (l *Level) Set(value string) error {
- v, err := strconv.Atoi(value)
- if err != nil {
- return err
- }
- logging.mu.Lock()
- defer logging.mu.Unlock()
- logging.setVState(Level(v), logging.vmodule.filter, false)
- return nil
-}
-
-// moduleSpec represents the setting of the -vmodule flag.
-type moduleSpec struct {
- filter []modulePat
-}
-
-// modulePat contains a filter for the -vmodule flag.
-// It holds a verbosity level and a file pattern to match.
-type modulePat struct {
- pattern string
- literal bool // The pattern is a literal string
- level Level
-}
-
-// match reports whether the file matches the pattern. It uses a string
-// comparison if the pattern contains no metacharacters.
-func (m *modulePat) match(file string) bool {
- if m.literal {
- return file == m.pattern
- }
- match, _ := filepath.Match(m.pattern, file)
- return match
-}
-
-func (m *moduleSpec) String() string {
- // Lock because the type is not atomic. TODO: clean this up.
- logging.mu.Lock()
- defer logging.mu.Unlock()
- var b bytes.Buffer
- for i, f := range m.filter {
- if i > 0 {
- b.WriteRune(',')
- }
- fmt.Fprintf(&b, "%s=%d", f.pattern, f.level)
- }
- return b.String()
-}
-
-// Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the
-// struct is not exported.
-func (m *moduleSpec) Get() interface{} {
- return nil
-}
-
-var errVmoduleSyntax = errors.New("syntax error: expect comma-separated list of filename=N")
-
-// Syntax: -vmodule=recordio=2,file=1,gfs*=3
-func (m *moduleSpec) Set(value string) error {
- var filter []modulePat
- for _, pat := range strings.Split(value, ",") {
- if len(pat) == 0 {
- // Empty strings such as from a trailing comma can be ignored.
- continue
- }
- patLev := strings.Split(pat, "=")
- if len(patLev) != 2 || len(patLev[0]) == 0 || len(patLev[1]) == 0 {
- return errVmoduleSyntax
- }
- pattern := patLev[0]
- v, err := strconv.Atoi(patLev[1])
- if err != nil {
- return errors.New("syntax error: expect comma-separated list of filename=N")
- }
- if v < 0 {
- return errors.New("negative value for vmodule level")
- }
- if v == 0 {
- continue // Ignore. It's harmless but no point in paying the overhead.
- }
- // TODO: check syntax of filter?
- filter = append(filter, modulePat{pattern, isLiteral(pattern), Level(v)})
- }
- logging.mu.Lock()
- defer logging.mu.Unlock()
- logging.setVState(logging.verbosity, filter, true)
- return nil
-}
-
-// isLiteral reports whether the pattern is a literal string, that is, has no metacharacters
-// that require filepath.Match to be called to match the pattern.
-func isLiteral(pattern string) bool {
- return !strings.ContainsAny(pattern, `\*?[]`)
-}
-
-// traceLocation represents the setting of the -log_backtrace_at flag.
-type traceLocation struct {
- file string
- line int
-}
-
-// isSet reports whether the trace location has been specified.
-// logging.mu is held.
-func (t *traceLocation) isSet() bool {
- return t.line > 0
-}
-
-// match reports whether the specified file and line matches the trace location.
-// The argument file name is the full path, not the basename specified in the flag.
-// logging.mu is held.
-func (t *traceLocation) match(file string, line int) bool {
- if t.line != line {
- return false
- }
- if i := strings.LastIndex(file, "/"); i >= 0 {
- file = file[i+1:]
- }
- return t.file == file
-}
-
-func (t *traceLocation) String() string {
- // Lock because the type is not atomic. TODO: clean this up.
- logging.mu.Lock()
- defer logging.mu.Unlock()
- return fmt.Sprintf("%s:%d", t.file, t.line)
-}
-
-// Get is part of the (Go 1.2) flag.Getter interface. It always returns nil for this flag type since the
-// struct is not exported
-func (t *traceLocation) Get() interface{} {
- return nil
-}
-
-var errTraceSyntax = errors.New("syntax error: expect file.go:234")
-
-// Syntax: -log_backtrace_at=gopherflakes.go:234
-// Note that unlike vmodule the file extension is included here.
-func (t *traceLocation) Set(value string) error {
- if value == "" {
- // Unset.
- t.line = 0
- t.file = ""
- }
- fields := strings.Split(value, ":")
- if len(fields) != 2 {
- return errTraceSyntax
- }
- file, line := fields[0], fields[1]
- if !strings.Contains(file, ".") {
- return errTraceSyntax
- }
- v, err := strconv.Atoi(line)
- if err != nil {
- return errTraceSyntax
- }
- if v <= 0 {
- return errors.New("negative or zero value for level")
- }
- logging.mu.Lock()
- defer logging.mu.Unlock()
- t.line = v
- t.file = file
- return nil
-}
-
-// flushSyncWriter is the interface satisfied by logging destinations.
-type flushSyncWriter interface {
- Flush() error
- Sync() error
- io.Writer
-}
-
-func init() {
- flag.BoolVar(&logging.toStderr, "logtostderr", false, "log to standard error instead of files")
- flag.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files")
- flag.Var(&logging.verbosity, "v", "log level for V logs")
- flag.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr")
- flag.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging")
- flag.Var(&logging.traceLocation, "log_backtrace_at", "when logging hits line file:N, emit a stack trace")
-
- // Default stderrThreshold is ERROR.
- logging.stderrThreshold = errorLog
-
- logging.setVState(0, nil, false)
- go logging.flushDaemon()
-}
-
-// Flush flushes all pending log I/O.
-func Flush() {
- logging.lockAndFlushAll()
-}
-
-// loggingT collects all the global state of the logging setup.
-type loggingT struct {
- // Boolean flags. Not handled atomically because the flag.Value interface
- // does not let us avoid the =true, and that shorthand is necessary for
- // compatibility. TODO: does this matter enough to fix? Seems unlikely.
- toStderr bool // The -logtostderr flag.
- alsoToStderr bool // The -alsologtostderr flag.
-
- // Level flag. Handled atomically.
- stderrThreshold severity // The -stderrthreshold flag.
-
- // freeList is a list of byte buffers, maintained under freeListMu.
- freeList *buffer
- // freeListMu maintains the free list. It is separate from the main mutex
- // so buffers can be grabbed and printed to without holding the main lock,
- // for better parallelization.
- freeListMu sync.Mutex
-
- // mu protects the remaining elements of this structure and is
- // used to synchronize logging.
- mu sync.Mutex
- // file holds writer for each of the log types.
- file [numSeverity]flushSyncWriter
- // pcs is used in V to avoid an allocation when computing the caller's PC.
- pcs [1]uintptr
- // vmap is a cache of the V Level for each V() call site, identified by PC.
- // It is wiped whenever the vmodule flag changes state.
- vmap map[uintptr]Level
- // filterLength stores the length of the vmodule filter chain. If greater
- // than zero, it means vmodule is enabled. It may be read safely
- // using sync.LoadInt32, but is only modified under mu.
- filterLength int32
- // traceLocation is the state of the -log_backtrace_at flag.
- traceLocation traceLocation
- // These flags are modified only under lock, although verbosity may be fetched
- // safely using atomic.LoadInt32.
- vmodule moduleSpec // The state of the -vmodule flag.
- verbosity Level // V logging level, the value of the -v flag/
-}
-
-// buffer holds a byte Buffer for reuse. The zero value is ready for use.
-type buffer struct {
- bytes.Buffer
- tmp [64]byte // temporary byte array for creating headers.
- next *buffer
-}
-
-var logging loggingT
-
-// setVState sets a consistent state for V logging.
-// l.mu is held.
-func (l *loggingT) setVState(verbosity Level, filter []modulePat, setFilter bool) {
- // Turn verbosity off so V will not fire while we are in transition.
- logging.verbosity.set(0)
- // Ditto for filter length.
- atomic.StoreInt32(&logging.filterLength, 0)
-
- // Set the new filters and wipe the pc->Level map if the filter has changed.
- if setFilter {
- logging.vmodule.filter = filter
- logging.vmap = make(map[uintptr]Level)
- }
-
- // Things are consistent now, so enable filtering and verbosity.
- // They are enabled in order opposite to that in V.
- atomic.StoreInt32(&logging.filterLength, int32(len(filter)))
- logging.verbosity.set(verbosity)
-}
-
-// getBuffer returns a new, ready-to-use buffer.
-func (l *loggingT) getBuffer() *buffer {
- l.freeListMu.Lock()
- b := l.freeList
- if b != nil {
- l.freeList = b.next
- }
- l.freeListMu.Unlock()
- if b == nil {
- b = new(buffer)
- } else {
- b.next = nil
- b.Reset()
- }
- return b
-}
-
-// putBuffer returns a buffer to the free list.
-func (l *loggingT) putBuffer(b *buffer) {
- if b.Len() >= 256 {
- // Let big buffers die a natural death.
- return
- }
- l.freeListMu.Lock()
- b.next = l.freeList
- l.freeList = b
- l.freeListMu.Unlock()
-}
-
-var timeNow = time.Now // Stubbed out for testing.
-
-/*
-header formats a log header as defined by the C++ implementation.
-It returns a buffer containing the formatted header and the user's file and line number.
-The depth specifies how many stack frames above lives the source line to be identified in the log message.
-
-Log lines have this form:
- Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
-where the fields are defined as follows:
- L A single character, representing the log level (eg 'I' for INFO)
- mm The month (zero padded; ie May is '05')
- dd The day (zero padded)
- hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds
- threadid The space-padded thread ID as returned by GetTID()
- file The file name
- line The line number
- msg The user-supplied message
-*/
-func (l *loggingT) header(s severity, depth int) (*buffer, string, int) {
- _, file, line, ok := runtime.Caller(3 + depth)
- if !ok {
- file = "???"
- line = 1
- } else {
- slash := strings.LastIndex(file, "/")
- if slash >= 0 {
- file = file[slash+1:]
- }
- }
- return l.formatHeader(s, file, line), file, line
-}
-
-// formatHeader formats a log header using the provided file name and line number.
-func (l *loggingT) formatHeader(s severity, file string, line int) *buffer {
- now := timeNow()
- if line < 0 {
- line = 0 // not a real line number, but acceptable to someDigits
- }
- if s > fatalLog {
- s = infoLog // for safety.
- }
- buf := l.getBuffer()
-
- // Avoid Fprintf, for speed. The format is so simple that we can do it quickly by hand.
- // It's worth about 3X. Fprintf is hard.
- _, month, day := now.Date()
- hour, minute, second := now.Clock()
- // Lmmdd hh:mm:ss.uuuuuu threadid file:line]
- buf.tmp[0] = severityChar[s]
- buf.twoDigits(1, int(month))
- buf.twoDigits(3, day)
- buf.tmp[5] = ' '
- buf.twoDigits(6, hour)
- buf.tmp[8] = ':'
- buf.twoDigits(9, minute)
- buf.tmp[11] = ':'
- buf.twoDigits(12, second)
- buf.tmp[14] = '.'
- buf.nDigits(6, 15, now.Nanosecond()/1000, '0')
- buf.tmp[21] = ' '
- buf.nDigits(7, 22, pid, ' ') // TODO: should be TID
- buf.tmp[29] = ' '
- buf.Write(buf.tmp[:30])
- buf.WriteString(file)
- buf.tmp[0] = ':'
- n := buf.someDigits(1, line)
- buf.tmp[n+1] = ']'
- buf.tmp[n+2] = ' '
- buf.Write(buf.tmp[:n+3])
- return buf
-}
-
-// Some custom tiny helper functions to print the log header efficiently.
-
-const digits = "0123456789"
-
-// twoDigits formats a zero-prefixed two-digit integer at buf.tmp[i].
-func (buf *buffer) twoDigits(i, d int) {
- buf.tmp[i+1] = digits[d%10]
- d /= 10
- buf.tmp[i] = digits[d%10]
-}
-
-// nDigits formats an n-digit integer at buf.tmp[i],
-// padding with pad on the left.
-// It assumes d >= 0.
-func (buf *buffer) nDigits(n, i, d int, pad byte) {
- j := n - 1
- for ; j >= 0 && d > 0; j-- {
- buf.tmp[i+j] = digits[d%10]
- d /= 10
- }
- for ; j >= 0; j-- {
- buf.tmp[i+j] = pad
- }
-}
-
-// someDigits formats a zero-prefixed variable-width integer at buf.tmp[i].
-func (buf *buffer) someDigits(i, d int) int {
- // Print into the top, then copy down. We know there's space for at least
- // a 10-digit number.
- j := len(buf.tmp)
- for {
- j--
- buf.tmp[j] = digits[d%10]
- d /= 10
- if d == 0 {
- break
- }
- }
- return copy(buf.tmp[i:], buf.tmp[j:])
-}
-
-func (l *loggingT) println(s severity, args ...interface{}) {
- buf, file, line := l.header(s, 0)
- fmt.Fprintln(buf, args...)
- l.output(s, buf, file, line, false)
-}
-
-func (l *loggingT) print(s severity, args ...interface{}) {
- l.printDepth(s, 1, args...)
-}
-
-func (l *loggingT) printDepth(s severity, depth int, args ...interface{}) {
- buf, file, line := l.header(s, depth)
- fmt.Fprint(buf, args...)
- if buf.Bytes()[buf.Len()-1] != '\n' {
- buf.WriteByte('\n')
- }
- l.output(s, buf, file, line, false)
-}
-
-func (l *loggingT) printf(s severity, format string, args ...interface{}) {
- buf, file, line := l.header(s, 0)
- fmt.Fprintf(buf, format, args...)
- if buf.Bytes()[buf.Len()-1] != '\n' {
- buf.WriteByte('\n')
- }
- l.output(s, buf, file, line, false)
-}
-
-// printWithFileLine behaves like print but uses the provided file and line number. If
-// alsoLogToStderr is true, the log message always appears on standard error; it
-// will also appear in the log file unless --logtostderr is set.
-func (l *loggingT) printWithFileLine(s severity, file string, line int, alsoToStderr bool, args ...interface{}) {
- buf := l.formatHeader(s, file, line)
- fmt.Fprint(buf, args...)
- if buf.Bytes()[buf.Len()-1] != '\n' {
- buf.WriteByte('\n')
- }
- l.output(s, buf, file, line, alsoToStderr)
-}
-
-// output writes the data to the log files and releases the buffer.
-func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoToStderr bool) {
- l.mu.Lock()
- if l.traceLocation.isSet() {
- if l.traceLocation.match(file, line) {
- buf.Write(stacks(false))
- }
- }
- data := buf.Bytes()
- if l.toStderr {
- os.Stderr.Write(data)
- } else {
- if alsoToStderr || l.alsoToStderr || s >= l.stderrThreshold.get() {
- os.Stderr.Write(data)
- }
- if l.file[s] == nil {
- if err := l.createFiles(s); err != nil {
- os.Stderr.Write(data) // Make sure the message appears somewhere.
- l.exit(err)
- }
- }
- switch s {
- case fatalLog:
- l.file[fatalLog].Write(data)
- fallthrough
- case errorLog:
- l.file[errorLog].Write(data)
- fallthrough
- case warningLog:
- l.file[warningLog].Write(data)
- fallthrough
- case infoLog:
- l.file[infoLog].Write(data)
- }
- }
- if s == fatalLog {
- // If we got here via Exit rather than Fatal, print no stacks.
- if atomic.LoadUint32(&fatalNoStacks) > 0 {
- l.mu.Unlock()
- timeoutFlush(10 * time.Second)
- os.Exit(1)
- }
- // Dump all goroutine stacks before exiting.
- // First, make sure we see the trace for the current goroutine on standard error.
- // If -logtostderr has been specified, the loop below will do that anyway
- // as the first stack in the full dump.
- if !l.toStderr {
- os.Stderr.Write(stacks(false))
- }
- // Write the stack trace for all goroutines to the files.
- trace := stacks(true)
- logExitFunc = func(error) {} // If we get a write error, we'll still exit below.
- for log := fatalLog; log >= infoLog; log-- {
- if f := l.file[log]; f != nil { // Can be nil if -logtostderr is set.
- f.Write(trace)
- }
- }
- l.mu.Unlock()
- timeoutFlush(10 * time.Second)
- os.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway.
- }
- l.putBuffer(buf)
- l.mu.Unlock()
- if stats := severityStats[s]; stats != nil {
- atomic.AddInt64(&stats.lines, 1)
- atomic.AddInt64(&stats.bytes, int64(len(data)))
- }
-}
-
-// timeoutFlush calls Flush and returns when it completes or after timeout
-// elapses, whichever happens first. This is needed because the hooks invoked
-// by Flush may deadlock when glog.Fatal is called from a hook that holds
-// a lock.
-func timeoutFlush(timeout time.Duration) {
- done := make(chan bool, 1)
- go func() {
- Flush() // calls logging.lockAndFlushAll()
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(timeout):
- fmt.Fprintln(os.Stderr, "glog: Flush took longer than", timeout)
- }
-}
-
-// stacks is a wrapper for runtime.Stack that attempts to recover the data for all goroutines.
-func stacks(all bool) []byte {
- // We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.
- n := 10000
- if all {
- n = 100000
- }
- var trace []byte
- for i := 0; i < 5; i++ {
- trace = make([]byte, n)
- nbytes := runtime.Stack(trace, all)
- if nbytes < len(trace) {
- return trace[:nbytes]
- }
- n *= 2
- }
- return trace
-}
-
-// logExitFunc provides a simple mechanism to override the default behavior
-// of exiting on error. Used in testing and to guarantee we reach a required exit
-// for fatal logs. Instead, exit could be a function rather than a method but that
-// would make its use clumsier.
-var logExitFunc func(error)
-
-// exit is called if there is trouble creating or writing log files.
-// It flushes the logs and exits the program; there's no point in hanging around.
-// l.mu is held.
-func (l *loggingT) exit(err error) {
- fmt.Fprintf(os.Stderr, "log: exiting because of error: %s\n", err)
- // If logExitFunc is set, we do that instead of exiting.
- if logExitFunc != nil {
- logExitFunc(err)
- return
- }
- l.flushAll()
- os.Exit(2)
-}
-
-// syncBuffer joins a bufio.Writer to its underlying file, providing access to the
-// file's Sync method and providing a wrapper for the Write method that provides log
-// file rotation. There are conflicting methods, so the file cannot be embedded.
-// l.mu is held for all its methods.
-type syncBuffer struct {
- logger *loggingT
- *bufio.Writer
- file *os.File
- sev severity
- nbytes uint64 // The number of bytes written to this file
-}
-
-func (sb *syncBuffer) Sync() error {
- return sb.file.Sync()
-}
-
-func (sb *syncBuffer) Write(p []byte) (n int, err error) {
- if sb.nbytes+uint64(len(p)) >= MaxSize {
- if err := sb.rotateFile(time.Now()); err != nil {
- sb.logger.exit(err)
- }
- }
- n, err = sb.Writer.Write(p)
- sb.nbytes += uint64(n)
- if err != nil {
- sb.logger.exit(err)
- }
- return
-}
-
-// rotateFile closes the syncBuffer's file and starts a new one.
-func (sb *syncBuffer) rotateFile(now time.Time) error {
- if sb.file != nil {
- sb.Flush()
- sb.file.Close()
- }
- var err error
- sb.file, _, err = create(severityName[sb.sev], now)
- sb.nbytes = 0
- if err != nil {
- return err
- }
-
- sb.Writer = bufio.NewWriterSize(sb.file, bufferSize)
-
- // Write header.
- var buf bytes.Buffer
- fmt.Fprintf(&buf, "Log file created at: %s\n", now.Format("2006/01/02 15:04:05"))
- fmt.Fprintf(&buf, "Running on machine: %s\n", host)
- fmt.Fprintf(&buf, "Binary: Built with %s %s for %s/%s\n", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH)
- fmt.Fprintf(&buf, "Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\n")
- n, err := sb.file.Write(buf.Bytes())
- sb.nbytes += uint64(n)
- return err
-}
-
-// bufferSize sizes the buffer associated with each log file. It's large
-// so that log records can accumulate without the logging thread blocking
-// on disk I/O. The flushDaemon will block instead.
-const bufferSize = 256 * 1024
-
-// createFiles creates all the log files for severity from sev down to infoLog.
-// l.mu is held.
-func (l *loggingT) createFiles(sev severity) error {
- now := time.Now()
- // Files are created in decreasing severity order, so as soon as we find one
- // has already been created, we can stop.
- for s := sev; s >= infoLog && l.file[s] == nil; s-- {
- sb := &syncBuffer{
- logger: l,
- sev: s,
- }
- if err := sb.rotateFile(now); err != nil {
- return err
- }
- l.file[s] = sb
- }
- return nil
-}
-
-const flushInterval = 30 * time.Second
-
-// flushDaemon periodically flushes the log file buffers.
-func (l *loggingT) flushDaemon() {
- for _ = range time.NewTicker(flushInterval).C {
- l.lockAndFlushAll()
- }
-}
-
-// lockAndFlushAll is like flushAll but locks l.mu first.
-func (l *loggingT) lockAndFlushAll() {
- l.mu.Lock()
- l.flushAll()
- l.mu.Unlock()
-}
-
-// flushAll flushes all the logs and attempts to "sync" their data to disk.
-// l.mu is held.
-func (l *loggingT) flushAll() {
- // Flush from fatal down, in case there's trouble flushing.
- for s := fatalLog; s >= infoLog; s-- {
- file := l.file[s]
- if file != nil {
- file.Flush() // ignore error
- file.Sync() // ignore error
- }
- }
-}
-
-// CopyStandardLogTo arranges for messages written to the Go "log" package's
-// default logs to also appear in the Google logs for the named and lower
-// severities. Subsequent changes to the standard log's default output location
-// or format may break this behavior.
-//
-// Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not
-// recognized, CopyStandardLogTo panics.
-func CopyStandardLogTo(name string) {
- sev, ok := severityByName(name)
- if !ok {
- panic(fmt.Sprintf("log.CopyStandardLogTo(%q): unrecognized severity name", name))
- }
- // Set a log format that captures the user's file and line:
- // d.go:23: message
- stdLog.SetFlags(stdLog.Lshortfile)
- stdLog.SetOutput(logBridge(sev))
-}
-
-// logBridge provides the Write method that enables CopyStandardLogTo to connect
-// Go's standard logs to the logs provided by this package.
-type logBridge severity
-
-// Write parses the standard logging line and passes its components to the
-// logger for severity(lb).
-func (lb logBridge) Write(b []byte) (n int, err error) {
- var (
- file = "???"
- line = 1
- text string
- )
- // Split "d.go:23: message" into "d.go", "23", and "message".
- if parts := bytes.SplitN(b, []byte{':'}, 3); len(parts) != 3 || len(parts[0]) < 1 || len(parts[2]) < 1 {
- text = fmt.Sprintf("bad log format: %s", b)
- } else {
- file = string(parts[0])
- text = string(parts[2][1:]) // skip leading space
- line, err = strconv.Atoi(string(parts[1]))
- if err != nil {
- text = fmt.Sprintf("bad line number: %s", b)
- line = 1
- }
- }
- // printWithFileLine with alsoToStderr=true, so standard log messages
- // always appear on standard error.
- logging.printWithFileLine(severity(lb), file, line, true, text)
- return len(b), nil
-}
-
-// setV computes and remembers the V level for a given PC
-// when vmodule is enabled.
-// File pattern matching takes the basename of the file, stripped
-// of its .go suffix, and uses filepath.Match, which is a little more
-// general than the *? matching used in C++.
-// l.mu is held.
-func (l *loggingT) setV(pc uintptr) Level {
- fn := runtime.FuncForPC(pc)
- file, _ := fn.FileLine(pc)
- // The file is something like /a/b/c/d.go. We want just the d.
- if strings.HasSuffix(file, ".go") {
- file = file[:len(file)-3]
- }
- if slash := strings.LastIndex(file, "/"); slash >= 0 {
- file = file[slash+1:]
- }
- for _, filter := range l.vmodule.filter {
- if filter.match(file) {
- l.vmap[pc] = filter.level
- return filter.level
- }
- }
- l.vmap[pc] = 0
- return 0
-}
-
-// Verbose is a boolean type that implements Infof (like Printf) etc.
-// See the documentation of V for more information.
-type Verbose bool
-
-// V reports whether verbosity at the call site is at least the requested level.
-// The returned value is a boolean of type Verbose, which implements Info, Infoln
-// and Infof. These methods will write to the Info log if called.
-// Thus, one may write either
-// if glog.V(2) { glog.Info("log this") }
-// or
-// glog.V(2).Info("log this")
-// The second form is shorter but the first is cheaper if logging is off because it does
-// not evaluate its arguments.
-//
-// Whether an individual call to V generates a log record depends on the setting of
-// the -v and --vmodule flags; both are off by default. If the level in the call to
-// V is at least the value of -v, or of -vmodule for the source file containing the
-// call, the V call will log.
-func V(level Level) Verbose {
- // This function tries hard to be cheap unless there's work to do.
- // The fast path is two atomic loads and compares.
-
- // Here is a cheap but safe test to see if V logging is enabled globally.
- if logging.verbosity.get() >= level {
- return Verbose(true)
- }
-
- // It's off globally but it vmodule may still be set.
- // Here is another cheap but safe test to see if vmodule is enabled.
- if atomic.LoadInt32(&logging.filterLength) > 0 {
- // Now we need a proper lock to use the logging structure. The pcs field
- // is shared so we must lock before accessing it. This is fairly expensive,
- // but if V logging is enabled we're slow anyway.
- logging.mu.Lock()
- defer logging.mu.Unlock()
- if runtime.Callers(2, logging.pcs[:]) == 0 {
- return Verbose(false)
- }
- v, ok := logging.vmap[logging.pcs[0]]
- if !ok {
- v = logging.setV(logging.pcs[0])
- }
- return Verbose(v >= level)
- }
- return Verbose(false)
-}
-
-// Info is equivalent to the global Info function, guarded by the value of v.
-// See the documentation of V for usage.
-func (v Verbose) Info(args ...interface{}) {
- if v {
- logging.print(infoLog, args...)
- }
-}
-
-// Infoln is equivalent to the global Infoln function, guarded by the value of v.
-// See the documentation of V for usage.
-func (v Verbose) Infoln(args ...interface{}) {
- if v {
- logging.println(infoLog, args...)
- }
-}
-
-// Infof is equivalent to the global Infof function, guarded by the value of v.
-// See the documentation of V for usage.
-func (v Verbose) Infof(format string, args ...interface{}) {
- if v {
- logging.printf(infoLog, format, args...)
- }
-}
-
-// Info logs to the INFO log.
-// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
-func Info(args ...interface{}) {
- logging.print(infoLog, args...)
-}
-
-// InfoDepth acts as Info but uses depth to determine which call frame to log.
-// InfoDepth(0, "msg") is the same as Info("msg").
-func InfoDepth(depth int, args ...interface{}) {
- logging.printDepth(infoLog, depth, args...)
-}
-
-// Infoln logs to the INFO log.
-// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
-func Infoln(args ...interface{}) {
- logging.println(infoLog, args...)
-}
-
-// Infof logs to the INFO log.
-// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
-func Infof(format string, args ...interface{}) {
- logging.printf(infoLog, format, args...)
-}
-
-// Warning logs to the WARNING and INFO logs.
-// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
-func Warning(args ...interface{}) {
- logging.print(warningLog, args...)
-}
-
-// WarningDepth acts as Warning but uses depth to determine which call frame to log.
-// WarningDepth(0, "msg") is the same as Warning("msg").
-func WarningDepth(depth int, args ...interface{}) {
- logging.printDepth(warningLog, depth, args...)
-}
-
-// Warningln logs to the WARNING and INFO logs.
-// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
-func Warningln(args ...interface{}) {
- logging.println(warningLog, args...)
-}
-
-// Warningf logs to the WARNING and INFO logs.
-// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
-func Warningf(format string, args ...interface{}) {
- logging.printf(warningLog, format, args...)
-}
-
-// Error logs to the ERROR, WARNING, and INFO logs.
-// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
-func Error(args ...interface{}) {
- logging.print(errorLog, args...)
-}
-
-// ErrorDepth acts as Error but uses depth to determine which call frame to log.
-// ErrorDepth(0, "msg") is the same as Error("msg").
-func ErrorDepth(depth int, args ...interface{}) {
- logging.printDepth(errorLog, depth, args...)
-}
-
-// Errorln logs to the ERROR, WARNING, and INFO logs.
-// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
-func Errorln(args ...interface{}) {
- logging.println(errorLog, args...)
-}
-
-// Errorf logs to the ERROR, WARNING, and INFO logs.
-// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
-func Errorf(format string, args ...interface{}) {
- logging.printf(errorLog, format, args...)
-}
-
-// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
-// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
-func Fatal(args ...interface{}) {
- logging.print(fatalLog, args...)
-}
-
-// FatalDepth acts as Fatal but uses depth to determine which call frame to log.
-// FatalDepth(0, "msg") is the same as Fatal("msg").
-func FatalDepth(depth int, args ...interface{}) {
- logging.printDepth(fatalLog, depth, args...)
-}
-
-// Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
-// Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
-func Fatalln(args ...interface{}) {
- logging.println(fatalLog, args...)
-}
-
-// Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs,
-// including a stack trace of all running goroutines, then calls os.Exit(255).
-// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
-func Fatalf(format string, args ...interface{}) {
- logging.printf(fatalLog, format, args...)
-}
-
-// fatalNoStacks is non-zero if we are to exit without dumping goroutine stacks.
-// It allows Exit and relatives to use the Fatal logs.
-var fatalNoStacks uint32
-
-// Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
-// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
-func Exit(args ...interface{}) {
- atomic.StoreUint32(&fatalNoStacks, 1)
- logging.print(fatalLog, args...)
-}
-
-// ExitDepth acts as Exit but uses depth to determine which call frame to log.
-// ExitDepth(0, "msg") is the same as Exit("msg").
-func ExitDepth(depth int, args ...interface{}) {
- atomic.StoreUint32(&fatalNoStacks, 1)
- logging.printDepth(fatalLog, depth, args...)
-}
-
-// Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
-func Exitln(args ...interface{}) {
- atomic.StoreUint32(&fatalNoStacks, 1)
- logging.println(fatalLog, args...)
-}
-
-// Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).
-// Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
-func Exitf(format string, args ...interface{}) {
- atomic.StoreUint32(&fatalNoStacks, 1)
- logging.printf(fatalLog, format, args...)
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/glog/glog_file.go b/archived/event-adapter/vendor/github.com/golang/glog/glog_file.go
deleted file mode 100644
index 65075d281..000000000
--- a/archived/event-adapter/vendor/github.com/golang/glog/glog_file.go
+++ /dev/null
@@ -1,124 +0,0 @@
-// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
-//
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// File I/O for logs.
-
-package glog
-
-import (
- "errors"
- "flag"
- "fmt"
- "os"
- "os/user"
- "path/filepath"
- "strings"
- "sync"
- "time"
-)
-
-// MaxSize is the maximum size of a log file in bytes.
-var MaxSize uint64 = 1024 * 1024 * 1800
-
-// logDirs lists the candidate directories for new log files.
-var logDirs []string
-
-// If non-empty, overrides the choice of directory in which to write logs.
-// See createLogDirs for the full list of possible destinations.
-var logDir = flag.String("log_dir", "", "If non-empty, write log files in this directory")
-
-func createLogDirs() {
- if *logDir != "" {
- logDirs = append(logDirs, *logDir)
- }
- logDirs = append(logDirs, os.TempDir())
-}
-
-var (
- pid = os.Getpid()
- program = filepath.Base(os.Args[0])
- host = "unknownhost"
- userName = "unknownuser"
-)
-
-func init() {
- h, err := os.Hostname()
- if err == nil {
- host = shortHostname(h)
- }
-
- current, err := user.Current()
- if err == nil {
- userName = current.Username
- }
-
- // Sanitize userName since it may contain filepath separators on Windows.
- userName = strings.Replace(userName, `\`, "_", -1)
-}
-
-// shortHostname returns its argument, truncating at the first period.
-// For instance, given "www.google.com" it returns "www".
-func shortHostname(hostname string) string {
- if i := strings.Index(hostname, "."); i >= 0 {
- return hostname[:i]
- }
- return hostname
-}
-
-// logName returns a new log file name containing tag, with start time t, and
-// the name for the symlink for tag.
-func logName(tag string, t time.Time) (name, link string) {
- name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d",
- program,
- host,
- userName,
- tag,
- t.Year(),
- t.Month(),
- t.Day(),
- t.Hour(),
- t.Minute(),
- t.Second(),
- pid)
- return name, program + "." + tag
-}
-
-var onceLogDirs sync.Once
-
-// create creates a new log file and returns the file and its filename, which
-// contains tag ("INFO", "FATAL", etc.) and t. If the file is created
-// successfully, create also attempts to update the symlink for that tag, ignoring
-// errors.
-func create(tag string, t time.Time) (f *os.File, filename string, err error) {
- onceLogDirs.Do(createLogDirs)
- if len(logDirs) == 0 {
- return nil, "", errors.New("log: no log dirs")
- }
- name, link := logName(tag, t)
- var lastErr error
- for _, dir := range logDirs {
- fname := filepath.Join(dir, name)
- f, err := os.Create(fname)
- if err == nil {
- symlink := filepath.Join(dir, link)
- os.Remove(symlink) // ignore err
- os.Symlink(name, symlink) // ignore err
- return f, fname, nil
- }
- lastErr = err
- }
- return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/groupcache/LICENSE b/archived/event-adapter/vendor/github.com/golang/groupcache/LICENSE
deleted file mode 100644
index 37ec93a14..000000000
--- a/archived/event-adapter/vendor/github.com/golang/groupcache/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/golang/groupcache/lru/lru.go b/archived/event-adapter/vendor/github.com/golang/groupcache/lru/lru.go
deleted file mode 100644
index cdfe2991f..000000000
--- a/archived/event-adapter/vendor/github.com/golang/groupcache/lru/lru.go
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Copyright 2013 Google Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package lru implements an LRU cache.
-package lru
-
-import "container/list"
-
-// Cache is an LRU cache. It is not safe for concurrent access.
-type Cache struct {
- // MaxEntries is the maximum number of cache entries before
- // an item is evicted. Zero means no limit.
- MaxEntries int
-
- // OnEvicted optionally specificies a callback function to be
- // executed when an entry is purged from the cache.
- OnEvicted func(key Key, value interface{})
-
- ll *list.List
- cache map[interface{}]*list.Element
-}
-
-// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
-type Key interface{}
-
-type entry struct {
- key Key
- value interface{}
-}
-
-// New creates a new Cache.
-// If maxEntries is zero, the cache has no limit and it's assumed
-// that eviction is done by the caller.
-func New(maxEntries int) *Cache {
- return &Cache{
- MaxEntries: maxEntries,
- ll: list.New(),
- cache: make(map[interface{}]*list.Element),
- }
-}
-
-// Add adds a value to the cache.
-func (c *Cache) Add(key Key, value interface{}) {
- if c.cache == nil {
- c.cache = make(map[interface{}]*list.Element)
- c.ll = list.New()
- }
- if ee, ok := c.cache[key]; ok {
- c.ll.MoveToFront(ee)
- ee.Value.(*entry).value = value
- return
- }
- ele := c.ll.PushFront(&entry{key, value})
- c.cache[key] = ele
- if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries {
- c.RemoveOldest()
- }
-}
-
-// Get looks up a key's value from the cache.
-func (c *Cache) Get(key Key) (value interface{}, ok bool) {
- if c.cache == nil {
- return
- }
- if ele, hit := c.cache[key]; hit {
- c.ll.MoveToFront(ele)
- return ele.Value.(*entry).value, true
- }
- return
-}
-
-// Remove removes the provided key from the cache.
-func (c *Cache) Remove(key Key) {
- if c.cache == nil {
- return
- }
- if ele, hit := c.cache[key]; hit {
- c.removeElement(ele)
- }
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *Cache) RemoveOldest() {
- if c.cache == nil {
- return
- }
- ele := c.ll.Back()
- if ele != nil {
- c.removeElement(ele)
- }
-}
-
-func (c *Cache) removeElement(e *list.Element) {
- c.ll.Remove(e)
- kv := e.Value.(*entry)
- delete(c.cache, kv.key)
- if c.OnEvicted != nil {
- c.OnEvicted(kv.key, kv.value)
- }
-}
-
-// Len returns the number of items in the cache.
-func (c *Cache) Len() int {
- if c.cache == nil {
- return 0
- }
- return c.ll.Len()
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/AUTHORS b/archived/event-adapter/vendor/github.com/golang/protobuf/AUTHORS
deleted file mode 100644
index 15167cd74..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/CONTRIBUTORS b/archived/event-adapter/vendor/github.com/golang/protobuf/CONTRIBUTORS
deleted file mode 100644
index 1c4577e96..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/LICENSE b/archived/event-adapter/vendor/github.com/golang/protobuf/LICENSE
deleted file mode 100644
index 1b1b1921e..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/LICENSE
+++ /dev/null
@@ -1,31 +0,0 @@
-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
-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.
-
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go b/archived/event-adapter/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
deleted file mode 100644
index 6308548cb..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
+++ /dev/null
@@ -1,799 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2015 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
-// 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.
-
-/*
-Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
-It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json.
-
-This package produces a different output than the standard "encoding/json" package,
-which does not operate correctly on protocol buffers.
-*/
-package jsonpb
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/golang/protobuf/proto"
-)
-
-// Marshaler is a configurable object for converting between
-// protocol buffer objects and a JSON representation for them.
-type Marshaler struct {
- // Whether to render enum values as integers, as opposed to string values.
- EnumsAsInts bool
-
- // Whether to render fields with zero values.
- EmitDefaults bool
-
- // A string to indent each level by. The presence of this field will
- // also cause a space to appear between the field separator and
- // value, and for newlines to be appear between fields and array
- // elements.
- Indent string
-
- // Whether to use the original (.proto) name for fields.
- OrigName bool
-}
-
-// Marshal marshals a protocol buffer into JSON.
-func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error {
- writer := &errWriter{writer: out}
- return m.marshalObject(writer, pb, "", "")
-}
-
-// MarshalToString converts a protocol buffer object to JSON string.
-func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) {
- var buf bytes.Buffer
- if err := m.Marshal(&buf, pb); err != nil {
- return "", err
- }
- return buf.String(), nil
-}
-
-type int32Slice []int32
-
-// For sorting extensions ids to ensure stable output.
-func (s int32Slice) Len() int { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-type wkt interface {
- XXX_WellKnownType() string
-}
-
-// marshalObject writes a struct to the Writer.
-func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error {
- s := reflect.ValueOf(v).Elem()
-
- // Handle well-known types.
- if wkt, ok := v.(wkt); ok {
- switch wkt.XXX_WellKnownType() {
- case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value",
- "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue":
- // "Wrappers use the same representation in JSON
- // as the wrapped primitive type, ..."
- sprop := proto.GetProperties(s.Type())
- return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent)
- case "Any":
- // Any is a bit more involved.
- return m.marshalAny(out, v, indent)
- case "Duration":
- // "Generated output always contains 3, 6, or 9 fractional digits,
- // depending on required precision."
- s, ns := s.Field(0).Int(), s.Field(1).Int()
- d := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond
- x := fmt.Sprintf("%.9f", d.Seconds())
- x = strings.TrimSuffix(x, "000")
- x = strings.TrimSuffix(x, "000")
- out.write(`"`)
- out.write(x)
- out.write(`s"`)
- return out.err
- case "Struct":
- // Let marshalValue handle the `fields` map.
- // TODO: pass the correct Properties if needed.
- return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent)
- case "Timestamp":
- // "RFC 3339, where generated output will always be Z-normalized
- // and uses 3, 6 or 9 fractional digits."
- s, ns := s.Field(0).Int(), s.Field(1).Int()
- t := time.Unix(s, ns).UTC()
- // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits).
- x := t.Format("2006-01-02T15:04:05.000000000")
- x = strings.TrimSuffix(x, "000")
- x = strings.TrimSuffix(x, "000")
- out.write(`"`)
- out.write(x)
- out.write(`Z"`)
- return out.err
- case "Value":
- // Value has a single oneof.
- kind := s.Field(0)
- if kind.IsNil() {
- // "absence of any variant indicates an error"
- return errors.New("nil Value")
- }
- // oneof -> *T -> T -> T.F
- x := kind.Elem().Elem().Field(0)
- // TODO: pass the correct Properties if needed.
- return m.marshalValue(out, &proto.Properties{}, x, indent)
- }
- }
-
- out.write("{")
- if m.Indent != "" {
- out.write("\n")
- }
-
- firstField := true
-
- if typeURL != "" {
- if err := m.marshalTypeURL(out, indent, typeURL); err != nil {
- return err
- }
- firstField = false
- }
-
- for i := 0; i < s.NumField(); i++ {
- value := s.Field(i)
- valueField := s.Type().Field(i)
- if strings.HasPrefix(valueField.Name, "XXX_") {
- continue
- }
-
- // IsNil will panic on most value kinds.
- switch value.Kind() {
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- if value.IsNil() {
- continue
- }
- }
-
- if !m.EmitDefaults {
- switch value.Kind() {
- case reflect.Bool:
- if !value.Bool() {
- continue
- }
- case reflect.Int32, reflect.Int64:
- if value.Int() == 0 {
- continue
- }
- case reflect.Uint32, reflect.Uint64:
- if value.Uint() == 0 {
- continue
- }
- case reflect.Float32, reflect.Float64:
- if value.Float() == 0 {
- continue
- }
- case reflect.String:
- if value.Len() == 0 {
- continue
- }
- }
- }
-
- // Oneof fields need special handling.
- if valueField.Tag.Get("protobuf_oneof") != "" {
- // value is an interface containing &T{real_value}.
- sv := value.Elem().Elem() // interface -> *T -> T
- value = sv.Field(0)
- valueField = sv.Type().Field(0)
- }
- prop := jsonProperties(valueField, m.OrigName)
- if !firstField {
- m.writeSep(out)
- }
- if err := m.marshalField(out, prop, value, indent); err != nil {
- return err
- }
- firstField = false
- }
-
- // Handle proto2 extensions.
- if ep, ok := v.(proto.Message); ok {
- extensions := proto.RegisteredExtensions(v)
- // Sort extensions for stable output.
- ids := make([]int32, 0, len(extensions))
- for id, desc := range extensions {
- if !proto.HasExtension(ep, desc) {
- continue
- }
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids))
- for _, id := range ids {
- desc := extensions[id]
- if desc == nil {
- // unknown extension
- continue
- }
- ext, extErr := proto.GetExtension(ep, desc)
- if extErr != nil {
- return extErr
- }
- value := reflect.ValueOf(ext)
- var prop proto.Properties
- prop.Parse(desc.Tag)
- prop.JSONName = fmt.Sprintf("[%s]", desc.Name)
- if !firstField {
- m.writeSep(out)
- }
- if err := m.marshalField(out, &prop, value, indent); err != nil {
- return err
- }
- firstField = false
- }
-
- }
-
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- }
- out.write("}")
- return out.err
-}
-
-func (m *Marshaler) writeSep(out *errWriter) {
- if m.Indent != "" {
- out.write(",\n")
- } else {
- out.write(",")
- }
-}
-
-func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error {
- // "If the Any contains a value that has a special JSON mapping,
- // it will be converted as follows: {"@type": xxx, "value": yyy}.
- // Otherwise, the value will be converted into a JSON object,
- // and the "@type" field will be inserted to indicate the actual data type."
- v := reflect.ValueOf(any).Elem()
- turl := v.Field(0).String()
- val := v.Field(1).Bytes()
-
- // Only the part of type_url after the last slash is relevant.
- mname := turl
- if slash := strings.LastIndex(mname, "/"); slash >= 0 {
- mname = mname[slash+1:]
- }
- mt := proto.MessageType(mname)
- if mt == nil {
- return fmt.Errorf("unknown message type %q", mname)
- }
- msg := reflect.New(mt.Elem()).Interface().(proto.Message)
- if err := proto.Unmarshal(val, msg); err != nil {
- return err
- }
-
- if _, ok := msg.(wkt); ok {
- out.write("{")
- if m.Indent != "" {
- out.write("\n")
- }
- if err := m.marshalTypeURL(out, indent, turl); err != nil {
- return err
- }
- m.writeSep(out)
- if m.Indent != "" {
- out.write(indent)
- out.write(m.Indent)
- out.write(`"value": `)
- } else {
- out.write(`"value":`)
- }
- if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil {
- return err
- }
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- }
- out.write("}")
- return out.err
- }
-
- return m.marshalObject(out, msg, indent, turl)
-}
-
-func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error {
- if m.Indent != "" {
- out.write(indent)
- out.write(m.Indent)
- }
- out.write(`"@type":`)
- if m.Indent != "" {
- out.write(" ")
- }
- b, err := json.Marshal(typeURL)
- if err != nil {
- return err
- }
- out.write(string(b))
- return out.err
-}
-
-// marshalField writes field description and value to the Writer.
-func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {
- if m.Indent != "" {
- out.write(indent)
- out.write(m.Indent)
- }
- out.write(`"`)
- out.write(prop.JSONName)
- out.write(`":`)
- if m.Indent != "" {
- out.write(" ")
- }
- if err := m.marshalValue(out, prop, v, indent); err != nil {
- return err
- }
- return nil
-}
-
-// marshalValue writes the value to the Writer.
-func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error {
-
- var err error
- v = reflect.Indirect(v)
-
- // Handle repeated elements.
- if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 {
- out.write("[")
- comma := ""
- for i := 0; i < v.Len(); i++ {
- sliceVal := v.Index(i)
- out.write(comma)
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- out.write(m.Indent)
- out.write(m.Indent)
- }
- if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {
- return err
- }
- comma = ","
- }
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- out.write(m.Indent)
- }
- out.write("]")
- return out.err
- }
-
- // Handle well-known types.
- // Most are handled up in marshalObject (because 99% are messages).
- type wkt interface {
- XXX_WellKnownType() string
- }
- if wkt, ok := v.Interface().(wkt); ok {
- switch wkt.XXX_WellKnownType() {
- case "NullValue":
- out.write("null")
- return out.err
- }
- }
-
- // Handle enumerations.
- if !m.EnumsAsInts && prop.Enum != "" {
- // Unknown enum values will are stringified by the proto library as their
- // value. Such values should _not_ be quoted or they will be interpreted
- // as an enum string instead of their value.
- enumStr := v.Interface().(fmt.Stringer).String()
- var valStr string
- if v.Kind() == reflect.Ptr {
- valStr = strconv.Itoa(int(v.Elem().Int()))
- } else {
- valStr = strconv.Itoa(int(v.Int()))
- }
- isKnownEnum := enumStr != valStr
- if isKnownEnum {
- out.write(`"`)
- }
- out.write(enumStr)
- if isKnownEnum {
- out.write(`"`)
- }
- return out.err
- }
-
- // Handle nested messages.
- if v.Kind() == reflect.Struct {
- return m.marshalObject(out, v.Addr().Interface().(proto.Message), indent+m.Indent, "")
- }
-
- // Handle maps.
- // Since Go randomizes map iteration, we sort keys for stable output.
- if v.Kind() == reflect.Map {
- out.write(`{`)
- keys := v.MapKeys()
- sort.Sort(mapKeys(keys))
- for i, k := range keys {
- if i > 0 {
- out.write(`,`)
- }
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- out.write(m.Indent)
- out.write(m.Indent)
- }
-
- b, err := json.Marshal(k.Interface())
- if err != nil {
- return err
- }
- s := string(b)
-
- // If the JSON is not a string value, encode it again to make it one.
- if !strings.HasPrefix(s, `"`) {
- b, err := json.Marshal(s)
- if err != nil {
- return err
- }
- s = string(b)
- }
-
- out.write(s)
- out.write(`:`)
- if m.Indent != "" {
- out.write(` `)
- }
-
- if err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil {
- return err
- }
- }
- if m.Indent != "" {
- out.write("\n")
- out.write(indent)
- out.write(m.Indent)
- }
- out.write(`}`)
- return out.err
- }
-
- // Default handling defers to the encoding/json library.
- b, err := json.Marshal(v.Interface())
- if err != nil {
- return err
- }
- needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64)
- if needToQuote {
- out.write(`"`)
- }
- out.write(string(b))
- if needToQuote {
- out.write(`"`)
- }
- return out.err
-}
-
-// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream.
-// This function is lenient and will decode any options permutations of the
-// related Marshaler.
-func UnmarshalNext(dec *json.Decoder, pb proto.Message) error {
- inputValue := json.RawMessage{}
- if err := dec.Decode(&inputValue); err != nil {
- return err
- }
- return unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil)
-}
-
-// Unmarshal unmarshals a JSON object stream into a protocol
-// buffer. This function is lenient and will decode any options
-// permutations of the related Marshaler.
-func Unmarshal(r io.Reader, pb proto.Message) error {
- dec := json.NewDecoder(r)
- return UnmarshalNext(dec, pb)
-}
-
-// UnmarshalString will populate the fields of a protocol buffer based
-// on a JSON string. This function is lenient and will decode any options
-// permutations of the related Marshaler.
-func UnmarshalString(str string, pb proto.Message) error {
- return Unmarshal(strings.NewReader(str), pb)
-}
-
-// unmarshalValue converts/copies a value into the target.
-// prop may be nil.
-func unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error {
- targetType := target.Type()
-
- // Allocate memory for pointer fields.
- if targetType.Kind() == reflect.Ptr {
- target.Set(reflect.New(targetType.Elem()))
- return unmarshalValue(target.Elem(), inputValue, prop)
- }
-
- // Handle well-known types.
- type wkt interface {
- XXX_WellKnownType() string
- }
- if wkt, ok := target.Addr().Interface().(wkt); ok {
- switch wkt.XXX_WellKnownType() {
- case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value",
- "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue":
- // "Wrappers use the same representation in JSON
- // as the wrapped primitive type, except that null is allowed."
- // encoding/json will turn JSON `null` into Go `nil`,
- // so we don't have to do any extra work.
- return unmarshalValue(target.Field(0), inputValue, prop)
- case "Any":
- return fmt.Errorf("unmarshaling Any not supported yet")
- case "Duration":
- unq, err := strconv.Unquote(string(inputValue))
- if err != nil {
- return err
- }
- d, err := time.ParseDuration(unq)
- if err != nil {
- return fmt.Errorf("bad Duration: %v", err)
- }
- ns := d.Nanoseconds()
- s := ns / 1e9
- ns %= 1e9
- target.Field(0).SetInt(s)
- target.Field(1).SetInt(ns)
- return nil
- case "Timestamp":
- unq, err := strconv.Unquote(string(inputValue))
- if err != nil {
- return err
- }
- t, err := time.Parse(time.RFC3339Nano, unq)
- if err != nil {
- return fmt.Errorf("bad Timestamp: %v", err)
- }
- ns := t.UnixNano()
- s := ns / 1e9
- ns %= 1e9
- target.Field(0).SetInt(s)
- target.Field(1).SetInt(ns)
- return nil
- }
- }
-
- // Handle enums, which have an underlying type of int32,
- // and may appear as strings.
- // The case of an enum appearing as a number is handled
- // at the bottom of this function.
- if inputValue[0] == '"' && prop != nil && prop.Enum != "" {
- vmap := proto.EnumValueMap(prop.Enum)
- // Don't need to do unquoting; valid enum names
- // are from a limited character set.
- s := inputValue[1 : len(inputValue)-1]
- n, ok := vmap[string(s)]
- if !ok {
- return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum)
- }
- if target.Kind() == reflect.Ptr { // proto2
- target.Set(reflect.New(targetType.Elem()))
- target = target.Elem()
- }
- target.SetInt(int64(n))
- return nil
- }
-
- // Handle nested messages.
- if targetType.Kind() == reflect.Struct {
- var jsonFields map[string]json.RawMessage
- if err := json.Unmarshal(inputValue, &jsonFields); err != nil {
- return err
- }
-
- consumeField := func(prop *proto.Properties) (json.RawMessage, bool) {
- // Be liberal in what names we accept; both orig_name and camelName are okay.
- fieldNames := acceptedJSONFieldNames(prop)
-
- vOrig, okOrig := jsonFields[fieldNames.orig]
- vCamel, okCamel := jsonFields[fieldNames.camel]
- if !okOrig && !okCamel {
- return nil, false
- }
- // If, for some reason, both are present in the data, favour the camelName.
- var raw json.RawMessage
- if okOrig {
- raw = vOrig
- delete(jsonFields, fieldNames.orig)
- }
- if okCamel {
- raw = vCamel
- delete(jsonFields, fieldNames.camel)
- }
- return raw, true
- }
-
- sprops := proto.GetProperties(targetType)
- for i := 0; i < target.NumField(); i++ {
- ft := target.Type().Field(i)
- if strings.HasPrefix(ft.Name, "XXX_") {
- continue
- }
-
- valueForField, ok := consumeField(sprops.Prop[i])
- if !ok {
- continue
- }
-
- if err := unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil {
- return err
- }
- }
- // Check for any oneof fields.
- if len(jsonFields) > 0 {
- for _, oop := range sprops.OneofTypes {
- raw, ok := consumeField(oop.Prop)
- if !ok {
- continue
- }
- nv := reflect.New(oop.Type.Elem())
- target.Field(oop.Field).Set(nv)
- if err := unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil {
- return err
- }
- }
- }
- if len(jsonFields) > 0 {
- // Pick any field to be the scapegoat.
- var f string
- for fname := range jsonFields {
- f = fname
- break
- }
- return fmt.Errorf("unknown field %q in %v", f, targetType)
- }
- return nil
- }
-
- // Handle arrays (which aren't encoded bytes)
- if targetType.Kind() == reflect.Slice && targetType.Elem().Kind() != reflect.Uint8 {
- var slc []json.RawMessage
- if err := json.Unmarshal(inputValue, &slc); err != nil {
- return err
- }
- len := len(slc)
- target.Set(reflect.MakeSlice(targetType, len, len))
- for i := 0; i < len; i++ {
- if err := unmarshalValue(target.Index(i), slc[i], prop); err != nil {
- return err
- }
- }
- return nil
- }
-
- // Handle maps (whose keys are always strings)
- if targetType.Kind() == reflect.Map {
- var mp map[string]json.RawMessage
- if err := json.Unmarshal(inputValue, &mp); err != nil {
- return err
- }
- target.Set(reflect.MakeMap(targetType))
- var keyprop, valprop *proto.Properties
- if prop != nil {
- // These could still be nil if the protobuf metadata is broken somehow.
- // TODO: This won't work because the fields are unexported.
- // We should probably just reparse them.
- //keyprop, valprop = prop.mkeyprop, prop.mvalprop
- }
- for ks, raw := range mp {
- // Unmarshal map key. The core json library already decoded the key into a
- // string, so we handle that specially. Other types were quoted post-serialization.
- var k reflect.Value
- if targetType.Key().Kind() == reflect.String {
- k = reflect.ValueOf(ks)
- } else {
- k = reflect.New(targetType.Key()).Elem()
- if err := unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil {
- return err
- }
- }
-
- // Unmarshal map value.
- v := reflect.New(targetType.Elem()).Elem()
- if err := unmarshalValue(v, raw, valprop); err != nil {
- return err
- }
- target.SetMapIndex(k, v)
- }
- 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]
- }
-
- // Use the encoding/json for parsing other value types.
- return json.Unmarshal(inputValue, target.Addr().Interface())
-}
-
-// 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
- prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
- if origName || prop.JSONName == "" {
- prop.JSONName = prop.OrigName
- }
- return &prop
-}
-
-type fieldNames struct {
- orig, camel string
-}
-
-func acceptedJSONFieldNames(prop *proto.Properties) fieldNames {
- opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName}
- if prop.JSONName != "" {
- opts.camel = prop.JSONName
- }
- return opts
-}
-
-// Writer wrapper inspired by https://blog.golang.org/errors-are-values
-type errWriter struct {
- writer io.Writer
- err error
-}
-
-func (w *errWriter) write(str string) {
- if w.err != nil {
- return
- }
- _, w.err = w.writer.Write([]byte(str))
-}
-
-// Map fields may have key types of non-float scalars, strings and enums.
-// The easiest way to sort them in some deterministic order is to use fmt.
-// If this turns out to be inefficient we can always consider other options,
-// such as doing a Schwartzian transform.
-type mapKeys []reflect.Value
-
-func (s mapKeys) Len() int { return len(s) }
-func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s mapKeys) Less(i, j int) bool {
- return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface())
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/Makefile b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/Makefile
deleted file mode 100644
index e2e0651a9..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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
-# 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.
-
-install:
- go install
-
-test: install generate-test-pbs
- go test
-
-
-generate-test-pbs:
- make install
- make -C testdata
- protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto
- make
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/clone.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/clone.go
deleted file mode 100644
index e392575b3..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/clone.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 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
-// 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.
-
-// Protocol buffer deep copy and merge.
-// TODO: RawMessage.
-
-package proto
-
-import (
- "log"
- "reflect"
- "strings"
-)
-
-// Clone returns a deep copy of a protocol buffer.
-func Clone(pb Message) Message {
- in := reflect.ValueOf(pb)
- if in.IsNil() {
- return pb
- }
-
- out := reflect.New(in.Type().Elem())
- // out is empty so a merge is a deep copy.
- mergeStruct(out.Elem(), in.Elem())
- return out.Interface().(Message)
-}
-
-// Merge merges src into dst.
-// Required and optional fields that are set in src will be set to that value in dst.
-// Elements of repeated fields will be appended.
-// Merge panics if src and dst are not the same type, or if dst is nil.
-func Merge(dst, src Message) {
- in := reflect.ValueOf(src)
- out := reflect.ValueOf(dst)
- if out.IsNil() {
- panic("proto: nil destination")
- }
- if in.Type() != out.Type() {
- // Explicit test prior to mergeStruct so that mistyped nils will fail
- panic("proto: type mismatch")
- }
- if in.IsNil() {
- // Merging nil into non-nil is a quiet no-op
- return
- }
- mergeStruct(out.Elem(), in.Elem())
-}
-
-func mergeStruct(out, in reflect.Value) {
- sprop := GetProperties(in.Type())
- for i := 0; i < in.NumField(); i++ {
- f := in.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
- }
-
- if emIn, ok := extendable(in.Addr().Interface()); ok {
- emOut, _ := extendable(out.Addr().Interface())
- mIn, muIn := emIn.extensionsRead()
- if mIn != nil {
- mOut := emOut.extensionsWrite()
- muIn.Lock()
- mergeExtension(mOut, mIn)
- muIn.Unlock()
- }
- }
-
- uf := in.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return
- }
- uin := uf.Bytes()
- if len(uin) > 0 {
- out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
- }
-}
-
-// mergeAny performs a merge between two values of the same type.
-// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
-// prop is set if this is a struct field (it may be nil).
-func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
- if in.Type() == protoMessageType {
- if !in.IsNil() {
- if out.IsNil() {
- out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
- } else {
- Merge(out.Interface().(Message), in.Interface().(Message))
- }
- }
- return
- }
- switch in.Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- if !viaPtr && isProto3Zero(in) {
- return
- }
- out.Set(in)
- case reflect.Interface:
- // Probably a oneof field; copy non-nil values.
- if in.IsNil() {
- return
- }
- // Allocate destination if it is not set, or set to a different type.
- // Otherwise we will merge as normal.
- if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
- out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
- }
- mergeAny(out.Elem(), in.Elem(), false, nil)
- case reflect.Map:
- if in.Len() == 0 {
- return
- }
- if out.IsNil() {
- out.Set(reflect.MakeMap(in.Type()))
- }
- // For maps with value types of *T or []byte we need to deep copy each value.
- elemKind := in.Type().Elem().Kind()
- for _, key := range in.MapKeys() {
- var val reflect.Value
- switch elemKind {
- case reflect.Ptr:
- val = reflect.New(in.Type().Elem().Elem())
- mergeAny(val, in.MapIndex(key), false, nil)
- case reflect.Slice:
- val = in.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- default:
- val = in.MapIndex(key)
- }
- out.SetMapIndex(key, val)
- }
- case reflect.Ptr:
- if in.IsNil() {
- return
- }
- if out.IsNil() {
- out.Set(reflect.New(in.Elem().Type()))
- }
- mergeAny(out.Elem(), in.Elem(), true, nil)
- case reflect.Slice:
- if in.IsNil() {
- return
- }
- if in.Type().Elem().Kind() == reflect.Uint8 {
- // []byte is a scalar bytes field, not a repeated field.
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value, and should not
- // be merged.
- if prop != nil && prop.proto3 && in.Len() == 0 {
- return
- }
-
- // Make a deep copy.
- // Append to []byte{} instead of []byte(nil) so that we never end up
- // with a nil result.
- out.SetBytes(append([]byte{}, in.Bytes()...))
- return
- }
- n := in.Len()
- if out.IsNil() {
- out.Set(reflect.MakeSlice(in.Type(), 0, n))
- }
- switch in.Type().Elem().Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- out.Set(reflect.AppendSlice(out, in))
- default:
- for i := 0; i < n; i++ {
- x := reflect.Indirect(reflect.New(in.Type().Elem()))
- mergeAny(x, in.Index(i), false, nil)
- out.Set(reflect.Append(out, x))
- }
- }
- case reflect.Struct:
- mergeStruct(out, in)
- default:
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to copy %v", in)
- }
-}
-
-func mergeExtension(out, in map[int32]Extension) {
- for extNum, eIn := range in {
- eOut := Extension{desc: eIn.desc}
- if eIn.value != nil {
- v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
- mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
- eOut.value = v.Interface()
- }
- if eIn.enc != nil {
- eOut.enc = make([]byte, len(eIn.enc))
- copy(eOut.enc, eIn.enc)
- }
-
- out[extNum] = eOut
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/decode.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/decode.go
deleted file mode 100644
index 07288a250..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/decode.go
+++ /dev/null
@@ -1,869 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for decoding protocol buffer data to construct in-memory representations.
- */
-
-import (
- "errors"
- "fmt"
- "io"
- "os"
- "reflect"
-)
-
-// errOverflow is returned when an integer is too large to be represented.
-var errOverflow = errors.New("proto: integer overflow")
-
-// ErrInternalBadWireType is returned by generated code when an incorrect
-// wire type is encountered. It does not get returned to user code.
-var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
-
-// The fundamental decoders that interpret bytes on the wire.
-// Those that take integer types all return uint64 and are
-// therefore of type valueDecoder.
-
-// DecodeVarint reads a varint-encoded integer from the slice.
-// It returns the integer and the number of bytes consumed, or
-// zero if there is not enough.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func DecodeVarint(buf []byte) (x uint64, n int) {
- // x, n already 0
- for shift := uint(0); shift < 64; shift += 7 {
- if n >= len(buf) {
- return 0, 0
- }
- b := uint64(buf[n])
- n++
- x |= (b & 0x7F) << shift
- if (b & 0x80) == 0 {
- return x, n
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- return 0, 0
-}
-
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
- // x, err already 0
-
- i := p.index
- l := len(p.buf)
-
- for shift := uint(0); shift < 64; shift += 7 {
- if i >= l {
- err = io.ErrUnexpectedEOF
- return
- }
- b := p.buf[i]
- i++
- x |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- p.index = i
- return
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- err = errOverflow
- return
-}
-
-// DecodeFixed64 reads a 64-bit integer from the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) DecodeFixed64() (x uint64, err error) {
- // x, err already 0
- i := p.index + 8
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-8])
- x |= uint64(p.buf[i-7]) << 8
- x |= uint64(p.buf[i-6]) << 16
- x |= uint64(p.buf[i-5]) << 24
- x |= uint64(p.buf[i-4]) << 32
- x |= uint64(p.buf[i-3]) << 40
- x |= uint64(p.buf[i-2]) << 48
- x |= uint64(p.buf[i-1]) << 56
- return
-}
-
-// DecodeFixed32 reads a 32-bit integer from the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) DecodeFixed32() (x uint64, err error) {
- // x, err already 0
- i := p.index + 4
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-4])
- x |= uint64(p.buf[i-3]) << 8
- x |= uint64(p.buf[i-2]) << 16
- x |= uint64(p.buf[i-1]) << 24
- return
-}
-
-// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
-// from the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
- return
-}
-
-// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
-// from the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
- return
-}
-
-// These are not ValueDecoders: they produce an array of bytes or a string.
-// bytes, embedded messages
-
-// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
- n, err := p.DecodeVarint()
- if err != nil {
- return nil, err
- }
-
- nb := int(n)
- if nb < 0 {
- return nil, fmt.Errorf("proto: bad byte length %d", nb)
- }
- end := p.index + nb
- if end < p.index || end > len(p.buf) {
- return nil, io.ErrUnexpectedEOF
- }
-
- if !alloc {
- // todo: check if can get more uses of alloc=false
- buf = p.buf[p.index:end]
- p.index += nb
- return
- }
-
- buf = make([]byte, nb)
- copy(buf, p.buf[p.index:])
- p.index += nb
- return
-}
-
-// DecodeStringBytes reads an encoded string from the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) DecodeStringBytes() (s string, err error) {
- buf, err := p.DecodeRawBytes(false)
- if err != nil {
- return
- }
- return string(buf), nil
-}
-
-// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.
-// If the protocol buffer has extensions, and the field matches, add it as an extension.
-// Otherwise, if the XXX_unrecognized field exists, append the skipped data there.
-func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error {
- oi := o.index
-
- err := o.skip(t, tag, wire)
- if err != nil {
- return err
- }
-
- if !unrecField.IsValid() {
- return nil
- }
-
- ptr := structPointer_Bytes(base, unrecField)
-
- // Add the skipped field to struct field
- obuf := o.buf
-
- o.buf = *ptr
- o.EncodeVarint(uint64(tag<<3 | wire))
- *ptr = append(o.buf, obuf[oi:o.index]...)
-
- o.buf = obuf
-
- return nil
-}
-
-// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.
-func (o *Buffer) skip(t reflect.Type, tag, wire int) error {
-
- var u uint64
- var err error
-
- switch wire {
- case WireVarint:
- _, err = o.DecodeVarint()
- case WireFixed64:
- _, err = o.DecodeFixed64()
- case WireBytes:
- _, err = o.DecodeRawBytes(false)
- case WireFixed32:
- _, err = o.DecodeFixed32()
- case WireStartGroup:
- for {
- u, err = o.DecodeVarint()
- if err != nil {
- break
- }
- fwire := int(u & 0x7)
- if fwire == WireEndGroup {
- break
- }
- ftag := int(u >> 3)
- err = o.skip(t, ftag, fwire)
- if err != nil {
- break
- }
- }
- default:
- err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t)
- }
- return err
-}
-
-// Unmarshaler is the interface representing objects that can
-// unmarshal themselves. The method should reset the receiver before
-// decoding starts. The argument points to data that may be
-// overwritten, so implementations should not keep references to the
-// buffer.
-type Unmarshaler interface {
- Unmarshal([]byte) error
-}
-
-// Unmarshal parses the protocol buffer representation in buf and places the
-// decoded result in pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// Unmarshal resets pb before starting to unmarshal, so any
-// existing data in pb is always removed. Use UnmarshalMerge
-// to preserve and append to existing data.
-func Unmarshal(buf []byte, pb Message) error {
- pb.Reset()
- return UnmarshalMerge(buf, pb)
-}
-
-// UnmarshalMerge parses the protocol buffer representation in buf and
-// writes the decoded result to pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// UnmarshalMerge merges into existing data in pb.
-// Most code should use Unmarshal instead.
-func UnmarshalMerge(buf []byte, pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(Unmarshaler); ok {
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// DecodeMessage reads a count-delimited message from the Buffer.
-func (p *Buffer) DecodeMessage(pb Message) error {
- enc, err := p.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- return NewBuffer(enc).Unmarshal(pb)
-}
-
-// DecodeGroup reads a tag-delimited group from the Buffer.
-func (p *Buffer) DecodeGroup(pb Message) error {
- typ, base, err := getbase(pb)
- if err != nil {
- return err
- }
- return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base)
-}
-
-// Unmarshal parses the protocol buffer representation in the
-// Buffer and places the decoded result in pb. If the struct
-// underlying pb does not match the data in the buffer, the results can be
-// unpredictable.
-func (p *Buffer) Unmarshal(pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(Unmarshaler); ok {
- err := u.Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
-
- typ, base, err := getbase(pb)
- if err != nil {
- return err
- }
-
- err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base)
-
- if collectStats {
- stats.Decode++
- }
-
- return err
-}
-
-// unmarshalType does the work of unmarshaling a structure.
-func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error {
- var state errorState
- required, reqFields := prop.reqCount, uint64(0)
-
- var err error
- for err == nil && o.index < len(o.buf) {
- oi := o.index
- var u uint64
- u, err = o.DecodeVarint()
- if err != nil {
- break
- }
- wire := int(u & 0x7)
- if wire == WireEndGroup {
- if is_group {
- return nil // input is satisfied
- }
- return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
- }
- tag := int(u >> 3)
- if tag <= 0 {
- return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire)
- }
- fieldnum, ok := prop.decoderTags.get(tag)
- if !ok {
- // Maybe it's an extension?
- if prop.extendable {
- if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) {
- if err = o.skip(st, tag, wire); err == nil {
- extmap := e.extensionsWrite()
- ext := extmap[int32(tag)] // may be missing
- ext.enc = append(ext.enc, o.buf[oi:o.index]...)
- extmap[int32(tag)] = ext
- }
- continue
- }
- }
- // Maybe it's a oneof?
- if prop.oneofUnmarshaler != nil {
- m := structPointer_Interface(base, st).(Message)
- // First return value indicates whether tag is a oneof field.
- ok, err = prop.oneofUnmarshaler(m, tag, wire, o)
- if err == ErrInternalBadWireType {
- // Map the error to something more descriptive.
- // Do the formatting here to save generated code space.
- err = fmt.Errorf("bad wiretype for oneof field in %T", m)
- }
- if ok {
- continue
- }
- }
- err = o.skipAndSave(st, tag, wire, base, prop.unrecField)
- continue
- }
- p := prop.Prop[fieldnum]
-
- if p.dec == nil {
- fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name)
- continue
- }
- dec := p.dec
- if wire != WireStartGroup && wire != p.WireType {
- if wire == WireBytes && p.packedDec != nil {
- // a packable field
- dec = p.packedDec
- } else {
- err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType)
- continue
- }
- }
- decErr := dec(o, p, base)
- if decErr != nil && !state.shouldContinue(decErr, p) {
- err = decErr
- }
- if err == nil && p.Required {
- // Successfully decoded a required field.
- if tag <= 64 {
- // use bitmap for fields 1-64 to catch field reuse.
- var mask uint64 = 1 << uint64(tag-1)
- if reqFields&mask == 0 {
- // new required field
- reqFields |= mask
- required--
- }
- } else {
- // This is imprecise. It can be fooled by a required field
- // with a tag > 64 that is encoded twice; that's very rare.
- // A fully correct implementation would require allocating
- // a data structure, which we would like to avoid.
- required--
- }
- }
- }
- if err == nil {
- if is_group {
- return io.ErrUnexpectedEOF
- }
- if state.err != nil {
- return state.err
- }
- if required > 0 {
- // Not enough information to determine the exact field. If we use extra
- // CPU, we could determine the field only if the missing required field
- // has a tag <= 64 and we check reqFields.
- return &RequiredNotSetError{"{Unknown}"}
- }
- }
- return err
-}
-
-// Individual type decoders
-// For each,
-// u is the decoded value,
-// v is a pointer to the field (pointer) in the struct
-
-// Sizes of the pools to allocate inside the Buffer.
-// The goal is modest amortization and allocation
-// on at least 16-byte boundaries.
-const (
- boolPoolSize = 16
- uint32PoolSize = 8
- uint64PoolSize = 4
-)
-
-// Decode a bool.
-func (o *Buffer) dec_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- if len(o.bools) == 0 {
- o.bools = make([]bool, boolPoolSize)
- }
- o.bools[0] = u != 0
- *structPointer_Bool(base, p.field) = &o.bools[0]
- o.bools = o.bools[1:]
- return nil
-}
-
-func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- *structPointer_BoolVal(base, p.field) = u != 0
- return nil
-}
-
-// Decode an int32.
-func (o *Buffer) dec_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word32_Set(structPointer_Word32(base, p.field), o, uint32(u))
- return nil
-}
-
-func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u))
- return nil
-}
-
-// Decode an int64.
-func (o *Buffer) dec_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word64_Set(structPointer_Word64(base, p.field), o, u)
- return nil
-}
-
-func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- word64Val_Set(structPointer_Word64Val(base, p.field), o, u)
- return nil
-}
-
-// Decode a string.
-func (o *Buffer) dec_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- *structPointer_String(base, p.field) = &s
- return nil
-}
-
-func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- *structPointer_StringVal(base, p.field) = s
- return nil
-}
-
-// Decode a slice of bytes ([]byte).
-func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- *structPointer_Bytes(base, p.field) = b
- return nil
-}
-
-// Decode a slice of bools ([]bool).
-func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v := structPointer_BoolSlice(base, p.field)
- *v = append(*v, u != 0)
- return nil
-}
-
-// Decode a slice of bools ([]bool) in packed format.
-func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error {
- v := structPointer_BoolSlice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded bools
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
-
- y := *v
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- y = append(y, u != 0)
- }
-
- *v = y
- return nil
-}
-
-// Decode a slice of int32s ([]int32).
-func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- structPointer_Word32Slice(base, p.field).Append(uint32(u))
- return nil
-}
-
-// Decode a slice of int32s ([]int32) in packed format.
-func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32Slice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded int32s
-
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v.Append(uint32(u))
- }
- return nil
-}
-
-// Decode a slice of int64s ([]int64).
-func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
-
- structPointer_Word64Slice(base, p.field).Append(u)
- return nil
-}
-
-// Decode a slice of int64s ([]int64) in packed format.
-func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64Slice(base, p.field)
-
- nn, err := o.DecodeVarint()
- if err != nil {
- return err
- }
- nb := int(nn) // number of bytes of encoded int64s
-
- fin := o.index + nb
- if fin < o.index {
- return errOverflow
- }
- for o.index < fin {
- u, err := p.valDec(o)
- if err != nil {
- return err
- }
- v.Append(u)
- }
- return nil
-}
-
-// Decode a slice of strings ([]string).
-func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error {
- s, err := o.DecodeStringBytes()
- if err != nil {
- return err
- }
- v := structPointer_StringSlice(base, p.field)
- *v = append(*v, s)
- return nil
-}
-
-// Decode a slice of slice of bytes ([][]byte).
-func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error {
- b, err := o.DecodeRawBytes(true)
- if err != nil {
- return err
- }
- v := structPointer_BytesSlice(base, p.field)
- *v = append(*v, b)
- return nil
-}
-
-// Decode a map field.
-func (o *Buffer) dec_new_map(p *Properties, base structPointer) error {
- raw, err := o.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- oi := o.index // index at the end of this map entry
- o.index -= len(raw) // move buffer back to start of map entry
-
- mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V
- if mptr.Elem().IsNil() {
- mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem()))
- }
- v := mptr.Elem() // map[K]V
-
- // Prepare addressable doubly-indirect placeholders for the key and value types.
- // See enc_new_map for why.
- keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K
- keybase := toStructPointer(keyptr.Addr()) // **K
-
- var valbase structPointer
- var valptr reflect.Value
- switch p.mtype.Elem().Kind() {
- case reflect.Slice:
- // []byte
- var dummy []byte
- valptr = reflect.ValueOf(&dummy) // *[]byte
- valbase = toStructPointer(valptr) // *[]byte
- case reflect.Ptr:
- // message; valptr is **Msg; need to allocate the intermediate pointer
- valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V
- valptr.Set(reflect.New(valptr.Type().Elem()))
- valbase = toStructPointer(valptr)
- default:
- // everything else
- valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V
- valbase = toStructPointer(valptr.Addr()) // **V
- }
-
- // Decode.
- // This parses a restricted wire format, namely the encoding of a message
- // with two fields. See enc_new_map for the format.
- for o.index < oi {
- // tagcode for key and value properties are always a single byte
- // because they have tags 1 and 2.
- tagcode := o.buf[o.index]
- o.index++
- switch tagcode {
- case p.mkeyprop.tagcode[0]:
- if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil {
- return err
- }
- case p.mvalprop.tagcode[0]:
- if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil {
- return err
- }
- default:
- // TODO: Should we silently skip this instead?
- return fmt.Errorf("proto: bad map data tag %d", raw[0])
- }
- }
- keyelem, valelem := keyptr.Elem(), valptr.Elem()
- if !keyelem.IsValid() {
- keyelem = reflect.Zero(p.mtype.Key())
- }
- if !valelem.IsValid() {
- valelem = reflect.Zero(p.mtype.Elem())
- }
-
- v.SetMapIndex(keyelem, valelem)
- return nil
-}
-
-// Decode a group.
-func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error {
- bas := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(bas) {
- // allocate new nested message
- bas = toStructPointer(reflect.New(p.stype))
- structPointer_SetStructPointer(base, p.field, bas)
- }
- return o.unmarshalType(p.stype, p.sprop, true, bas)
-}
-
-// Decode an embedded message.
-func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) {
- raw, e := o.DecodeRawBytes(false)
- if e != nil {
- return e
- }
-
- bas := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(bas) {
- // allocate new nested message
- bas = toStructPointer(reflect.New(p.stype))
- structPointer_SetStructPointer(base, p.field, bas)
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- iv := structPointer_Interface(bas, p.stype)
- return iv.(Unmarshaler).Unmarshal(raw)
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- err = o.unmarshalType(p.stype, p.sprop, false, bas)
- o.buf = obuf
- o.index = oi
-
- return err
-}
-
-// Decode a slice of embedded messages.
-func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error {
- return o.dec_slice_struct(p, false, base)
-}
-
-// Decode a slice of embedded groups.
-func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error {
- return o.dec_slice_struct(p, true, base)
-}
-
-// Decode a slice of structs ([]*struct).
-func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error {
- v := reflect.New(p.stype)
- bas := toStructPointer(v)
- structPointer_StructPointerSlice(base, p.field).Append(bas)
-
- if is_group {
- err := o.unmarshalType(p.stype, p.sprop, is_group, bas)
- return err
- }
-
- raw, err := o.DecodeRawBytes(false)
- if err != nil {
- return err
- }
-
- // If the object can unmarshal itself, let it.
- if p.isUnmarshaler {
- iv := v.Interface()
- return iv.(Unmarshaler).Unmarshal(raw)
- }
-
- obuf := o.buf
- oi := o.index
- o.buf = raw
- o.index = 0
-
- err = o.unmarshalType(p.stype, p.sprop, is_group, bas)
-
- o.buf = obuf
- o.index = oi
-
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/encode.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/encode.go
deleted file mode 100644
index 8c1b8fd1f..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/encode.go
+++ /dev/null
@@ -1,1363 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "errors"
- "fmt"
- "reflect"
- "sort"
-)
-
-// 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.
- errRepeatedHasNil = errors.New("proto: repeated field has nil element")
-
- // errOneofHasNil is the error returned if Marshal is called with
- // a struct with a oneof field containing a nil element.
- errOneofHasNil = errors.New("proto: oneof field has nil value")
-
- // ErrNil is the error returned if Marshal is called with nil.
- ErrNil = errors.New("proto: Marshal called with nil")
-
- // ErrTooLarge is the error returned if Marshal is called with a
- // message that encodes to >2GB.
- ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
-)
-
-// The fundamental encoders that put bytes on the wire.
-// Those that take integer types all accept uint64 and are
-// therefore of type valueEncoder.
-
-const maxVarintBytes = 10 // maximum length of a varint
-
-// maxMarshalSize is the largest allowed size of an encoded protobuf,
-// since C++ and Java use signed int32s for the size.
-const maxMarshalSize = 1<<31 - 1
-
-// EncodeVarint returns the varint encoding of x.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-// Not used by the package itself, but helpful to clients
-// wishing to use the same encoding.
-func EncodeVarint(x uint64) []byte {
- var buf [maxVarintBytes]byte
- var n int
- for n = 0; x > 127; n++ {
- buf[n] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- buf[n] = uint8(x)
- n++
- return buf[0:n]
-}
-
-// EncodeVarint writes a varint-encoded integer to the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) EncodeVarint(x uint64) error {
- for x >= 1<<7 {
- p.buf = append(p.buf, uint8(x&0x7f|0x80))
- x >>= 7
- }
- p.buf = append(p.buf, uint8(x))
- return nil
-}
-
-// SizeVarint returns the varint encoding size of an integer.
-func SizeVarint(x uint64) int {
- return sizeVarint(x)
-}
-
-func sizeVarint(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-
-// EncodeFixed64 writes a 64-bit integer to the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) EncodeFixed64(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24),
- uint8(x>>32),
- uint8(x>>40),
- uint8(x>>48),
- uint8(x>>56))
- return nil
-}
-
-func sizeFixed64(x uint64) int {
- return 8
-}
-
-// EncodeFixed32 writes a 32-bit integer to the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) EncodeFixed32(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24))
- return nil
-}
-
-func sizeFixed32(x uint64) int {
- return 4
-}
-
-// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
-// to the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) EncodeZigzag64(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-func sizeZigzag64(x uint64) int {
- return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
-// to the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) EncodeZigzag32(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-func sizeZigzag32(x uint64) int {
- return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) EncodeRawBytes(b []byte) error {
- p.EncodeVarint(uint64(len(b)))
- p.buf = append(p.buf, b...)
- return nil
-}
-
-func sizeRawBytes(b []byte) int {
- return sizeVarint(uint64(len(b))) +
- len(b)
-}
-
-// EncodeStringBytes writes an encoded string to the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) EncodeStringBytes(s string) error {
- p.EncodeVarint(uint64(len(s)))
- p.buf = append(p.buf, s...)
- return nil
-}
-
-func sizeStringBytes(s string) int {
- return sizeVarint(uint64(len(s))) +
- len(s)
-}
-
-// Marshaler is the interface representing objects that can marshal themselves.
-type Marshaler interface {
- Marshal() ([]byte, error)
-}
-
-// Marshal takes the protocol buffer
-// and encodes it into the wire format, returning the data.
-func Marshal(pb Message) ([]byte, error) {
- // Can the object marshal itself?
- if m, ok := pb.(Marshaler); ok {
- return m.Marshal()
- }
- p := NewBuffer(nil)
- err := p.Marshal(pb)
- var state errorState
- if err != nil && !state.shouldContinue(err, nil) {
- return nil, err
- }
- if p.buf == nil && err == nil {
- // Return a non-nil slice on success.
- return []byte{}, nil
- }
- return p.buf, err
-}
-
-// EncodeMessage writes the protocol buffer to the Buffer,
-// prefixed by a varint-encoded length.
-func (p *Buffer) EncodeMessage(pb Message) error {
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return ErrNil
- }
- if err == nil {
- var state errorState
- err = p.enc_len_struct(GetProperties(t.Elem()), base, &state)
- }
- return err
-}
-
-// Marshal takes the protocol buffer
-// and encodes it into the wire format, writing the result to the
-// Buffer.
-func (p *Buffer) Marshal(pb Message) error {
- // Can the object marshal itself?
- if m, ok := pb.(Marshaler); ok {
- data, err := m.Marshal()
- if err != nil {
- return err
- }
- p.buf = append(p.buf, data...)
- return nil
- }
-
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return ErrNil
- }
- if err == nil {
- err = p.enc_struct(GetProperties(t.Elem()), base)
- }
-
- if collectStats {
- stats.Encode++
- }
-
- if len(p.buf) > maxMarshalSize {
- return ErrTooLarge
- }
- return err
-}
-
-// Size returns the encoded size of a protocol buffer.
-func Size(pb Message) (n int) {
- // Can the object marshal itself? If so, Size is slow.
- // TODO: add Size to Marshaler, or add a Sizer interface.
- if m, ok := pb.(Marshaler); ok {
- b, _ := m.Marshal()
- return len(b)
- }
-
- t, base, err := getbase(pb)
- if structPointer_IsNil(base) {
- return 0
- }
- if err == nil {
- n = size_struct(GetProperties(t.Elem()), base)
- }
-
- if collectStats {
- stats.Size++
- }
-
- return
-}
-
-// Individual type encoders.
-
-// Encode a bool.
-func (o *Buffer) enc_bool(p *Properties, base structPointer) error {
- v := *structPointer_Bool(base, p.field)
- if v == nil {
- return ErrNil
- }
- x := 0
- if *v {
- x = 1
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error {
- v := *structPointer_BoolVal(base, p.field)
- if !v {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, 1)
- return nil
-}
-
-func size_bool(p *Properties, base structPointer) int {
- v := *structPointer_Bool(base, p.field)
- if v == nil {
- return 0
- }
- return len(p.tagcode) + 1 // each bool takes exactly one byte
-}
-
-func size_proto3_bool(p *Properties, base structPointer) int {
- v := *structPointer_BoolVal(base, p.field)
- if !v && !p.oneof {
- return 0
- }
- return len(p.tagcode) + 1 // each bool takes exactly one byte
-}
-
-// Encode an int32.
-func (o *Buffer) enc_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return ErrNil
- }
- x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_int32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return 0
- }
- x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-func size_proto3_int32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-// Encode a uint32.
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_uint32(p *Properties, base structPointer) error {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return ErrNil
- }
- x := word32_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, uint64(x))
- return nil
-}
-
-func size_uint32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32(base, p.field)
- if word32_IsNil(v) {
- return 0
- }
- x := word32_Get(v)
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-func size_proto3_uint32(p *Properties, base structPointer) (n int) {
- v := structPointer_Word32Val(base, p.field)
- x := word32Val_Get(v)
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(uint64(x))
- return
-}
-
-// Encode an int64.
-func (o *Buffer) enc_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64(base, p.field)
- if word64_IsNil(v) {
- return ErrNil
- }
- x := word64_Get(v)
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, x)
- return nil
-}
-
-func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- if x == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, x)
- return nil
-}
-
-func size_int64(p *Properties, base structPointer) (n int) {
- v := structPointer_Word64(base, p.field)
- if word64_IsNil(v) {
- return 0
- }
- x := word64_Get(v)
- n += len(p.tagcode)
- n += p.valSize(x)
- return
-}
-
-func size_proto3_int64(p *Properties, base structPointer) (n int) {
- v := structPointer_Word64Val(base, p.field)
- x := word64Val_Get(v)
- if x == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += p.valSize(x)
- return
-}
-
-// Encode a string.
-func (o *Buffer) enc_string(p *Properties, base structPointer) error {
- v := *structPointer_String(base, p.field)
- if v == nil {
- return ErrNil
- }
- x := *v
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(x)
- return nil
-}
-
-func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error {
- v := *structPointer_StringVal(base, p.field)
- if v == "" {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(v)
- return nil
-}
-
-func size_string(p *Properties, base structPointer) (n int) {
- v := *structPointer_String(base, p.field)
- if v == nil {
- return 0
- }
- x := *v
- n += len(p.tagcode)
- n += sizeStringBytes(x)
- return
-}
-
-func size_proto3_string(p *Properties, base structPointer) (n int) {
- v := *structPointer_StringVal(base, p.field)
- if v == "" && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeStringBytes(v)
- return
-}
-
-// All protocol buffer fields are nillable, but be careful.
-func isNil(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
- }
- return false
-}
-
-// Encode a message struct.
-func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error {
- var state errorState
- structp := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return ErrNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- return state.err
- }
-
- o.buf = append(o.buf, p.tagcode...)
- return o.enc_len_struct(p.sprop, structp, &state)
-}
-
-func size_struct_message(p *Properties, base structPointer) int {
- structp := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(structp) {
- return 0
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n0 := len(p.tagcode)
- n1 := sizeRawBytes(data)
- return n0 + n1
- }
-
- n0 := len(p.tagcode)
- n1 := size_struct(p.sprop, structp)
- n2 := sizeVarint(uint64(n1)) // size of encoded length
- return n0 + n1 + n2
-}
-
-// Encode a group struct.
-func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error {
- var state errorState
- b := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(b) {
- return ErrNil
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
- err := o.enc_struct(p.sprop, b)
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))
- return state.err
-}
-
-func size_struct_group(p *Properties, base structPointer) (n int) {
- b := structPointer_GetStructPointer(base, p.field)
- if structPointer_IsNil(b) {
- return 0
- }
-
- n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup))
- n += size_struct(p.sprop, b)
- n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup))
- return
-}
-
-// Encode a slice of bools ([]bool).
-func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return ErrNil
- }
- for _, x := range s {
- o.buf = append(o.buf, p.tagcode...)
- v := uint64(0)
- if x {
- v = 1
- }
- p.valEnc(o, v)
- }
- return nil
-}
-
-func size_slice_bool(p *Properties, base structPointer) int {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return 0
- }
- return l * (len(p.tagcode) + 1) // each bool takes exactly one byte
-}
-
-// Encode a slice of bools ([]bool) in packed format.
-func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(l)) // each bool takes exactly one byte
- for _, x := range s {
- v := uint64(0)
- if x {
- v = 1
- }
- p.valEnc(o, v)
- }
- return nil
-}
-
-func size_slice_packed_bool(p *Properties, base structPointer) (n int) {
- s := *structPointer_BoolSlice(base, p.field)
- l := len(s)
- if l == 0 {
- return 0
- }
- n += len(p.tagcode)
- n += sizeVarint(uint64(l))
- n += l // each bool takes exactly one byte
- return
-}
-
-// Encode a slice of bytes ([]byte).
-func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error {
- s := *structPointer_Bytes(base, p.field)
- if s == nil {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(s)
- return nil
-}
-
-func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error {
- s := *structPointer_Bytes(base, p.field)
- if len(s) == 0 {
- return ErrNil
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(s)
- return nil
-}
-
-func size_slice_byte(p *Properties, base structPointer) (n int) {
- s := *structPointer_Bytes(base, p.field)
- if s == nil && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeRawBytes(s)
- return
-}
-
-func size_proto3_slice_byte(p *Properties, base structPointer) (n int) {
- s := *structPointer_Bytes(base, p.field)
- if len(s) == 0 && !p.oneof {
- return 0
- }
- n += len(p.tagcode)
- n += sizeRawBytes(s)
- return
-}
-
-// Encode a slice of int32s ([]int32).
-func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- p.valEnc(o, uint64(x))
- }
- return nil
-}
-
-func size_slice_int32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- n += p.valSize(uint64(x))
- }
- return
-}
-
-// Encode a slice of int32s ([]int32) in packed format.
-func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- p.valEnc(buf, uint64(x))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_int32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- x := int32(s.Index(i)) // permit sign extension to use full 64-bit range
- bufSize += p.valSize(uint64(x))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of uint32s ([]uint32).
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- x := s.Index(i)
- p.valEnc(o, uint64(x))
- }
- return nil
-}
-
-func size_slice_uint32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- x := s.Index(i)
- n += p.valSize(uint64(x))
- }
- return
-}
-
-// Encode a slice of uint32s ([]uint32) in packed format.
-// Exactly the same as int32, except for no sign extension.
-func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- p.valEnc(buf, uint64(s.Index(i)))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_uint32(p *Properties, base structPointer) (n int) {
- s := structPointer_Word32Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- bufSize += p.valSize(uint64(s.Index(i)))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of int64s ([]int64).
-func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- p.valEnc(o, s.Index(i))
- }
- return nil
-}
-
-func size_slice_int64(p *Properties, base structPointer) (n int) {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- for i := 0; i < l; i++ {
- n += len(p.tagcode)
- n += p.valSize(s.Index(i))
- }
- return
-}
-
-// Encode a slice of int64s ([]int64) in packed format.
-func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return ErrNil
- }
- // TODO: Reuse a Buffer.
- buf := NewBuffer(nil)
- for i := 0; i < l; i++ {
- p.valEnc(buf, s.Index(i))
- }
-
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeVarint(uint64(len(buf.buf)))
- o.buf = append(o.buf, buf.buf...)
- return nil
-}
-
-func size_slice_packed_int64(p *Properties, base structPointer) (n int) {
- s := structPointer_Word64Slice(base, p.field)
- l := s.Len()
- if l == 0 {
- return 0
- }
- var bufSize int
- for i := 0; i < l; i++ {
- bufSize += p.valSize(s.Index(i))
- }
-
- n += len(p.tagcode)
- n += sizeVarint(uint64(bufSize))
- n += bufSize
- return
-}
-
-// Encode a slice of slice of bytes ([][]byte).
-func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error {
- ss := *structPointer_BytesSlice(base, p.field)
- l := len(ss)
- if l == 0 {
- return ErrNil
- }
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(ss[i])
- }
- return nil
-}
-
-func size_slice_slice_byte(p *Properties, base structPointer) (n int) {
- ss := *structPointer_BytesSlice(base, p.field)
- l := len(ss)
- if l == 0 {
- return 0
- }
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- n += sizeRawBytes(ss[i])
- }
- return
-}
-
-// Encode a slice of strings ([]string).
-func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error {
- ss := *structPointer_StringSlice(base, p.field)
- l := len(ss)
- for i := 0; i < l; i++ {
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeStringBytes(ss[i])
- }
- return nil
-}
-
-func size_slice_string(p *Properties, base structPointer) (n int) {
- ss := *structPointer_StringSlice(base, p.field)
- l := len(ss)
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- n += sizeStringBytes(ss[i])
- }
- return
-}
-
-// Encode a slice of message structs ([]*struct).
-func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error {
- var state errorState
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- for i := 0; i < l; i++ {
- structp := s.Index(i)
- if structPointer_IsNil(structp) {
- return errRepeatedHasNil
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, err := m.Marshal()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- o.buf = append(o.buf, p.tagcode...)
- o.EncodeRawBytes(data)
- continue
- }
-
- o.buf = append(o.buf, p.tagcode...)
- err := o.enc_len_struct(p.sprop, structp, &state)
- if err != nil && !state.shouldContinue(err, nil) {
- if err == ErrNil {
- return errRepeatedHasNil
- }
- return err
- }
- }
- return state.err
-}
-
-func size_slice_struct_message(p *Properties, base structPointer) (n int) {
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
- n += l * len(p.tagcode)
- for i := 0; i < l; i++ {
- structp := s.Index(i)
- if structPointer_IsNil(structp) {
- return // return the size up to this point
- }
-
- // Can the object marshal itself?
- if p.isMarshaler {
- m := structPointer_Interface(structp, p.stype).(Marshaler)
- data, _ := m.Marshal()
- n += len(p.tagcode)
- n += sizeRawBytes(data)
- continue
- }
-
- n0 := size_struct(p.sprop, structp)
- n1 := sizeVarint(uint64(n0)) // size of encoded length
- n += n0 + n1
- }
- return
-}
-
-// Encode a slice of group structs ([]*struct).
-func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error {
- var state errorState
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- for i := 0; i < l; i++ {
- b := s.Index(i)
- if structPointer_IsNil(b) {
- return errRepeatedHasNil
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
-
- err := o.enc_struct(p.sprop, b)
-
- if err != nil && !state.shouldContinue(err, nil) {
- if err == ErrNil {
- return errRepeatedHasNil
- }
- return err
- }
-
- o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))
- }
- return state.err
-}
-
-func size_slice_struct_group(p *Properties, base structPointer) (n int) {
- s := structPointer_StructPointerSlice(base, p.field)
- l := s.Len()
-
- n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup))
- n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup))
- for i := 0; i < l; i++ {
- b := s.Index(i)
- if structPointer_IsNil(b) {
- return // return size up to this point
- }
-
- n += size_struct(p.sprop, b)
- }
- return
-}
-
-// Encode an extension map.
-func (o *Buffer) enc_map(p *Properties, base structPointer) error {
- exts := structPointer_ExtMap(base, p.field)
- if err := encodeExtensionsMap(*exts); err != nil {
- return err
- }
-
- return o.enc_map_body(*exts)
-}
-
-func (o *Buffer) enc_exts(p *Properties, base structPointer) error {
- exts := structPointer_Extensions(base, p.field)
- if err := encodeExtensions(exts); err != nil {
- return err
- }
- v, _ := exts.extensionsRead()
-
- return o.enc_map_body(v)
-}
-
-func (o *Buffer) enc_map_body(v map[int32]Extension) error {
- // Fast-path for common cases: zero or one extensions.
- if len(v) <= 1 {
- for _, e := range v {
- o.buf = append(o.buf, e.enc...)
- }
- return nil
- }
-
- // Sort keys to provide a deterministic encoding.
- keys := make([]int, 0, len(v))
- for k := range v {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, k := range keys {
- o.buf = append(o.buf, v[int32(k)].enc...)
- }
- return nil
-}
-
-func size_map(p *Properties, base structPointer) int {
- v := structPointer_ExtMap(base, p.field)
- return extensionsMapSize(*v)
-}
-
-func size_exts(p *Properties, base structPointer) int {
- v := structPointer_Extensions(base, p.field)
- return extensionsSize(v)
-}
-
-// Encode a map field.
-func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
- var state errorState // XXX: or do we need to plumb this through?
-
- /*
- A map defined as
- map map_field = N;
- is encoded in the same way as
- message MapFieldEntry {
- key_type key = 1;
- value_type value = 2;
- }
- repeated MapFieldEntry map_field = N;
- */
-
- v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V
- if v.Len() == 0 {
- return nil
- }
-
- keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)
-
- enc := func() error {
- if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {
- return err
- }
- if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil {
- return err
- }
- return nil
- }
-
- // Don't sort map keys. It is not required by the spec, and C++ doesn't do it.
- for _, key := range v.MapKeys() {
- val := v.MapIndex(key)
-
- keycopy.Set(key)
- valcopy.Set(val)
-
- o.buf = append(o.buf, p.tagcode...)
- if err := o.enc_len_thing(enc, &state); err != nil {
- return err
- }
- }
- return nil
-}
-
-func size_new_map(p *Properties, base structPointer) int {
- v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V
-
- keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype)
-
- n := 0
- for _, key := range v.MapKeys() {
- val := v.MapIndex(key)
- keycopy.Set(key)
- valcopy.Set(val)
-
- // Tag codes for key and val are the responsibility of the sub-sizer.
- keysize := p.mkeyprop.size(p.mkeyprop, keybase)
- valsize := p.mvalprop.size(p.mvalprop, valbase)
- entry := keysize + valsize
- // Add on tag code and length of map entry itself.
- n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry
- }
- return n
-}
-
-// mapEncodeScratch returns a new reflect.Value matching the map's value type,
-// and a structPointer suitable for passing to an encoder or sizer.
-func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) {
- // Prepare addressable doubly-indirect placeholders for the key and value types.
- // This is needed because the element-type encoders expect **T, but the map iteration produces T.
-
- keycopy = reflect.New(mapType.Key()).Elem() // addressable K
- keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K
- keyptr.Set(keycopy.Addr()) //
- keybase = toStructPointer(keyptr.Addr()) // **K
-
- // Value types are more varied and require special handling.
- switch mapType.Elem().Kind() {
- case reflect.Slice:
- // []byte
- var dummy []byte
- valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte
- valbase = toStructPointer(valcopy.Addr())
- case reflect.Ptr:
- // message; the generated field type is map[K]*Msg (so V is *Msg),
- // so we only need one level of indirection.
- valcopy = reflect.New(mapType.Elem()).Elem() // addressable V
- valbase = toStructPointer(valcopy.Addr())
- default:
- // everything else
- valcopy = reflect.New(mapType.Elem()).Elem() // addressable V
- valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V
- valptr.Set(valcopy.Addr()) //
- valbase = toStructPointer(valptr.Addr()) // **V
- }
- return
-}
-
-// Encode a struct.
-func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
- var state errorState
- // Encode fields in tag order so that decoders may use optimizations
- // that depend on the ordering.
- // https://developers.google.com/protocol-buffers/docs/encoding#order
- for _, i := range prop.order {
- p := prop.Prop[i]
- if p.enc != nil {
- err := p.enc(o, p, base)
- if err != nil {
- if err == ErrNil {
- if p.Required && state.err == nil {
- state.err = &RequiredNotSetError{p.Name}
- }
- } else if err == errRepeatedHasNil {
- // Give more context to nil values in repeated fields.
- return errors.New("repeated field " + p.OrigName + " has nil element")
- } else if !state.shouldContinue(err, p) {
- return err
- }
- }
- if len(o.buf) > maxMarshalSize {
- return ErrTooLarge
- }
- }
- }
-
- // Do oneof fields.
- if prop.oneofMarshaler != nil {
- m := structPointer_Interface(base, prop.stype).(Message)
- if err := prop.oneofMarshaler(m, o); err == ErrNil {
- return errOneofHasNil
- } else if err != nil {
- return err
- }
- }
-
- // Add unrecognized fields at the end.
- if prop.unrecField.IsValid() {
- v := *structPointer_Bytes(base, prop.unrecField)
- if len(o.buf)+len(v) > maxMarshalSize {
- return ErrTooLarge
- }
- if len(v) > 0 {
- o.buf = append(o.buf, v...)
- }
- }
-
- return state.err
-}
-
-func size_struct(prop *StructProperties, base structPointer) (n int) {
- for _, i := range prop.order {
- p := prop.Prop[i]
- if p.size != nil {
- n += p.size(p, base)
- }
- }
-
- // Add unrecognized fields at the end.
- if prop.unrecField.IsValid() {
- v := *structPointer_Bytes(base, prop.unrecField)
- n += len(v)
- }
-
- // Factor in any oneof fields.
- if prop.oneofSizer != nil {
- m := structPointer_Interface(base, prop.stype).(Message)
- n += prop.oneofSizer(m)
- }
-
- return
-}
-
-var zeroes [20]byte // longer than any conceivable sizeVarint
-
-// Encode a struct, preceded by its encoded length (as a varint).
-func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error {
- return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state)
-}
-
-// Encode something, preceded by its encoded length (as a varint).
-func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error {
- iLen := len(o.buf)
- o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length
- iMsg := len(o.buf)
- err := enc()
- if err != nil && !state.shouldContinue(err, nil) {
- return err
- }
- lMsg := len(o.buf) - iMsg
- lLen := sizeVarint(uint64(lMsg))
- switch x := lLen - (iMsg - iLen); {
- case x > 0: // actual length is x bytes larger than the space we reserved
- // Move msg x bytes right.
- o.buf = append(o.buf, zeroes[:x]...)
- copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])
- case x < 0: // actual length is x bytes smaller than the space we reserved
- // Move msg x bytes left.
- copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg])
- o.buf = o.buf[:len(o.buf)+x] // x is negative
- }
- // Encode the length in the reserved space.
- o.buf = o.buf[:iLen]
- o.EncodeVarint(uint64(lMsg))
- o.buf = o.buf[:len(o.buf)+lMsg]
- return state.err
-}
-
-// errorState maintains the first error that occurs and updates that error
-// with additional context.
-type errorState struct {
- err error
-}
-
-// shouldContinue reports whether encoding should continue upon encountering the
-// given error. If the error is RequiredNotSetError, shouldContinue returns true
-// and, if this is the first appearance of that error, remembers it for future
-// reporting.
-//
-// If prop is not nil, it may update any error with additional context about the
-// field with the error.
-func (s *errorState) shouldContinue(err error, prop *Properties) bool {
- // Ignore unset required fields.
- reqNotSet, ok := err.(*RequiredNotSetError)
- if !ok {
- return false
- }
- if s.err == nil {
- if prop != nil {
- err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field}
- }
- s.err = err
- }
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/equal.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/equal.go
deleted file mode 100644
index 8b16f951c..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/equal.go
+++ /dev/null
@@ -1,296 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 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
-// 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.
-
-// Protocol buffer comparison.
-
-package proto
-
-import (
- "bytes"
- "log"
- "reflect"
- "strings"
-)
-
-/*
-Equal returns true iff protocol buffers a and b are equal.
-The arguments must both be pointers to protocol buffer structs.
-
-Equality is defined in this way:
- - Two messages are equal iff they are the same type,
- corresponding fields are equal, unknown field sets
- are equal, and extensions sets are equal.
- - Two set scalar fields are equal iff their values are equal.
- If the fields are of a floating-point type, remember that
- NaN != x for all x, including NaN. If the message is defined
- in a proto3 .proto file, fields are not "set"; specifically,
- zero length proto3 "bytes" fields are equal (nil == {}).
- - Two repeated fields are equal iff their lengths are the same,
- and their corresponding elements are equal (a "bytes" field,
- although represented by []byte, is not a repeated field)
- - Two unset fields are equal.
- - Two unknown field sets are equal if their current
- encoded state is equal.
- - Two extension sets are equal iff they have corresponding
- elements that are pairwise equal.
- - Every other combination of things are not equal.
-
-The return value is undefined if a and b are not protocol buffers.
-*/
-func Equal(a, b Message) bool {
- if a == nil || b == nil {
- return a == b
- }
- v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
- if v1.Type() != v2.Type() {
- return false
- }
- if v1.Kind() == reflect.Ptr {
- if v1.IsNil() {
- return v2.IsNil()
- }
- if v2.IsNil() {
- return false
- }
- v1, v2 = v1.Elem(), v2.Elem()
- }
- if v1.Kind() != reflect.Struct {
- return false
- }
- return equalStruct(v1, v2)
-}
-
-// v1 and v2 are known to have the same type.
-func equalStruct(v1, v2 reflect.Value) bool {
- sprop := GetProperties(v1.Type())
- for i := 0; i < v1.NumField(); i++ {
- f := v1.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- f1, f2 := v1.Field(i), v2.Field(i)
- if f.Type.Kind() == reflect.Ptr {
- if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
- // both unset
- continue
- } else if n1 != n2 {
- // set/unset mismatch
- return false
- }
- b1, ok := f1.Interface().(raw)
- if ok {
- b2 := f2.Interface().(raw)
- // RawMessage
- if !bytes.Equal(b1.Bytes(), b2.Bytes()) {
- return false
- }
- continue
- }
- f1, f2 = f1.Elem(), f2.Elem()
- }
- if !equalAny(f1, f2, sprop.Prop[i]) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_InternalExtensions")
- if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_extensions")
- if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
- return false
- }
- }
-
- uf := v1.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return true
- }
-
- u1 := uf.Bytes()
- u2 := v2.FieldByName("XXX_unrecognized").Bytes()
- if !bytes.Equal(u1, u2) {
- return false
- }
-
- return true
-}
-
-// v1 and v2 are known to have the same type.
-// prop may be nil.
-func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
- if v1.Type() == protoMessageType {
- m1, _ := v1.Interface().(Message)
- m2, _ := v2.Interface().(Message)
- return Equal(m1, m2)
- }
- switch v1.Kind() {
- case reflect.Bool:
- return v1.Bool() == v2.Bool()
- case reflect.Float32, reflect.Float64:
- return v1.Float() == v2.Float()
- case reflect.Int32, reflect.Int64:
- return v1.Int() == v2.Int()
- case reflect.Interface:
- // Probably a oneof field; compare the inner values.
- n1, n2 := v1.IsNil(), v2.IsNil()
- if n1 || n2 {
- return n1 == n2
- }
- e1, e2 := v1.Elem(), v2.Elem()
- if e1.Type() != e2.Type() {
- return false
- }
- return equalAny(e1, e2, nil)
- case reflect.Map:
- if v1.Len() != v2.Len() {
- return false
- }
- for _, key := range v1.MapKeys() {
- val2 := v2.MapIndex(key)
- if !val2.IsValid() {
- // This key was not found in the second map.
- return false
- }
- if !equalAny(v1.MapIndex(key), val2, nil) {
- return false
- }
- }
- return true
- case reflect.Ptr:
- // Maps may have nil values in them, so check for nil.
- if v1.IsNil() && v2.IsNil() {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return equalAny(v1.Elem(), v2.Elem(), prop)
- case reflect.Slice:
- if v1.Type().Elem().Kind() == reflect.Uint8 {
- // short circuit: []byte
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value.
- if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
- }
-
- if v1.Len() != v2.Len() {
- return false
- }
- for i := 0; i < v1.Len(); i++ {
- if !equalAny(v1.Index(i), v2.Index(i), prop) {
- return false
- }
- }
- return true
- case reflect.String:
- return v1.Interface().(string) == v2.Interface().(string)
- case reflect.Struct:
- return equalStruct(v1, v2)
- case reflect.Uint32, reflect.Uint64:
- return v1.Uint() == v2.Uint()
- }
-
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to compare %v", v1)
- return false
-}
-
-// base is the struct type that the extensions are based on.
-// x1 and x2 are InternalExtensions.
-func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
- em1, _ := x1.extensionsRead()
- em2, _ := x2.extensionsRead()
- return equalExtMap(base, em1, em2)
-}
-
-func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
- if len(em1) != len(em2) {
- return false
- }
-
- for extNum, e1 := range em1 {
- e2, ok := em2[extNum]
- if !ok {
- return false
- }
-
- m1, m2 := e1.value, e2.value
-
- if m1 != nil && m2 != nil {
- // Both are unencoded.
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- continue
- }
-
- // At least one is encoded. To do a semantically correct comparison
- // we need to unmarshal them first.
- var desc *ExtensionDesc
- if m := extensionMaps[base]; m != nil {
- desc = m[extNum]
- }
- if desc == nil {
- log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
- continue
- }
- var err error
- if m1 == nil {
- m1, err = decodeExtension(e1.enc, desc)
- }
- if m2 == nil && err == nil {
- m2, err = decodeExtension(e2.enc, desc)
- }
- if err != nil {
- // The encoded form is invalid.
- log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
- return false
- }
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- }
-
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/extensions.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/extensions.go
deleted file mode 100644
index 9f484f53a..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/extensions.go
+++ /dev/null
@@ -1,555 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Types and routines for supporting protocol buffer extensions.
- */
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "sync"
-)
-
-// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
-var ErrMissingExtension = errors.New("proto: missing extension")
-
-// ExtensionRange represents a range of message extensions for a protocol buffer.
-// Used in code generated by the protocol compiler.
-type ExtensionRange struct {
- Start, End int32 // both inclusive
-}
-
-// extendableProto is an interface implemented by any protocol buffer generated by the current
-// proto compiler that may be extended.
-type extendableProto interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- extensionsWrite() map[int32]Extension
- extensionsRead() (map[int32]Extension, sync.Locker)
-}
-
-// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
-// version of the proto compiler that may be extended.
-type extendableProtoV1 interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- ExtensionMap() map[int32]Extension
-}
-
-// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
-type extensionAdapter struct {
- extendableProtoV1
-}
-
-func (e extensionAdapter) extensionsWrite() map[int32]Extension {
- return e.ExtensionMap()
-}
-
-func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
- return e.ExtensionMap(), notLocker{}
-}
-
-// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
-type notLocker struct{}
-
-func (n notLocker) Lock() {}
-func (n notLocker) Unlock() {}
-
-// extendable returns the extendableProto interface for the given generated proto message.
-// If the proto message has the old extension format, it returns a wrapper that implements
-// the extendableProto interface.
-func extendable(p interface{}) (extendableProto, bool) {
- if ep, ok := p.(extendableProto); ok {
- return ep, ok
- }
- if ep, ok := p.(extendableProtoV1); ok {
- return extensionAdapter{ep}, ok
- }
- return nil, false
-}
-
-// XXX_InternalExtensions is an internal representation of proto extensions.
-//
-// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
-// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
-//
-// The methods of XXX_InternalExtensions are not concurrency safe in general,
-// but calls to logically read-only methods such as has and get may be executed concurrently.
-type XXX_InternalExtensions struct {
- // The struct must be indirect so that if a user inadvertently copies a
- // generated message and its embedded XXX_InternalExtensions, they
- // avoid the mayhem of a copied mutex.
- //
- // The mutex serializes all logically read-only operations to p.extensionMap.
- // It is up to the client to ensure that write operations to p.extensionMap are
- // mutually exclusive with other accesses.
- p *struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- }
-}
-
-// extensionsWrite returns the extension map, creating it on first use.
-func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
- if e.p == nil {
- e.p = new(struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- })
- e.p.extensionMap = make(map[int32]Extension)
- }
- return e.p.extensionMap
-}
-
-// extensionsRead returns the extensions map for read-only use. It may be nil.
-// The caller must hold the returned mutex's lock when accessing Elements within the map.
-func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
- if e.p == nil {
- return nil, nil
- }
- return e.p.extensionMap, &e.p.mu
-}
-
-var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()
-var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem()
-
-// ExtensionDesc represents an extension specification.
-// Used in generated code from the protocol compiler.
-type ExtensionDesc struct {
- ExtendedType Message // nil pointer to the type that is being extended
- ExtensionType interface{} // nil pointer to the extension type
- Field int32 // field number
- Name string // fully-qualified name of extension, for text formatting
- Tag string // protobuf tag style
-}
-
-func (ed *ExtensionDesc) repeated() bool {
- t := reflect.TypeOf(ed.ExtensionType)
- return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
-}
-
-// Extension represents an extension in a message.
-type Extension struct {
- // When an extension is stored in a message using SetExtension
- // only desc and value are set. When the message is marshaled
- // enc will be set to the encoded form of the message.
- //
- // When a message is unmarshaled and contains extensions, each
- // extension will have only enc set. When such an extension is
- // accessed using GetExtension (or GetExtensions) desc and value
- // will be set.
- desc *ExtensionDesc
- value interface{}
- enc []byte
-}
-
-// SetRawExtension is for testing only.
-func SetRawExtension(base Message, id int32, b []byte) {
- epb, ok := extendable(base)
- if !ok {
- return
- }
- extmap := epb.extensionsWrite()
- extmap[id] = Extension{enc: b}
-}
-
-// isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
- for _, er := range pb.ExtensionRangeArray() {
- if er.Start <= field && field <= er.End {
- return true
- }
- }
- return false
-}
-
-// checkExtensionTypes checks that the given extension is valid for pb.
-func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
- var pbi interface{} = pb
- // Check the extended type.
- if ea, ok := pbi.(extensionAdapter); ok {
- pbi = ea.extendableProtoV1
- }
- if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
- return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String())
- }
- // Check the range.
- if !isExtensionField(pb, extension.Field) {
- return errors.New("proto: bad extension number; not in declared ranges")
- }
- return nil
-}
-
-// extPropKey is sufficient to uniquely identify an extension.
-type extPropKey struct {
- base reflect.Type
- field int32
-}
-
-var extProp = struct {
- sync.RWMutex
- m map[extPropKey]*Properties
-}{
- m: make(map[extPropKey]*Properties),
-}
-
-func extensionProperties(ed *ExtensionDesc) *Properties {
- key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}
-
- extProp.RLock()
- if prop, ok := extProp.m[key]; ok {
- extProp.RUnlock()
- return prop
- }
- extProp.RUnlock()
-
- extProp.Lock()
- defer extProp.Unlock()
- // Check again.
- if prop, ok := extProp.m[key]; ok {
- return prop
- }
-
- prop := new(Properties)
- prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
- extProp.m[key] = prop
- return prop
-}
-
-// encode encodes any unmarshaled (unencoded) extensions in e.
-func encodeExtensions(e *XXX_InternalExtensions) error {
- m, mu := e.extensionsRead()
- if m == nil {
- return nil // fast path
- }
- mu.Lock()
- defer mu.Unlock()
- return encodeExtensionsMap(m)
-}
-
-// encode encodes any unmarshaled (unencoded) extensions in e.
-func encodeExtensionsMap(m map[int32]Extension) error {
- for k, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- et := reflect.TypeOf(e.desc.ExtensionType)
- props := extensionProperties(e.desc)
-
- p := NewBuffer(nil)
- // If e.value has type T, the encoder expects a *struct{ X T }.
- // Pass a *T with a zero field and hope it all works out.
- x := reflect.New(et)
- x.Elem().Set(reflect.ValueOf(e.value))
- if err := props.enc(p, props, toStructPointer(x)); err != nil {
- return err
- }
- e.enc = p.buf
- m[k] = e
- }
- return nil
-}
-
-func extensionsSize(e *XXX_InternalExtensions) (n int) {
- m, mu := e.extensionsRead()
- if m == nil {
- return 0
- }
- mu.Lock()
- defer mu.Unlock()
- return extensionsMapSize(m)
-}
-
-func extensionsMapSize(m map[int32]Extension) (n int) {
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- et := reflect.TypeOf(e.desc.ExtensionType)
- props := extensionProperties(e.desc)
-
- // If e.value has type T, the encoder expects a *struct{ X T }.
- // Pass a *T with a zero field and hope it all works out.
- x := reflect.New(et)
- x.Elem().Set(reflect.ValueOf(e.value))
- n += props.size(props, toStructPointer(x))
- }
- return
-}
-
-// HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb Message, extension *ExtensionDesc) bool {
- // TODO: Check types, field numbers, etc.?
- epb, ok := extendable(pb)
- if !ok {
- return false
- }
- extmap, mu := epb.extensionsRead()
- if extmap == nil {
- return false
- }
- mu.Lock()
- _, ok = extmap[extension.Field]
- mu.Unlock()
- return ok
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb Message, extension *ExtensionDesc) {
- epb, ok := extendable(pb)
- if !ok {
- return
- }
- // TODO: Check types, field numbers, etc.?
- extmap := epb.extensionsWrite()
- delete(extmap, extension.Field)
-}
-
-// GetExtension parses and returns the given extension of pb.
-// If the extension is not present and has no default value it returns ErrMissingExtension.
-func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
- epb, ok := extendable(pb)
- if !ok {
- return nil, errors.New("proto: not an extendable proto")
- }
-
- if err := checkExtensionTypes(epb, extension); err != nil {
- return nil, err
- }
-
- emap, mu := epb.extensionsRead()
- if emap == nil {
- return defaultExtensionValue(extension)
- }
- mu.Lock()
- defer mu.Unlock()
- e, ok := emap[extension.Field]
- if !ok {
- // defaultExtensionValue returns the default value or
- // ErrMissingExtension if there is no default.
- return defaultExtensionValue(extension)
- }
-
- if e.value != nil {
- // Already decoded. Check the descriptor, though.
- if e.desc != extension {
- // This shouldn't happen. If it does, it means that
- // GetExtension was called twice with two different
- // descriptors with the same field number.
- return nil, errors.New("proto: descriptor conflict")
- }
- return e.value, nil
- }
-
- v, err := decodeExtension(e.enc, extension)
- if err != nil {
- return nil, err
- }
-
- // Remember the decoded version and drop the encoded version.
- // That way it is safe to mutate what we return.
- e.value = v
- e.desc = extension
- e.enc = nil
- emap[extension.Field] = e
- return e.value, nil
-}
-
-// defaultExtensionValue returns the default value for extension.
-// If no default for an extension is defined ErrMissingExtension is returned.
-func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
- t := reflect.TypeOf(extension.ExtensionType)
- props := extensionProperties(extension)
-
- sf, _, err := fieldDefault(t, props)
- if err != nil {
- return nil, err
- }
-
- if sf == nil || sf.value == nil {
- // There is no default value.
- return nil, ErrMissingExtension
- }
-
- if t.Kind() != reflect.Ptr {
- // We do not need to return a Ptr, we can directly return sf.value.
- return sf.value, nil
- }
-
- // We need to return an interface{} that is a pointer to sf.value.
- value := reflect.New(t).Elem()
- value.Set(reflect.New(value.Type().Elem()))
- if sf.kind == reflect.Int32 {
- // We may have an int32 or an enum, but the underlying data is int32.
- // Since we can't set an int32 into a non int32 reflect.value directly
- // set it as a int32.
- value.Elem().SetInt(int64(sf.value.(int32)))
- } else {
- value.Elem().Set(reflect.ValueOf(sf.value))
- }
- return value.Interface(), nil
-}
-
-// decodeExtension decodes an extension encoded in b.
-func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
- o := NewBuffer(b)
-
- t := reflect.TypeOf(extension.ExtensionType)
-
- props := extensionProperties(extension)
-
- // t is a pointer to a struct, pointer to basic type or a slice.
- // Allocate a "field" to store the pointer/slice itself; the
- // pointer/slice will be stored here. We pass
- // the address of this field to props.dec.
- // This passes a zero field and a *t and lets props.dec
- // interpret it as a *struct{ x t }.
- value := reflect.New(t).Elem()
-
- for {
- // Discard wire type and field number varint. It isn't needed.
- if _, err := o.DecodeVarint(); err != nil {
- return nil, err
- }
-
- if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil {
- return nil, err
- }
-
- if o.index >= len(o.buf) {
- break
- }
- }
- return value.Interface(), nil
-}
-
-// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
-// The returned slice has the same length as es; missing extensions will appear as nil elements.
-func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
- epb, ok := extendable(pb)
- if !ok {
- return nil, errors.New("proto: not an extendable proto")
- }
- extensions = make([]interface{}, len(es))
- for i, e := range es {
- extensions[i], err = GetExtension(epb, e)
- if err == ErrMissingExtension {
- err = nil
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
- epb, ok := extendable(pb)
- if !ok {
- return errors.New("proto: not an extendable proto")
- }
- if err := checkExtensionTypes(epb, extension); err != nil {
- return err
- }
- typ := reflect.TypeOf(extension.ExtensionType)
- if typ != reflect.TypeOf(value) {
- return errors.New("proto: bad extension value type")
- }
- // nil extension values need to be caught early, because the
- // encoder can't distinguish an ErrNil due to a nil extension
- // from an ErrNil due to a missing field. Extensions are
- // always optional, so the encoder would just swallow the error
- // and drop all the extensions from the encoded message.
- if reflect.ValueOf(value).IsNil() {
- return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
- }
-
- extmap := epb.extensionsWrite()
- extmap[extension.Field] = Extension{desc: extension, value: value}
- return nil
-}
-
-// ClearAllExtensions clears all extensions from pb.
-func ClearAllExtensions(pb Message) {
- epb, ok := extendable(pb)
- if !ok {
- return
- }
- m := epb.extensionsWrite()
- for k := range m {
- delete(m, k)
- }
-}
-
-// A global registry of extensions.
-// The generated code will register the generated descriptors by calling RegisterExtension.
-
-var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)
-
-// RegisterExtension is called from the generated code.
-func RegisterExtension(desc *ExtensionDesc) {
- st := reflect.TypeOf(desc.ExtendedType).Elem()
- m := extensionMaps[st]
- if m == nil {
- m = make(map[int32]*ExtensionDesc)
- extensionMaps[st] = m
- }
- if _, ok := m[desc.Field]; ok {
- panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field)))
- }
- m[desc.Field] = desc
-}
-
-// RegisteredExtensions returns a map of the registered extensions of a
-// protocol buffer struct, indexed by the extension number.
-// The argument pb should be a nil pointer to the struct type.
-func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
- return extensionMaps[reflect.TypeOf(pb).Elem()]
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/lib.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/lib.go
deleted file mode 100644
index 170b8e87d..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/lib.go
+++ /dev/null
@@ -1,898 +0,0 @@
-// 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
-// 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.
-
-/*
-Package proto converts data structures to and from the wire format of
-protocol buffers. It works in concert with the Go source code generated
-for .proto files by the protocol compiler.
-
-A summary of the properties of the protocol buffer interface
-for a protocol buffer variable v:
-
- - Names are turned from camel_case to CamelCase for export.
- - There are no methods on v to set fields; just treat
- them as structure fields.
- - There are getters that return a field's value if set,
- and return the field's default value if unset.
- The getters work even if the receiver is a nil message.
- - The zero value for a struct is its correct initialization state.
- All desired fields must be set before marshaling.
- - A Reset() method will restore a protobuf struct to its zero state.
- - Non-repeated fields are pointers to the values; nil means unset.
- That is, optional or required field int32 f becomes F *int32.
- - Repeated fields are slices.
- - Helper functions are available to aid the setting of fields.
- msg.Foo = proto.String("hello") // set field
- - Constants are defined to hold the default values of all fields that
- have them. They have the form Default_StructName_FieldName.
- Because the getter methods handle defaulted values,
- direct use of these constants should be rare.
- - Enums are given type names and maps from names to values.
- Enum values are prefixed by the enclosing message's name, or by the
- enum's type name if it is a top-level enum. Enum types have a String
- method, and a Enum method to assist in message construction.
- - Nested messages, groups and enums have type names prefixed with the name of
- the surrounding message type.
- - Extensions are given descriptor names that start with E_,
- followed by an underscore-delimited list of the nested messages
- that contain it (if any) followed by the CamelCased name of the
- extension field itself. HasExtension, ClearExtension, GetExtension
- and SetExtension are functions for manipulating extensions.
- - Oneof field sets are given a single field in their message,
- with distinguished wrapper types for each possible field value.
- - Marshal and Unmarshal are functions to encode and decode the wire format.
-
-When the .proto file specifies `syntax="proto3"`, there are some differences:
-
- - Non-repeated fields of non-message type are values instead of pointers.
- - Getters are only generated for message and oneof fields.
- - Enum types do not get an Enum method.
-
-The simplest way to describe this is to see an example.
-Given file test.proto, containing
-
- package example;
-
- enum FOO { X = 17; }
-
- message Test {
- required string label = 1;
- optional int32 type = 2 [default=77];
- repeated int64 reps = 3;
- optional group OptionalGroup = 4 {
- required string RequiredField = 5;
- }
- oneof union {
- int32 number = 6;
- string name = 7;
- }
- }
-
-The resulting file, test.pb.go, is:
-
- package example
-
- import proto "github.com/golang/protobuf/proto"
- import math "math"
-
- type FOO int32
- const (
- FOO_X FOO = 17
- )
- var FOO_name = map[int32]string{
- 17: "X",
- }
- var FOO_value = map[string]int32{
- "X": 17,
- }
-
- func (x FOO) Enum() *FOO {
- p := new(FOO)
- *p = x
- return p
- }
- func (x FOO) String() string {
- return proto.EnumName(FOO_name, int32(x))
- }
- func (x *FOO) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FOO_value, data)
- if err != nil {
- return err
- }
- *x = FOO(value)
- return nil
- }
-
- type Test struct {
- Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
- Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
- Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
- Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"`
- // Types that are valid to be assigned to Union:
- // *Test_Number
- // *Test_Name
- Union isTest_Union `protobuf_oneof:"union"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Test) Reset() { *m = Test{} }
- func (m *Test) String() string { return proto.CompactTextString(m) }
- func (*Test) ProtoMessage() {}
-
- type isTest_Union interface {
- isTest_Union()
- }
-
- type Test_Number struct {
- Number int32 `protobuf:"varint,6,opt,name=number"`
- }
- type Test_Name struct {
- Name string `protobuf:"bytes,7,opt,name=name"`
- }
-
- func (*Test_Number) isTest_Union() {}
- func (*Test_Name) isTest_Union() {}
-
- func (m *Test) GetUnion() isTest_Union {
- if m != nil {
- return m.Union
- }
- return nil
- }
- const Default_Test_Type int32 = 77
-
- func (m *Test) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
- }
-
- func (m *Test) GetType() int32 {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return Default_Test_Type
- }
-
- func (m *Test) GetOptionalgroup() *Test_OptionalGroup {
- if m != nil {
- return m.Optionalgroup
- }
- return nil
- }
-
- type Test_OptionalGroup struct {
- RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"`
- }
- func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} }
- func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }
-
- func (m *Test_OptionalGroup) GetRequiredField() string {
- if m != nil && m.RequiredField != nil {
- return *m.RequiredField
- }
- return ""
- }
-
- func (m *Test) GetNumber() int32 {
- if x, ok := m.GetUnion().(*Test_Number); ok {
- return x.Number
- }
- return 0
- }
-
- func (m *Test) GetName() string {
- if x, ok := m.GetUnion().(*Test_Name); ok {
- return x.Name
- }
- return ""
- }
-
- func init() {
- proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
- }
-
-To create and play with a Test object:
-
- package main
-
- import (
- "log"
-
- "github.com/golang/protobuf/proto"
- pb "./example.pb"
- )
-
- func main() {
- test := &pb.Test{
- Label: proto.String("hello"),
- Type: proto.Int32(17),
- Reps: []int64{1, 2, 3},
- Optionalgroup: &pb.Test_OptionalGroup{
- RequiredField: proto.String("good bye"),
- },
- Union: &pb.Test_Name{"fred"},
- }
- data, err := proto.Marshal(test)
- if err != nil {
- log.Fatal("marshaling error: ", err)
- }
- newTest := &pb.Test{}
- err = proto.Unmarshal(data, newTest)
- if err != nil {
- log.Fatal("unmarshaling error: ", err)
- }
- // Now test and newTest contain the same data.
- if test.GetLabel() != newTest.GetLabel() {
- log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
- }
- // Use a type switch to determine which oneof was set.
- switch u := test.Union.(type) {
- case *pb.Test_Number: // u.Number contains the number.
- case *pb.Test_Name: // u.Name contains the string.
- }
- // etc.
- }
-*/
-package proto
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "reflect"
- "sort"
- "strconv"
- "sync"
-)
-
-// Message is implemented by generated protocol buffer messages.
-type Message interface {
- Reset()
- String() string
- ProtoMessage()
-}
-
-// Stats records allocation details about the protocol buffer encoders
-// and decoders. Useful for tuning the library itself.
-type Stats struct {
- Emalloc uint64 // mallocs in encode
- Dmalloc uint64 // mallocs in decode
- Encode uint64 // number of encodes
- Decode uint64 // number of decodes
- Chit uint64 // number of cache hits
- Cmiss uint64 // number of cache misses
- Size uint64 // number of sizes
-}
-
-// Set to true to enable stats collection.
-const collectStats = false
-
-var stats Stats
-
-// GetStats returns a copy of the global Stats structure.
-func GetStats() Stats { return stats }
-
-// A Buffer is a buffer manager for marshaling and unmarshaling
-// protocol buffers. It may be reused between invocations to
-// reduce memory usage. It is not necessary to use a Buffer;
-// the global functions Marshal and Unmarshal create a
-// temporary Buffer and are fine for most applications.
-type Buffer struct {
- buf []byte // encode/decode byte stream
- index int // write point
-
- // pools of basic types to amortize allocation.
- bools []bool
- uint32s []uint32
- uint64s []uint64
-
- // extra pools, only used with pointer_reflect.go
- int32s []int32
- int64s []int64
- float32s []float32
- float64s []float64
-}
-
-// NewBuffer allocates a new Buffer and initializes its internal data to
-// the contents of the argument slice.
-func NewBuffer(e []byte) *Buffer {
- return &Buffer{buf: e}
-}
-
-// Reset resets the Buffer, ready for marshaling a new protocol buffer.
-func (p *Buffer) Reset() {
- p.buf = p.buf[0:0] // for reading/writing
- p.index = 0 // for reading
-}
-
-// SetBuf replaces the internal buffer with the slice,
-// ready for unmarshaling the contents of the slice.
-func (p *Buffer) SetBuf(s []byte) {
- p.buf = s
- p.index = 0
-}
-
-// Bytes returns the contents of the Buffer.
-func (p *Buffer) Bytes() []byte { return p.buf }
-
-/*
- * Helper routines for simplifying the creation of optional fields of basic type.
- */
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
- return &v
-}
-
-// Int32 is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int32 {
- p := new(int32)
- *p = int32(v)
- return p
-}
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Float32 is a helper routine that allocates a new float32 value
-// to store v and returns a pointer to it.
-func Float32(v float32) *float32 {
- return &v
-}
-
-// Float64 is a helper routine that allocates a new float64 value
-// to store v and returns a pointer to it.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Uint32 is a helper routine that allocates a new uint32 value
-// to store v and returns a pointer to it.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint64 is a helper routine that allocates a new uint64 value
-// to store v and returns a pointer to it.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
- return &v
-}
-
-// EnumName is a helper function to simplify printing protocol buffer enums
-// by name. Given an enum map and a value, it returns a useful string.
-func EnumName(m map[int32]string, v int32) string {
- s, ok := m[v]
- if ok {
- return s
- }
- return strconv.Itoa(int(v))
-}
-
-// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
-// from their JSON-encoded representation. Given a map from the enum's symbolic
-// names to its int values, and a byte buffer containing the JSON-encoded
-// value, it returns an int32 that can be cast to the enum type by the caller.
-//
-// The function can deal with both JSON representations, numeric and symbolic.
-func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
- if data[0] == '"' {
- // New style: enums are strings.
- var repr string
- if err := json.Unmarshal(data, &repr); err != nil {
- return -1, err
- }
- val, ok := m[repr]
- if !ok {
- return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
- }
- return val, nil
- }
- // Old style: enums are ints.
- var val int32
- if err := json.Unmarshal(data, &val); err != nil {
- return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
- }
- return val, nil
-}
-
-// DebugPrint dumps the encoded data in b in a debugging format with a header
-// including the string s. Used in testing but made available for general debugging.
-func (p *Buffer) DebugPrint(s string, b []byte) {
- var u uint64
-
- obuf := p.buf
- index := p.index
- p.buf = b
- p.index = 0
- depth := 0
-
- fmt.Printf("\n--- %s ---\n", s)
-
-out:
- for {
- for i := 0; i < depth; i++ {
- fmt.Print(" ")
- }
-
- index := p.index
- if index == len(p.buf) {
- break
- }
-
- op, err := p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: fetching op err %v\n", index, err)
- break out
- }
- tag := op >> 3
- wire := op & 7
-
- switch wire {
- default:
- fmt.Printf("%3d: t=%3d unknown wire=%d\n",
- index, tag, wire)
- break out
-
- case WireBytes:
- var r []byte
-
- r, err = p.DecodeRawBytes(false)
- if err != nil {
- break out
- }
- fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r))
- if len(r) <= 6 {
- for i := 0; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- } else {
- for i := 0; i < 3; i++ {
- fmt.Printf(" %.2x", r[i])
- }
- fmt.Printf(" ..")
- for i := len(r) - 3; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- }
- fmt.Printf("\n")
-
- case WireFixed32:
- u, err = p.DecodeFixed32()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u)
-
- case WireFixed64:
- u, err = p.DecodeFixed64()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u)
-
- case WireVarint:
- u, err = p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u)
-
- case WireStartGroup:
- fmt.Printf("%3d: t=%3d start\n", index, tag)
- depth++
-
- case WireEndGroup:
- depth--
- fmt.Printf("%3d: t=%3d end\n", index, tag)
- }
- }
-
- if depth != 0 {
- fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth)
- }
- fmt.Printf("\n")
-
- p.buf = obuf
- p.index = index
-}
-
-// SetDefaults sets unset protocol buffer fields to their default values.
-// It only modifies fields that are both unset and have defined defaults.
-// It recursively sets default values in any non-nil sub-messages.
-func SetDefaults(pb Message) {
- setDefaults(reflect.ValueOf(pb), true, false)
-}
-
-// v is a pointer to a struct.
-func setDefaults(v reflect.Value, recur, zeros bool) {
- v = v.Elem()
-
- defaultMu.RLock()
- dm, ok := defaults[v.Type()]
- defaultMu.RUnlock()
- if !ok {
- dm = buildDefaultMessage(v.Type())
- defaultMu.Lock()
- defaults[v.Type()] = dm
- defaultMu.Unlock()
- }
-
- for _, sf := range dm.scalars {
- f := v.Field(sf.index)
- if !f.IsNil() {
- // field already set
- continue
- }
- dv := sf.value
- if dv == nil && !zeros {
- // no explicit default, and don't want to set zeros
- continue
- }
- fptr := f.Addr().Interface() // **T
- // TODO: Consider batching the allocations we do here.
- switch sf.kind {
- case reflect.Bool:
- b := new(bool)
- if dv != nil {
- *b = dv.(bool)
- }
- *(fptr.(**bool)) = b
- case reflect.Float32:
- f := new(float32)
- if dv != nil {
- *f = dv.(float32)
- }
- *(fptr.(**float32)) = f
- case reflect.Float64:
- f := new(float64)
- if dv != nil {
- *f = dv.(float64)
- }
- *(fptr.(**float64)) = f
- case reflect.Int32:
- // might be an enum
- if ft := f.Type(); ft != int32PtrType {
- // enum
- f.Set(reflect.New(ft.Elem()))
- if dv != nil {
- f.Elem().SetInt(int64(dv.(int32)))
- }
- } else {
- // int32 field
- i := new(int32)
- if dv != nil {
- *i = dv.(int32)
- }
- *(fptr.(**int32)) = i
- }
- case reflect.Int64:
- i := new(int64)
- if dv != nil {
- *i = dv.(int64)
- }
- *(fptr.(**int64)) = i
- case reflect.String:
- s := new(string)
- if dv != nil {
- *s = dv.(string)
- }
- *(fptr.(**string)) = s
- case reflect.Uint8:
- // exceptional case: []byte
- var b []byte
- if dv != nil {
- db := dv.([]byte)
- b = make([]byte, len(db))
- copy(b, db)
- } else {
- b = []byte{}
- }
- *(fptr.(*[]byte)) = b
- case reflect.Uint32:
- u := new(uint32)
- if dv != nil {
- *u = dv.(uint32)
- }
- *(fptr.(**uint32)) = u
- case reflect.Uint64:
- u := new(uint64)
- if dv != nil {
- *u = dv.(uint64)
- }
- *(fptr.(**uint64)) = u
- default:
- log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind)
- }
- }
-
- for _, ni := range dm.nested {
- f := v.Field(ni)
- // f is *T or []*T or map[T]*T
- switch f.Kind() {
- case reflect.Ptr:
- if f.IsNil() {
- continue
- }
- setDefaults(f, recur, zeros)
-
- case reflect.Slice:
- for i := 0; i < f.Len(); i++ {
- e := f.Index(i)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
-
- case reflect.Map:
- for _, k := range f.MapKeys() {
- e := f.MapIndex(k)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
- }
- }
-}
-
-var (
- // defaults maps a protocol buffer struct type to a slice of the fields,
- // with its scalar fields set to their proto-declared non-zero default values.
- defaultMu sync.RWMutex
- defaults = make(map[reflect.Type]defaultMessage)
-
- int32PtrType = reflect.TypeOf((*int32)(nil))
-)
-
-// defaultMessage represents information about the default values of a message.
-type defaultMessage struct {
- scalars []scalarField
- nested []int // struct field index of nested messages
-}
-
-type scalarField struct {
- index int // struct field index
- kind reflect.Kind // element type (the T in *T or []T)
- value interface{} // the proto-declared default value, or nil
-}
-
-// t is a struct type.
-func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
- sprop := GetProperties(t)
- for _, prop := range sprop.Prop {
- fi, ok := sprop.decoderTags.get(prop.Tag)
- if !ok {
- // XXX_unrecognized
- continue
- }
- ft := t.Field(fi).Type
-
- sf, nested, err := fieldDefault(ft, prop)
- switch {
- case err != nil:
- log.Print(err)
- case nested:
- dm.nested = append(dm.nested, fi)
- case sf != nil:
- sf.index = fi
- dm.scalars = append(dm.scalars, *sf)
- }
- }
-
- return dm
-}
-
-// fieldDefault returns the scalarField for field type ft.
-// sf will be nil if the field can not have a default.
-// nestedMessage will be true if this is a nested message.
-// Note that sf.index is not set on return.
-func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
- var canHaveDefault bool
- switch ft.Kind() {
- case reflect.Ptr:
- if ft.Elem().Kind() == reflect.Struct {
- nestedMessage = true
- } else {
- canHaveDefault = true // proto2 scalar field
- }
-
- case reflect.Slice:
- switch ft.Elem().Kind() {
- case reflect.Ptr:
- nestedMessage = true // repeated message
- case reflect.Uint8:
- canHaveDefault = true // bytes field
- }
-
- case reflect.Map:
- if ft.Elem().Kind() == reflect.Ptr {
- nestedMessage = true // map with message values
- }
- }
-
- if !canHaveDefault {
- if nestedMessage {
- return nil, true, nil
- }
- return nil, false, nil
- }
-
- // We now know that ft is a pointer or slice.
- sf = &scalarField{kind: ft.Elem().Kind()}
-
- // scalar fields without defaults
- if !prop.HasDefault {
- return sf, false, nil
- }
-
- // a scalar field: either *T or []byte
- switch ft.Elem().Kind() {
- case reflect.Bool:
- x, err := strconv.ParseBool(prop.Default)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Float32:
- x, err := strconv.ParseFloat(prop.Default, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
- }
- sf.value = float32(x)
- case reflect.Float64:
- x, err := strconv.ParseFloat(prop.Default, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Int32:
- x, err := strconv.ParseInt(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
- }
- sf.value = int32(x)
- case reflect.Int64:
- x, err := strconv.ParseInt(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.String:
- sf.value = prop.Default
- case reflect.Uint8:
- // []byte (not *uint8)
- sf.value = []byte(prop.Default)
- case reflect.Uint32:
- x, err := strconv.ParseUint(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
- }
- sf.value = uint32(x)
- case reflect.Uint64:
- x, err := strconv.ParseUint(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
- }
- sf.value = x
- default:
- return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
- }
-
- return sf, false, nil
-}
-
-// Map fields may have key types of non-float scalars, strings and enums.
-// The easiest way to sort them in some deterministic order is to use fmt.
-// If this turns out to be inefficient we can always consider other options,
-// such as doing a Schwartzian transform.
-
-func mapKeys(vs []reflect.Value) sort.Interface {
- s := mapKeySorter{
- vs: vs,
- // default Less function: textual comparison
- less: func(a, b reflect.Value) bool {
- return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface())
- },
- }
-
- // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps;
- // numeric keys are sorted numerically.
- if len(vs) == 0 {
- return s
- }
- switch vs[0].Kind() {
- case reflect.Int32, reflect.Int64:
- s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }
- case reflect.Uint32, reflect.Uint64:
- s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }
- }
-
- return s
-}
-
-type mapKeySorter struct {
- vs []reflect.Value
- less func(a, b reflect.Value) bool
-}
-
-func (s mapKeySorter) Len() int { return len(s.vs) }
-func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }
-func (s mapKeySorter) Less(i, j int) bool {
- return s.less(s.vs[i], s.vs[j])
-}
-
-// isProto3Zero reports whether v is a zero proto3 value.
-func isProto3Zero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint32, reflect.Uint64:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.String:
- return v.String() == ""
- }
- return false
-}
-
-// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion2 = true
-
-// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion1 = true
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/message_set.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/message_set.go
deleted file mode 100644
index fd982decd..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/message_set.go
+++ /dev/null
@@ -1,311 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Support for message sets.
- */
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "sort"
-)
-
-// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
-// A message type ID is required for storing a protocol buffer in a message set.
-var errNoMessageTypeID = errors.New("proto does not have a message type ID")
-
-// The first two types (_MessageSet_Item and messageSet)
-// model what the protocol compiler produces for the following protocol message:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-// That is the MessageSet wire format. We can't use a proto to generate these
-// because that would introduce a circular dependency between it and this package.
-
-type _MessageSet_Item struct {
- TypeId *int32 `protobuf:"varint,2,req,name=type_id"`
- Message []byte `protobuf:"bytes,3,req,name=message"`
-}
-
-type messageSet struct {
- Item []*_MessageSet_Item `protobuf:"group,1,rep"`
- XXX_unrecognized []byte
- // TODO: caching?
-}
-
-// Make sure messageSet is a Message.
-var _ Message = (*messageSet)(nil)
-
-// messageTypeIder is an interface satisfied by a protocol buffer type
-// that may be stored in a MessageSet.
-type messageTypeIder interface {
- MessageTypeId() int32
-}
-
-func (ms *messageSet) find(pb Message) *_MessageSet_Item {
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return nil
- }
- id := mti.MessageTypeId()
- for _, item := range ms.Item {
- if *item.TypeId == id {
- return item
- }
- }
- return nil
-}
-
-func (ms *messageSet) Has(pb Message) bool {
- if ms.find(pb) != nil {
- return true
- }
- return false
-}
-
-func (ms *messageSet) Unmarshal(pb Message) error {
- if item := ms.find(pb); item != nil {
- return Unmarshal(item.Message, pb)
- }
- if _, ok := pb.(messageTypeIder); !ok {
- return errNoMessageTypeID
- }
- return nil // TODO: return error instead?
-}
-
-func (ms *messageSet) Marshal(pb Message) error {
- msg, err := Marshal(pb)
- if err != nil {
- return err
- }
- if item := ms.find(pb); item != nil {
- // reuse existing item
- item.Message = msg
- return nil
- }
-
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return errNoMessageTypeID
- }
-
- mtid := mti.MessageTypeId()
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: &mtid,
- Message: msg,
- })
- return nil
-}
-
-func (ms *messageSet) Reset() { *ms = messageSet{} }
-func (ms *messageSet) String() string { return CompactTextString(ms) }
-func (*messageSet) ProtoMessage() {}
-
-// Support for the message_set_wire_format message option.
-
-func skipVarint(buf []byte) []byte {
- i := 0
- for ; buf[i]&0x80 != 0; i++ {
- }
- return buf[i+1:]
-}
-
-// MarshalMessageSet encodes the extension map represented by m in the message set wire format.
-// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSet(exts interface{}) ([]byte, error) {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- if err := encodeExtensions(exts); err != nil {
- return nil, err
- }
- m, _ = exts.extensionsRead()
- case map[int32]Extension:
- if err := encodeExtensionsMap(exts); err != nil {
- return nil, err
- }
- m = exts
- default:
- return nil, errors.New("proto: not an extension map")
- }
-
- // Sort extension IDs to provide a deterministic encoding.
- // See also enc_map in encode.go.
- ids := make([]int, 0, len(m))
- for id := range m {
- ids = append(ids, int(id))
- }
- sort.Ints(ids)
-
- ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))}
- for _, id := range ids {
- e := m[int32(id)]
- // Remove the wire type and field number varint, as well as the length varint.
- msg := skipVarint(skipVarint(e.enc))
-
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: Int32(int32(id)),
- Message: msg,
- })
- }
- return Marshal(ms)
-}
-
-// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
-// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSet(buf []byte, exts interface{}) error {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- m = exts.extensionsWrite()
- case map[int32]Extension:
- m = exts
- default:
- return errors.New("proto: not an extension map")
- }
-
- ms := new(messageSet)
- if err := Unmarshal(buf, ms); err != nil {
- return err
- }
- for _, item := range ms.Item {
- id := *item.TypeId
- msg := item.Message
-
- // Restore wire type and field number varint, plus length varint.
- // Be careful to preserve duplicate items.
- b := EncodeVarint(uint64(id)<<3 | WireBytes)
- if ext, ok := m[id]; ok {
- // Existing data; rip off the tag and length varint
- // so we join the new data correctly.
- // We can assume that ext.enc is set because we are unmarshaling.
- o := ext.enc[len(b):] // skip wire type and field number
- _, n := DecodeVarint(o) // calculate length of length varint
- o = o[n:] // skip length varint
- msg = append(o, msg...) // join old data and new data
- }
- b = append(b, EncodeVarint(uint64(len(msg)))...)
- b = append(b, msg...)
-
- m[id] = Extension{enc: b}
- }
- return nil
-}
-
-// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
-// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- m, _ = exts.extensionsRead()
- case map[int32]Extension:
- m = exts
- default:
- return nil, errors.New("proto: not an extension map")
- }
- var b bytes.Buffer
- b.WriteByte('{')
-
- // Process the map in key order for deterministic output.
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids)) // int32Slice defined in text.go
-
- for i, id := range ids {
- ext := m[id]
- if i > 0 {
- b.WriteByte(',')
- }
-
- msd, ok := messageSetMap[id]
- if !ok {
- // Unknown type; we can't render it, so skip it.
- continue
- }
- fmt.Fprintf(&b, `"[%s]":`, msd.name)
-
- x := ext.value
- if x == nil {
- x = reflect.New(msd.t.Elem()).Interface()
- if err := Unmarshal(ext.enc, x.(Message)); err != nil {
- return nil, err
- }
- }
- d, err := json.Marshal(x)
- if err != nil {
- return nil, err
- }
- b.Write(d)
- }
- b.WriteByte('}')
- return b.Bytes(), nil
-}
-
-// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
-// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
- // Common-case fast path.
- if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
- return nil
- }
-
- // This is fairly tricky, and it's not clear that it is needed.
- return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented")
-}
-
-// A global registry of types that can be used in a MessageSet.
-
-var messageSetMap = make(map[int32]messageSetDesc)
-
-type messageSetDesc struct {
- t reflect.Type // pointer to struct
- name string
-}
-
-// RegisterMessageSetType is called from the generated code.
-func RegisterMessageSetType(m Message, fieldNum int32, name string) {
- messageSetMap[fieldNum] = messageSetDesc{
- t: reflect.TypeOf(m),
- name: name,
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
deleted file mode 100644
index fb512e2e1..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
+++ /dev/null
@@ -1,484 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 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
-// 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.
-
-// +build appengine js
-
-// This file contains an implementation of proto field accesses using package reflect.
-// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
-// be used on App Engine.
-
-package proto
-
-import (
- "math"
- "reflect"
-)
-
-// A structPointer is a pointer to a struct.
-type structPointer struct {
- v reflect.Value
-}
-
-// toStructPointer returns a structPointer equivalent to the given reflect value.
-// The reflect value must itself be a pointer to a struct.
-func toStructPointer(v reflect.Value) structPointer {
- return structPointer{v}
-}
-
-// IsNil reports whether p is nil.
-func structPointer_IsNil(p structPointer) bool {
- return p.v.IsNil()
-}
-
-// Interface returns the struct pointer as an interface value.
-func structPointer_Interface(p structPointer, _ reflect.Type) interface{} {
- return p.v.Interface()
-}
-
-// A field identifies a field in a struct, accessible from a structPointer.
-// In this implementation, a field is identified by the sequence of field indices
-// passed to reflect's FieldByIndex.
-type field []int
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return f.Index
-}
-
-// invalidField is an invalid field identifier.
-var invalidField = field(nil)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool { return f != nil }
-
-// field returns the given field in the struct as a reflect value.
-func structPointer_field(p structPointer, f field) reflect.Value {
- // Special case: an extension map entry with a value of type T
- // passes a *T to the struct-handling code with a zero field,
- // expecting that it will be treated as equivalent to *struct{ X T },
- // which has the same memory layout. We have to handle that case
- // specially, because reflect will panic if we call FieldByIndex on a
- // non-struct.
- if f == nil {
- return p.v.Elem()
- }
-
- return p.v.Elem().FieldByIndex(f)
-}
-
-// ifield returns the given field in the struct as an interface value.
-func structPointer_ifield(p structPointer, f field) interface{} {
- return structPointer_field(p, f).Addr().Interface()
-}
-
-// Bytes returns the address of a []byte field in the struct.
-func structPointer_Bytes(p structPointer, f field) *[]byte {
- return structPointer_ifield(p, f).(*[]byte)
-}
-
-// BytesSlice returns the address of a [][]byte field in the struct.
-func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
- return structPointer_ifield(p, f).(*[][]byte)
-}
-
-// Bool returns the address of a *bool field in the struct.
-func structPointer_Bool(p structPointer, f field) **bool {
- return structPointer_ifield(p, f).(**bool)
-}
-
-// BoolVal returns the address of a bool field in the struct.
-func structPointer_BoolVal(p structPointer, f field) *bool {
- return structPointer_ifield(p, f).(*bool)
-}
-
-// BoolSlice returns the address of a []bool field in the struct.
-func structPointer_BoolSlice(p structPointer, f field) *[]bool {
- return structPointer_ifield(p, f).(*[]bool)
-}
-
-// String returns the address of a *string field in the struct.
-func structPointer_String(p structPointer, f field) **string {
- return structPointer_ifield(p, f).(**string)
-}
-
-// StringVal returns the address of a string field in the struct.
-func structPointer_StringVal(p structPointer, f field) *string {
- return structPointer_ifield(p, f).(*string)
-}
-
-// StringSlice returns the address of a []string field in the struct.
-func structPointer_StringSlice(p structPointer, f field) *[]string {
- return structPointer_ifield(p, f).(*[]string)
-}
-
-// Extensions returns the address of an extension map field in the struct.
-func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {
- return structPointer_ifield(p, f).(*XXX_InternalExtensions)
-}
-
-// ExtMap returns the address of an extension map field in the struct.
-func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
- return structPointer_ifield(p, f).(*map[int32]Extension)
-}
-
-// NewAt returns the reflect.Value for a pointer to a field in the struct.
-func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {
- return structPointer_field(p, f).Addr()
-}
-
-// SetStructPointer writes a *struct field in the struct.
-func structPointer_SetStructPointer(p structPointer, f field, q structPointer) {
- structPointer_field(p, f).Set(q.v)
-}
-
-// GetStructPointer reads a *struct field in the struct.
-func structPointer_GetStructPointer(p structPointer, f field) structPointer {
- return structPointer{structPointer_field(p, f)}
-}
-
-// StructPointerSlice the address of a []*struct field in the struct.
-func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice {
- return structPointerSlice{structPointer_field(p, f)}
-}
-
-// A structPointerSlice represents the address of a slice of pointers to structs
-// (themselves messages or groups). That is, v.Type() is *[]*struct{...}.
-type structPointerSlice struct {
- v reflect.Value
-}
-
-func (p structPointerSlice) Len() int { return p.v.Len() }
-func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} }
-func (p structPointerSlice) Append(q structPointer) {
- p.v.Set(reflect.Append(p.v, q.v))
-}
-
-var (
- int32Type = reflect.TypeOf(int32(0))
- uint32Type = reflect.TypeOf(uint32(0))
- float32Type = reflect.TypeOf(float32(0))
- int64Type = reflect.TypeOf(int64(0))
- uint64Type = reflect.TypeOf(uint64(0))
- float64Type = reflect.TypeOf(float64(0))
-)
-
-// A word32 represents a field of type *int32, *uint32, *float32, or *enum.
-// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable.
-type word32 struct {
- v reflect.Value
-}
-
-// IsNil reports whether p is nil.
-func word32_IsNil(p word32) bool {
- return p.v.IsNil()
-}
-
-// Set sets p to point at a newly allocated word with bits set to x.
-func word32_Set(p word32, o *Buffer, x uint32) {
- t := p.v.Type().Elem()
- switch t {
- case int32Type:
- if len(o.int32s) == 0 {
- o.int32s = make([]int32, uint32PoolSize)
- }
- o.int32s[0] = int32(x)
- p.v.Set(reflect.ValueOf(&o.int32s[0]))
- o.int32s = o.int32s[1:]
- return
- case uint32Type:
- if len(o.uint32s) == 0 {
- o.uint32s = make([]uint32, uint32PoolSize)
- }
- o.uint32s[0] = x
- p.v.Set(reflect.ValueOf(&o.uint32s[0]))
- o.uint32s = o.uint32s[1:]
- return
- case float32Type:
- if len(o.float32s) == 0 {
- o.float32s = make([]float32, uint32PoolSize)
- }
- o.float32s[0] = math.Float32frombits(x)
- p.v.Set(reflect.ValueOf(&o.float32s[0]))
- o.float32s = o.float32s[1:]
- return
- }
-
- // must be enum
- p.v.Set(reflect.New(t))
- p.v.Elem().SetInt(int64(int32(x)))
-}
-
-// Get gets the bits pointed at by p, as a uint32.
-func word32_Get(p word32) uint32 {
- elem := p.v.Elem()
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32(p structPointer, f field) word32 {
- return word32{structPointer_field(p, f)}
-}
-
-// A word32Val represents a field of type int32, uint32, float32, or enum.
-// That is, v.Type() is int32, uint32, float32, or enum and v is assignable.
-type word32Val struct {
- v reflect.Value
-}
-
-// Set sets *p to x.
-func word32Val_Set(p word32Val, x uint32) {
- switch p.v.Type() {
- case int32Type:
- p.v.SetInt(int64(x))
- return
- case uint32Type:
- p.v.SetUint(uint64(x))
- return
- case float32Type:
- p.v.SetFloat(float64(math.Float32frombits(x)))
- return
- }
-
- // must be enum
- p.v.SetInt(int64(int32(x)))
-}
-
-// Get gets the bits pointed at by p, as a uint32.
-func word32Val_Get(p word32Val) uint32 {
- elem := p.v
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct.
-func structPointer_Word32Val(p structPointer, f field) word32Val {
- return word32Val{structPointer_field(p, f)}
-}
-
-// A word32Slice is a slice of 32-bit values.
-// That is, v.Type() is []int32, []uint32, []float32, or []enum.
-type word32Slice struct {
- v reflect.Value
-}
-
-func (p word32Slice) Append(x uint32) {
- n, m := p.v.Len(), p.v.Cap()
- if n < m {
- p.v.SetLen(n + 1)
- } else {
- t := p.v.Type().Elem()
- p.v.Set(reflect.Append(p.v, reflect.Zero(t)))
- }
- elem := p.v.Index(n)
- switch elem.Kind() {
- case reflect.Int32:
- elem.SetInt(int64(int32(x)))
- case reflect.Uint32:
- elem.SetUint(uint64(x))
- case reflect.Float32:
- elem.SetFloat(float64(math.Float32frombits(x)))
- }
-}
-
-func (p word32Slice) Len() int {
- return p.v.Len()
-}
-
-func (p word32Slice) Index(i int) uint32 {
- elem := p.v.Index(i)
- switch elem.Kind() {
- case reflect.Int32:
- return uint32(elem.Int())
- case reflect.Uint32:
- return uint32(elem.Uint())
- case reflect.Float32:
- return math.Float32bits(float32(elem.Float()))
- }
- panic("unreachable")
-}
-
-// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct.
-func structPointer_Word32Slice(p structPointer, f field) word32Slice {
- return word32Slice{structPointer_field(p, f)}
-}
-
-// word64 is like word32 but for 64-bit values.
-type word64 struct {
- v reflect.Value
-}
-
-func word64_Set(p word64, o *Buffer, x uint64) {
- t := p.v.Type().Elem()
- switch t {
- case int64Type:
- if len(o.int64s) == 0 {
- o.int64s = make([]int64, uint64PoolSize)
- }
- o.int64s[0] = int64(x)
- p.v.Set(reflect.ValueOf(&o.int64s[0]))
- o.int64s = o.int64s[1:]
- return
- case uint64Type:
- if len(o.uint64s) == 0 {
- o.uint64s = make([]uint64, uint64PoolSize)
- }
- o.uint64s[0] = x
- p.v.Set(reflect.ValueOf(&o.uint64s[0]))
- o.uint64s = o.uint64s[1:]
- return
- case float64Type:
- if len(o.float64s) == 0 {
- o.float64s = make([]float64, uint64PoolSize)
- }
- o.float64s[0] = math.Float64frombits(x)
- p.v.Set(reflect.ValueOf(&o.float64s[0]))
- o.float64s = o.float64s[1:]
- return
- }
- panic("unreachable")
-}
-
-func word64_IsNil(p word64) bool {
- return p.v.IsNil()
-}
-
-func word64_Get(p word64) uint64 {
- elem := p.v.Elem()
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return elem.Uint()
- case reflect.Float64:
- return math.Float64bits(elem.Float())
- }
- panic("unreachable")
-}
-
-func structPointer_Word64(p structPointer, f field) word64 {
- return word64{structPointer_field(p, f)}
-}
-
-// word64Val is like word32Val but for 64-bit values.
-type word64Val struct {
- v reflect.Value
-}
-
-func word64Val_Set(p word64Val, o *Buffer, x uint64) {
- switch p.v.Type() {
- case int64Type:
- p.v.SetInt(int64(x))
- return
- case uint64Type:
- p.v.SetUint(x)
- return
- case float64Type:
- p.v.SetFloat(math.Float64frombits(x))
- return
- }
- panic("unreachable")
-}
-
-func word64Val_Get(p word64Val) uint64 {
- elem := p.v
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return elem.Uint()
- case reflect.Float64:
- return math.Float64bits(elem.Float())
- }
- panic("unreachable")
-}
-
-func structPointer_Word64Val(p structPointer, f field) word64Val {
- return word64Val{structPointer_field(p, f)}
-}
-
-type word64Slice struct {
- v reflect.Value
-}
-
-func (p word64Slice) Append(x uint64) {
- n, m := p.v.Len(), p.v.Cap()
- if n < m {
- p.v.SetLen(n + 1)
- } else {
- t := p.v.Type().Elem()
- p.v.Set(reflect.Append(p.v, reflect.Zero(t)))
- }
- elem := p.v.Index(n)
- switch elem.Kind() {
- case reflect.Int64:
- elem.SetInt(int64(int64(x)))
- case reflect.Uint64:
- elem.SetUint(uint64(x))
- case reflect.Float64:
- elem.SetFloat(float64(math.Float64frombits(x)))
- }
-}
-
-func (p word64Slice) Len() int {
- return p.v.Len()
-}
-
-func (p word64Slice) Index(i int) uint64 {
- elem := p.v.Index(i)
- switch elem.Kind() {
- case reflect.Int64:
- return uint64(elem.Int())
- case reflect.Uint64:
- return uint64(elem.Uint())
- case reflect.Float64:
- return math.Float64bits(float64(elem.Float()))
- }
- panic("unreachable")
-}
-
-func structPointer_Word64Slice(p structPointer, f field) word64Slice {
- return word64Slice{structPointer_field(p, f)}
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
deleted file mode 100644
index 6b5567d47..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
+++ /dev/null
@@ -1,270 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 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
-// 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.
-
-// +build !appengine,!js
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
- "reflect"
- "unsafe"
-)
-
-// NOTE: These type_Foo functions would more idiomatically be methods,
-// but Go does not allow methods on pointer types, and we must preserve
-// some pointer type for the garbage collector. We use these
-// funcs with clunky names as our poor approximation to methods.
-//
-// An alternative would be
-// type structPointer struct { p unsafe.Pointer }
-// but that does not registerize as well.
-
-// A structPointer is a pointer to a struct.
-type structPointer unsafe.Pointer
-
-// toStructPointer returns a structPointer equivalent to the given reflect value.
-func toStructPointer(v reflect.Value) structPointer {
- return structPointer(unsafe.Pointer(v.Pointer()))
-}
-
-// IsNil reports whether p is nil.
-func structPointer_IsNil(p structPointer) bool {
- return p == nil
-}
-
-// Interface returns the struct pointer, assumed to have element type t,
-// as an interface value.
-func structPointer_Interface(p structPointer, t reflect.Type) interface{} {
- return reflect.NewAt(t, unsafe.Pointer(p)).Interface()
-}
-
-// A field identifies a field in a struct, accessible from a structPointer.
-// In this implementation, a field is identified by its byte offset from the start of the struct.
-type field uintptr
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return field(f.Offset)
-}
-
-// invalidField is an invalid field identifier.
-const invalidField = ^field(0)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool {
- return f != ^field(0)
-}
-
-// Bytes returns the address of a []byte field in the struct.
-func structPointer_Bytes(p structPointer, f field) *[]byte {
- return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BytesSlice returns the address of a [][]byte field in the struct.
-func structPointer_BytesSlice(p structPointer, f field) *[][]byte {
- return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// Bool returns the address of a *bool field in the struct.
-func structPointer_Bool(p structPointer, f field) **bool {
- return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BoolVal returns the address of a bool field in the struct.
-func structPointer_BoolVal(p structPointer, f field) *bool {
- return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// BoolSlice returns the address of a []bool field in the struct.
-func structPointer_BoolSlice(p structPointer, f field) *[]bool {
- return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// String returns the address of a *string field in the struct.
-func structPointer_String(p structPointer, f field) **string {
- return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StringVal returns the address of a string field in the struct.
-func structPointer_StringVal(p structPointer, f field) *string {
- return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StringSlice returns the address of a []string field in the struct.
-func structPointer_StringSlice(p structPointer, f field) *[]string {
- return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// ExtMap returns the address of an extension map field in the struct.
-func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {
- return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
- return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// NewAt returns the reflect.Value for a pointer to a field in the struct.
-func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value {
- return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f)))
-}
-
-// SetStructPointer writes a *struct field in the struct.
-func structPointer_SetStructPointer(p structPointer, f field, q structPointer) {
- *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q
-}
-
-// GetStructPointer reads a *struct field in the struct.
-func structPointer_GetStructPointer(p structPointer, f field) structPointer {
- return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// StructPointerSlice the address of a []*struct field in the struct.
-func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice {
- return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups).
-type structPointerSlice []structPointer
-
-func (v *structPointerSlice) Len() int { return len(*v) }
-func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] }
-func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) }
-
-// A word32 is the address of a "pointer to 32-bit value" field.
-type word32 **uint32
-
-// IsNil reports whether *v is nil.
-func word32_IsNil(p word32) bool {
- return *p == nil
-}
-
-// Set sets *v to point at a newly allocated word set to x.
-func word32_Set(p word32, o *Buffer, x uint32) {
- if len(o.uint32s) == 0 {
- o.uint32s = make([]uint32, uint32PoolSize)
- }
- o.uint32s[0] = x
- *p = &o.uint32s[0]
- o.uint32s = o.uint32s[1:]
-}
-
-// Get gets the value pointed at by *v.
-func word32_Get(p word32) uint32 {
- return **p
-}
-
-// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32(p structPointer, f field) word32 {
- return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// A word32Val is the address of a 32-bit value field.
-type word32Val *uint32
-
-// Set sets *p to x.
-func word32Val_Set(p word32Val, x uint32) {
- *p = x
-}
-
-// Get gets the value pointed at by p.
-func word32Val_Get(p word32Val) uint32 {
- return *p
-}
-
-// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct.
-func structPointer_Word32Val(p structPointer, f field) word32Val {
- return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// A word32Slice is a slice of 32-bit values.
-type word32Slice []uint32
-
-func (v *word32Slice) Append(x uint32) { *v = append(*v, x) }
-func (v *word32Slice) Len() int { return len(*v) }
-func (v *word32Slice) Index(i int) uint32 { return (*v)[i] }
-
-// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct.
-func structPointer_Word32Slice(p structPointer, f field) *word32Slice {
- return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
-
-// word64 is like word32 but for 64-bit values.
-type word64 **uint64
-
-func word64_Set(p word64, o *Buffer, x uint64) {
- if len(o.uint64s) == 0 {
- o.uint64s = make([]uint64, uint64PoolSize)
- }
- o.uint64s[0] = x
- *p = &o.uint64s[0]
- o.uint64s = o.uint64s[1:]
-}
-
-func word64_IsNil(p word64) bool {
- return *p == nil
-}
-
-func word64_Get(p word64) uint64 {
- return **p
-}
-
-func structPointer_Word64(p structPointer, f field) word64 {
- return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// word64Val is like word32Val but for 64-bit values.
-type word64Val *uint64
-
-func word64Val_Set(p word64Val, o *Buffer, x uint64) {
- *p = x
-}
-
-func word64Val_Get(p word64Val) uint64 {
- return *p
-}
-
-func structPointer_Word64Val(p structPointer, f field) word64Val {
- return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f))))
-}
-
-// word64Slice is like word32Slice but for 64-bit values.
-type word64Slice []uint64
-
-func (v *word64Slice) Append(x uint64) { *v = append(*v, x) }
-func (v *word64Slice) Len() int { return len(*v) }
-func (v *word64Slice) Index(i int) uint64 { return (*v)[i] }
-
-func structPointer_Word64Slice(p structPointer, f field) *word64Slice {
- return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f)))
-}
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/properties.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/properties.go
deleted file mode 100644
index 69ddda8d4..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/properties.go
+++ /dev/null
@@ -1,864 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "fmt"
- "log"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
-)
-
-const debug bool = false
-
-// Constants that identify the encoding of a value on the wire.
-const (
- WireVarint = 0
- WireFixed64 = 1
- WireBytes = 2
- WireStartGroup = 3
- WireEndGroup = 4
- WireFixed32 = 5
-)
-
-const startSize = 10 // initial slice/string sizes
-
-// Encoders are defined in encode.go
-// An encoder outputs the full representation of a field, including its
-// tag and encoder type.
-type encoder func(p *Buffer, prop *Properties, base structPointer) error
-
-// A valueEncoder encodes a single integer in a particular encoding.
-type valueEncoder func(o *Buffer, x uint64) error
-
-// Sizers are defined in encode.go
-// A sizer returns the encoded size of a field, including its tag and encoder
-// type.
-type sizer func(prop *Properties, base structPointer) int
-
-// A valueSizer returns the encoded size of a single integer in a particular
-// encoding.
-type valueSizer func(x uint64) int
-
-// Decoders are defined in decode.go
-// A decoder creates a value from its wire representation.
-// Unrecognized subelements are saved in unrec.
-type decoder func(p *Buffer, prop *Properties, base structPointer) error
-
-// A valueDecoder decodes a single integer in a particular encoding.
-type valueDecoder func(o *Buffer) (x uint64, err error)
-
-// A oneofMarshaler does the marshaling for all oneof fields in a message.
-type oneofMarshaler func(Message, *Buffer) error
-
-// A oneofUnmarshaler does the unmarshaling for a oneof field in a message.
-type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error)
-
-// A oneofSizer does the sizing for all oneof fields in a message.
-type oneofSizer func(Message) int
-
-// tagMap is an optimization over map[int]int for typical protocol buffer
-// use-cases. Encoded protocol buffers are often in tag order with small tag
-// numbers.
-type tagMap struct {
- fastTags []int
- slowTags map[int]int
-}
-
-// tagMapFastLimit is the upper bound on the tag number that will be stored in
-// the tagMap slice rather than its map.
-const tagMapFastLimit = 1024
-
-func (p *tagMap) get(t int) (int, bool) {
- if t > 0 && t < tagMapFastLimit {
- if t >= len(p.fastTags) {
- return 0, false
- }
- fi := p.fastTags[t]
- return fi, fi >= 0
- }
- fi, ok := p.slowTags[t]
- return fi, ok
-}
-
-func (p *tagMap) put(t int, fi int) {
- if t > 0 && t < tagMapFastLimit {
- for len(p.fastTags) < t+1 {
- p.fastTags = append(p.fastTags, -1)
- }
- p.fastTags[t] = fi
- return
- }
- if p.slowTags == nil {
- p.slowTags = make(map[int]int)
- }
- p.slowTags[t] = fi
-}
-
-// StructProperties represents properties for all the fields of a struct.
-// decoderTags and decoderOrigNames should only be used by the decoder.
-type StructProperties struct {
- Prop []*Properties // properties for each field
- reqCount int // required count
- decoderTags tagMap // map from proto tag to struct field number
- decoderOrigNames map[string]int // map from original name to struct field number
- order []int // list of struct field numbers in tag order
- unrecField field // field id of the XXX_unrecognized []byte field
- extendable bool // is this an extendable proto
-
- oneofMarshaler oneofMarshaler
- oneofUnmarshaler oneofUnmarshaler
- oneofSizer oneofSizer
- stype reflect.Type
-
- // OneofTypes contains information about the oneof fields in this message.
- // It is keyed by the original name of a field.
- OneofTypes map[string]*OneofProperties
-}
-
-// OneofProperties represents information about a specific field in a oneof.
-type OneofProperties struct {
- Type reflect.Type // pointer to generated struct type for this oneof field
- Field int // struct field number of the containing oneof in the message
- Prop *Properties
-}
-
-// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.
-// See encode.go, (*Buffer).enc_struct.
-
-func (sp *StructProperties) Len() int { return len(sp.order) }
-func (sp *StructProperties) Less(i, j int) bool {
- return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag
-}
-func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }
-
-// Properties represents the protocol-specific behavior of a single struct field.
-type Properties struct {
- Name string // name of the field, for error messages
- OrigName string // original name before protocol compiler (always set)
- JSONName string // name to use for JSON; determined by protoc
- Wire string
- WireType int
- Tag int
- Required bool
- Optional bool
- 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
- oneof bool // whether this is a oneof field
-
- Default string // default value
- HasDefault bool // whether an explicit default was provided
- def_uint64 uint64
-
- enc encoder
- valEnc valueEncoder // set for bool and numeric types only
- field field
- tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType)
- tagbuf [8]byte
- stype reflect.Type // set for struct types only
- sprop *StructProperties // set for struct types only
- isMarshaler bool
- isUnmarshaler bool
-
- mtype reflect.Type // set for map types only
- mkeyprop *Properties // set for map types only
- mvalprop *Properties // set for map types only
-
- size sizer
- valSize valueSizer // set for bool and numeric types only
-
- dec decoder
- valDec valueDecoder // set for bool and numeric types only
-
- // If this is a packable field, this will be the decoder for the packed version of the field.
- packedDec decoder
-}
-
-// String formats the properties in the protobuf struct field tag style.
-func (p *Properties) String() string {
- s := p.Wire
- s = ","
- s += strconv.Itoa(p.Tag)
- if p.Required {
- s += ",req"
- }
- if p.Optional {
- s += ",opt"
- }
- if p.Repeated {
- s += ",rep"
- }
- if p.Packed {
- s += ",packed"
- }
- s += ",name=" + p.OrigName
- if p.JSONName != p.OrigName {
- s += ",json=" + p.JSONName
- }
- if p.proto3 {
- s += ",proto3"
- }
- if p.oneof {
- s += ",oneof"
- }
- if len(p.Enum) > 0 {
- s += ",enum=" + p.Enum
- }
- if p.HasDefault {
- s += ",def=" + p.Default
- }
- return s
-}
-
-// Parse populates p by parsing a string in the protobuf struct field tag style.
-func (p *Properties) Parse(s string) {
- // "bytes,49,opt,name=foo,def=hello!"
- fields := strings.Split(s, ",") // breaks def=, but handled below.
- if len(fields) < 2 {
- fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
- return
- }
-
- p.Wire = fields[0]
- switch p.Wire {
- case "varint":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeVarint
- p.valDec = (*Buffer).DecodeVarint
- p.valSize = sizeVarint
- case "fixed32":
- p.WireType = WireFixed32
- p.valEnc = (*Buffer).EncodeFixed32
- p.valDec = (*Buffer).DecodeFixed32
- p.valSize = sizeFixed32
- case "fixed64":
- p.WireType = WireFixed64
- p.valEnc = (*Buffer).EncodeFixed64
- p.valDec = (*Buffer).DecodeFixed64
- p.valSize = sizeFixed64
- case "zigzag32":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeZigzag32
- p.valDec = (*Buffer).DecodeZigzag32
- p.valSize = sizeZigzag32
- case "zigzag64":
- p.WireType = WireVarint
- p.valEnc = (*Buffer).EncodeZigzag64
- p.valDec = (*Buffer).DecodeZigzag64
- p.valSize = sizeZigzag64
- case "bytes", "group":
- p.WireType = WireBytes
- // no numeric converter for non-numeric types
- default:
- fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s)
- return
- }
-
- var err error
- p.Tag, err = strconv.Atoi(fields[1])
- if err != nil {
- return
- }
-
- for i := 2; i < len(fields); i++ {
- f := fields[i]
- switch {
- case f == "req":
- p.Required = true
- case f == "opt":
- p.Optional = true
- case f == "rep":
- p.Repeated = true
- case f == "packed":
- p.Packed = true
- case strings.HasPrefix(f, "name="):
- p.OrigName = f[5:]
- case strings.HasPrefix(f, "json="):
- p.JSONName = f[5:]
- case strings.HasPrefix(f, "enum="):
- p.Enum = f[5:]
- case f == "proto3":
- p.proto3 = true
- case f == "oneof":
- p.oneof = true
- case strings.HasPrefix(f, "def="):
- p.HasDefault = true
- p.Default = f[4:] // rest of string
- if i+1 < len(fields) {
- // Commas aren't escaped, and def is always last.
- p.Default += "," + strings.Join(fields[i+1:], ",")
- break
- }
- }
- }
-}
-
-func logNoSliceEnc(t1, t2 reflect.Type) {
- fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2)
-}
-
-var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()
-
-// Initialize the fields for encoding and decoding.
-func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {
- p.enc = nil
- p.dec = nil
- p.size = nil
-
- switch t1 := typ; t1.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1)
-
- // proto3 scalar types
-
- case reflect.Bool:
- p.enc = (*Buffer).enc_proto3_bool
- p.dec = (*Buffer).dec_proto3_bool
- p.size = size_proto3_bool
- case reflect.Int32:
- p.enc = (*Buffer).enc_proto3_int32
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_proto3_int32
- case reflect.Uint32:
- p.enc = (*Buffer).enc_proto3_uint32
- p.dec = (*Buffer).dec_proto3_int32 // can reuse
- p.size = size_proto3_uint32
- case reflect.Int64, reflect.Uint64:
- p.enc = (*Buffer).enc_proto3_int64
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_proto3_int64
- case reflect.Float32:
- p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int32
- p.size = size_proto3_uint32
- case reflect.Float64:
- p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits
- p.dec = (*Buffer).dec_proto3_int64
- p.size = size_proto3_int64
- case reflect.String:
- p.enc = (*Buffer).enc_proto3_string
- p.dec = (*Buffer).dec_proto3_string
- p.size = size_proto3_string
-
- case reflect.Ptr:
- switch t2 := t1.Elem(); t2.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2)
- break
- case reflect.Bool:
- p.enc = (*Buffer).enc_bool
- p.dec = (*Buffer).dec_bool
- p.size = size_bool
- case reflect.Int32:
- p.enc = (*Buffer).enc_int32
- p.dec = (*Buffer).dec_int32
- p.size = size_int32
- case reflect.Uint32:
- p.enc = (*Buffer).enc_uint32
- p.dec = (*Buffer).dec_int32 // can reuse
- p.size = size_uint32
- case reflect.Int64, reflect.Uint64:
- p.enc = (*Buffer).enc_int64
- p.dec = (*Buffer).dec_int64
- p.size = size_int64
- case reflect.Float32:
- p.enc = (*Buffer).enc_uint32 // can just treat them as bits
- p.dec = (*Buffer).dec_int32
- p.size = size_uint32
- case reflect.Float64:
- p.enc = (*Buffer).enc_int64 // can just treat them as bits
- p.dec = (*Buffer).dec_int64
- p.size = size_int64
- case reflect.String:
- p.enc = (*Buffer).enc_string
- p.dec = (*Buffer).dec_string
- p.size = size_string
- case reflect.Struct:
- p.stype = t1.Elem()
- p.isMarshaler = isMarshaler(t1)
- p.isUnmarshaler = isUnmarshaler(t1)
- if p.Wire == "bytes" {
- p.enc = (*Buffer).enc_struct_message
- p.dec = (*Buffer).dec_struct_message
- p.size = size_struct_message
- } else {
- p.enc = (*Buffer).enc_struct_group
- p.dec = (*Buffer).dec_struct_group
- p.size = size_struct_group
- }
- }
-
- case reflect.Slice:
- switch t2 := t1.Elem(); t2.Kind() {
- default:
- logNoSliceEnc(t1, t2)
- break
- case reflect.Bool:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_bool
- p.size = size_slice_packed_bool
- } else {
- p.enc = (*Buffer).enc_slice_bool
- p.size = size_slice_bool
- }
- p.dec = (*Buffer).dec_slice_bool
- p.packedDec = (*Buffer).dec_slice_packed_bool
- case reflect.Int32:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int32
- p.size = size_slice_packed_int32
- } else {
- p.enc = (*Buffer).enc_slice_int32
- p.size = size_slice_int32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case reflect.Uint32:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_uint32
- p.size = size_slice_packed_uint32
- } else {
- p.enc = (*Buffer).enc_slice_uint32
- p.size = size_slice_uint32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case reflect.Int64, reflect.Uint64:
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int64
- p.size = size_slice_packed_int64
- } else {
- p.enc = (*Buffer).enc_slice_int64
- p.size = size_slice_int64
- }
- p.dec = (*Buffer).dec_slice_int64
- p.packedDec = (*Buffer).dec_slice_packed_int64
- case reflect.Uint8:
- p.dec = (*Buffer).dec_slice_byte
- if p.proto3 {
- p.enc = (*Buffer).enc_proto3_slice_byte
- p.size = size_proto3_slice_byte
- } else {
- p.enc = (*Buffer).enc_slice_byte
- p.size = size_slice_byte
- }
- case reflect.Float32, reflect.Float64:
- switch t2.Bits() {
- case 32:
- // can just treat them as bits
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_uint32
- p.size = size_slice_packed_uint32
- } else {
- p.enc = (*Buffer).enc_slice_uint32
- p.size = size_slice_uint32
- }
- p.dec = (*Buffer).dec_slice_int32
- p.packedDec = (*Buffer).dec_slice_packed_int32
- case 64:
- // can just treat them as bits
- if p.Packed {
- p.enc = (*Buffer).enc_slice_packed_int64
- p.size = size_slice_packed_int64
- } else {
- p.enc = (*Buffer).enc_slice_int64
- p.size = size_slice_int64
- }
- p.dec = (*Buffer).dec_slice_int64
- p.packedDec = (*Buffer).dec_slice_packed_int64
- default:
- logNoSliceEnc(t1, t2)
- break
- }
- case reflect.String:
- p.enc = (*Buffer).enc_slice_string
- p.dec = (*Buffer).dec_slice_string
- p.size = size_slice_string
- case reflect.Ptr:
- switch t3 := t2.Elem(); t3.Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3)
- break
- case reflect.Struct:
- p.stype = t2.Elem()
- p.isMarshaler = isMarshaler(t2)
- p.isUnmarshaler = isUnmarshaler(t2)
- if p.Wire == "bytes" {
- p.enc = (*Buffer).enc_slice_struct_message
- p.dec = (*Buffer).dec_slice_struct_message
- p.size = size_slice_struct_message
- } else {
- p.enc = (*Buffer).enc_slice_struct_group
- p.dec = (*Buffer).dec_slice_struct_group
- p.size = size_slice_struct_group
- }
- }
- case reflect.Slice:
- switch t2.Elem().Kind() {
- default:
- fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem())
- break
- case reflect.Uint8:
- p.enc = (*Buffer).enc_slice_slice_byte
- p.dec = (*Buffer).dec_slice_slice_byte
- p.size = size_slice_slice_byte
- }
- }
-
- case reflect.Map:
- p.enc = (*Buffer).enc_new_map
- p.dec = (*Buffer).dec_new_map
- p.size = size_new_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{}
- 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)
- }
-
- // precalculate tag code
- wire := p.WireType
- if p.Packed {
- wire = WireBytes
- }
- x := uint32(p.Tag)<<3 | uint32(wire)
- i := 0
- for i = 0; x > 127; i++ {
- p.tagbuf[i] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- p.tagbuf[i] = uint8(x)
- p.tagcode = p.tagbuf[0 : i+1]
-
- if p.stype != nil {
- if lockGetProp {
- p.sprop = GetProperties(p.stype)
- } else {
- p.sprop = getPropertiesLocked(p.stype)
- }
- }
-}
-
-var (
- marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
- unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem()
-)
-
-// isMarshaler reports whether type t implements Marshaler.
-func isMarshaler(t reflect.Type) bool {
- // We're checking for (likely) pointer-receiver methods
- // so if t is not a pointer, something is very wrong.
- // The calls above only invoke isMarshaler on pointer types.
- if t.Kind() != reflect.Ptr {
- panic("proto: misuse of isMarshaler")
- }
- return t.Implements(marshalerType)
-}
-
-// isUnmarshaler reports whether type t implements Unmarshaler.
-func isUnmarshaler(t reflect.Type) bool {
- // We're checking for (likely) pointer-receiver methods
- // so if t is not a pointer, something is very wrong.
- // The calls above only invoke isUnmarshaler on pointer types.
- if t.Kind() != reflect.Ptr {
- panic("proto: misuse of isUnmarshaler")
- }
- return t.Implements(unmarshalerType)
-}
-
-// Init populates the properties from a protocol buffer struct tag.
-func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
- p.init(typ, name, tag, f, true)
-}
-
-func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {
- // "bytes,49,opt,def=hello!"
- p.Name = name
- p.OrigName = name
- if f != nil {
- p.field = toField(f)
- }
- if tag == "" {
- return
- }
- p.Parse(tag)
- p.setEncAndDec(typ, f, lockGetProp)
-}
-
-var (
- propertiesMu sync.RWMutex
- propertiesMap = make(map[reflect.Type]*StructProperties)
-)
-
-// GetProperties returns the list of properties for the type represented by t.
-// t must represent a generated struct type of a protocol message.
-func GetProperties(t reflect.Type) *StructProperties {
- if t.Kind() != reflect.Struct {
- panic("proto: type must have kind struct")
- }
-
- // Most calls to GetProperties in a long-running program will be
- // retrieving details for types we have seen before.
- propertiesMu.RLock()
- sprop, ok := propertiesMap[t]
- propertiesMu.RUnlock()
- if ok {
- if collectStats {
- stats.Chit++
- }
- return sprop
- }
-
- propertiesMu.Lock()
- sprop = getPropertiesLocked(t)
- propertiesMu.Unlock()
- return sprop
-}
-
-// getPropertiesLocked requires that propertiesMu is held.
-func getPropertiesLocked(t reflect.Type) *StructProperties {
- if prop, ok := propertiesMap[t]; ok {
- if collectStats {
- stats.Chit++
- }
- return prop
- }
- if collectStats {
- stats.Cmiss++
- }
-
- prop := new(StructProperties)
- // in case of recursive protos, fill this in now.
- propertiesMap[t] = prop
-
- // build properties
- prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) ||
- reflect.PtrTo(t).Implements(extendableProtoV1Type)
- prop.unrecField = invalidField
- prop.Prop = make([]*Properties, t.NumField())
- prop.order = make([]int, t.NumField())
-
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- p := new(Properties)
- name := f.Name
- p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
-
- if f.Name == "XXX_InternalExtensions" { // special case
- p.enc = (*Buffer).enc_exts
- p.dec = nil // not needed
- p.size = size_exts
- } else if f.Name == "XXX_extensions" { // special case
- p.enc = (*Buffer).enc_map
- p.dec = nil // not needed
- p.size = size_map
- } else if f.Name == "XXX_unrecognized" { // special case
- prop.unrecField = toField(&f)
- }
- oneof := f.Tag.Get("protobuf_oneof") // special case
- if oneof != "" {
- // Oneof fields don't use the traditional protobuf tag.
- p.OrigName = oneof
- }
- prop.Prop[i] = p
- prop.order[i] = i
- if debug {
- print(i, " ", f.Name, " ", t.String(), " ")
- if p.Tag > 0 {
- print(p.String())
- }
- print("\n")
- }
- if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" {
- fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]")
- }
- }
-
- // Re-order prop.order.
- sort.Sort(prop)
-
- type oneofMessage interface {
- XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
- }
- if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {
- var oots []interface{}
- prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs()
- prop.stype = t
-
- // Interpret oneof metadata.
- prop.OneofTypes = make(map[string]*OneofProperties)
- for _, oot := range oots {
- oop := &OneofProperties{
- Type: reflect.ValueOf(oot).Type(), // *T
- Prop: new(Properties),
- }
- sft := oop.Type.Elem().Field(0)
- oop.Prop.Name = sft.Name
- oop.Prop.Parse(sft.Tag.Get("protobuf"))
- // There will be exactly one interface field that
- // this new value is assignable to.
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if f.Type.Kind() != reflect.Interface {
- continue
- }
- if !oop.Type.AssignableTo(f.Type) {
- continue
- }
- oop.Field = i
- break
- }
- prop.OneofTypes[oop.Prop.OrigName] = oop
- }
- }
-
- // build required counts
- // build tags
- reqCount := 0
- prop.decoderOrigNames = make(map[string]int)
- for i, p := range prop.Prop {
- if strings.HasPrefix(p.Name, "XXX_") {
- // Internal fields should not appear in tags/origNames maps.
- // They are handled specially when encoding and decoding.
- continue
- }
- if p.Required {
- reqCount++
- }
- prop.decoderTags.put(p.Tag, i)
- prop.decoderOrigNames[p.OrigName] = i
- }
- prop.reqCount = reqCount
-
- return prop
-}
-
-// Return the Properties object for the x[0]'th field of the structure.
-func propByIndex(t reflect.Type, x []int) *Properties {
- if len(x) != 1 {
- fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t)
- return nil
- }
- prop := GetProperties(t)
- return prop.Prop[x[0]]
-}
-
-// Get the address and type of a pointer to a struct from an interface.
-func getbase(pb Message) (t reflect.Type, b structPointer, err error) {
- if pb == nil {
- err = ErrNil
- return
- }
- // get the reflect type of the pointer to the struct.
- t = reflect.TypeOf(pb)
- // get the address of the struct.
- value := reflect.ValueOf(pb)
- b = toStructPointer(value)
- return
-}
-
-// A global registry of enum types.
-// The generated code will register the generated maps by calling RegisterEnum.
-
-var enumValueMaps = make(map[string]map[string]int32)
-
-// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing text format protocol buffers.
-func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
- if _, ok := enumValueMaps[typeName]; ok {
- panic("proto: duplicate enum registered: " + typeName)
- }
- enumValueMaps[typeName] = valueMap
-}
-
-// EnumValueMap returns the mapping from names to integers of the
-// enum type enumType, or a nil if not found.
-func EnumValueMap(enumType string) map[string]int32 {
- return enumValueMaps[enumType]
-}
-
-// A registry of all linked message types.
-// The string is a fully-qualified proto name ("pkg.Message").
-var (
- protoTypes = make(map[string]reflect.Type)
- revProtoTypes = make(map[reflect.Type]string)
-)
-
-// RegisterType is called from generated code and maps from the fully qualified
-// proto name to the type (pointer to struct) of the protocol buffer.
-func RegisterType(x Message, name string) {
- if _, ok := protoTypes[name]; ok {
- // TODO: Some day, make this a panic.
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- protoTypes[name] = t
- revProtoTypes[t] = name
-}
-
-// MessageName returns the fully-qualified proto name for the given message type.
-func MessageName(x Message) string { return revProtoTypes[reflect.TypeOf(x)] }
-
-// MessageType returns the message type (pointer to struct) for a named message.
-func MessageType(name string) reflect.Type { return protoTypes[name] }
-
-// A registry of all linked proto files.
-var (
- protoFiles = make(map[string][]byte) // file name => fileDescriptor
-)
-
-// RegisterFile is called from generated code and maps from the
-// full file name of a .proto file to its compressed FileDescriptorProto.
-func RegisterFile(filename string, fileDescriptor []byte) {
- protoFiles[filename] = fileDescriptor
-}
-
-// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.
-func FileDescriptor(filename string) []byte { return protoFiles[filename] }
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text.go
deleted file mode 100644
index 8214ce326..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text.go
+++ /dev/null
@@ -1,854 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-// Functions for writing the text protocol buffer format.
-
-import (
- "bufio"
- "bytes"
- "encoding"
- "errors"
- "fmt"
- "io"
- "log"
- "math"
- "reflect"
- "sort"
- "strings"
-)
-
-var (
- newline = []byte("\n")
- spaces = []byte(" ")
- gtNewline = []byte(">\n")
- endBraceNewline = []byte("}\n")
- backslashN = []byte{'\\', 'n'}
- backslashR = []byte{'\\', 'r'}
- backslashT = []byte{'\\', 't'}
- backslashDQ = []byte{'\\', '"'}
- backslashBS = []byte{'\\', '\\'}
- posInf = []byte("inf")
- negInf = []byte("-inf")
- nan = []byte("nan")
-)
-
-type writer interface {
- io.Writer
- WriteByte(byte) error
-}
-
-// textWriter is an io.Writer that tracks its indentation level.
-type textWriter struct {
- ind int
- complete bool // if the current position is a complete line
- compact bool // whether to write out as a one-liner
- w writer
-}
-
-func (w *textWriter) WriteString(s string) (n int, err error) {
- if !strings.Contains(s, "\n") {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- w.complete = false
- return io.WriteString(w.w, s)
- }
- // WriteString is typically called without newlines, so this
- // codepath and its copy are rare. We copy to avoid
- // duplicating all of Write's logic here.
- return w.Write([]byte(s))
-}
-
-func (w *textWriter) Write(p []byte) (n int, err error) {
- newlines := bytes.Count(p, newline)
- if newlines == 0 {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- n, err = w.w.Write(p)
- w.complete = false
- return n, err
- }
-
- frags := bytes.SplitN(p, newline, newlines+1)
- if w.compact {
- for i, frag := range frags {
- if i > 0 {
- if err := w.w.WriteByte(' '); err != nil {
- return n, err
- }
- n++
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- }
- return n, nil
- }
-
- for i, frag := range frags {
- if w.complete {
- w.writeIndent()
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- if i+1 < len(frags) {
- if err := w.w.WriteByte('\n'); err != nil {
- return n, err
- }
- n++
- }
- }
- w.complete = len(frags[len(frags)-1]) == 0
- return n, nil
-}
-
-func (w *textWriter) WriteByte(c byte) error {
- if w.compact && c == '\n' {
- c = ' '
- }
- if !w.compact && w.complete {
- w.writeIndent()
- }
- err := w.w.WriteByte(c)
- w.complete = c == '\n'
- return err
-}
-
-func (w *textWriter) indent() { w.ind++ }
-
-func (w *textWriter) unindent() {
- if w.ind == 0 {
- log.Printf("proto: textWriter unindented too far")
- return
- }
- w.ind--
-}
-
-func writeName(w *textWriter, props *Properties) error {
- if _, err := w.WriteString(props.OrigName); err != nil {
- return err
- }
- if props.Wire != "group" {
- return w.WriteByte(':')
- }
- return nil
-}
-
-// raw is the interface satisfied by RawMessage.
-type raw interface {
- Bytes() []byte
-}
-
-func requiresQuotes(u string) bool {
- // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted.
- for _, ch := range u {
- switch {
- case ch == '.' || ch == '/' || ch == '_':
- continue
- case '0' <= ch && ch <= '9':
- continue
- case 'A' <= ch && ch <= 'Z':
- continue
- case 'a' <= ch && ch <= 'z':
- continue
- default:
- return true
- }
- }
- return false
-}
-
-// isAny reports whether sv is a google.protobuf.Any message
-func isAny(sv reflect.Value) bool {
- type wkt interface {
- XXX_WellKnownType() string
- }
- t, ok := sv.Addr().Interface().(wkt)
- return ok && t.XXX_WellKnownType() == "Any"
-}
-
-// writeProto3Any writes an expanded google.protobuf.Any message.
-//
-// It returns (false, nil) if sv value can't be unmarshaled (e.g. because
-// required messages are not linked in).
-//
-// It returns (true, error) when sv was written in expanded format or an error
-// was encountered.
-func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) {
- turl := sv.FieldByName("TypeUrl")
- val := sv.FieldByName("Value")
- if !turl.IsValid() || !val.IsValid() {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- b, ok := val.Interface().([]byte)
- if !ok {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- parts := strings.Split(turl.String(), "/")
- mt := MessageType(parts[len(parts)-1])
- if mt == nil {
- return false, nil
- }
- m := reflect.New(mt.Elem())
- if err := Unmarshal(b, m.Interface().(Message)); err != nil {
- return false, nil
- }
- w.Write([]byte("["))
- u := turl.String()
- if requiresQuotes(u) {
- writeString(w, u)
- } else {
- w.Write([]byte(u))
- }
- if w.compact {
- w.Write([]byte("]:<"))
- } else {
- w.Write([]byte("]: <\n"))
- w.ind++
- }
- if err := tm.writeStruct(w, m.Elem()); err != nil {
- return true, err
- }
- if w.compact {
- w.Write([]byte("> "))
- } else {
- w.ind--
- w.Write([]byte(">\n"))
- }
- return true, nil
-}
-
-func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
- if tm.ExpandAny && isAny(sv) {
- if canExpand, err := tm.writeProto3Any(w, sv); canExpand {
- return err
- }
- }
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < sv.NumField(); i++ {
- fv := sv.Field(i)
- props := sprops.Prop[i]
- name := st.Field(i).Name
-
- if strings.HasPrefix(name, "XXX_") {
- // There are two XXX_ fields:
- // XXX_unrecognized []byte
- // XXX_extensions map[int32]proto.Extension
- // The first is handled here;
- // the second is handled at the bottom of this function.
- if name == "XXX_unrecognized" && !fv.IsNil() {
- if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Field not filled in. This could be an optional field or
- // a required field that wasn't filled in. Either way, there
- // isn't anything we can show for it.
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- // Repeated field that is empty, or a bytes field that is unused.
- continue
- }
-
- if props.Repeated && fv.Kind() == reflect.Slice {
- // Repeated field.
- for j := 0; j < fv.Len(); j++ {
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- v := fv.Index(j)
- if v.Kind() == reflect.Ptr && v.IsNil() {
- // A nil message in a repeated field is not valid,
- // but we can handle that more gracefully than panicking.
- if _, err := w.Write([]byte("\n")); err != nil {
- return err
- }
- continue
- }
- if err := tm.writeAny(w, v, props); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Map {
- // Map fields are rendered as a repeated struct with key/value fields.
- keys := fv.MapKeys()
- sort.Sort(mapKeys(keys))
- for _, key := range keys {
- val := fv.MapIndex(key)
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- // open struct
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- // key
- if _, err := w.WriteString("key:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, key, props.mkeyprop); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- // nil values aren't legal, but we can avoid panicking because of them.
- if val.Kind() != reflect.Ptr || !val.IsNil() {
- // value
- if _, err := w.WriteString("value:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, val, props.mvalprop); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- // close struct
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {
- // empty bytes field
- continue
- }
- if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {
- // proto3 non-repeated scalar field; skip if zero value
- if isProto3Zero(fv) {
- continue
- }
- }
-
- if fv.Kind() == reflect.Interface {
- // Check if it is a oneof.
- if st.Field(i).Tag.Get("protobuf_oneof") != "" {
- // fv is nil, or holds a pointer to generated struct.
- // That generated struct has exactly one field,
- // which has a protobuf struct tag.
- if fv.IsNil() {
- continue
- }
- inner := fv.Elem().Elem() // interface -> *T -> T
- tag := inner.Type().Field(0).Tag.Get("protobuf")
- props = new(Properties) // Overwrite the outer props var, but not its pointee.
- props.Parse(tag)
- // Write the value in the oneof, not the oneof itself.
- fv = inner.Field(0)
-
- // Special case to cope with malformed messages gracefully:
- // If the value in the oneof is a nil pointer, don't panic
- // in writeAny.
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Use errors.New so writeAny won't render quotes.
- msg := errors.New("/* nil */")
- fv = reflect.ValueOf(&msg).Elem()
- }
- }
- }
-
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if b, ok := fv.Interface().(raw); ok {
- if err := writeRaw(w, b.Bytes()); err != nil {
- return err
- }
- continue
- }
-
- // Enums have a String method, so writeAny will work fine.
- if err := tm.writeAny(w, fv, props); err != nil {
- return err
- }
-
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
-
- // Extensions (the XXX_extensions field).
- pv := sv.Addr()
- if _, ok := extendable(pv.Interface()); ok {
- if err := tm.writeExtensions(w, pv); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// writeRaw writes an uninterpreted raw message.
-func writeRaw(w *textWriter, b []byte) error {
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if err := writeUnknownStruct(w, b); err != nil {
- return err
- }
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- return nil
-}
-
-// writeAny writes an arbitrary field.
-func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
- v = reflect.Indirect(v)
-
- // Floats have special cases.
- if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {
- x := v.Float()
- var b []byte
- switch {
- case math.IsInf(x, 1):
- b = posInf
- case math.IsInf(x, -1):
- b = negInf
- case math.IsNaN(x):
- b = nan
- }
- if b != nil {
- _, err := w.Write(b)
- return err
- }
- // Other values are handled below.
- }
-
- // We don't attempt to serialise every possible value type; only those
- // that can occur in protocol buffers.
- switch v.Kind() {
- case reflect.Slice:
- // Should only be a []byte; repeated fields are handled in writeStruct.
- if err := writeString(w, string(v.Bytes())); err != nil {
- return err
- }
- case reflect.String:
- if err := writeString(w, v.String()); err != nil {
- return err
- }
- case reflect.Struct:
- // Required/optional group/message.
- var bra, ket byte = '<', '>'
- if props != nil && props.Wire == "group" {
- bra, ket = '{', '}'
- }
- if err := w.WriteByte(bra); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = w.Write(text); err != nil {
- return err
- }
- } else if err := tm.writeStruct(w, v); err != nil {
- return err
- }
- w.unindent()
- if err := w.WriteByte(ket); err != nil {
- return err
- }
- default:
- _, err := fmt.Fprint(w, v.Interface())
- return err
- }
- return nil
-}
-
-// equivalent to C's isprint.
-func isprint(c byte) bool {
- return c >= 0x20 && c < 0x7f
-}
-
-// writeString writes a string in the protocol buffer text format.
-// It is similar to strconv.Quote except we don't use Go escape sequences,
-// we treat the string as a byte sequence, and we use octal escapes.
-// These differences are to maintain interoperability with the other
-// languages' implementations of the text format.
-func writeString(w *textWriter, s string) error {
- // use WriteByte here to get any needed indent
- if err := w.WriteByte('"'); err != nil {
- return err
- }
- // Loop over the bytes, not the runes.
- for i := 0; i < len(s); i++ {
- var err error
- // Divergence from C++: we don't escape apostrophes.
- // There's no need to escape them, and the C++ parser
- // copes with a naked apostrophe.
- switch c := s[i]; c {
- case '\n':
- _, err = w.w.Write(backslashN)
- case '\r':
- _, err = w.w.Write(backslashR)
- case '\t':
- _, err = w.w.Write(backslashT)
- case '"':
- _, err = w.w.Write(backslashDQ)
- case '\\':
- _, err = w.w.Write(backslashBS)
- default:
- if isprint(c) {
- err = w.w.WriteByte(c)
- } else {
- _, err = fmt.Fprintf(w.w, "\\%03o", c)
- }
- }
- if err != nil {
- return err
- }
- }
- return w.WriteByte('"')
-}
-
-func writeUnknownStruct(w *textWriter, data []byte) (err error) {
- if !w.compact {
- if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil {
- return err
- }
- }
- b := NewBuffer(data)
- for b.index < len(b.buf) {
- x, err := b.DecodeVarint()
- if err != nil {
- _, err := fmt.Fprintf(w, "/* %v */\n", err)
- return err
- }
- wire, tag := x&7, x>>3
- if wire == WireEndGroup {
- w.unindent()
- if _, err := w.Write(endBraceNewline); err != nil {
- return err
- }
- continue
- }
- if _, err := fmt.Fprint(w, tag); err != nil {
- return err
- }
- if wire != WireStartGroup {
- if err := w.WriteByte(':'); err != nil {
- return err
- }
- }
- if !w.compact || wire == WireStartGroup {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- switch wire {
- case WireBytes:
- buf, e := b.DecodeRawBytes(false)
- if e == nil {
- _, err = fmt.Fprintf(w, "%q", buf)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", e)
- }
- case WireFixed32:
- x, err = b.DecodeFixed32()
- err = writeUnknownInt(w, x, err)
- case WireFixed64:
- x, err = b.DecodeFixed64()
- err = writeUnknownInt(w, x, err)
- case WireStartGroup:
- err = w.WriteByte('{')
- w.indent()
- case WireVarint:
- x, err = b.DecodeVarint()
- err = writeUnknownInt(w, x, err)
- default:
- _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire)
- }
- if err != nil {
- return err
- }
- if err = w.WriteByte('\n'); err != nil {
- return err
- }
- }
- return nil
-}
-
-func writeUnknownInt(w *textWriter, x uint64, err error) error {
- if err == nil {
- _, err = fmt.Fprint(w, x)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", err)
- }
- return err
-}
-
-type int32Slice []int32
-
-func (s int32Slice) Len() int { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-// writeExtensions writes all the extensions in pv.
-// pv is assumed to be a pointer to a protocol message struct that is extendable.
-func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error {
- emap := extensionMaps[pv.Type().Elem()]
- ep, _ := extendable(pv.Interface())
-
- // Order the extensions by ID.
- // This isn't strictly necessary, but it will give us
- // canonical output, which will also make testing easier.
- m, mu := ep.extensionsRead()
- if m == nil {
- return nil
- }
- mu.Lock()
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids))
- mu.Unlock()
-
- for _, extNum := range ids {
- ext := m[extNum]
- var desc *ExtensionDesc
- if emap != nil {
- desc = emap[extNum]
- }
- if desc == nil {
- // Unknown extension.
- if err := writeUnknownStruct(w, ext.enc); err != nil {
- return err
- }
- continue
- }
-
- pb, err := GetExtension(ep, desc)
- if err != nil {
- return fmt.Errorf("failed getting extension: %v", err)
- }
-
- // Repeated extensions will appear as a slice.
- if !desc.repeated() {
- if err := tm.writeExtension(w, desc.Name, pb); err != nil {
- return err
- }
- } else {
- v := reflect.ValueOf(pb)
- for i := 0; i < v.Len(); i++ {
- if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {
- return err
- }
- }
- }
- }
- return nil
-}
-
-func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error {
- if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- return nil
-}
-
-func (w *textWriter) writeIndent() {
- if !w.complete {
- return
- }
- remain := w.ind * 2
- for remain > 0 {
- n := remain
- if n > len(spaces) {
- n = len(spaces)
- }
- w.w.Write(spaces[:n])
- remain -= n
- }
- w.complete = false
-}
-
-// TextMarshaler is a configurable text format marshaler.
-type TextMarshaler struct {
- Compact bool // use compact text format (one line).
- ExpandAny bool // expand google.protobuf.Any messages of known types
-}
-
-// Marshal writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {
- val := reflect.ValueOf(pb)
- if pb == nil || val.IsNil() {
- w.Write([]byte(""))
- return nil
- }
- var bw *bufio.Writer
- ww, ok := w.(writer)
- if !ok {
- bw = bufio.NewWriter(w)
- ww = bw
- }
- aw := &textWriter{
- w: ww,
- complete: true,
- compact: tm.Compact,
- }
-
- if etm, ok := pb.(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = aw.Write(text); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
- }
- // Dereference the received pointer so we don't have outer < and >.
- v := reflect.Indirect(val)
- if err := tm.writeStruct(aw, v); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
-}
-
-// Text is the same as Marshal, but returns the string directly.
-func (tm *TextMarshaler) Text(pb Message) string {
- var buf bytes.Buffer
- tm.Marshal(&buf, pb)
- return buf.String()
-}
-
-var (
- defaultTextMarshaler = TextMarshaler{}
- compactTextMarshaler = TextMarshaler{Compact: true}
-)
-
-// TODO: consider removing some of the Marshal functions below.
-
-// MarshalText writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
-
-// MarshalTextString is the same as MarshalText, but returns the string directly.
-func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
-
-// CompactText writes a given protocol buffer in compact text format (one line).
-func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
-
-// CompactTextString is the same as CompactText, but returns the string directly.
-func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }
diff --git a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text_parser.go b/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text_parser.go
deleted file mode 100644
index 0b8c59f74..000000000
--- a/archived/event-adapter/vendor/github.com/golang/protobuf/proto/text_parser.go
+++ /dev/null
@@ -1,880 +0,0 @@
-// 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
-// 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.
-
-package proto
-
-// Functions for parsing the Text protocol buffer format.
-// TODO: message sets.
-
-import (
- "encoding"
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-type ParseError struct {
- Message string
- Line int // 1-based line number
- Offset int // 0-based byte offset from start of input
-}
-
-func (p *ParseError) Error() string {
- if p.Line == 1 {
- // show offset only for first line
- return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message)
- }
- return fmt.Sprintf("line %d: %v", p.Line, p.Message)
-}
-
-type token struct {
- value string
- err *ParseError
- line int // line number
- offset int // byte number from start of input, not start of line
- unquoted string // the unquoted version of value, if it was a quoted string
-}
-
-func (t *token) String() string {
- if t.err == nil {
- return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset)
- }
- return fmt.Sprintf("parse error: %v", t.err)
-}
-
-type textParser struct {
- s string // remaining input
- done bool // whether the parsing is finished (success or error)
- backed bool // whether back() was called
- offset, line int
- cur token
-}
-
-func newTextParser(s string) *textParser {
- p := new(textParser)
- p.s = s
- p.line = 1
- p.cur.line = 1
- return p
-}
-
-func (p *textParser) errorf(format string, a ...interface{}) *ParseError {
- pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}
- p.cur.err = pe
- p.done = true
- return pe
-}
-
-// Numbers and identifiers are matched by [-+._A-Za-z0-9]
-func isIdentOrNumberChar(c byte) bool {
- switch {
- case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':
- return true
- case '0' <= c && c <= '9':
- return true
- }
- switch c {
- case '-', '+', '.', '_':
- return true
- }
- return false
-}
-
-func isWhitespace(c byte) bool {
- switch c {
- case ' ', '\t', '\n', '\r':
- return true
- }
- return false
-}
-
-func isQuote(c byte) bool {
- switch c {
- case '"', '\'':
- return true
- }
- return false
-}
-
-func (p *textParser) skipWhitespace() {
- i := 0
- for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {
- if p.s[i] == '#' {
- // comment; skip to end of line or input
- for i < len(p.s) && p.s[i] != '\n' {
- i++
- }
- if i == len(p.s) {
- break
- }
- }
- if p.s[i] == '\n' {
- p.line++
- }
- i++
- }
- p.offset += i
- p.s = p.s[i:len(p.s)]
- if len(p.s) == 0 {
- p.done = true
- }
-}
-
-func (p *textParser) advance() {
- // Skip whitespace
- p.skipWhitespace()
- if p.done {
- return
- }
-
- // Start of non-whitespace
- p.cur.err = nil
- p.cur.offset, p.cur.line = p.offset, p.line
- p.cur.unquoted = ""
- switch p.s[0] {
- case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':
- // Single symbol
- p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
- case '"', '\'':
- // Quoted string
- i := 1
- for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' {
- if p.s[i] == '\\' && i+1 < len(p.s) {
- // skip escaped char
- i++
- }
- i++
- }
- if i >= len(p.s) || p.s[i] != p.s[0] {
- p.errorf("unmatched quote")
- return
- }
- unq, err := unquoteC(p.s[1:i], rune(p.s[0]))
- if err != nil {
- p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err)
- return
- }
- p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]
- p.cur.unquoted = unq
- default:
- i := 0
- for i < len(p.s) && isIdentOrNumberChar(p.s[i]) {
- i++
- }
- if i == 0 {
- p.errorf("unexpected byte %#x", p.s[0])
- return
- }
- p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]
- }
- p.offset += len(p.cur.value)
-}
-
-var (
- errBadUTF8 = errors.New("proto: bad UTF-8")
- errBadHex = errors.New("proto: bad hexadecimal")
-)
-
-func unquoteC(s string, quote rune) (string, error) {
- // This is based on C++'s tokenizer.cc.
- // Despite its name, this is *not* parsing C syntax.
- // For instance, "\0" is an invalid quoted string.
-
- // Avoid allocation in trivial cases.
- simple := true
- for _, r := range s {
- if r == '\\' || r == quote {
- simple = false
- break
- }
- }
- if simple {
- return s, nil
- }
-
- buf := make([]byte, 0, 3*len(s)/2)
- for len(s) > 0 {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", errBadUTF8
- }
- s = s[n:]
- if r != '\\' {
- if r < utf8.RuneSelf {
- buf = append(buf, byte(r))
- } else {
- buf = append(buf, string(r)...)
- }
- continue
- }
-
- ch, tail, err := unescape(s)
- if err != nil {
- return "", err
- }
- buf = append(buf, ch...)
- s = tail
- }
- return string(buf), nil
-}
-
-func unescape(s string) (ch string, tail string, err error) {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", "", errBadUTF8
- }
- s = s[n:]
- switch r {
- case 'a':
- return "\a", s, nil
- case 'b':
- return "\b", s, nil
- case 'f':
- return "\f", s, nil
- case 'n':
- return "\n", s, nil
- case 'r':
- return "\r", s, nil
- case 't':
- return "\t", s, nil
- case 'v':
- return "\v", s, nil
- case '?':
- return "?", s, nil // trigraph workaround
- case '\'', '"', '\\':
- return string(r), s, nil
- case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X':
- if len(s) < 2 {
- return "", "", fmt.Errorf(`\%c requires 2 following digits`, r)
- }
- base := 8
- ss := s[:2]
- s = s[2:]
- if r == 'x' || r == 'X' {
- base = 16
- } else {
- ss = string(r) + ss
- }
- i, err := strconv.ParseUint(ss, base, 8)
- if err != nil {
- return "", "", err
- }
- return string([]byte{byte(i)}), s, nil
- case 'u', 'U':
- n := 4
- if r == 'U' {
- n = 8
- }
- if len(s) < n {
- return "", "", fmt.Errorf(`\%c requires %d digits`, r, n)
- }
-
- bs := make([]byte, n/2)
- for i := 0; i < n; i += 2 {
- a, ok1 := unhex(s[i])
- b, ok2 := unhex(s[i+1])
- if !ok1 || !ok2 {
- return "", "", errBadHex
- }
- bs[i/2] = a<<4 | b
- }
- s = s[n:]
- return string(bs), s, nil
- }
- return "", "", fmt.Errorf(`unknown escape \%c`, r)
-}
-
-// Adapted from src/pkg/strconv/quote.go.
-func unhex(b byte) (v byte, ok bool) {
- switch {
- case '0' <= b && b <= '9':
- return b - '0', true
- case 'a' <= b && b <= 'f':
- return b - 'a' + 10, true
- case 'A' <= b && b <= 'F':
- return b - 'A' + 10, true
- }
- return 0, false
-}
-
-// Back off the parser by one token. Can only be done between calls to next().
-// It makes the next advance() a no-op.
-func (p *textParser) back() { p.backed = true }
-
-// Advances the parser and returns the new current token.
-func (p *textParser) next() *token {
- if p.backed || p.done {
- p.backed = false
- return &p.cur
- }
- p.advance()
- if p.done {
- p.cur.value = ""
- } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
- // Look for multiple quoted strings separated by whitespace,
- // and concatenate them.
- cat := p.cur
- for {
- p.skipWhitespace()
- if p.done || !isQuote(p.s[0]) {
- break
- }
- p.advance()
- if p.cur.err != nil {
- return &p.cur
- }
- cat.value += " " + p.cur.value
- cat.unquoted += p.cur.unquoted
- }
- p.done = false // parser may have seen EOF, but we want to return cat
- p.cur = cat
- }
- return &p.cur
-}
-
-func (p *textParser) consumeToken(s string) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != s {
- p.back()
- return p.errorf("expected %q, found %q", s, tok.value)
- }
- return nil
-}
-
-// Return a RequiredNotSetError indicating which required field was not set.
-func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < st.NumField(); i++ {
- if !isNil(sv.Field(i)) {
- continue
- }
-
- props := sprops.Prop[i]
- if props.Required {
- return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)}
- }
- }
- return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen
-}
-
-// Returns the index in the struct for the named field, as well as the parsed tag properties.
-func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
- i, ok := sprops.decoderOrigNames[name]
- if ok {
- return i, sprops.Prop[i], true
- }
- return -1, nil, false
-}
-
-// Consume a ':' from the input stream (if the next token is a colon),
-// returning an error if a colon is needed but not present.
-func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ":" {
- // Colon is optional when the field is a group or message.
- needColon := true
- switch props.Wire {
- case "group":
- needColon = false
- case "bytes":
- // A "bytes" field is either a message, a string, or a repeated field;
- // those three become *T, *string and []T respectively, so we can check for
- // this field being a pointer to a non-string.
- if typ.Kind() == reflect.Ptr {
- // *T or *string
- if typ.Elem().Kind() == reflect.String {
- break
- }
- } else if typ.Kind() == reflect.Slice {
- // []T or []*T
- if typ.Elem().Kind() != reflect.Ptr {
- break
- }
- } else if typ.Kind() == reflect.String {
- // The proto3 exception is for a string field,
- // which requires a colon.
- break
- }
- needColon = false
- }
- if needColon {
- return p.errorf("expected ':', found %q", tok.value)
- }
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
- st := sv.Type()
- sprops := GetProperties(st)
- reqCount := sprops.reqCount
- var reqFieldErr error
- fieldSet := make(map[string]bool)
- // A struct is a sequence of "name: value", terminated by one of
- // '>' or '}', or the end of the input. A name may also be
- // "[extension]" or "[type/url]".
- //
- // The whole struct can also be an expanded Any message, like:
- // [type/url] < ... struct contents ... >
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- if tok.value == "[" {
- // Looks like an extension or an Any.
- //
- // TODO: Check whether we need to handle
- // namespace rooted names (e.g. ".something.Foo").
- extName, err := p.consumeExtName()
- if err != nil {
- return err
- }
-
- if s := strings.LastIndex(extName, "/"); s >= 0 {
- // If it contains a slash, it's an Any type URL.
- messageName := extName[s+1:]
- mt := MessageType(messageName)
- if mt == nil {
- return p.errorf("unrecognized message %q in google.protobuf.Any", messageName)
- }
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- // consume an optional colon
- if tok.value == ":" {
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- }
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- v := reflect.New(mt.Elem())
- if pe := p.readStruct(v.Elem(), terminator); pe != nil {
- return pe
- }
- b, err := Marshal(v.Interface().(Message))
- if err != nil {
- return p.errorf("failed to marshal message of type %q: %v", messageName, err)
- }
- sv.FieldByName("TypeUrl").SetString(extName)
- sv.FieldByName("Value").SetBytes(b)
- continue
- }
-
- var desc *ExtensionDesc
- // This could be faster, but it's functional.
- // TODO: Do something smarter than a linear scan.
- for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {
- if d.Name == extName {
- desc = d
- break
- }
- }
- if desc == nil {
- return p.errorf("unrecognized extension %q", extName)
- }
-
- props := &Properties{}
- props.Parse(desc.Tag)
-
- typ := reflect.TypeOf(desc.ExtensionType)
- if err := p.checkForColon(props, typ); err != nil {
- return err
- }
-
- rep := desc.repeated()
-
- // Read the extension structure, and set it in
- // the value we're constructing.
- var ext reflect.Value
- if !rep {
- ext = reflect.New(typ).Elem()
- } else {
- ext = reflect.New(typ.Elem()).Elem()
- }
- if err := p.readAny(ext, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- ep := sv.Addr().Interface().(Message)
- if !rep {
- SetExtension(ep, desc, ext.Interface())
- } else {
- old, err := GetExtension(ep, desc)
- var sl reflect.Value
- if err == nil {
- sl = reflect.ValueOf(old) // existing slice
- } else {
- sl = reflect.MakeSlice(typ, 0, 1)
- }
- sl = reflect.Append(sl, ext)
- SetExtension(ep, desc, sl.Interface())
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- continue
- }
-
- // This is a normal, non-extension field.
- name := tok.value
- var dst reflect.Value
- fi, props, ok := structFieldByName(sprops, name)
- if ok {
- dst = sv.Field(fi)
- } else if oop, ok := sprops.OneofTypes[name]; ok {
- // It is a oneof.
- props = oop.Prop
- nv := reflect.New(oop.Type.Elem())
- dst = nv.Elem().Field(0)
- sv.Field(oop.Field).Set(nv)
- }
- if !dst.IsValid() {
- return p.errorf("unknown field name %q in %v", name, st)
- }
-
- if dst.Kind() == reflect.Map {
- // Consume any colon.
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Construct the map if it doesn't already exist.
- if dst.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- key := reflect.New(dst.Type().Key()).Elem()
- val := reflect.New(dst.Type().Elem()).Elem()
-
- // The map entry should be this sequence of tokens:
- // < key : KEY value : VALUE >
- // However, implementations may omit key or value, and technically
- // we should support them in any order. See b/28924776 for a time
- // this went wrong.
-
- tok := p.next()
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- switch tok.value {
- case "key":
- if err := p.consumeToken(":"); err != nil {
- return err
- }
- if err := p.readAny(key, props.mkeyprop); 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 {
- return err
- }
- if err := p.readAny(val, props.mvalprop); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- default:
- p.back()
- return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value)
- }
- }
-
- dst.SetMapIndex(key, val)
- continue
- }
-
- // Check that it's not already set if it's not a repeated field.
- if !props.Repeated && fieldSet[name] {
- return p.errorf("non-repeated field %q was repeated", name)
- }
-
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Parse into the field.
- fieldSet[name] = true
- if err := p.readAny(dst, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- if props.Required {
- reqCount--
- }
-
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
-
- }
-
- if reqCount > 0 {
- return p.missingRequiredFieldError(sv)
- }
- return reqFieldErr
-}
-
-// consumeExtName consumes extension name or expanded Any type URL and the
-// following ']'. It returns the name or URL consumed.
-func (p *textParser) consumeExtName() (string, error) {
- tok := p.next()
- if tok.err != nil {
- return "", tok.err
- }
-
- // If extension name or type url is quoted, it's a single token.
- if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {
- name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))
- if err != nil {
- return "", err
- }
- return name, p.consumeToken("]")
- }
-
- // Consume everything up to "]"
- var parts []string
- for tok.value != "]" {
- parts = append(parts, tok.value)
- tok = p.next()
- if tok.err != nil {
- return "", p.errorf("unrecognized type_url or extension name: %s", tok.err)
- }
- }
- return strings.Join(parts, ""), nil
-}
-
-// consumeOptionalSeparator consumes an optional semicolon or comma.
-// It is used in readStruct to provide backward compatibility.
-func (p *textParser) consumeOptionalSeparator() error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ";" && tok.value != "," {
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readAny(v reflect.Value, props *Properties) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "" {
- return p.errorf("unexpected EOF")
- }
-
- switch fv := v; fv.Kind() {
- case reflect.Slice:
- at := v.Type()
- if at.Elem().Kind() == reflect.Uint8 {
- // Special case for []byte
- if tok.value[0] != '"' && tok.value[0] != '\'' {
- // Deliberately written out here, as the error after
- // this switch statement would write "invalid []byte: ...",
- // which is not as user-friendly.
- return p.errorf("invalid string: %v", tok.value)
- }
- bytes := []byte(tok.unquoted)
- fv.Set(reflect.ValueOf(bytes))
- return nil
- }
- // Repeated field.
- if tok.value == "[" {
- // Repeated field with list notation, like [1,2,3].
- for {
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- err := p.readAny(fv.Index(fv.Len()-1), props)
- if err != nil {
- return err
- }
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "]" {
- break
- }
- if tok.value != "," {
- return p.errorf("Expected ']' or ',' found %q", tok.value)
- }
- }
- return nil
- }
- // One value of the repeated field.
- p.back()
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- return p.readAny(fv.Index(fv.Len()-1), props)
- case reflect.Bool:
- // Either "true", "false", 1 or 0.
- switch tok.value {
- case "true", "1":
- fv.SetBool(true)
- return nil
- case "false", "0":
- fv.SetBool(false)
- return nil
- }
- case reflect.Float32, reflect.Float64:
- v := tok.value
- // Ignore 'f' for compatibility with output generated by C++, but don't
- // remove 'f' when the value is "-inf" or "inf".
- if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
- v = v[:len(v)-1]
- }
- if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
- fv.SetFloat(f)
- return nil
- }
- case reflect.Int32:
- if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- if len(props.Enum) == 0 {
- break
- }
- m, ok := enumValueMaps[props.Enum]
- if !ok {
- break
- }
- x, ok := m[tok.value]
- if !ok {
- break
- }
- fv.SetInt(int64(x))
- return nil
- case reflect.Int64:
- if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- case reflect.Ptr:
- // A basic field (indirected through pointer), or a repeated message/group
- p.back()
- fv.Set(reflect.New(fv.Type().Elem()))
- return p.readAny(fv.Elem(), props)
- case reflect.String:
- if tok.value[0] == '"' || tok.value[0] == '\'' {
- fv.SetString(tok.unquoted)
- return nil
- }
- case reflect.Struct:
- var terminator string
- switch tok.value {
- case "{":
- terminator = "}"
- case "<":
- terminator = ">"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- // TODO: Handle nested messages which implement encoding.TextUnmarshaler.
- return p.readStruct(fv, terminator)
- case reflect.Uint32:
- if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {
- fv.SetUint(uint64(x))
- return nil
- }
- case reflect.Uint64:
- if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {
- fv.SetUint(x)
- return nil
- }
- }
- return p.errorf("invalid %v: %v", v.Type(), tok.value)
-}
-
-// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb
-// before starting to unmarshal, so any existing data in pb is always removed.
-// If a required field is not set and no other error occurs,
-// UnmarshalText returns *RequiredNotSetError.
-func UnmarshalText(s string, pb Message) error {
- if um, ok := pb.(encoding.TextUnmarshaler); ok {
- err := um.UnmarshalText([]byte(s))
- return err
- }
- pb.Reset()
- v := reflect.ValueOf(pb)
- if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil {
- return pe
- }
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/.travis.yml b/archived/event-adapter/vendor/github.com/google/gofuzz/.travis.yml
deleted file mode 100644
index f8684d99f..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-
-go:
- - 1.4
- - 1.3
- - 1.2
- - tip
-
-install:
- - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
-
-script:
- - go test -cover
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/archived/event-adapter/vendor/github.com/google/gofuzz/CONTRIBUTING.md
deleted file mode 100644
index 51cf5cd1a..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/CONTRIBUTING.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# How to contribute #
-
-We'd love to accept your patches and contributions to this project. There are
-a just a few small guidelines you need to follow.
-
-
-## Contributor License Agreement ##
-
-Contributions to any Google project must be accompanied by a Contributor
-License Agreement. This is not a copyright **assignment**, it simply gives
-Google permission to use and redistribute your contributions as part of the
-project.
-
- * If you are an individual writing original source code and you're sure you
- own the intellectual property, then you'll need to sign an [individual
- CLA][].
-
- * If you work for a company that wants to allow you to contribute your work,
- then you'll need to sign a [corporate CLA][].
-
-You generally only need to submit a CLA once, so if you've already submitted
-one (even if it was for a different project), you probably don't need to do it
-again.
-
-[individual CLA]: https://developers.google.com/open-source/cla/individual
-[corporate CLA]: https://developers.google.com/open-source/cla/corporate
-
-
-## Submitting a patch ##
-
- 1. It's generally best to start by opening a new issue describing the bug or
- feature you're intending to fix. Even if you think it's relatively minor,
- it's helpful to know what people are working on. Mention in the initial
- issue that you are planning to work on that bug or feature so that it can
- be assigned to you.
-
- 1. Follow the normal process of [forking][] the project, and setup a new
- branch to work in. It's important that each group of changes be done in
- separate branches in order to ensure that a pull request only includes the
- commits related to that bug or feature.
-
- 1. Go makes it very simple to ensure properly formatted code, so always run
- `go fmt` on your code before committing it. You should also run
- [golint][] over your code. As noted in the [golint readme][], it's not
- strictly necessary that your code be completely "lint-free", but this will
- help you find common style issues.
-
- 1. Any significant changes should almost always be accompanied by tests. The
- project already has good test coverage, so look at some of the existing
- tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
- are invaluable tools for seeing which parts of your code aren't being
- exercised by your tests.
-
- 1. Do your best to have [well-formed commit messages][] for each change.
- This provides consistency throughout the project, and ensures that commit
- messages are able to be formatted properly by various git tools.
-
- 1. Finally, push the commits to your fork and submit a [pull request][].
-
-[forking]: https://help.github.com/articles/fork-a-repo
-[golint]: https://github.com/golang/lint
-[golint readme]: https://github.com/golang/lint/blob/master/README
-[gocov]: https://github.com/axw/gocov
-[gocov-html]: https://github.com/matm/gocov-html
-[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
-[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
-[pull request]: https://help.github.com/articles/creating-a-pull-request
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/LICENSE b/archived/event-adapter/vendor/github.com/google/gofuzz/LICENSE
deleted file mode 100644
index d64569567..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/README.md b/archived/event-adapter/vendor/github.com/google/gofuzz/README.md
deleted file mode 100644
index 64869af34..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/README.md
+++ /dev/null
@@ -1,71 +0,0 @@
-gofuzz
-======
-
-gofuzz is a library for populating go objects with random values.
-
-[![GoDoc](https://godoc.org/github.com/google/gofuzz?status.png)](https://godoc.org/github.com/google/gofuzz)
-[![Travis](https://travis-ci.org/google/gofuzz.svg?branch=master)](https://travis-ci.org/google/gofuzz)
-
-This is useful for testing:
-
-* Do your project's objects really serialize/unserialize correctly in all cases?
-* Is there an incorrectly formatted object that will cause your project to panic?
-
-Import with ```import "github.com/google/gofuzz"```
-
-You can use it on single variables:
-```go
-f := fuzz.New()
-var myInt int
-f.Fuzz(&myInt) // myInt gets a random value.
-```
-
-You can use it on maps:
-```go
-f := fuzz.New().NilChance(0).NumElements(1, 1)
-var myMap map[ComplexKeyType]string
-f.Fuzz(&myMap) // myMap will have exactly one element.
-```
-
-Customize the chance of getting a nil pointer:
-```go
-f := fuzz.New().NilChance(.5)
-var fancyStruct struct {
- A, B, C, D *string
-}
-f.Fuzz(&fancyStruct) // About half the pointers should be set.
-```
-
-You can even customize the randomization completely if needed:
-```go
-type MyEnum string
-const (
- A MyEnum = "A"
- B MyEnum = "B"
-)
-type MyInfo struct {
- Type MyEnum
- AInfo *string
- BInfo *string
-}
-
-f := fuzz.New().NilChance(0).Funcs(
- func(e *MyInfo, c fuzz.Continue) {
- switch c.Intn(2) {
- case 0:
- e.Type = A
- c.Fuzz(&e.AInfo)
- case 1:
- e.Type = B
- c.Fuzz(&e.BInfo)
- }
- },
-)
-
-var myObject MyInfo
-f.Fuzz(&myObject) // Type will correspond to whether A or B info is set.
-```
-
-See more examples in ```example_test.go```.
-
-Happy testing!
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/doc.go b/archived/event-adapter/vendor/github.com/google/gofuzz/doc.go
deleted file mode 100644
index 9f9956d4a..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/doc.go
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright 2014 Google Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package fuzz is a library for populating go objects with random values.
-package fuzz
diff --git a/archived/event-adapter/vendor/github.com/google/gofuzz/fuzz.go b/archived/event-adapter/vendor/github.com/google/gofuzz/fuzz.go
deleted file mode 100644
index 4f888fbc8..000000000
--- a/archived/event-adapter/vendor/github.com/google/gofuzz/fuzz.go
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
-Copyright 2014 Google Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package fuzz
-
-import (
- "fmt"
- "math/rand"
- "reflect"
- "time"
-)
-
-// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type.
-type fuzzFuncMap map[reflect.Type]reflect.Value
-
-// Fuzzer knows how to fill any object with random fields.
-type Fuzzer struct {
- fuzzFuncs fuzzFuncMap
- defaultFuzzFuncs fuzzFuncMap
- r *rand.Rand
- nilChance float64
- minElements int
- maxElements int
-}
-
-// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs,
-// RandSource, NilChance, or NumElements in any order.
-func New() *Fuzzer {
- f := &Fuzzer{
- defaultFuzzFuncs: fuzzFuncMap{
- reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime),
- },
-
- fuzzFuncs: fuzzFuncMap{},
- r: rand.New(rand.NewSource(time.Now().UnixNano())),
- nilChance: .2,
- minElements: 1,
- maxElements: 10,
- }
- return f
-}
-
-// Funcs adds each entry in fuzzFuncs as a custom fuzzing function.
-//
-// Each entry in fuzzFuncs must be a function taking two parameters.
-// The first parameter must be a pointer or map. It is the variable that
-// function will fill with random data. The second parameter must be a
-// fuzz.Continue, which will provide a source of randomness and a way
-// to automatically continue fuzzing smaller pieces of the first parameter.
-//
-// These functions are called sensibly, e.g., if you wanted custom string
-// fuzzing, the function `func(s *string, c fuzz.Continue)` would get
-// called and passed the address of strings. Maps and pointers will always
-// be made/new'd for you, ignoring the NilChange option. For slices, it
-// doesn't make much sense to pre-create them--Fuzzer doesn't know how
-// long you want your slice--so take a pointer to a slice, and make it
-// yourself. (If you don't want your map/pointer type pre-made, take a
-// pointer to it, and make it yourself.) See the examples for a range of
-// custom functions.
-func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer {
- for i := range fuzzFuncs {
- v := reflect.ValueOf(fuzzFuncs[i])
- if v.Kind() != reflect.Func {
- panic("Need only funcs!")
- }
- t := v.Type()
- if t.NumIn() != 2 || t.NumOut() != 0 {
- panic("Need 2 in and 0 out params!")
- }
- argT := t.In(0)
- switch argT.Kind() {
- case reflect.Ptr, reflect.Map:
- default:
- panic("fuzzFunc must take pointer or map type")
- }
- if t.In(1) != reflect.TypeOf(Continue{}) {
- panic("fuzzFunc's second parameter must be type fuzz.Continue")
- }
- f.fuzzFuncs[argT] = v
- }
- return f
-}
-
-// RandSource causes f to get values from the given source of randomness.
-// Use if you want deterministic fuzzing.
-func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer {
- f.r = rand.New(s)
- return f
-}
-
-// NilChance sets the probability of creating a nil pointer, map, or slice to
-// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive.
-func (f *Fuzzer) NilChance(p float64) *Fuzzer {
- if p < 0 || p > 1 {
- panic("p should be between 0 and 1, inclusive.")
- }
- f.nilChance = p
- return f
-}
-
-// NumElements sets the minimum and maximum number of elements that will be
-// added to a non-nil map or slice.
-func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer {
- if atLeast > atMost {
- panic("atLeast must be <= atMost")
- }
- if atLeast < 0 {
- panic("atLeast must be >= 0")
- }
- f.minElements = atLeast
- f.maxElements = atMost
- return f
-}
-
-func (f *Fuzzer) genElementCount() int {
- if f.minElements == f.maxElements {
- return f.minElements
- }
- return f.minElements + f.r.Intn(f.maxElements-f.minElements+1)
-}
-
-func (f *Fuzzer) genShouldFill() bool {
- return f.r.Float64() > f.nilChance
-}
-
-// Fuzz recursively fills all of obj's fields with something random. First
-// this tries to find a custom fuzz function (see Funcs). If there is no
-// custom function this tests whether the object implements fuzz.Interface and,
-// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if
-// there is a default fuzz function provided by this package. If all of that
-// fails, this will generate random values for all primitive fields and then
-// recurse for all non-primitives.
-//
-// Not safe for cyclic or tree-like structs!
-//
-// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ )
-// Intended for tests, so will panic on bad input or unimplemented fields.
-func (f *Fuzzer) Fuzz(obj interface{}) {
- v := reflect.ValueOf(obj)
- if v.Kind() != reflect.Ptr {
- panic("needed ptr!")
- }
- v = v.Elem()
- f.doFuzz(v, 0)
-}
-
-// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for
-// obj's type will not be called and obj will not be tested for fuzz.Interface
-// conformance. This applies only to obj and not other instances of obj's
-// type.
-// Not safe for cyclic or tree-like structs!
-// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ )
-// Intended for tests, so will panic on bad input or unimplemented fields.
-func (f *Fuzzer) FuzzNoCustom(obj interface{}) {
- v := reflect.ValueOf(obj)
- if v.Kind() != reflect.Ptr {
- panic("needed ptr!")
- }
- v = v.Elem()
- f.doFuzz(v, flagNoCustomFuzz)
-}
-
-const (
- // Do not try to find a custom fuzz function. Does not apply recursively.
- flagNoCustomFuzz uint64 = 1 << iota
-)
-
-func (f *Fuzzer) doFuzz(v reflect.Value, flags uint64) {
- if !v.CanSet() {
- return
- }
-
- if flags&flagNoCustomFuzz == 0 {
- // Check for both pointer and non-pointer custom functions.
- if v.CanAddr() && f.tryCustom(v.Addr()) {
- return
- }
- if f.tryCustom(v) {
- return
- }
- }
-
- if fn, ok := fillFuncMap[v.Kind()]; ok {
- fn(v, f.r)
- return
- }
- switch v.Kind() {
- case reflect.Map:
- if f.genShouldFill() {
- v.Set(reflect.MakeMap(v.Type()))
- n := f.genElementCount()
- for i := 0; i < n; i++ {
- key := reflect.New(v.Type().Key()).Elem()
- f.doFuzz(key, 0)
- val := reflect.New(v.Type().Elem()).Elem()
- f.doFuzz(val, 0)
- v.SetMapIndex(key, val)
- }
- return
- }
- v.Set(reflect.Zero(v.Type()))
- case reflect.Ptr:
- if f.genShouldFill() {
- v.Set(reflect.New(v.Type().Elem()))
- f.doFuzz(v.Elem(), 0)
- return
- }
- v.Set(reflect.Zero(v.Type()))
- case reflect.Slice:
- if f.genShouldFill() {
- n := f.genElementCount()
- v.Set(reflect.MakeSlice(v.Type(), n, n))
- for i := 0; i < n; i++ {
- f.doFuzz(v.Index(i), 0)
- }
- return
- }
- v.Set(reflect.Zero(v.Type()))
- case reflect.Array:
- if f.genShouldFill() {
- n := v.Len()
- for i := 0; i < n; i++ {
- f.doFuzz(v.Index(i), 0)
- }
- return
- }
- v.Set(reflect.Zero(v.Type()))
- case reflect.Struct:
- for i := 0; i < v.NumField(); i++ {
- f.doFuzz(v.Field(i), 0)
- }
- case reflect.Chan:
- fallthrough
- case reflect.Func:
- fallthrough
- case reflect.Interface:
- fallthrough
- default:
- panic(fmt.Sprintf("Can't handle %#v", v.Interface()))
- }
-}
-
-// tryCustom searches for custom handlers, and returns true iff it finds a match
-// and successfully randomizes v.
-func (f *Fuzzer) tryCustom(v reflect.Value) bool {
- // First: see if we have a fuzz function for it.
- doCustom, ok := f.fuzzFuncs[v.Type()]
- if !ok {
- // Second: see if it can fuzz itself.
- if v.CanInterface() {
- intf := v.Interface()
- if fuzzable, ok := intf.(Interface); ok {
- fuzzable.Fuzz(Continue{f: f, Rand: f.r})
- return true
- }
- }
- // Finally: see if there is a default fuzz function.
- doCustom, ok = f.defaultFuzzFuncs[v.Type()]
- if !ok {
- return false
- }
- }
-
- switch v.Kind() {
- case reflect.Ptr:
- if v.IsNil() {
- if !v.CanSet() {
- return false
- }
- v.Set(reflect.New(v.Type().Elem()))
- }
- case reflect.Map:
- if v.IsNil() {
- if !v.CanSet() {
- return false
- }
- v.Set(reflect.MakeMap(v.Type()))
- }
- default:
- return false
- }
-
- doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{
- f: f,
- Rand: f.r,
- })})
- return true
-}
-
-// Interface represents an object that knows how to fuzz itself. Any time we
-// find a type that implements this interface we will delegate the act of
-// fuzzing itself.
-type Interface interface {
- Fuzz(c Continue)
-}
-
-// Continue can be passed to custom fuzzing functions to allow them to use
-// the correct source of randomness and to continue fuzzing their members.
-type Continue struct {
- f *Fuzzer
-
- // For convenience, Continue implements rand.Rand via embedding.
- // Use this for generating any randomness if you want your fuzzing
- // to be repeatable for a given seed.
- *rand.Rand
-}
-
-// Fuzz continues fuzzing obj. obj must be a pointer.
-func (c Continue) Fuzz(obj interface{}) {
- v := reflect.ValueOf(obj)
- if v.Kind() != reflect.Ptr {
- panic("needed ptr!")
- }
- v = v.Elem()
- c.f.doFuzz(v, 0)
-}
-
-// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for
-// obj's type will not be called and obj will not be tested for fuzz.Interface
-// conformance. This applies only to obj and not other instances of obj's
-// type.
-func (c Continue) FuzzNoCustom(obj interface{}) {
- v := reflect.ValueOf(obj)
- if v.Kind() != reflect.Ptr {
- panic("needed ptr!")
- }
- v = v.Elem()
- c.f.doFuzz(v, flagNoCustomFuzz)
-}
-
-// RandString makes a random string up to 20 characters long. The returned string
-// may include a variety of (valid) UTF-8 encodings.
-func (c Continue) RandString() string {
- return randString(c.Rand)
-}
-
-// RandUint64 makes random 64 bit numbers.
-// Weirdly, rand doesn't have a function that gives you 64 random bits.
-func (c Continue) RandUint64() uint64 {
- return randUint64(c.Rand)
-}
-
-// RandBool returns true or false randomly.
-func (c Continue) RandBool() bool {
- return randBool(c.Rand)
-}
-
-func fuzzInt(v reflect.Value, r *rand.Rand) {
- v.SetInt(int64(randUint64(r)))
-}
-
-func fuzzUint(v reflect.Value, r *rand.Rand) {
- v.SetUint(randUint64(r))
-}
-
-func fuzzTime(t *time.Time, c Continue) {
- var sec, nsec int64
- // Allow for about 1000 years of random time values, which keeps things
- // like JSON parsing reasonably happy.
- sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60)
- c.Fuzz(&nsec)
- *t = time.Unix(sec, nsec)
-}
-
-var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
- reflect.Bool: func(v reflect.Value, r *rand.Rand) {
- v.SetBool(randBool(r))
- },
- reflect.Int: fuzzInt,
- reflect.Int8: fuzzInt,
- reflect.Int16: fuzzInt,
- reflect.Int32: fuzzInt,
- reflect.Int64: fuzzInt,
- reflect.Uint: fuzzUint,
- reflect.Uint8: fuzzUint,
- reflect.Uint16: fuzzUint,
- reflect.Uint32: fuzzUint,
- reflect.Uint64: fuzzUint,
- reflect.Uintptr: fuzzUint,
- reflect.Float32: func(v reflect.Value, r *rand.Rand) {
- v.SetFloat(float64(r.Float32()))
- },
- reflect.Float64: func(v reflect.Value, r *rand.Rand) {
- v.SetFloat(r.Float64())
- },
- reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
- },
- reflect.Complex128: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
- },
- reflect.String: func(v reflect.Value, r *rand.Rand) {
- v.SetString(randString(r))
- },
- reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
- },
-}
-
-// randBool returns true or false randomly.
-func randBool(r *rand.Rand) bool {
- if r.Int()&1 == 1 {
- return true
- }
- return false
-}
-
-type charRange struct {
- first, last rune
-}
-
-// choose returns a random unicode character from the given range, using the
-// given randomness source.
-func (r *charRange) choose(rand *rand.Rand) rune {
- count := int64(r.last - r.first)
- return r.first + rune(rand.Int63n(count))
-}
-
-var unicodeRanges = []charRange{
- {' ', '~'}, // ASCII characters
- {'\u00a0', '\u02af'}, // Multi-byte encoded characters
- {'\u4e00', '\u9fff'}, // Common CJK (even longer encodings)
-}
-
-// randString makes a random string up to 20 characters long. The returned string
-// may include a variety of (valid) UTF-8 encodings.
-func randString(r *rand.Rand) string {
- n := r.Intn(20)
- runes := make([]rune, n)
- for i := range runes {
- runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r)
- }
- return string(runes)
-}
-
-// randUint64 makes random 64 bit numbers.
-// Weirdly, rand doesn't have a function that gives you 64 random bits.
-func randUint64(r *rand.Rand) uint64 {
- return uint64(r.Uint32())<<32 | uint64(r.Uint32())
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt
deleted file mode 100644
index 364516251..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2015, Gengo, 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 Gengo, 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.
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
deleted file mode 100644
index ad4253566..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package runtime
-
-import (
- "fmt"
- "net"
- "net/http"
- "strconv"
- "strings"
- "time"
-
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
-)
-
-const metadataHeaderPrefix = "Grpc-Metadata-"
-const metadataTrailerPrefix = "Grpc-Trailer-"
-const metadataGrpcTimeout = "Grpc-Timeout"
-
-const xForwardedFor = "X-Forwarded-For"
-const xForwardedHost = "X-Forwarded-Host"
-
-var (
- // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound
- // header isn't present. If the value is 0 the sent `context` will not have a timeout.
- DefaultContextTimeout = 0 * time.Second
-)
-
-/*
-AnnotateContext adds context information such as metadata from the request.
-
-At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For",
-except that the forwarded destination is not another HTTP service but rather
-a gRPC service.
-*/
-func AnnotateContext(ctx context.Context, req *http.Request) (context.Context, error) {
- var pairs []string
- timeout := DefaultContextTimeout
- if tm := req.Header.Get(metadataGrpcTimeout); tm != "" {
- var err error
- timeout, err = timeoutDecode(tm)
- if err != nil {
- return nil, grpc.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm)
- }
- }
-
- for key, vals := range req.Header {
- for _, val := range vals {
- if key == "Authorization" {
- pairs = append(pairs, "authorization", val)
- continue
- }
- if strings.HasPrefix(key, metadataHeaderPrefix) {
- pairs = append(pairs, key[len(metadataHeaderPrefix):], val)
- }
- }
- }
- if host := req.Header.Get(xForwardedHost); host != "" {
- pairs = append(pairs, strings.ToLower(xForwardedHost), host)
- } else if req.Host != "" {
- pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host)
- }
-
- if addr := req.RemoteAddr; addr != "" {
- if remoteIP, _, err := net.SplitHostPort(addr); err == nil {
- if fwd := req.Header.Get(xForwardedFor); fwd == "" {
- pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP)
- } else {
- pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP))
- }
- } else {
- grpclog.Printf("invalid remote addr: %s", addr)
- }
- }
-
- if timeout != 0 {
- ctx, _ = context.WithTimeout(ctx, timeout)
- }
- if len(pairs) == 0 {
- return ctx, nil
- }
- return metadata.NewContext(ctx, metadata.Pairs(pairs...)), nil
-}
-
-// ServerMetadata consists of metadata sent from gRPC server.
-type ServerMetadata struct {
- HeaderMD metadata.MD
- TrailerMD metadata.MD
-}
-
-type serverMetadataKey struct{}
-
-// NewServerMetadataContext creates a new context with ServerMetadata
-func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context {
- return context.WithValue(ctx, serverMetadataKey{}, md)
-}
-
-// ServerMetadataFromContext returns the ServerMetadata in ctx
-func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) {
- md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata)
- return
-}
-
-func timeoutDecode(s string) (time.Duration, error) {
- size := len(s)
- if size < 2 {
- return 0, fmt.Errorf("timeout string is too short: %q", s)
- }
- d, ok := timeoutUnitToDuration(s[size-1])
- if !ok {
- return 0, fmt.Errorf("timeout unit is not recognized: %q", s)
- }
- t, err := strconv.ParseInt(s[:size-1], 10, 64)
- if err != nil {
- return 0, err
- }
- return d * time.Duration(t), nil
-}
-
-func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) {
- switch u {
- case 'H':
- return time.Hour, true
- case 'M':
- return time.Minute, true
- case 'S':
- return time.Second, true
- case 'm':
- return time.Millisecond, true
- case 'u':
- return time.Microsecond, true
- case 'n':
- return time.Nanosecond, true
- default:
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go
deleted file mode 100644
index 1af5cc4eb..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package runtime
-
-import (
- "strconv"
-)
-
-// String just returns the given string.
-// It is just for compatibility to other types.
-func String(val string) (string, error) {
- return val, nil
-}
-
-// Bool converts the given string representation of a boolean value into bool.
-func Bool(val string) (bool, error) {
- return strconv.ParseBool(val)
-}
-
-// Float64 converts the given string representation into representation of a floating point number into float64.
-func Float64(val string) (float64, error) {
- return strconv.ParseFloat(val, 64)
-}
-
-// Float32 converts the given string representation of a floating point number into float32.
-func Float32(val string) (float32, error) {
- f, err := strconv.ParseFloat(val, 32)
- if err != nil {
- return 0, err
- }
- return float32(f), nil
-}
-
-// Int64 converts the given string representation of an integer into int64.
-func Int64(val string) (int64, error) {
- return strconv.ParseInt(val, 0, 64)
-}
-
-// Int32 converts the given string representation of an integer into int32.
-func Int32(val string) (int32, error) {
- i, err := strconv.ParseInt(val, 0, 32)
- if err != nil {
- return 0, err
- }
- return int32(i), nil
-}
-
-// Uint64 converts the given string representation of an integer into uint64.
-func Uint64(val string) (uint64, error) {
- return strconv.ParseUint(val, 0, 64)
-}
-
-// Uint32 converts the given string representation of an integer into uint32.
-func Uint32(val string) (uint32, error) {
- i, err := strconv.ParseUint(val, 0, 32)
- if err != nil {
- return 0, err
- }
- return uint32(i), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go
deleted file mode 100644
index b6e5ddf7a..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
-Package runtime contains runtime helper functions used by
-servers which protoc-gen-grpc-gateway generates.
-*/
-package runtime
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go
deleted file mode 100644
index 7d7a9b224..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package runtime
-
-import (
- "io"
- "net/http"
-
- "github.com/golang/protobuf/proto"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
-)
-
-// HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status.
-func HTTPStatusFromCode(code codes.Code) int {
- switch code {
- case codes.OK:
- return http.StatusOK
- case codes.Canceled:
- return http.StatusRequestTimeout
- case codes.Unknown:
- return http.StatusInternalServerError
- case codes.InvalidArgument:
- return http.StatusBadRequest
- case codes.DeadlineExceeded:
- return http.StatusRequestTimeout
- case codes.NotFound:
- return http.StatusNotFound
- case codes.AlreadyExists:
- return http.StatusConflict
- case codes.PermissionDenied:
- return http.StatusForbidden
- case codes.Unauthenticated:
- return http.StatusUnauthorized
- case codes.ResourceExhausted:
- return http.StatusForbidden
- case codes.FailedPrecondition:
- return http.StatusPreconditionFailed
- case codes.Aborted:
- return http.StatusConflict
- case codes.OutOfRange:
- return http.StatusBadRequest
- case codes.Unimplemented:
- return http.StatusNotImplemented
- case codes.Internal:
- return http.StatusInternalServerError
- case codes.Unavailable:
- return http.StatusServiceUnavailable
- case codes.DataLoss:
- return http.StatusInternalServerError
- }
-
- grpclog.Printf("Unknown gRPC error code: %v", code)
- return http.StatusInternalServerError
-}
-
-var (
- // HTTPError replies to the request with the error.
- // You can set a custom function to this variable to customize error format.
- HTTPError = DefaultHTTPError
- // OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest
- OtherErrorHandler = DefaultOtherErrorHandler
-)
-
-type errorBody struct {
- Error string `json:"error"`
- Code int `json:"code"`
-}
-
-//Make this also conform to proto.Message for builtin JSONPb Marshaler
-func (e *errorBody) Reset() { *e = errorBody{} }
-func (e *errorBody) String() string { return proto.CompactTextString(e) }
-func (*errorBody) ProtoMessage() {}
-
-// DefaultHTTPError is the default implementation of HTTPError.
-// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode.
-// If otherwise, it replies with http.StatusInternalServerError.
-//
-// The response body returned by this function is a JSON object,
-// which contains a member whose key is "error" and whose value is err.Error().
-func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) {
- const fallback = `{"error": "failed to marshal error message"}`
-
- w.Header().Del("Trailer")
- w.Header().Set("Content-Type", marshaler.ContentType())
- body := &errorBody{
- Error: grpc.ErrorDesc(err),
- Code: int(grpc.Code(err)),
- }
-
- buf, merr := marshaler.Marshal(body)
- if merr != nil {
- grpclog.Printf("Failed to marshal error message %q: %v", body, merr)
- w.WriteHeader(http.StatusInternalServerError)
- if _, err := io.WriteString(w, fallback); err != nil {
- grpclog.Printf("Failed to write response: %v", err)
- }
- return
- }
-
- md, ok := ServerMetadataFromContext(ctx)
- if !ok {
- grpclog.Printf("Failed to extract ServerMetadata from context")
- }
-
- handleForwardResponseServerMetadata(w, md)
- handleForwardResponseTrailerHeader(w, md)
- st := HTTPStatusFromCode(grpc.Code(err))
- w.WriteHeader(st)
- if _, err := w.Write(buf); err != nil {
- grpclog.Printf("Failed to write response: %v", err)
- }
-
- handleForwardResponseTrailer(w, md)
-}
-
-// DefaultOtherErrorHandler is the default implementation of OtherErrorHandler.
-// It simply writes a string representation of the given error into "w".
-func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, msg string, code int) {
- http.Error(w, msg, code)
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go
deleted file mode 100644
index bafa4285f..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go
+++ /dev/null
@@ -1,164 +0,0 @@
-package runtime
-
-import (
- "fmt"
- "io"
- "net/http"
- "net/textproto"
-
- "github.com/golang/protobuf/proto"
- "github.com/grpc-ecosystem/grpc-gateway/runtime/internal"
- "golang.org/x/net/context"
- "google.golang.org/grpc"
- "google.golang.org/grpc/grpclog"
-)
-
-// ForwardResponseStream forwards the stream from gRPC server to REST client.
-func ForwardResponseStream(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {
- f, ok := w.(http.Flusher)
- if !ok {
- grpclog.Printf("Flush not supported in %T", w)
- http.Error(w, "unexpected type of web server", http.StatusInternalServerError)
- return
- }
-
- md, ok := ServerMetadataFromContext(ctx)
- if !ok {
- grpclog.Printf("Failed to extract ServerMetadata from context")
- http.Error(w, "unexpected error", http.StatusInternalServerError)
- return
- }
- handleForwardResponseServerMetadata(w, md)
-
- w.Header().Set("Transfer-Encoding", "chunked")
- w.Header().Set("Content-Type", marshaler.ContentType())
- if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- w.WriteHeader(http.StatusOK)
- f.Flush()
- for {
- resp, err := recv()
- if err == io.EOF {
- return
- }
- if err != nil {
- handleForwardResponseStreamError(marshaler, w, err)
- return
- }
- if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil {
- handleForwardResponseStreamError(marshaler, w, err)
- return
- }
-
- buf, err := marshaler.Marshal(streamChunk(resp, nil))
- if err != nil {
- grpclog.Printf("Failed to marshal response chunk: %v", err)
- return
- }
- if _, err = fmt.Fprintf(w, "%s\n", buf); err != nil {
- grpclog.Printf("Failed to send response chunk: %v", err)
- return
- }
- f.Flush()
- }
-}
-
-func handleForwardResponseServerMetadata(w http.ResponseWriter, md ServerMetadata) {
- for k, vs := range md.HeaderMD {
- hKey := fmt.Sprintf("%s%s", metadataHeaderPrefix, k)
- for i := range vs {
- w.Header().Add(hKey, vs[i])
- }
- }
-}
-
-func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) {
- for k := range md.TrailerMD {
- tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", metadataTrailerPrefix, k))
- w.Header().Add("Trailer", tKey)
- }
-}
-
-func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) {
- for k, vs := range md.TrailerMD {
- tKey := fmt.Sprintf("%s%s", metadataTrailerPrefix, k)
- for i := range vs {
- w.Header().Add(tKey, vs[i])
- }
- }
-}
-
-// ForwardResponseMessage forwards the message "resp" from gRPC server to REST client.
-func ForwardResponseMessage(ctx context.Context, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {
- md, ok := ServerMetadataFromContext(ctx)
- if !ok {
- grpclog.Printf("Failed to extract ServerMetadata from context")
- }
-
- handleForwardResponseServerMetadata(w, md)
- handleForwardResponseTrailerHeader(w, md)
- w.Header().Set("Content-Type", marshaler.ContentType())
- if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil {
- HTTPError(ctx, marshaler, w, req, err)
- return
- }
-
- buf, err := marshaler.Marshal(resp)
- if err != nil {
- grpclog.Printf("Marshal error: %v", err)
- HTTPError(ctx, marshaler, w, req, err)
- return
- }
-
- if _, err = w.Write(buf); err != nil {
- grpclog.Printf("Failed to write response: %v", err)
- }
-
- handleForwardResponseTrailer(w, md)
-}
-
-func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, resp proto.Message, opts []func(context.Context, http.ResponseWriter, proto.Message) error) error {
- if len(opts) == 0 {
- return nil
- }
- for _, opt := range opts {
- if err := opt(ctx, w, resp); err != nil {
- grpclog.Printf("Error handling ForwardResponseOptions: %v", err)
- return err
- }
- }
- return nil
-}
-
-func handleForwardResponseStreamError(marshaler Marshaler, w http.ResponseWriter, err error) {
- buf, merr := marshaler.Marshal(streamChunk(nil, err))
- if merr != nil {
- grpclog.Printf("Failed to marshal an error: %v", merr)
- return
- }
- if _, werr := fmt.Fprintf(w, "%s\n", buf); werr != nil {
- grpclog.Printf("Failed to notify error to client: %v", werr)
- return
- }
-}
-
-func streamChunk(result proto.Message, err error) map[string]proto.Message {
- if err != nil {
- grpcCode := grpc.Code(err)
- httpCode := HTTPStatusFromCode(grpcCode)
- return map[string]proto.Message{
- "error": &internal.StreamError{
- GrpcCode: int32(grpcCode),
- HttpCode: int32(httpCode),
- Message: err.Error(),
- HttpStatus: http.StatusText(httpCode),
- },
- }
- }
- if result == nil {
- return streamChunk(nil, fmt.Errorf("empty response"))
- }
- return map[string]proto.Message{"result": result}
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go
deleted file mode 100644
index 524e0d3c3..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.pb.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Code generated by protoc-gen-go.
-// source: runtime/internal/stream_chunk.proto
-// DO NOT EDIT!
-
-/*
-Package internal is a generated protocol buffer package.
-
-It is generated from these files:
- runtime/internal/stream_chunk.proto
-
-It has these top-level messages:
- StreamError
-*/
-package internal
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
-
-// StreamError is a response type which is returned when
-// streaming rpc returns an error.
-type StreamError struct {
- GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode" json:"grpc_code,omitempty"`
- HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode" json:"http_code,omitempty"`
- Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
- HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus" json:"http_status,omitempty"`
-}
-
-func (m *StreamError) Reset() { *m = StreamError{} }
-func (m *StreamError) String() string { return proto.CompactTextString(m) }
-func (*StreamError) ProtoMessage() {}
-func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
-
-func init() {
- proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError")
-}
-
-func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) }
-
-var fileDescriptor0 = []byte{
- // 180 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2a, 0xcd, 0x2b,
- 0xc9, 0xcc, 0x4d, 0xd5, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x2e, 0x29,
- 0x4a, 0x4d, 0xcc, 0x8d, 0x4f, 0xce, 0x28, 0xcd, 0xcb, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
- 0x12, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0xea,
- 0x50, 0x6a, 0x62, 0xe4, 0xe2, 0x0e, 0x06, 0x2b, 0x76, 0x2d, 0x2a, 0xca, 0x2f, 0x12, 0x92, 0xe6,
- 0xe2, 0x04, 0xa9, 0x8b, 0x4f, 0xce, 0x4f, 0x49, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0d, 0xe2,
- 0x00, 0x09, 0x38, 0x03, 0xf9, 0x20, 0xc9, 0x8c, 0x92, 0x92, 0x02, 0x88, 0x24, 0x13, 0x44, 0x12,
- 0x24, 0x00, 0x96, 0x94, 0xe0, 0x62, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x95, 0x60, 0x06,
- 0x4a, 0x71, 0x06, 0xc1, 0xb8, 0x42, 0xf2, 0x5c, 0xdc, 0x60, 0x6d, 0xc5, 0x25, 0x89, 0x25, 0xa5,
- 0xc5, 0x12, 0x2c, 0x60, 0x59, 0x2e, 0x90, 0x50, 0x30, 0x58, 0xc4, 0x89, 0x2b, 0x8a, 0x03, 0xe6,
- 0xf2, 0x24, 0x36, 0xb0, 0x6b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, 0xb6,
- 0xd4, 0x00, 0x00, 0x00,
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto
deleted file mode 100644
index f7fba56c3..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/stream_chunk.proto
+++ /dev/null
@@ -1,12 +0,0 @@
-syntax = "proto3";
-package grpc.gateway.runtime;
-option go_package = "internal";
-
-// StreamError is a response type which is returned when
-// streaming rpc returns an error.
-message StreamError {
- int32 grpc_code = 1;
- int32 http_code = 2;
- string message = 3;
- string http_status = 4;
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go
deleted file mode 100644
index 0acd2ca29..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package runtime
-
-import (
- "encoding/json"
- "io"
-)
-
-// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON
-// with the standard "encoding/json" package of Golang.
-// Although it is generally faster for simple proto messages than JSONPb,
-// it does not support advanced features of protobuf, e.g. map, oneof, ....
-type JSONBuiltin struct{}
-
-// ContentType always Returns "application/json".
-func (*JSONBuiltin) ContentType() string {
- return "application/json"
-}
-
-// Marshal marshals "v" into JSON
-func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) {
- return json.Marshal(v)
-}
-
-// Unmarshal unmarshals JSON data into "v".
-func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error {
- return json.Unmarshal(data, v)
-}
-
-// NewDecoder returns a Decoder which reads JSON stream from "r".
-func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder {
- return json.NewDecoder(r)
-}
-
-// NewEncoder returns an Encoder which writes JSON stream into "w".
-func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder {
- return json.NewEncoder(w)
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go
deleted file mode 100644
index 9a4219111..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go
+++ /dev/null
@@ -1,182 +0,0 @@
-package runtime
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "reflect"
-
- "github.com/golang/protobuf/jsonpb"
- "github.com/golang/protobuf/proto"
-)
-
-// JSONPb is a Marshaler which marshals/unmarshals into/from JSON
-// with the "github.com/golang/protobuf/jsonpb".
-// It supports fully functionality of protobuf unlike JSONBuiltin.
-type JSONPb jsonpb.Marshaler
-
-// ContentType always returns "application/json".
-func (*JSONPb) ContentType() string {
- return "application/json"
-}
-
-// Marshal marshals "v" into JSON
-// Currently it can marshal only proto.Message.
-// TODO(yugui) Support fields of primitive types in a message.
-func (j *JSONPb) Marshal(v interface{}) ([]byte, error) {
- if _, ok := v.(proto.Message); !ok {
- return j.marshalNonProtoField(v)
- }
-
- var buf bytes.Buffer
- if err := j.marshalTo(&buf, v); err != nil {
- return nil, err
- }
- return buf.Bytes(), nil
-}
-
-func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error {
- p, ok := v.(proto.Message)
- if !ok {
- buf, err := j.marshalNonProtoField(v)
- if err != nil {
- return err
- }
- _, err = w.Write(buf)
- return err
- }
- return (*jsonpb.Marshaler)(j).Marshal(w, p)
-}
-
-// marshalNonProto marshals a non-message field of a protobuf message.
-// This function does not correctly marshals arbitary data structure into JSON,
-// but it is only capable of marshaling non-message field values of protobuf,
-// i.e. primitive types, enums; pointers to primitives or enums; maps from
-// integer/string types to primitives/enums/pointers to messages.
-func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) {
- rv := reflect.ValueOf(v)
- for rv.Kind() == reflect.Ptr {
- if rv.IsNil() {
- return []byte("null"), nil
- }
- rv = rv.Elem()
- }
-
- if rv.Kind() == reflect.Map {
- m := make(map[string]*json.RawMessage)
- for _, k := range rv.MapKeys() {
- buf, err := j.Marshal(rv.MapIndex(k).Interface())
- if err != nil {
- return nil, err
- }
- m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf)
- }
- if j.Indent != "" {
- return json.MarshalIndent(m, "", j.Indent)
- }
- return json.Marshal(m)
- }
- if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts {
- return json.Marshal(enum.String())
- }
- return json.Marshal(rv.Interface())
-}
-
-// Unmarshal unmarshals JSON "data" into "v"
-// Currently it can marshal only proto.Message.
-// TODO(yugui) Support fields of primitive types in a message.
-func (j *JSONPb) Unmarshal(data []byte, v interface{}) error {
- return unmarshalJSONPb(data, v)
-}
-
-// NewDecoder returns a Decoder which reads JSON stream from "r".
-func (j *JSONPb) NewDecoder(r io.Reader) Decoder {
- d := json.NewDecoder(r)
- return DecoderFunc(func(v interface{}) error { return decodeJSONPb(d, v) })
-}
-
-// NewEncoder returns an Encoder which writes JSON stream into "w".
-func (j *JSONPb) NewEncoder(w io.Writer) Encoder {
- return EncoderFunc(func(v interface{}) error { return j.marshalTo(w, v) })
-}
-
-func unmarshalJSONPb(data []byte, v interface{}) error {
- d := json.NewDecoder(bytes.NewReader(data))
- return decodeJSONPb(d, v)
-}
-
-func decodeJSONPb(d *json.Decoder, v interface{}) error {
- p, ok := v.(proto.Message)
- if !ok {
- return decodeNonProtoField(d, v)
- }
- return jsonpb.UnmarshalNext(d, p)
-}
-
-func decodeNonProtoField(d *json.Decoder, v interface{}) error {
- rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr {
- return fmt.Errorf("%T is not a pointer", v)
- }
- for rv.Kind() == reflect.Ptr {
- if rv.IsNil() {
- rv.Set(reflect.New(rv.Type().Elem()))
- }
- if rv.Type().ConvertibleTo(typeProtoMessage) {
- return jsonpb.UnmarshalNext(d, rv.Interface().(proto.Message))
- }
- rv = rv.Elem()
- }
- if rv.Kind() == reflect.Map {
- if rv.IsNil() {
- rv.Set(reflect.MakeMap(rv.Type()))
- }
- conv, ok := convFromType[rv.Type().Key().Kind()]
- if !ok {
- return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key())
- }
-
- m := make(map[string]*json.RawMessage)
- if err := d.Decode(&m); err != nil {
- return err
- }
- for k, v := range m {
- result := conv.Call([]reflect.Value{reflect.ValueOf(k)})
- if err := result[1].Interface(); err != nil {
- return err.(error)
- }
- bk := result[0]
- bv := reflect.New(rv.Type().Elem())
- if err := unmarshalJSONPb([]byte(*v), bv.Interface()); err != nil {
- return err
- }
- rv.SetMapIndex(bk, bv.Elem())
- }
- return nil
- }
- if _, ok := rv.Interface().(protoEnum); ok {
- var repr interface{}
- if err := d.Decode(&repr); err != nil {
- return err
- }
- switch repr.(type) {
- case string:
- // TODO(yugui) Should use proto.StructProperties?
- return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface())
- case float64:
- rv.Set(reflect.ValueOf(int32(repr.(float64))).Convert(rv.Type()))
- return nil
- default:
- return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface())
- }
- }
- return d.Decode(v)
-}
-
-type protoEnum interface {
- fmt.Stringer
- EnumDescriptor() ([]byte, []int)
-}
-
-var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem()
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go
deleted file mode 100644
index 6d434f13c..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package runtime
-
-import (
- "io"
-)
-
-// Marshaler defines a conversion between byte sequence and gRPC payloads / fields.
-type Marshaler interface {
- // Marshal marshals "v" into byte sequence.
- Marshal(v interface{}) ([]byte, error)
- // Unmarshal unmarshals "data" into "v".
- // "v" must be a pointer value.
- Unmarshal(data []byte, v interface{}) error
- // NewDecoder returns a Decoder which reads byte sequence from "r".
- NewDecoder(r io.Reader) Decoder
- // NewEncoder returns an Encoder which writes bytes sequence into "w".
- NewEncoder(w io.Writer) Encoder
- // ContentType returns the Content-Type which this marshaler is responsible for.
- ContentType() string
-}
-
-// Decoder decodes a byte sequence
-type Decoder interface {
- Decode(v interface{}) error
-}
-
-// Encoder encodes gRPC payloads / fields into byte sequence.
-type Encoder interface {
- Encode(v interface{}) error
-}
-
-// DecoderFunc adapts an decoder function into Decoder.
-type DecoderFunc func(v interface{}) error
-
-// Decode delegates invocations to the underlying function itself.
-func (f DecoderFunc) Decode(v interface{}) error { return f(v) }
-
-// EncoderFunc adapts an encoder function into Encoder
-type EncoderFunc func(v interface{}) error
-
-// Encode delegates invocations to the underlying function itself.
-func (f EncoderFunc) Encode(v interface{}) error { return f(v) }
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go
deleted file mode 100644
index 928f07332..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package runtime
-
-import (
- "errors"
- "net/http"
-)
-
-// MIMEWildcard is the fallback MIME type used for requests which do not match
-// a registered MIME type.
-const MIMEWildcard = "*"
-
-var (
- acceptHeader = http.CanonicalHeaderKey("Accept")
- contentTypeHeader = http.CanonicalHeaderKey("Content-Type")
-
- defaultMarshaler = &JSONPb{OrigName: true}
-)
-
-// MarshalerForRequest returns the inbound/outbound marshalers for this request.
-// It checks the registry on the ServeMux for the MIME type set by the Content-Type header.
-// If it isn't set (or the request Content-Type is empty), checks for "*".
-// If there are multiple Content-Type headers set, choose the first one that it can
-// exactly match in the registry.
-// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler.
-func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) {
- for _, acceptVal := range r.Header[acceptHeader] {
- if m, ok := mux.marshalers.mimeMap[acceptVal]; ok {
- outbound = m
- break
- }
- }
-
- for _, contentTypeVal := range r.Header[contentTypeHeader] {
- if m, ok := mux.marshalers.mimeMap[contentTypeVal]; ok {
- inbound = m
- break
- }
- }
-
- if inbound == nil {
- inbound = mux.marshalers.mimeMap[MIMEWildcard]
- }
- if outbound == nil {
- outbound = inbound
- }
-
- return inbound, outbound
-}
-
-// marshalerRegistry is a mapping from MIME types to Marshalers.
-type marshalerRegistry struct {
- mimeMap map[string]Marshaler
-}
-
-// add adds a marshaler for a case-sensitive MIME type string ("*" to match any
-// MIME type).
-func (m marshalerRegistry) add(mime string, marshaler Marshaler) error {
- if len(mime) == 0 {
- return errors.New("empty MIME type")
- }
-
- m.mimeMap[mime] = marshaler
-
- return nil
-}
-
-// makeMarshalerMIMERegistry returns a new registry of marshalers.
-// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces.
-//
-// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler
-// with a "applicaton/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler
-// with a "application/json" Content-Type.
-// "*" can be used to match any Content-Type.
-// This can be attached to a ServerMux with the marshaler option.
-func makeMarshalerMIMERegistry() marshalerRegistry {
- return marshalerRegistry{
- mimeMap: map[string]Marshaler{
- MIMEWildcard: defaultMarshaler,
- },
- }
-}
-
-// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound
-// Marshalers to a MIME type in mux.
-func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption {
- return func(mux *ServeMux) {
- if err := mux.marshalers.add(mime, marshaler); err != nil {
- panic(err)
- }
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go
deleted file mode 100644
index 2e6c56213..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go
+++ /dev/null
@@ -1,132 +0,0 @@
-package runtime
-
-import (
- "net/http"
- "strings"
-
- "golang.org/x/net/context"
-
- "github.com/golang/protobuf/proto"
-)
-
-// A HandlerFunc handles a specific pair of path pattern and HTTP method.
-type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string)
-
-// ServeMux is a request multiplexer for grpc-gateway.
-// It matches http requests to patterns and invokes the corresponding handler.
-type ServeMux struct {
- // handlers maps HTTP method to a list of handlers.
- handlers map[string][]handler
- forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error
- marshalers marshalerRegistry
-}
-
-// ServeMuxOption is an option that can be given to a ServeMux on construction.
-type ServeMuxOption func(*ServeMux)
-
-// WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption.
-//
-// forwardResponseOption is an option that will be called on the relevant context.Context,
-// http.ResponseWriter, and proto.Message before every forwarded response.
-//
-// The message may be nil in the case where just a header is being sent.
-func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption {
- return func(serveMux *ServeMux) {
- serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption)
- }
-}
-
-// NewServeMux returns a new ServeMux whose internal mapping is empty.
-func NewServeMux(opts ...ServeMuxOption) *ServeMux {
- serveMux := &ServeMux{
- handlers: make(map[string][]handler),
- forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0),
- marshalers: makeMarshalerMIMERegistry(),
- }
-
- for _, opt := range opts {
- opt(serveMux)
- }
- return serveMux
-}
-
-// Handle associates "h" to the pair of HTTP method and path pattern.
-func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) {
- s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h})
-}
-
-// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path.
-func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- path := r.URL.Path
- if !strings.HasPrefix(path, "/") {
- OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
- return
- }
-
- components := strings.Split(path[1:], "/")
- l := len(components)
- var verb string
- if idx := strings.LastIndex(components[l-1], ":"); idx == 0 {
- OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound)
- return
- } else if idx > 0 {
- c := components[l-1]
- components[l-1], verb = c[:idx], c[idx+1:]
- }
-
- if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && isPathLengthFallback(r) {
- r.Method = strings.ToUpper(override)
- if err := r.ParseForm(); err != nil {
- OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest)
- return
- }
- }
- for _, h := range s.handlers[r.Method] {
- pathParams, err := h.pat.Match(components, verb)
- if err != nil {
- continue
- }
- h.h(w, r, pathParams)
- return
- }
-
- // lookup other methods to handle fallback from GET to POST and
- // to determine if it is MethodNotAllowed or NotFound.
- for m, handlers := range s.handlers {
- if m == r.Method {
- continue
- }
- for _, h := range handlers {
- pathParams, err := h.pat.Match(components, verb)
- if err != nil {
- continue
- }
- // X-HTTP-Method-Override is optional. Always allow fallback to POST.
- if isPathLengthFallback(r) {
- if err := r.ParseForm(); err != nil {
- OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest)
- return
- }
- h.h(w, r, pathParams)
- return
- }
- OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
- return
- }
- }
- OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound)
-}
-
-// GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux.
-func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error {
- return s.forwardResponseOptions
-}
-
-func isPathLengthFallback(r *http.Request) bool {
- return r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded"
-}
-
-type handler struct {
- pat Pattern
- h HandlerFunc
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go
deleted file mode 100644
index 3947dbea0..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go
+++ /dev/null
@@ -1,227 +0,0 @@
-package runtime
-
-import (
- "errors"
- "fmt"
- "strings"
-
- "github.com/grpc-ecosystem/grpc-gateway/utilities"
- "google.golang.org/grpc/grpclog"
-)
-
-var (
- // ErrNotMatch indicates that the given HTTP request path does not match to the pattern.
- ErrNotMatch = errors.New("not match to the path pattern")
- // ErrInvalidPattern indicates that the given definition of Pattern is not valid.
- ErrInvalidPattern = errors.New("invalid pattern")
-)
-
-type op struct {
- code utilities.OpCode
- operand int
-}
-
-// Pattern is a template pattern of http request paths defined in third_party/googleapis/google/api/http.proto.
-type Pattern struct {
- // ops is a list of operations
- ops []op
- // pool is a constant pool indexed by the operands or vars.
- pool []string
- // vars is a list of variables names to be bound by this pattern
- vars []string
- // stacksize is the max depth of the stack
- stacksize int
- // tailLen is the length of the fixed-size segments after a deep wildcard
- tailLen int
- // verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part.
- verb string
-}
-
-// NewPattern returns a new Pattern from the given definition values.
-// "ops" is a sequence of op codes. "pool" is a constant pool.
-// "verb" is the verb part of the pattern. It is empty if the pattern does not have the part.
-// "version" must be 1 for now.
-// It returns an error if the given definition is invalid.
-func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, error) {
- if version != 1 {
- grpclog.Printf("unsupported version: %d", version)
- return Pattern{}, ErrInvalidPattern
- }
-
- l := len(ops)
- if l%2 != 0 {
- grpclog.Printf("odd number of ops codes: %d", l)
- return Pattern{}, ErrInvalidPattern
- }
-
- var (
- typedOps []op
- stack, maxstack int
- tailLen int
- pushMSeen bool
- vars []string
- )
- for i := 0; i < l; i += 2 {
- op := op{code: utilities.OpCode(ops[i]), operand: ops[i+1]}
- switch op.code {
- case utilities.OpNop:
- continue
- case utilities.OpPush:
- if pushMSeen {
- tailLen++
- }
- stack++
- case utilities.OpPushM:
- if pushMSeen {
- grpclog.Printf("pushM appears twice")
- return Pattern{}, ErrInvalidPattern
- }
- pushMSeen = true
- stack++
- case utilities.OpLitPush:
- if op.operand < 0 || len(pool) <= op.operand {
- grpclog.Printf("negative literal index: %d", op.operand)
- return Pattern{}, ErrInvalidPattern
- }
- if pushMSeen {
- tailLen++
- }
- stack++
- case utilities.OpConcatN:
- if op.operand <= 0 {
- grpclog.Printf("negative concat size: %d", op.operand)
- return Pattern{}, ErrInvalidPattern
- }
- stack -= op.operand
- if stack < 0 {
- grpclog.Print("stack underflow")
- return Pattern{}, ErrInvalidPattern
- }
- stack++
- case utilities.OpCapture:
- if op.operand < 0 || len(pool) <= op.operand {
- grpclog.Printf("variable name index out of bound: %d", op.operand)
- return Pattern{}, ErrInvalidPattern
- }
- v := pool[op.operand]
- op.operand = len(vars)
- vars = append(vars, v)
- stack--
- if stack < 0 {
- grpclog.Printf("stack underflow")
- return Pattern{}, ErrInvalidPattern
- }
- default:
- grpclog.Printf("invalid opcode: %d", op.code)
- return Pattern{}, ErrInvalidPattern
- }
-
- if maxstack < stack {
- maxstack = stack
- }
- typedOps = append(typedOps, op)
- }
- return Pattern{
- ops: typedOps,
- pool: pool,
- vars: vars,
- stacksize: maxstack,
- tailLen: tailLen,
- verb: verb,
- }, nil
-}
-
-// MustPattern is a helper function which makes it easier to call NewPattern in variable initialization.
-func MustPattern(p Pattern, err error) Pattern {
- if err != nil {
- grpclog.Fatalf("Pattern initialization failed: %v", err)
- }
- return p
-}
-
-// Match examines components if it matches to the Pattern.
-// If it matches, the function returns a mapping from field paths to their captured values.
-// If otherwise, the function returns an error.
-func (p Pattern) Match(components []string, verb string) (map[string]string, error) {
- if p.verb != verb {
- return nil, ErrNotMatch
- }
-
- var pos int
- stack := make([]string, 0, p.stacksize)
- captured := make([]string, len(p.vars))
- l := len(components)
- for _, op := range p.ops {
- switch op.code {
- case utilities.OpNop:
- continue
- case utilities.OpPush, utilities.OpLitPush:
- if pos >= l {
- return nil, ErrNotMatch
- }
- c := components[pos]
- if op.code == utilities.OpLitPush {
- if lit := p.pool[op.operand]; c != lit {
- return nil, ErrNotMatch
- }
- }
- stack = append(stack, c)
- pos++
- case utilities.OpPushM:
- end := len(components)
- if end < pos+p.tailLen {
- return nil, ErrNotMatch
- }
- end -= p.tailLen
- stack = append(stack, strings.Join(components[pos:end], "/"))
- pos = end
- case utilities.OpConcatN:
- n := op.operand
- l := len(stack) - n
- stack = append(stack[:l], strings.Join(stack[l:], "/"))
- case utilities.OpCapture:
- n := len(stack) - 1
- captured[op.operand] = stack[n]
- stack = stack[:n]
- }
- }
- if pos < l {
- return nil, ErrNotMatch
- }
- bindings := make(map[string]string)
- for i, val := range captured {
- bindings[p.vars[i]] = val
- }
- return bindings, nil
-}
-
-// Verb returns the verb part of the Pattern.
-func (p Pattern) Verb() string { return p.verb }
-
-func (p Pattern) String() string {
- var stack []string
- for _, op := range p.ops {
- switch op.code {
- case utilities.OpNop:
- continue
- case utilities.OpPush:
- stack = append(stack, "*")
- case utilities.OpLitPush:
- stack = append(stack, p.pool[op.operand])
- case utilities.OpPushM:
- stack = append(stack, "**")
- case utilities.OpConcatN:
- n := op.operand
- l := len(stack) - n
- stack = append(stack[:l], strings.Join(stack[l:], "/"))
- case utilities.OpCapture:
- n := len(stack) - 1
- stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n])
- }
- }
- segs := strings.Join(stack, "/")
- if p.verb != "" {
- return fmt.Sprintf("/%s:%s", segs, p.verb)
- }
- return "/" + segs
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go
deleted file mode 100644
index a3151e2a5..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package runtime
-
-import (
- "github.com/golang/protobuf/proto"
-)
-
-// StringP returns a pointer to a string whose pointee is same as the given string value.
-func StringP(val string) (*string, error) {
- return proto.String(val), nil
-}
-
-// BoolP parses the given string representation of a boolean value,
-// and returns a pointer to a bool whose value is same as the parsed value.
-func BoolP(val string) (*bool, error) {
- b, err := Bool(val)
- if err != nil {
- return nil, err
- }
- return proto.Bool(b), nil
-}
-
-// Float64P parses the given string representation of a floating point number,
-// and returns a pointer to a float64 whose value is same as the parsed number.
-func Float64P(val string) (*float64, error) {
- f, err := Float64(val)
- if err != nil {
- return nil, err
- }
- return proto.Float64(f), nil
-}
-
-// Float32P parses the given string representation of a floating point number,
-// and returns a pointer to a float32 whose value is same as the parsed number.
-func Float32P(val string) (*float32, error) {
- f, err := Float32(val)
- if err != nil {
- return nil, err
- }
- return proto.Float32(f), nil
-}
-
-// Int64P parses the given string representation of an integer
-// and returns a pointer to a int64 whose value is same as the parsed integer.
-func Int64P(val string) (*int64, error) {
- i, err := Int64(val)
- if err != nil {
- return nil, err
- }
- return proto.Int64(i), nil
-}
-
-// Int32P parses the given string representation of an integer
-// and returns a pointer to a int32 whose value is same as the parsed integer.
-func Int32P(val string) (*int32, error) {
- i, err := Int32(val)
- if err != nil {
- return nil, err
- }
- return proto.Int32(i), err
-}
-
-// Uint64P parses the given string representation of an integer
-// and returns a pointer to a uint64 whose value is same as the parsed integer.
-func Uint64P(val string) (*uint64, error) {
- i, err := Uint64(val)
- if err != nil {
- return nil, err
- }
- return proto.Uint64(i), err
-}
-
-// Uint32P parses the given string representation of an integer
-// and returns a pointer to a uint32 whose value is same as the parsed integer.
-func Uint32P(val string) (*uint32, error) {
- i, err := Uint32(val)
- if err != nil {
- return nil, err
- }
- return proto.Uint32(i), err
-}
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go
deleted file mode 100644
index 56a919a52..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go
+++ /dev/null
@@ -1,140 +0,0 @@
-package runtime
-
-import (
- "fmt"
- "net/url"
- "reflect"
- "strings"
-
- "github.com/golang/protobuf/proto"
- "github.com/grpc-ecosystem/grpc-gateway/utilities"
- "google.golang.org/grpc/grpclog"
-)
-
-// PopulateQueryParameters populates "values" into "msg".
-// A value is ignored if its key starts with one of the elements in "filter".
-func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error {
- for key, values := range values {
- fieldPath := strings.Split(key, ".")
- if filter.HasCommonPrefix(fieldPath) {
- continue
- }
- if err := populateFieldValueFromPath(msg, fieldPath, values); err != nil {
- return err
- }
- }
- return nil
-}
-
-// PopulateFieldFromPath sets a value in a nested Protobuf structure.
-// It instantiates missing protobuf fields as it goes.
-func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error {
- fieldPath := strings.Split(fieldPathString, ".")
- return populateFieldValueFromPath(msg, fieldPath, []string{value})
-}
-
-func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values []string) error {
- m := reflect.ValueOf(msg)
- if m.Kind() != reflect.Ptr {
- return fmt.Errorf("unexpected type %T: %v", msg, msg)
- }
- m = m.Elem()
- for i, fieldName := range fieldPath {
- isLast := i == len(fieldPath)-1
- if !isLast && m.Kind() != reflect.Struct {
- return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, "."))
- }
- f := fieldByProtoName(m, fieldName)
- if !f.IsValid() {
- grpclog.Printf("field not found in %T: %s", msg, strings.Join(fieldPath, "."))
- return nil
- }
-
- switch f.Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64:
- m = f
- case reflect.Slice:
- // TODO(yugui) Support []byte
- if !isLast {
- return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, "."))
- }
- return populateRepeatedField(f, values)
- case reflect.Ptr:
- if f.IsNil() {
- m = reflect.New(f.Type().Elem())
- f.Set(m)
- }
- m = f.Elem()
- continue
- case reflect.Struct:
- m = f
- continue
- default:
- return fmt.Errorf("unexpected type %s in %T", f.Type(), msg)
- }
- }
- switch len(values) {
- case 0:
- return fmt.Errorf("no value of field: %s", strings.Join(fieldPath, "."))
- case 1:
- default:
- grpclog.Printf("too many field values: %s", strings.Join(fieldPath, "."))
- }
- return populateField(m, values[0])
-}
-
-// fieldByProtoName looks up a field whose corresponding protobuf field name is "name".
-// "m" must be a struct value. It returns zero reflect.Value if no such field found.
-func fieldByProtoName(m reflect.Value, name string) reflect.Value {
- props := proto.GetProperties(m.Type())
- for _, p := range props.Prop {
- if p.OrigName == name {
- return m.FieldByName(p.Name)
- }
- }
- return reflect.Value{}
-}
-
-func populateRepeatedField(f reflect.Value, values []string) error {
- elemType := f.Type().Elem()
- conv, ok := convFromType[elemType.Kind()]
- if !ok {
- return fmt.Errorf("unsupported field type %s", elemType)
- }
- f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)))
- for i, v := range values {
- result := conv.Call([]reflect.Value{reflect.ValueOf(v)})
- if err := result[1].Interface(); err != nil {
- return err.(error)
- }
- f.Index(i).Set(result[0])
- }
- return nil
-}
-
-func populateField(f reflect.Value, value string) error {
- conv, ok := convFromType[f.Kind()]
- if !ok {
- return fmt.Errorf("unsupported field type %T", f)
- }
- result := conv.Call([]reflect.Value{reflect.ValueOf(value)})
- if err := result[1].Interface(); err != nil {
- return err.(error)
- }
- f.Set(result[0])
- return nil
-}
-
-var (
- convFromType = map[reflect.Kind]reflect.Value{
- reflect.String: reflect.ValueOf(String),
- reflect.Bool: reflect.ValueOf(Bool),
- reflect.Float64: reflect.ValueOf(Float64),
- reflect.Float32: reflect.ValueOf(Float32),
- reflect.Int64: reflect.ValueOf(Int64),
- reflect.Int32: reflect.ValueOf(Int32),
- reflect.Uint64: reflect.ValueOf(Uint64),
- reflect.Uint32: reflect.ValueOf(Uint32),
- // TODO(yugui) Support []byte
- }
-)
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go
deleted file mode 100644
index cf79a4d58..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package utilities provides members for internal use in grpc-gateway.
-package utilities
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go
deleted file mode 100644
index 28ad9461f..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package utilities
-
-// An OpCode is a opcode of compiled path patterns.
-type OpCode int
-
-// These constants are the valid values of OpCode.
-const (
- // OpNop does nothing
- OpNop = OpCode(iota)
- // OpPush pushes a component to stack
- OpPush
- // OpLitPush pushes a component to stack if it matches to the literal
- OpLitPush
- // OpPushM concatenates the remaining components and pushes it to stack
- OpPushM
- // OpConcatN pops N items from stack, concatenates them and pushes it back to stack
- OpConcatN
- // OpCapture pops an item and binds it to the variable
- OpCapture
- // OpEnd is the least postive invalid opcode.
- OpEnd
-)
diff --git a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go b/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go
deleted file mode 100644
index c2b7b30dd..000000000
--- a/archived/event-adapter/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package utilities
-
-import (
- "sort"
-)
-
-// DoubleArray is a Double Array implementation of trie on sequences of strings.
-type DoubleArray struct {
- // Encoding keeps an encoding from string to int
- Encoding map[string]int
- // Base is the base array of Double Array
- Base []int
- // Check is the check array of Double Array
- Check []int
-}
-
-// NewDoubleArray builds a DoubleArray from a set of sequences of strings.
-func NewDoubleArray(seqs [][]string) *DoubleArray {
- da := &DoubleArray{Encoding: make(map[string]int)}
- if len(seqs) == 0 {
- return da
- }
-
- encoded := registerTokens(da, seqs)
- sort.Sort(byLex(encoded))
-
- root := node{row: -1, col: -1, left: 0, right: len(encoded)}
- addSeqs(da, encoded, 0, root)
-
- for i := len(da.Base); i > 0; i-- {
- if da.Check[i-1] != 0 {
- da.Base = da.Base[:i]
- da.Check = da.Check[:i]
- break
- }
- }
- return da
-}
-
-func registerTokens(da *DoubleArray, seqs [][]string) [][]int {
- var result [][]int
- for _, seq := range seqs {
- var encoded []int
- for _, token := range seq {
- if _, ok := da.Encoding[token]; !ok {
- da.Encoding[token] = len(da.Encoding)
- }
- encoded = append(encoded, da.Encoding[token])
- }
- result = append(result, encoded)
- }
- for i := range result {
- result[i] = append(result[i], len(da.Encoding))
- }
- return result
-}
-
-type node struct {
- row, col int
- left, right int
-}
-
-func (n node) value(seqs [][]int) int {
- return seqs[n.row][n.col]
-}
-
-func (n node) children(seqs [][]int) []*node {
- var result []*node
- lastVal := int(-1)
- last := new(node)
- for i := n.left; i < n.right; i++ {
- if lastVal == seqs[i][n.col+1] {
- continue
- }
- last.right = i
- last = &node{
- row: i,
- col: n.col + 1,
- left: i,
- }
- result = append(result, last)
- }
- last.right = n.right
- return result
-}
-
-func addSeqs(da *DoubleArray, seqs [][]int, pos int, n node) {
- ensureSize(da, pos)
-
- children := n.children(seqs)
- var i int
- for i = 1; ; i++ {
- ok := func() bool {
- for _, child := range children {
- code := child.value(seqs)
- j := i + code
- ensureSize(da, j)
- if da.Check[j] != 0 {
- return false
- }
- }
- return true
- }()
- if ok {
- break
- }
- }
- da.Base[pos] = i
- for _, child := range children {
- code := child.value(seqs)
- j := i + code
- da.Check[j] = pos + 1
- }
- terminator := len(da.Encoding)
- for _, child := range children {
- code := child.value(seqs)
- if code == terminator {
- continue
- }
- j := i + code
- addSeqs(da, seqs, j, *child)
- }
-}
-
-func ensureSize(da *DoubleArray, i int) {
- for i >= len(da.Base) {
- da.Base = append(da.Base, make([]int, len(da.Base)+1)...)
- da.Check = append(da.Check, make([]int, len(da.Check)+1)...)
- }
-}
-
-type byLex [][]int
-
-func (l byLex) Len() int { return len(l) }
-func (l byLex) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
-func (l byLex) Less(i, j int) bool {
- si := l[i]
- sj := l[j]
- var k int
- for k = 0; k < len(si) && k < len(sj); k++ {
- if si[k] < sj[k] {
- return true
- }
- if si[k] > sj[k] {
- return false
- }
- }
- if k < len(sj) {
- return true
- }
- return false
-}
-
-// HasCommonPrefix determines if any sequence in the DoubleArray is a prefix of the given sequence.
-func (da *DoubleArray) HasCommonPrefix(seq []string) bool {
- if len(da.Base) == 0 {
- return false
- }
-
- var i int
- for _, t := range seq {
- code, ok := da.Encoding[t]
- if !ok {
- break
- }
- j := da.Base[i] + code
- if len(da.Check) <= j || da.Check[j] != i+1 {
- break
- }
- i = j
- }
- j := da.Base[i] + len(da.Encoding)
- if len(da.Check) <= j || da.Check[j] != i+1 {
- return false
- }
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/.travis.yml b/archived/event-adapter/vendor/github.com/howeyc/gopass/.travis.yml
deleted file mode 100644
index cc5d509fd..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-
-os:
- - linux
- - osx
-
-go:
- - 1.3
- - 1.4
- - 1.5
- - tip
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/LICENSE.txt b/archived/event-adapter/vendor/github.com/howeyc/gopass/LICENSE.txt
deleted file mode 100644
index 14f74708a..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/LICENSE.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-ISC License
-
-Copyright (c) 2012 Chris Howey
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/OPENSOLARIS.LICENSE b/archived/event-adapter/vendor/github.com/howeyc/gopass/OPENSOLARIS.LICENSE
deleted file mode 100644
index da23621dc..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/OPENSOLARIS.LICENSE
+++ /dev/null
@@ -1,384 +0,0 @@
-Unless otherwise noted, all files in this distribution are released
-under the Common Development and Distribution License (CDDL).
-Exceptions are noted within the associated source files.
-
---------------------------------------------------------------------
-
-
-COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0
-
-1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that creates
- or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the Original
- Software, prior Modifications used by a Contributor (if any),
- and the Modifications made by that particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or (b)
- Modifications, or (c) the combination of files containing
- Original Software with files containing Modifications, in
- each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form other
- than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity that first
- makes Original Software available under this License.
-
- 1.6. "Larger Work" means a work which combines Covered Software or
- portions thereof with code not governed by the terms of this
- License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the maximum
- extent possible, whether at the time of the initial grant or
- subsequently acquired, any and all of the rights conveyed
- herein.
-
- 1.9. "Modifications" means the Source Code and Executable form of
- any of the following:
-
- A. Any file that results from an addition to, deletion from or
- modification of the contents of a file containing Original
- Software or previous Modifications;
-
- B. Any new file that contains any part of the Original
- Software or previous Modifications; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and Executable
- form of computer software code that is originally released
- under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned or
- hereafter acquired, including without limitation, method,
- process, and apparatus claims, in any patent Licensable by
- grantor.
-
- 1.12. "Source Code" means (a) the common form of computer software
- code in which modifications are made and (b) associated
- documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal entity
- exercising rights under, and complying with all of the terms
- of, this License. For legal entities, "You" includes any
- entity which controls, is controlled by, or is under common
- control with You. For purposes of this definition,
- "control" means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by
- contract or otherwise, or (b) ownership of more than fifty
- percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the Initial
- Developer hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than patent or
- trademark) Licensable by Initial Developer, to use,
- reproduce, modify, display, perform, sublicense and
- distribute the Original Software (or portions thereof),
- with or without Modifications, and/or as part of a Larger
- Work; and
-
- (b) under Patent Claims infringed by the making, using or
- selling of Original Software, to make, have made, use,
- practice, sell, and offer for sale, and/or otherwise
- dispose of the Original Software (or portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b) are
- effective on the date Initial Developer first distributes
- or otherwise makes the Original Software available to a
- third party under the terms of this License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent license is
- granted: (1) for code that You delete from the Original
- Software, or (2) for infringements caused by: (i) the
- modification of the Original Software, or (ii) the
- combination of the Original Software with other software
- or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than patent or
- trademark) Licensable by Contributor to use, reproduce,
- modify, display, perform, sublicense and distribute the
- Modifications created by such Contributor (or portions
- thereof), either on an unmodified basis, with other
- Modifications, as Covered Software and/or as part of a
- Larger Work; and
-
- (b) under Patent Claims infringed by the making, using, or
- selling of Modifications made by that Contributor either
- alone and/or in combination with its Contributor Version
- (or portions of such combination), to make, use, sell,
- offer for sale, have made, and/or otherwise dispose of:
- (1) Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications made by
- that Contributor with its Contributor Version (or portions
- of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and 2.2(b) are
- effective on the date Contributor first distributes or
- otherwise makes the Modifications available to a third
- party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent license is
- granted: (1) for any code that Contributor has deleted
- from the Contributor Version; (2) for infringements caused
- by: (i) third party modifications of Contributor Version,
- or (ii) the combination of Modifications made by that
- Contributor with other software (except as part of the
- Contributor Version) or other devices; or (3) under Patent
- Claims infringed by Covered Software in the absence of
- Modifications made by that Contributor.
-
-3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in Source
- Code form and that Source Code form must be distributed only under
- the terms of this License. You must include a copy of this
- License with every copy of the Source Code form of the Covered
- Software You distribute or otherwise make available. You must
- inform recipients of any such Covered Software in Executable form
- as to how they can obtain such Covered Software in Source Code
- form in a reasonable manner on or through a medium customarily
- used for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You contribute are
- governed by the terms of this License. You represent that You
- believe Your Modifications are Your original creation(s) and/or
- You have sufficient rights to grant the rights conveyed by this
- License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications that
- identifies You as the Contributor of the Modification. You may
- not remove or alter any copyright, patent or trademark notices
- contained within the Covered Software, or any notices of licensing
- or any descriptive text giving attribution to any Contributor or
- the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered Software in
- Source Code form that alters or restricts the applicable version
- of this License or the recipients' rights hereunder. You may
- choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of
- Covered Software. However, you may do so only on Your own behalf,
- and not on behalf of the Initial Developer or any Contributor.
- You must make it absolutely clear that any such warranty, support,
- indemnity or liability obligation is offered by You alone, and You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial Developer or
- such Contributor as a result of warranty, support, indemnity or
- liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered Software
- under the terms of this License or under the terms of a license of
- Your choice, which may contain terms different from this License,
- provided that You are in compliance with the terms of this License
- and that the license for the Executable form does not attempt to
- limit or alter the recipient's rights in the Source Code form from
- the rights set forth in this License. If You distribute the
- Covered Software in Executable form under a different license, You
- must make it absolutely clear that any terms which differ from
- this License are offered by You alone, not by the Initial
- Developer or Contributor. You hereby agree to indemnify the
- Initial Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of any
- such terms You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software with
- other code not governed by the terms of this License and
- distribute the Larger Work as a single product. In such a case,
- You must make sure the requirements of this License are fulfilled
- for the Covered Software.
-
-4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and may
- publish revised and/or new versions of this License from time to
- time. Each version will be given a distinguishing version number.
- Except as provided in Section 4.3, no one other than the license
- steward has the right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise make the
- Covered Software available under the terms of the version of the
- License under which You originally received the Covered Software.
- If the Initial Developer includes a notice in the Original
- Software prohibiting it from being distributed or otherwise made
- available under any subsequent version of the License, You must
- distribute and make the Covered Software available under the terms
- of the version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to use,
- distribute or otherwise make the Covered Software available under
- the terms of any subsequent version of the License published by
- the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a new
- license for Your Original Software, You may create and use a
- modified version of this License if You: (a) rename the license
- and remove any references to the name of the license steward
- (except to note that the license differs from this License); and
- (b) otherwise make it clear that the license contains terms which
- differ from this License.
-
-5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
- NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
-6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will terminate
- automatically if You fail to comply with terms herein and fail to
- cure such breach within 30 days of becoming aware of the breach.
- Provisions which, by their nature, must remain in effect beyond
- the termination of this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or a
- Contributor (the Initial Developer or Contributor against whom You
- assert such claim is referred to as "Participant") alleging that
- the Participant Software (meaning the Contributor Version where
- the Participant is a Contributor or the Original Software where
- the Participant is the Initial Developer) directly or indirectly
- infringes any patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial Developer (if
- the Initial Developer is not the Participant) and all Contributors
- under Sections 2.1 and/or 2.2 of this License shall, upon 60 days
- notice from Participant terminate prospectively and automatically
- at the expiration of such 60 day notice period, unless if within
- such 60 day period You withdraw Your claim with respect to the
- Participant Software against such Participant either unilaterally
- or pursuant to a written agreement with Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2 above,
- all end user licenses that have been validly granted by You or any
- distributor hereunder prior to termination (excluding licenses
- granted to You by any distributor) shall survive termination.
-
-7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
-8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48
- C.F.R. 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212
- (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48
- C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all
- U.S. Government End Users acquire Covered Software with only those
- rights set forth herein. This U.S. Government Rights clause is in
- lieu of, and supersedes, any other FAR, DFAR, or other clause or
- provision that addresses Government rights in computer software
- under this License.
-
-9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent
- necessary to make it enforceable. This License shall be governed
- by the law of the jurisdiction specified in a notice contained
- within the Original Software (except to the extent applicable law,
- if any, provides otherwise), excluding such jurisdiction's
- conflict-of-law provisions. Any litigation relating to this
- License shall be subject to the jurisdiction of the courts located
- in the jurisdiction and venue specified in a notice contained
- within the Original Software, with the losing party responsible
- for costs, including, without limitation, court costs and
- reasonable attorneys' fees and expenses. The application of the
- United Nations Convention on Contracts for the International Sale
- of Goods is expressly excluded. Any law or regulation which
- provides that the language of a contract shall be construed
- against the drafter shall not apply to this License. You agree
- that You alone are responsible for compliance with the United
- States export administration regulations (and the export control
- laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
-10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
---------------------------------------------------------------------
-
-NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
-DISTRIBUTION LICENSE (CDDL)
-
-For Covered Software in this distribution, this License shall
-be governed by the laws of the State of California (excluding
-conflict-of-law provisions).
-
-Any litigation relating to this License shall be subject to the
-jurisdiction of the Federal Courts of the Northern District of
-California and the state courts of the State of California, with
-venue lying in Santa Clara County, California.
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/README.md b/archived/event-adapter/vendor/github.com/howeyc/gopass/README.md
deleted file mode 100644
index 2d6a4e72c..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# getpasswd in Go [![GoDoc](https://godoc.org/github.com/howeyc/gopass?status.svg)](https://godoc.org/github.com/howeyc/gopass) [![Build Status](https://secure.travis-ci.org/howeyc/gopass.png?branch=master)](http://travis-ci.org/howeyc/gopass)
-
-Retrieve password from user terminal or piped input without echo.
-
-Verified on BSD, Linux, and Windows.
-
-Example:
-```go
-package main
-
-import "fmt"
-import "github.com/howeyc/gopass"
-
-func main() {
- fmt.Printf("Password: ")
-
- // Silent. For printing *'s use gopass.GetPasswdMasked()
- pass, err := gopass.GetPasswd()
- if err != nil {
- // Handle gopass.ErrInterrupted or getch() read error
- }
-
- // Do something with pass
-}
-```
-
-Caution: Multi-byte characters not supported!
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/pass.go b/archived/event-adapter/vendor/github.com/howeyc/gopass/pass.go
deleted file mode 100644
index 31c853ae2..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/pass.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package gopass
-
-import (
- "errors"
- "fmt"
- "io"
- "os"
-)
-
-var defaultGetCh = func() (byte, error) {
- buf := make([]byte, 1)
- if n, err := os.Stdin.Read(buf); n == 0 || err != nil {
- if err != nil {
- return 0, err
- }
- return 0, io.EOF
- }
- return buf[0], nil
-}
-
-var (
- maxLength = 512
- ErrInterrupted = errors.New("interrupted")
- ErrMaxLengthExceeded = fmt.Errorf("maximum byte limit (%v) exceeded", maxLength)
-
- // Provide variable so that tests can provide a mock implementation.
- getch = defaultGetCh
-)
-
-// getPasswd returns the input read from terminal.
-// If masked is true, typing will be matched by asterisks on the screen.
-// Otherwise, typing will echo nothing.
-func getPasswd(masked bool) ([]byte, error) {
- var err error
- var pass, bs, mask []byte
- if masked {
- bs = []byte("\b \b")
- mask = []byte("*")
- }
-
- if isTerminal(os.Stdin.Fd()) {
- if oldState, err := makeRaw(os.Stdin.Fd()); err != nil {
- return pass, err
- } else {
- defer restore(os.Stdin.Fd(), oldState)
- }
- }
-
- // Track total bytes read, not just bytes in the password. This ensures any
- // errors that might flood the console with nil or -1 bytes infinitely are
- // capped.
- var counter int
- for counter = 0; counter <= maxLength; counter++ {
- if v, e := getch(); e != nil {
- err = e
- break
- } else if v == 127 || v == 8 {
- if l := len(pass); l > 0 {
- pass = pass[:l-1]
- fmt.Print(string(bs))
- }
- } else if v == 13 || v == 10 {
- break
- } else if v == 3 {
- err = ErrInterrupted
- break
- } else if v != 0 {
- pass = append(pass, v)
- fmt.Print(string(mask))
- }
- }
-
- if counter > maxLength {
- err = ErrMaxLengthExceeded
- }
-
- fmt.Println()
- return pass, err
-}
-
-// GetPasswd returns the password read from the terminal without echoing input.
-// The returned byte array does not include end-of-line characters.
-func GetPasswd() ([]byte, error) {
- return getPasswd(false)
-}
-
-// GetPasswdMasked returns the password read from the terminal, echoing asterisks.
-// The returned byte array does not include end-of-line characters.
-func GetPasswdMasked() ([]byte, error) {
- return getPasswd(true)
-}
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal.go b/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal.go
deleted file mode 100644
index 083564146..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build !solaris
-
-package gopass
-
-import "golang.org/x/crypto/ssh/terminal"
-
-type terminalState struct {
- state *terminal.State
-}
-
-func isTerminal(fd uintptr) bool {
- return terminal.IsTerminal(int(fd))
-}
-
-func makeRaw(fd uintptr) (*terminalState, error) {
- state, err := terminal.MakeRaw(int(fd))
-
- return &terminalState{
- state: state,
- }, err
-}
-
-func restore(fd uintptr, oldState *terminalState) error {
- return terminal.Restore(int(fd), oldState.state)
-}
diff --git a/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal_solaris.go b/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal_solaris.go
deleted file mode 100644
index 257e1b4e8..000000000
--- a/archived/event-adapter/vendor/github.com/howeyc/gopass/terminal_solaris.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-// Below is derived from Solaris source, so CDDL license is included.
-
-package gopass
-
-import (
- "syscall"
-
- "golang.org/x/sys/unix"
-)
-
-type terminalState struct {
- state *unix.Termios
-}
-
-// isTerminal returns true if there is a terminal attached to the given
-// file descriptor.
-// Source: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
-func isTerminal(fd uintptr) bool {
- var termio unix.Termio
- err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
- return err == nil
-}
-
-// makeRaw puts the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-// Source: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libast/common/uwin/getpass.c
-func makeRaw(fd uintptr) (*terminalState, error) {
- oldTermiosPtr, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
- if err != nil {
- return nil, err
- }
- oldTermios := *oldTermiosPtr
-
- newTermios := oldTermios
- newTermios.Lflag &^= syscall.ECHO | syscall.ECHOE | syscall.ECHOK | syscall.ECHONL
- if err := unix.IoctlSetTermios(int(fd), unix.TCSETS, &newTermios); err != nil {
- return nil, err
- }
-
- return &terminalState{
- state: oldTermiosPtr,
- }, nil
-}
-
-func restore(fd uintptr, oldState *terminalState) error {
- return unix.IoctlSetTermios(int(fd), unix.TCSETS, oldState.state)
-}
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/.travis.yml b/archived/event-adapter/vendor/github.com/imdario/mergo/.travis.yml
deleted file mode 100644
index 9d91c6339..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/.travis.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-language: go
-install: go get -t
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/LICENSE b/archived/event-adapter/vendor/github.com/imdario/mergo/LICENSE
deleted file mode 100644
index 686680298..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2013 Dario Castañé. All rights reserved.
-Copyright (c) 2012 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/README.md b/archived/event-adapter/vendor/github.com/imdario/mergo/README.md
deleted file mode 100644
index cdcea0f65..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Mergo
-
-A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements.
-
-Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region Marche.
-
-![Mergo dall'alto](http://www.comune.mergo.an.it/Siti/Mergo/Immagini/Foto/mergo_dall_alto.jpg)
-
-## Status
-
-It is ready for production use. It works fine although it may use more of testing. Here some projects in the wild using Mergo:
-
-- [EagerIO/Stout](https://github.com/EagerIO/Stout)
-- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api)
-- [russross/canvasassignments](https://github.com/russross/canvasassignments)
-- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api)
-- [casualjim/exeggutor](https://github.com/casualjim/exeggutor)
-- [divshot/gitling](https://github.com/divshot/gitling)
-- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl)
-
-[![Build Status][1]][2]
-[![GoDoc](https://godoc.org/github.com/imdario/mergo?status.svg)](https://godoc.org/github.com/imdario/mergo)
-
-[1]: https://travis-ci.org/imdario/mergo.png
-[2]: https://travis-ci.org/imdario/mergo
-
-## Installation
-
- go get github.com/imdario/mergo
-
- // use in your .go code
- import (
- "github.com/imdario/mergo"
- )
-
-## Usage
-
-You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection).
-
- if err := mergo.Merge(&dst, src); err != nil {
- // ...
- }
-
-Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field.
-
- if err := mergo.Map(&dst, srcMap); err != nil {
- // ...
- }
-
-Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values.
-
-More information and examples in [godoc documentation](http://godoc.org/github.com/imdario/mergo).
-
-Note: if test are failing due missing package, please execute:
-
- go get gopkg.in/yaml.v1
-
-## Contact me
-
-If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario)
-
-## About
-
-Written by [Dario Castañé](http://dario.im).
-
-## License
-
-[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE).
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/doc.go b/archived/event-adapter/vendor/github.com/imdario/mergo/doc.go
deleted file mode 100644
index 6e9aa7baf..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/doc.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package mergo merges same-type structs and maps by setting default values in zero-value fields.
-
-Mergo won't merge unexported (private) fields but will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection).
-
-Usage
-
-From my own work-in-progress project:
-
- type networkConfig struct {
- Protocol string
- Address string
- ServerType string `json: "server_type"`
- Port uint16
- }
-
- type FssnConfig struct {
- Network networkConfig
- }
-
- var fssnDefault = FssnConfig {
- networkConfig {
- "tcp",
- "127.0.0.1",
- "http",
- 31560,
- },
- }
-
- // Inside a function [...]
-
- if err := mergo.Merge(&config, fssnDefault); err != nil {
- log.Fatal(err)
- }
-
- // More code [...]
-
-*/
-package mergo
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/map.go b/archived/event-adapter/vendor/github.com/imdario/mergo/map.go
deleted file mode 100644
index 44361e88b..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/map.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2014 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "fmt"
- "reflect"
- "unicode"
- "unicode/utf8"
-)
-
-func changeInitialCase(s string, mapper func(rune) rune) string {
- if s == "" {
- return s
- }
- r, n := utf8.DecodeRuneInString(s)
- return string(mapper(r)) + s[n:]
-}
-
-func isExported(field reflect.StructField) bool {
- r, _ := utf8.DecodeRuneInString(field.Name)
- return r >= 'A' && r <= 'Z'
-}
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) {
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
- zeroValue := reflect.Value{}
- switch dst.Kind() {
- case reflect.Map:
- dstMap := dst.Interface().(map[string]interface{})
- for i, n := 0, src.NumField(); i < n; i++ {
- srcType := src.Type()
- field := srcType.Field(i)
- if !isExported(field) {
- continue
- }
- fieldName := field.Name
- fieldName = changeInitialCase(fieldName, unicode.ToLower)
- if v, ok := dstMap[fieldName]; !ok || isEmptyValue(reflect.ValueOf(v)) {
- dstMap[fieldName] = src.Field(i).Interface()
- }
- }
- case reflect.Struct:
- srcMap := src.Interface().(map[string]interface{})
- for key := range srcMap {
- srcValue := srcMap[key]
- fieldName := changeInitialCase(key, unicode.ToUpper)
- dstElement := dst.FieldByName(fieldName)
- if dstElement == zeroValue {
- // We discard it because the field doesn't exist.
- continue
- }
- srcElement := reflect.ValueOf(srcValue)
- dstKind := dstElement.Kind()
- srcKind := srcElement.Kind()
- if srcKind == reflect.Ptr && dstKind != reflect.Ptr {
- srcElement = srcElement.Elem()
- srcKind = reflect.TypeOf(srcElement.Interface()).Kind()
- } else if dstKind == reflect.Ptr {
- // Can this work? I guess it can't.
- if srcKind != reflect.Ptr && srcElement.CanAddr() {
- srcPtr := srcElement.Addr()
- srcElement = reflect.ValueOf(srcPtr)
- srcKind = reflect.Ptr
- }
- }
- if !srcElement.IsValid() {
- continue
- }
- if srcKind == dstKind {
- if err = deepMerge(dstElement, srcElement, visited, depth+1); err != nil {
- return
- }
- } else {
- if srcKind == reflect.Map {
- if err = deepMap(dstElement, srcElement, visited, depth+1); err != nil {
- return
- }
- } else {
- return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind)
- }
- }
- }
- }
- return
-}
-
-// Map sets fields' values in dst from src.
-// src can be a map with string keys or a struct. dst must be the opposite:
-// if src is a map, dst must be a valid pointer to struct. If src is a struct,
-// dst must be map[string]interface{}.
-// It won't merge unexported (private) fields and will do recursively
-// any exported field.
-// If dst is a map, keys will be src fields' names in lower camel case.
-// Missing key in src that doesn't match a field in dst will be skipped. This
-// doesn't apply if dst is a map.
-// This is separated method from Merge because it is cleaner and it keeps sane
-// semantics: merging equal types, mapping different (restricted) types.
-func Map(dst, src interface{}) error {
- var (
- vDst, vSrc reflect.Value
- err error
- )
- if vDst, vSrc, err = resolveValues(dst, src); err != nil {
- return err
- }
- // To be friction-less, we redirect equal-type arguments
- // to deepMerge. Only because arguments can be anything.
- if vSrc.Kind() == vDst.Kind() {
- return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0)
- }
- switch vSrc.Kind() {
- case reflect.Struct:
- if vDst.Kind() != reflect.Map {
- return ErrExpectedMapAsDestination
- }
- case reflect.Map:
- if vDst.Kind() != reflect.Struct {
- return ErrExpectedStructAsDestination
- }
- default:
- return ErrNotSupported
- }
- return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0)
-}
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/merge.go b/archived/event-adapter/vendor/github.com/imdario/mergo/merge.go
deleted file mode 100644
index 5d328b1fe..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/merge.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "reflect"
-)
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) {
- if !src.IsValid() {
- return
- }
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
- switch dst.Kind() {
- case reflect.Struct:
- for i, n := 0, dst.NumField(); i < n; i++ {
- if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1); err != nil {
- return
- }
- }
- case reflect.Map:
- for _, key := range src.MapKeys() {
- srcElement := src.MapIndex(key)
- if !srcElement.IsValid() {
- continue
- }
- dstElement := dst.MapIndex(key)
- switch reflect.TypeOf(srcElement.Interface()).Kind() {
- case reflect.Struct:
- fallthrough
- case reflect.Map:
- if err = deepMerge(dstElement, srcElement, visited, depth+1); err != nil {
- return
- }
- }
- if !dstElement.IsValid() {
- dst.SetMapIndex(key, srcElement)
- }
- }
- case reflect.Ptr:
- fallthrough
- case reflect.Interface:
- if src.IsNil() {
- break
- } else if dst.IsNil() {
- if dst.CanSet() && isEmptyValue(dst) {
- dst.Set(src)
- }
- } else if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1); err != nil {
- return
- }
- default:
- if dst.CanSet() && !isEmptyValue(src) {
- dst.Set(src)
- }
- }
- return
-}
-
-// Merge sets fields' values in dst from src if they have a zero
-// value of their type.
-// dst and src must be valid same-type structs and dst must be
-// a pointer to struct.
-// It won't merge unexported (private) fields and will do recursively
-// any exported field.
-func Merge(dst, src interface{}) error {
- var (
- vDst, vSrc reflect.Value
- err error
- )
- if vDst, vSrc, err = resolveValues(dst, src); err != nil {
- return err
- }
- if vDst.Type() != vSrc.Type() {
- return ErrDifferentArgumentsTypes
- }
- return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0)
-}
diff --git a/archived/event-adapter/vendor/github.com/imdario/mergo/mergo.go b/archived/event-adapter/vendor/github.com/imdario/mergo/mergo.go
deleted file mode 100644
index f8a0991ec..000000000
--- a/archived/event-adapter/vendor/github.com/imdario/mergo/mergo.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "errors"
- "reflect"
-)
-
-// Errors reported by Mergo when it finds invalid arguments.
-var (
- ErrNilArguments = errors.New("src and dst must not be nil")
- ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type")
- ErrNotSupported = errors.New("only structs and maps are supported")
- ErrExpectedMapAsDestination = errors.New("dst was expected to be a map")
- ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct")
-)
-
-// During deepMerge, must keep track of checks that are
-// in progress. The comparison algorithm assumes that all
-// checks in progress are true when it reencounters them.
-// Visited are stored in a map indexed by 17 * a1 + a2;
-type visit struct {
- ptr uintptr
- typ reflect.Type
- next *visit
-}
-
-// From src/pkg/encoding/json.
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- }
- return false
-}
-
-func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) {
- if dst == nil || src == nil {
- err = ErrNilArguments
- return
- }
- vDst = reflect.ValueOf(dst).Elem()
- if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map {
- err = ErrNotSupported
- return
- }
- vSrc = reflect.ValueOf(src)
- // We check if vSrc is a pointer to dereference it.
- if vSrc.Kind() == reflect.Ptr {
- vSrc = vSrc.Elem()
- }
- return
-}
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deeper(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) {
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
- return // TODO refactor
-}
diff --git a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/LICENSE b/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/LICENSE
deleted file mode 100644
index 5f0d1fb6a..000000000
--- a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2014 Alan Shreve
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/README.md b/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/README.md
deleted file mode 100644
index 7a950d177..000000000
--- a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# mousetrap
-
-mousetrap is a tiny library that answers a single question.
-
-On a Windows machine, was the process invoked by someone double clicking on
-the executable file while browsing in explorer?
-
-### Motivation
-
-Windows developers unfamiliar with command line tools will often "double-click"
-the executable for a tool. Because most CLI tools print the help and then exit
-when invoked without arguments, this is often very frustrating for those users.
-
-mousetrap provides a way to detect these invocations so that you can provide
-more helpful behavior and instructions on how to run the CLI tool. To see what
-this looks like, both from an organizational and a technical perspective, see
-https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/
-
-### The interface
-
-The library exposes a single interface:
-
- func StartedByExplorer() (bool)
diff --git a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_others.go
deleted file mode 100644
index 9d2d8a4ba..000000000
--- a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_others.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mousetrap
-
-// StartedByExplorer returns true if the program was invoked by the user
-// double-clicking on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-//
-// On non-Windows platforms, it always returns false.
-func StartedByExplorer() bool {
- return false
-}
diff --git a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
deleted file mode 100644
index 336142a5e..000000000
--- a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// +build windows
-// +build !go1.4
-
-package mousetrap
-
-import (
- "fmt"
- "os"
- "syscall"
- "unsafe"
-)
-
-const (
- // defined by the Win32 API
- th32cs_snapprocess uintptr = 0x2
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot")
- Process32First = kernel.MustFindProc("Process32FirstW")
- Process32Next = kernel.MustFindProc("Process32NextW")
-)
-
-// ProcessEntry32 structure defined by the Win32 API
-type processEntry32 struct {
- dwSize uint32
- cntUsage uint32
- th32ProcessID uint32
- th32DefaultHeapID int
- th32ModuleID uint32
- cntThreads uint32
- th32ParentProcessID uint32
- pcPriClassBase int32
- dwFlags uint32
- szExeFile [syscall.MAX_PATH]uint16
-}
-
-func getProcessEntry(pid int) (pe *processEntry32, err error) {
- snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0))
- if snapshot == uintptr(syscall.InvalidHandle) {
- err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1)
- return
- }
- defer syscall.CloseHandle(syscall.Handle(snapshot))
-
- var processEntry processEntry32
- processEntry.dwSize = uint32(unsafe.Sizeof(processEntry))
- ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32First: %v", e1)
- return
- }
-
- for {
- if processEntry.th32ProcessID == uint32(pid) {
- pe = &processEntry
- return
- }
-
- ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32Next: %v", e1)
- return
- }
- }
-}
-
-func getppid() (pid int, err error) {
- pe, err := getProcessEntry(os.Getpid())
- if err != nil {
- return
- }
-
- pid = int(pe.th32ParentProcessID)
- return
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- ppid, err := getppid()
- if err != nil {
- return false
- }
-
- pe, err := getProcessEntry(ppid)
- if err != nil {
- return false
- }
-
- name := syscall.UTF16ToString(pe.szExeFile[:])
- return name == "explorer.exe"
-}
diff --git a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
deleted file mode 100644
index 9a28e57c3..000000000
--- a/archived/event-adapter/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build windows
-// +build go1.4
-
-package mousetrap
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
- snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(snapshot)
- var procEntry syscall.ProcessEntry32
- procEntry.Size = uint32(unsafe.Sizeof(procEntry))
- if err = syscall.Process32First(snapshot, &procEntry); err != nil {
- return nil, err
- }
- for {
- if procEntry.ProcessID == uint32(pid) {
- return &procEntry, nil
- }
- err = syscall.Process32Next(snapshot, &procEntry)
- if err != nil {
- return nil, err
- }
- }
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- pe, err := getProcessEntry(os.Getppid())
- if err != nil {
- return false
- }
- return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
-}
diff --git a/archived/event-adapter/vendor/github.com/juju/ratelimit/LICENSE b/archived/event-adapter/vendor/github.com/juju/ratelimit/LICENSE
deleted file mode 100644
index ade9307b3..000000000
--- a/archived/event-adapter/vendor/github.com/juju/ratelimit/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-All files in this repository are licensed as follows. If you contribute
-to this repository, it is assumed that you license your contribution
-under the same license unless you state otherwise.
-
-All files Copyright (C) 2015 Canonical Ltd. unless otherwise specified in the file.
-
-This software is licensed under the LGPLv3, included below.
-
-As a special exception to the GNU Lesser General Public License version 3
-("LGPL3"), the copyright holders of this Library give you permission to
-convey to a third party a Combined Work that links statically or dynamically
-to this Library without providing any Minimal Corresponding Source or
-Minimal Application Code as set out in 4d or providing the installation
-information set out in section 4e, provided that you comply with the other
-provisions of LGPL3 and provided that you meet, for the Application the
-terms and conditions of the license(s) which apply to the Application.
-
-Except as stated in this special exception, the provisions of LGPL3 will
-continue to comply in full to this Library. If you modify this Library, you
-may apply this exception to your version of this Library, but you are not
-obliged to do so. If you do not wish to do so, delete this exception
-statement from your version. This exception does not (and cannot) modify any
-license terms which apply to the Application, with which you must still
-comply.
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/archived/event-adapter/vendor/github.com/juju/ratelimit/README.md b/archived/event-adapter/vendor/github.com/juju/ratelimit/README.md
deleted file mode 100644
index a0fdfe2b1..000000000
--- a/archived/event-adapter/vendor/github.com/juju/ratelimit/README.md
+++ /dev/null
@@ -1,117 +0,0 @@
-# ratelimit
---
- import "github.com/juju/ratelimit"
-
-The ratelimit package provides an efficient token bucket implementation. See
-http://en.wikipedia.org/wiki/Token_bucket.
-
-## Usage
-
-#### func Reader
-
-```go
-func Reader(r io.Reader, bucket *Bucket) io.Reader
-```
-Reader returns a reader that is rate limited by the given token bucket. Each
-token in the bucket represents one byte.
-
-#### func Writer
-
-```go
-func Writer(w io.Writer, bucket *Bucket) io.Writer
-```
-Writer returns a writer that is rate limited by the given token bucket. Each
-token in the bucket represents one byte.
-
-#### type Bucket
-
-```go
-type Bucket struct {
-}
-```
-
-Bucket represents a token bucket that fills at a predetermined rate. Methods on
-Bucket may be called concurrently.
-
-#### func NewBucket
-
-```go
-func NewBucket(fillInterval time.Duration, capacity int64) *Bucket
-```
-NewBucket returns a new token bucket that fills at the rate of one token every
-fillInterval, up to the given maximum capacity. Both arguments must be positive.
-The bucket is initially full.
-
-#### func NewBucketWithQuantum
-
-```go
-func NewBucketWithQuantum(fillInterval time.Duration, capacity, quantum int64) *Bucket
-```
-NewBucketWithQuantum is similar to NewBucket, but allows the specification of
-the quantum size - quantum tokens are added every fillInterval.
-
-#### func NewBucketWithRate
-
-```go
-func NewBucketWithRate(rate float64, capacity int64) *Bucket
-```
-NewBucketWithRate returns a token bucket that fills the bucket at the rate of
-rate tokens per second up to the given maximum capacity. Because of limited
-clock resolution, at high rates, the actual rate may be up to 1% different from
-the specified rate.
-
-#### func (*Bucket) Rate
-
-```go
-func (tb *Bucket) Rate() float64
-```
-Rate returns the fill rate of the bucket, in tokens per second.
-
-#### func (*Bucket) Take
-
-```go
-func (tb *Bucket) Take(count int64) time.Duration
-```
-Take takes count tokens from the bucket without blocking. It returns the time
-that the caller should wait until the tokens are actually available.
-
-Note that if the request is irrevocable - there is no way to return tokens to
-the bucket once this method commits us to taking them.
-
-#### func (*Bucket) TakeAvailable
-
-```go
-func (tb *Bucket) TakeAvailable(count int64) int64
-```
-TakeAvailable takes up to count immediately available tokens from the bucket. It
-returns the number of tokens removed, or zero if there are no available tokens.
-It does not block.
-
-#### func (*Bucket) TakeMaxDuration
-
-```go
-func (tb *Bucket) TakeMaxDuration(count int64, maxWait time.Duration) (time.Duration, bool)
-```
-TakeMaxDuration is like Take, except that it will only take tokens from the
-bucket if the wait time for the tokens is no greater than maxWait.
-
-If it would take longer than maxWait for the tokens to become available, it does
-nothing and reports false, otherwise it returns the time that the caller should
-wait until the tokens are actually available, and reports true.
-
-#### func (*Bucket) Wait
-
-```go
-func (tb *Bucket) Wait(count int64)
-```
-Wait takes count tokens from the bucket, waiting until they are available.
-
-#### func (*Bucket) WaitMaxDuration
-
-```go
-func (tb *Bucket) WaitMaxDuration(count int64, maxWait time.Duration) bool
-```
-WaitMaxDuration is like Wait except that it will only take tokens from the
-bucket if it needs to wait for no greater than maxWait. It reports whether any
-tokens have been removed from the bucket If no tokens have been removed, it
-returns immediately.
diff --git a/archived/event-adapter/vendor/github.com/juju/ratelimit/ratelimit.go b/archived/event-adapter/vendor/github.com/juju/ratelimit/ratelimit.go
deleted file mode 100644
index 3ef32fbcc..000000000
--- a/archived/event-adapter/vendor/github.com/juju/ratelimit/ratelimit.go
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2014 Canonical Ltd.
-// Licensed under the LGPLv3 with static-linking exception.
-// See LICENCE file for details.
-
-// The ratelimit package provides an efficient token bucket implementation
-// that can be used to limit the rate of arbitrary things.
-// See http://en.wikipedia.org/wiki/Token_bucket.
-package ratelimit
-
-import (
- "math"
- "strconv"
- "sync"
- "time"
-)
-
-// Bucket represents a token bucket that fills at a predetermined rate.
-// Methods on Bucket may be called concurrently.
-type Bucket struct {
- startTime time.Time
- capacity int64
- quantum int64
- fillInterval time.Duration
-
- // The mutex guards the fields following it.
- mu sync.Mutex
-
- // avail holds the number of available tokens
- // in the bucket, as of availTick ticks from startTime.
- // It will be negative when there are consumers
- // waiting for tokens.
- avail int64
- availTick int64
-}
-
-// NewBucket returns a new token bucket that fills at the
-// rate of one token every fillInterval, up to the given
-// maximum capacity. Both arguments must be
-// positive. The bucket is initially full.
-func NewBucket(fillInterval time.Duration, capacity int64) *Bucket {
- return NewBucketWithQuantum(fillInterval, capacity, 1)
-}
-
-// rateMargin specifes the allowed variance of actual
-// rate from specified rate. 1% seems reasonable.
-const rateMargin = 0.01
-
-// NewBucketWithRate returns a token bucket that fills the bucket
-// at the rate of rate tokens per second up to the given
-// maximum capacity. Because of limited clock resolution,
-// at high rates, the actual rate may be up to 1% different from the
-// specified rate.
-func NewBucketWithRate(rate float64, capacity int64) *Bucket {
- for quantum := int64(1); quantum < 1<<50; quantum = nextQuantum(quantum) {
- fillInterval := time.Duration(1e9 * float64(quantum) / rate)
- if fillInterval <= 0 {
- continue
- }
- tb := NewBucketWithQuantum(fillInterval, capacity, quantum)
- if diff := math.Abs(tb.Rate() - rate); diff/rate <= rateMargin {
- return tb
- }
- }
- panic("cannot find suitable quantum for " + strconv.FormatFloat(rate, 'g', -1, 64))
-}
-
-// nextQuantum returns the next quantum to try after q.
-// We grow the quantum exponentially, but slowly, so we
-// get a good fit in the lower numbers.
-func nextQuantum(q int64) int64 {
- q1 := q * 11 / 10
- if q1 == q {
- q1++
- }
- return q1
-}
-
-// NewBucketWithQuantum is similar to NewBucket, but allows
-// the specification of the quantum size - quantum tokens
-// are added every fillInterval.
-func NewBucketWithQuantum(fillInterval time.Duration, capacity, quantum int64) *Bucket {
- if fillInterval <= 0 {
- panic("token bucket fill interval is not > 0")
- }
- if capacity <= 0 {
- panic("token bucket capacity is not > 0")
- }
- if quantum <= 0 {
- panic("token bucket quantum is not > 0")
- }
- return &Bucket{
- startTime: time.Now(),
- capacity: capacity,
- quantum: quantum,
- avail: capacity,
- fillInterval: fillInterval,
- }
-}
-
-// Wait takes count tokens from the bucket, waiting until they are
-// available.
-func (tb *Bucket) Wait(count int64) {
- if d := tb.Take(count); d > 0 {
- time.Sleep(d)
- }
-}
-
-// WaitMaxDuration is like Wait except that it will
-// only take tokens from the bucket if it needs to wait
-// for no greater than maxWait. It reports whether
-// any tokens have been removed from the bucket
-// If no tokens have been removed, it returns immediately.
-func (tb *Bucket) WaitMaxDuration(count int64, maxWait time.Duration) bool {
- d, ok := tb.TakeMaxDuration(count, maxWait)
- if d > 0 {
- time.Sleep(d)
- }
- return ok
-}
-
-const infinityDuration time.Duration = 0x7fffffffffffffff
-
-// Take takes count tokens from the bucket without blocking. It returns
-// the time that the caller should wait until the tokens are actually
-// available.
-//
-// Note that if the request is irrevocable - there is no way to return
-// tokens to the bucket once this method commits us to taking them.
-func (tb *Bucket) Take(count int64) time.Duration {
- d, _ := tb.take(time.Now(), count, infinityDuration)
- return d
-}
-
-// TakeMaxDuration is like Take, except that
-// it will only take tokens from the bucket if the wait
-// time for the tokens is no greater than maxWait.
-//
-// If it would take longer than maxWait for the tokens
-// to become available, it does nothing and reports false,
-// otherwise it returns the time that the caller should
-// wait until the tokens are actually available, and reports
-// true.
-func (tb *Bucket) TakeMaxDuration(count int64, maxWait time.Duration) (time.Duration, bool) {
- return tb.take(time.Now(), count, maxWait)
-}
-
-// TakeAvailable takes up to count immediately available tokens from the
-// bucket. It returns the number of tokens removed, or zero if there are
-// no available tokens. It does not block.
-func (tb *Bucket) TakeAvailable(count int64) int64 {
- return tb.takeAvailable(time.Now(), count)
-}
-
-// takeAvailable is the internal version of TakeAvailable - it takes the
-// current time as an argument to enable easy testing.
-func (tb *Bucket) takeAvailable(now time.Time, count int64) int64 {
- if count <= 0 {
- return 0
- }
- tb.mu.Lock()
- defer tb.mu.Unlock()
-
- tb.adjust(now)
- if tb.avail <= 0 {
- return 0
- }
- if count > tb.avail {
- count = tb.avail
- }
- tb.avail -= count
- return count
-}
-
-// Available returns the number of available tokens. It will be negative
-// when there are consumers waiting for tokens. Note that if this
-// returns greater than zero, it does not guarantee that calls that take
-// tokens from the buffer will succeed, as the number of available
-// tokens could have changed in the meantime. This method is intended
-// primarily for metrics reporting and debugging.
-func (tb *Bucket) Available() int64 {
- return tb.available(time.Now())
-}
-
-// available is the internal version of available - it takes the current time as
-// an argument to enable easy testing.
-func (tb *Bucket) available(now time.Time) int64 {
- tb.mu.Lock()
- defer tb.mu.Unlock()
- tb.adjust(now)
- return tb.avail
-}
-
-// Capacity returns the capacity that the bucket was created with.
-func (tb *Bucket) Capacity() int64 {
- return tb.capacity
-}
-
-// Rate returns the fill rate of the bucket, in tokens per second.
-func (tb *Bucket) Rate() float64 {
- return 1e9 * float64(tb.quantum) / float64(tb.fillInterval)
-}
-
-// take is the internal version of Take - it takes the current time as
-// an argument to enable easy testing.
-func (tb *Bucket) take(now time.Time, count int64, maxWait time.Duration) (time.Duration, bool) {
- if count <= 0 {
- return 0, true
- }
- tb.mu.Lock()
- defer tb.mu.Unlock()
-
- currentTick := tb.adjust(now)
- avail := tb.avail - count
- if avail >= 0 {
- tb.avail = avail
- return 0, true
- }
- // Round up the missing tokens to the nearest multiple
- // of quantum - the tokens won't be available until
- // that tick.
- endTick := currentTick + (-avail+tb.quantum-1)/tb.quantum
- endTime := tb.startTime.Add(time.Duration(endTick) * tb.fillInterval)
- waitTime := endTime.Sub(now)
- if waitTime > maxWait {
- return 0, false
- }
- tb.avail = avail
- return waitTime, true
-}
-
-// adjust adjusts the current bucket capacity based on the current time.
-// It returns the current tick.
-func (tb *Bucket) adjust(now time.Time) (currentTick int64) {
- currentTick = int64(now.Sub(tb.startTime) / tb.fillInterval)
-
- if tb.avail >= tb.capacity {
- return
- }
- tb.avail += (currentTick - tb.availTick) * tb.quantum
- if tb.avail > tb.capacity {
- tb.avail = tb.capacity
- }
- tb.availTick = currentTick
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/juju/ratelimit/reader.go b/archived/event-adapter/vendor/github.com/juju/ratelimit/reader.go
deleted file mode 100644
index 6403bf78d..000000000
--- a/archived/event-adapter/vendor/github.com/juju/ratelimit/reader.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 Canonical Ltd.
-// Licensed under the LGPLv3 with static-linking exception.
-// See LICENCE file for details.
-
-package ratelimit
-
-import "io"
-
-type reader struct {
- r io.Reader
- bucket *Bucket
-}
-
-// Reader returns a reader that is rate limited by
-// the given token bucket. Each token in the bucket
-// represents one byte.
-func Reader(r io.Reader, bucket *Bucket) io.Reader {
- return &reader{
- r: r,
- bucket: bucket,
- }
-}
-
-func (r *reader) Read(buf []byte) (int, error) {
- n, err := r.r.Read(buf)
- if n <= 0 {
- return n, err
- }
- r.bucket.Wait(int64(n))
- return n, err
-}
-
-type writer struct {
- w io.Writer
- bucket *Bucket
-}
-
-// Writer returns a reader that is rate limited by
-// the given token bucket. Each token in the bucket
-// represents one byte.
-func Writer(w io.Writer, bucket *Bucket) io.Writer {
- return &writer{
- w: w,
- bucket: bucket,
- }
-}
-
-func (w *writer) Write(buf []byte) (int, error) {
- w.bucket.Wait(int64(len(buf)))
- return w.w.Write(buf)
-}
diff --git a/archived/event-adapter/vendor/github.com/mailru/easyjson/LICENSE b/archived/event-adapter/vendor/github.com/mailru/easyjson/LICENSE
deleted file mode 100644
index fbff658f7..000000000
--- a/archived/event-adapter/vendor/github.com/mailru/easyjson/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (c) 2016 Mail.Ru Group
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/archived/event-adapter/vendor/github.com/mailru/easyjson/buffer/pool.go b/archived/event-adapter/vendor/github.com/mailru/easyjson/buffer/pool.go
deleted file mode 100644
index 4de4a51db..000000000
--- a/archived/event-adapter/vendor/github.com/mailru/easyjson/buffer/pool.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// Package buffer implements a buffer for serialization, consisting of a chain of []byte-s to
-// reduce copying and to allow reuse of individual chunks.
-package buffer
-
-import (
- "io"
- "sync"
-)
-
-// PoolConfig contains configuration for the allocation and reuse strategy.
-type PoolConfig struct {
- StartSize int // Minimum chunk size that is allocated.
- PooledSize int // Minimum chunk size that is reused, reusing chunks too small will result in overhead.
- MaxSize int // Maximum chunk size that will be allocated.
-}
-
-var config = PoolConfig{
- StartSize: 128,
- PooledSize: 512,
- MaxSize: 32768,
-}
-
-// Reuse pool: chunk size -> pool.
-var buffers = map[int]*sync.Pool{}
-
-func initBuffers() {
- for l := config.PooledSize; l <= config.MaxSize; l *= 2 {
- buffers[l] = new(sync.Pool)
- }
-}
-
-func init() {
- initBuffers()
-}
-
-// Init sets up a non-default pooling and allocation strategy. Should be run before serialization is done.
-func Init(cfg PoolConfig) {
- config = cfg
- initBuffers()
-}
-
-// putBuf puts a chunk to reuse pool if it can be reused.
-func putBuf(buf []byte) {
- size := cap(buf)
- if size < config.PooledSize {
- return
- }
- if c := buffers[size]; c != nil {
- c.Put(buf[:0])
- }
-}
-
-// getBuf gets a chunk from reuse pool or creates a new one if reuse failed.
-func getBuf(size int) []byte {
- if size < config.PooledSize {
- return make([]byte, 0, size)
- }
-
- if c := buffers[size]; c != nil {
- v := c.Get()
- if v != nil {
- return v.([]byte)
- }
- }
- return make([]byte, 0, size)
-}
-
-// Buffer is a buffer optimized for serialization without extra copying.
-type Buffer struct {
-
- // Buf is the current chunk that can be used for serialization.
- Buf []byte
-
- toPool []byte
- bufs [][]byte
-}
-
-// EnsureSpace makes sure that the current chunk contains at least s free bytes,
-// possibly creating a new chunk.
-func (b *Buffer) EnsureSpace(s int) {
- if cap(b.Buf)-len(b.Buf) >= s {
- return
- }
- l := len(b.Buf)
- if l > 0 {
- if cap(b.toPool) != cap(b.Buf) {
- // Chunk was reallocated, toPool can be pooled.
- putBuf(b.toPool)
- }
- if cap(b.bufs) == 0 {
- b.bufs = make([][]byte, 0, 8)
- }
- b.bufs = append(b.bufs, b.Buf)
- l = cap(b.toPool) * 2
- } else {
- l = config.StartSize
- }
-
- if l > config.MaxSize {
- l = config.MaxSize
- }
- b.Buf = getBuf(l)
- b.toPool = b.Buf
-}
-
-// AppendByte appends a single byte to buffer.
-func (b *Buffer) AppendByte(data byte) {
- if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined.
- b.EnsureSpace(1)
- }
- b.Buf = append(b.Buf, data)
-}
-
-// AppendBytes appends a byte slice to buffer.
-func (b *Buffer) AppendBytes(data []byte) {
- for len(data) > 0 {
- if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined.
- b.EnsureSpace(1)
- }
-
- sz := cap(b.Buf) - len(b.Buf)
- if sz > len(data) {
- sz = len(data)
- }
-
- b.Buf = append(b.Buf, data[:sz]...)
- data = data[sz:]
- }
-}
-
-// AppendBytes appends a string to buffer.
-func (b *Buffer) AppendString(data string) {
- for len(data) > 0 {
- if cap(b.Buf) == len(b.Buf) { // EnsureSpace won't be inlined.
- b.EnsureSpace(1)
- }
-
- sz := cap(b.Buf) - len(b.Buf)
- if sz > len(data) {
- sz = len(data)
- }
-
- b.Buf = append(b.Buf, data[:sz]...)
- data = data[sz:]
- }
-}
-
-// Size computes the size of a buffer by adding sizes of every chunk.
-func (b *Buffer) Size() int {
- size := len(b.Buf)
- for _, buf := range b.bufs {
- size += len(buf)
- }
- return size
-}
-
-// DumpTo outputs the contents of a buffer to a writer and resets the buffer.
-func (b *Buffer) DumpTo(w io.Writer) (written int, err error) {
- var n int
- for _, buf := range b.bufs {
- if err == nil {
- n, err = w.Write(buf)
- written += n
- }
- putBuf(buf)
- }
-
- if err == nil {
- n, err = w.Write(b.Buf)
- written += n
- }
- putBuf(b.toPool)
-
- b.bufs = nil
- b.Buf = nil
- b.toPool = nil
-
- return
-}
-
-// BuildBytes creates a single byte slice with all the contents of the buffer. Data is
-// copied if it does not fit in a single chunk.
-func (b *Buffer) BuildBytes() []byte {
- if len(b.bufs) == 0 {
-
- ret := b.Buf
- b.toPool = nil
- b.Buf = nil
-
- return ret
- }
-
- ret := make([]byte, 0, b.Size())
- for _, buf := range b.bufs {
- ret = append(ret, buf...)
- putBuf(buf)
- }
-
- ret = append(ret, b.Buf...)
- putBuf(b.toPool)
-
- b.bufs = nil
- b.toPool = nil
- b.Buf = nil
-
- return ret
-}
diff --git a/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/error.go b/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/error.go
deleted file mode 100644
index e90ec40d0..000000000
--- a/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/error.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package jlexer
-
-import "fmt"
-
-// LexerError implements the error interface and represents all possible errors that can be
-// generated during parsing the JSON data.
-type LexerError struct {
- Reason string
- Offset int
- Data string
-}
-
-func (l *LexerError) Error() string {
- return fmt.Sprintf("parse error: %s near offset %d of '%s'", l.Reason, l.Offset, l.Data)
-}
diff --git a/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/lexer.go b/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/lexer.go
deleted file mode 100644
index d700c0a32..000000000
--- a/archived/event-adapter/vendor/github.com/mailru/easyjson/jlexer/lexer.go
+++ /dev/null
@@ -1,956 +0,0 @@
-// Package jlexer contains a JSON lexer implementation.
-//
-// It is expected that it is mostly used with generated parser code, so the interface is tuned
-// for a parser that knows what kind of data is expected.
-package jlexer
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
- "unicode/utf8"
- "unsafe"
-)
-
-// tokenKind determines type of a token.
-type tokenKind byte
-
-const (
- tokenUndef tokenKind = iota // No token.
- tokenDelim // Delimiter: one of '{', '}', '[' or ']'.
- tokenString // A string literal, e.g. "abc\u1234"
- tokenNumber // Number literal, e.g. 1.5e5
- tokenBool // Boolean literal: true or false.
- tokenNull // null keyword.
-)
-
-// token describes a single token: type, position in the input and value.
-type token struct {
- kind tokenKind // Type of a token.
-
- boolValue bool // Value if a boolean literal token.
- byteValue []byte // Raw value of a token.
- delimValue byte
-}
-
-// Lexer is a JSON lexer: it iterates over JSON tokens in a byte slice.
-type Lexer struct {
- Data []byte // Input data given to the lexer.
-
- start int // Start of the current token.
- pos int // Current unscanned position in the input stream.
- token token // Last scanned token, if token.kind != tokenUndef.
-
- firstElement bool // Whether current element is the first in array or an object.
- wantSep byte // A comma or a colon character, which need to occur before a token.
-
- err error // Error encountered during lexing, if any.
-}
-
-// fetchToken scans the input for the next token.
-func (r *Lexer) fetchToken() {
- r.token.kind = tokenUndef
- r.start = r.pos
-
- // Check if r.Data has r.pos element
- // If it doesn't, it mean corrupted input data
- if len(r.Data) < r.pos {
- r.errParse("Unexpected end of data")
- return
- }
- // Determine the type of a token by skipping whitespace and reading the
- // first character.
- for _, c := range r.Data[r.pos:] {
- switch c {
- case ':', ',':
- if r.wantSep == c {
- r.pos++
- r.start++
- r.wantSep = 0
- } else {
- r.errSyntax()
- }
-
- case ' ', '\t', '\r', '\n':
- r.pos++
- r.start++
-
- case '"':
- if r.wantSep != 0 {
- r.errSyntax()
- }
-
- r.token.kind = tokenString
- r.fetchString()
- return
-
- case '{', '[':
- if r.wantSep != 0 {
- r.errSyntax()
- }
- r.firstElement = true
- r.token.kind = tokenDelim
- r.token.delimValue = r.Data[r.pos]
- r.pos++
- return
-
- case '}', ']':
- if !r.firstElement && (r.wantSep != ',') {
- r.errSyntax()
- }
- r.wantSep = 0
- r.token.kind = tokenDelim
- r.token.delimValue = r.Data[r.pos]
- r.pos++
- return
-
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-':
- if r.wantSep != 0 {
- r.errSyntax()
- }
- r.token.kind = tokenNumber
- r.fetchNumber()
- return
-
- case 'n':
- if r.wantSep != 0 {
- r.errSyntax()
- }
-
- r.token.kind = tokenNull
- r.fetchNull()
- return
-
- case 't':
- if r.wantSep != 0 {
- r.errSyntax()
- }
-
- r.token.kind = tokenBool
- r.token.boolValue = true
- r.fetchTrue()
- return
-
- case 'f':
- if r.wantSep != 0 {
- r.errSyntax()
- }
-
- r.token.kind = tokenBool
- r.token.boolValue = false
- r.fetchFalse()
- return
-
- default:
- r.errSyntax()
- return
- }
- }
- r.err = io.EOF
- return
-}
-
-// isTokenEnd returns true if the char can follow a non-delimiter token
-func isTokenEnd(c byte) bool {
- return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '[' || c == ']' || c == '{' || c == '}' || c == ',' || c == ':'
-}
-
-// fetchNull fetches and checks remaining bytes of null keyword.
-func (r *Lexer) fetchNull() {
- r.pos += 4
- if r.pos > len(r.Data) ||
- r.Data[r.pos-3] != 'u' ||
- r.Data[r.pos-2] != 'l' ||
- r.Data[r.pos-1] != 'l' ||
- (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
-
- r.pos -= 4
- r.errSyntax()
- }
-}
-
-// fetchTrue fetches and checks remaining bytes of true keyword.
-func (r *Lexer) fetchTrue() {
- r.pos += 4
- if r.pos > len(r.Data) ||
- r.Data[r.pos-3] != 'r' ||
- r.Data[r.pos-2] != 'u' ||
- r.Data[r.pos-1] != 'e' ||
- (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
-
- r.pos -= 4
- r.errSyntax()
- }
-}
-
-// fetchFalse fetches and checks remaining bytes of false keyword.
-func (r *Lexer) fetchFalse() {
- r.pos += 5
- if r.pos > len(r.Data) ||
- r.Data[r.pos-4] != 'a' ||
- r.Data[r.pos-3] != 'l' ||
- r.Data[r.pos-2] != 's' ||
- r.Data[r.pos-1] != 'e' ||
- (r.pos != len(r.Data) && !isTokenEnd(r.Data[r.pos])) {
-
- r.pos -= 5
- r.errSyntax()
- }
-}
-
-// bytesToStr creates a string pointing at the slice to avoid copying.
-//
-// Warning: the string returned by the function should be used with care, as the whole input data
-// chunk may be either blocked from being freed by GC because of a single string or the buffer.Data
-// may be garbage-collected even when the string exists.
-func bytesToStr(data []byte) string {
- h := (*reflect.SliceHeader)(unsafe.Pointer(&data))
- shdr := reflect.StringHeader{h.Data, h.Len}
- return *(*string)(unsafe.Pointer(&shdr))
-}
-
-// fetchNumber scans a number literal token.
-func (r *Lexer) fetchNumber() {
- hasE := false
- afterE := false
- hasDot := false
-
- r.pos++
- for i, c := range r.Data[r.pos:] {
- switch {
- case c >= '0' && c <= '9':
- afterE = false
- case c == '.' && !hasDot:
- hasDot = true
- case (c == 'e' || c == 'E') && !hasE:
- hasE = true
- hasDot = true
- afterE = true
- case (c == '+' || c == '-') && afterE:
- afterE = false
- default:
- r.pos += i
- if !isTokenEnd(c) {
- r.errSyntax()
- } else {
- r.token.byteValue = r.Data[r.start:r.pos]
- }
- return
- }
- }
-
- r.pos = len(r.Data)
- r.token.byteValue = r.Data[r.start:]
-}
-
-// findStringLen tries to scan into the string literal for ending quote char to determine required size.
-// The size will be exact if no escapes are present and may be inexact if there are escaped chars.
-func findStringLen(data []byte) (hasEscapes bool, length int) {
- delta := 0
-
- for i := 0; i < len(data); i++ {
- switch data[i] {
- case '\\':
- i++
- delta++
- if i < len(data) && data[i] == 'u' {
- delta++
- }
- case '"':
- return (delta > 0), (i - delta)
- }
- }
-
- return false, len(data)
-}
-
-// processEscape processes a single escape sequence and returns number of bytes processed.
-func (r *Lexer) processEscape(data []byte) (int, error) {
- if len(data) < 2 {
- return 0, fmt.Errorf("syntax error at %v", string(data))
- }
-
- c := data[1]
- switch c {
- case '"', '/', '\\':
- r.token.byteValue = append(r.token.byteValue, c)
- return 2, nil
- case 'b':
- r.token.byteValue = append(r.token.byteValue, '\b')
- return 2, nil
- case 'f':
- r.token.byteValue = append(r.token.byteValue, '\f')
- return 2, nil
- case 'n':
- r.token.byteValue = append(r.token.byteValue, '\n')
- return 2, nil
- case 'r':
- r.token.byteValue = append(r.token.byteValue, '\r')
- return 2, nil
- case 't':
- r.token.byteValue = append(r.token.byteValue, '\t')
- return 2, nil
- case 'u':
- default:
- return 0, fmt.Errorf("syntax error")
- }
-
- var val rune
-
- for i := 2; i < len(data) && i < 6; i++ {
- var v byte
- c = data[i]
- switch c {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- v = c - '0'
- case 'a', 'b', 'c', 'd', 'e', 'f':
- v = c - 'a' + 10
- case 'A', 'B', 'C', 'D', 'E', 'F':
- v = c - 'A' + 10
- default:
- return 0, fmt.Errorf("syntax error")
- }
-
- val <<= 4
- val |= rune(v)
- }
-
- l := utf8.RuneLen(val)
- if l == -1 {
- return 0, fmt.Errorf("invalid unicode escape")
- }
-
- var d [4]byte
- utf8.EncodeRune(d[:], val)
- r.token.byteValue = append(r.token.byteValue, d[:l]...)
- return 6, nil
-}
-
-// fetchString scans a string literal token.
-func (r *Lexer) fetchString() {
- r.pos++
- data := r.Data[r.pos:]
-
- hasEscapes, length := findStringLen(data)
- if !hasEscapes {
- r.token.byteValue = data[:length]
- r.pos += length + 1
- return
- }
-
- r.token.byteValue = make([]byte, 0, length)
- p := 0
- for i := 0; i < len(data); {
- switch data[i] {
- case '"':
- r.pos += i + 1
- r.token.byteValue = append(r.token.byteValue, data[p:i]...)
- i++
- return
-
- case '\\':
- r.token.byteValue = append(r.token.byteValue, data[p:i]...)
- off, err := r.processEscape(data[i:])
- if err != nil {
- r.errParse(err.Error())
- return
- }
- i += off
- p = i
-
- default:
- i++
- }
- }
- r.errParse("unterminated string literal")
-}
-
-// scanToken scans the next token if no token is currently available in the lexer.
-func (r *Lexer) scanToken() {
- if r.token.kind != tokenUndef || r.err != nil {
- return
- }
-
- r.fetchToken()
-}
-
-// consume resets the current token to allow scanning the next one.
-func (r *Lexer) consume() {
- r.token.kind = tokenUndef
- r.token.delimValue = 0
-}
-
-// Ok returns true if no error (including io.EOF) was encountered during scanning.
-func (r *Lexer) Ok() bool {
- return r.err == nil
-}
-
-const maxErrorContextLen = 13
-
-func (r *Lexer) errParse(what string) {
- if r.err == nil {
- var str string
- if len(r.Data)-r.pos <= maxErrorContextLen {
- str = string(r.Data)
- } else {
- str = string(r.Data[r.pos:r.pos+maxErrorContextLen-3]) + "..."
- }
- r.err = &LexerError{
- Reason: what,
- Offset: r.pos,
- Data: str,
- }
- }
-}
-
-func (r *Lexer) errSyntax() {
- r.errParse("syntax error")
-}
-
-func (r *Lexer) errInvalidToken(expected string) {
- if r.err == nil {
- var str string
- if len(r.token.byteValue) <= maxErrorContextLen {
- str = string(r.token.byteValue)
- } else {
- str = string(r.token.byteValue[:maxErrorContextLen-3]) + "..."
- }
- r.err = &LexerError{
- Reason: fmt.Sprintf("expected %s", expected),
- Offset: r.pos,
- Data: str,
- }
- }
-}
-
-// Delim consumes a token and verifies that it is the given delimiter.
-func (r *Lexer) Delim(c byte) {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.delimValue != c {
- r.errInvalidToken(string([]byte{c}))
- }
- r.consume()
-}
-
-// IsDelim returns true if there was no scanning error and next token is the given delimiter.
-func (r *Lexer) IsDelim(c byte) bool {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- return !r.Ok() || r.token.delimValue == c
-}
-
-// Null verifies that the next token is null and consumes it.
-func (r *Lexer) Null() {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.kind != tokenNull {
- r.errInvalidToken("null")
- }
- r.consume()
-}
-
-// IsNull returns true if the next token is a null keyword.
-func (r *Lexer) IsNull() bool {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- return r.Ok() && r.token.kind == tokenNull
-}
-
-// Skip skips a single token.
-func (r *Lexer) Skip() {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- r.consume()
-}
-
-// SkipRecursive skips next array or object completely, or just skips a single token if not
-// an array/object.
-//
-// Note: no syntax validation is performed on the skipped data.
-func (r *Lexer) SkipRecursive() {
- r.scanToken()
-
- var start, end byte
-
- if r.token.delimValue == '{' {
- start, end = '{', '}'
- } else if r.token.delimValue == '[' {
- start, end = '[', ']'
- } else {
- r.consume()
- return
- }
-
- r.consume()
-
- level := 1
- inQuotes := false
- wasEscape := false
-
- for i, c := range r.Data[r.pos:] {
- switch {
- case c == start && !inQuotes:
- level++
- case c == end && !inQuotes:
- level--
- if level == 0 {
- r.pos += i + 1
- return
- }
- case c == '\\' && inQuotes:
- wasEscape = true
- continue
- case c == '"' && inQuotes:
- inQuotes = wasEscape
- case c == '"':
- inQuotes = true
- }
- wasEscape = false
- }
- r.pos = len(r.Data)
- r.err = io.EOF
-}
-
-// Raw fetches the next item recursively as a data slice
-func (r *Lexer) Raw() []byte {
- r.SkipRecursive()
- if !r.Ok() {
- return nil
- }
- return r.Data[r.start:r.pos]
-}
-
-// UnsafeString returns the string value if the token is a string literal.
-//
-// Warning: returned string may point to the input buffer, so the string should not outlive
-// the input buffer. Intended pattern of usage is as an argument to a switch statement.
-func (r *Lexer) UnsafeString() string {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.kind != tokenString {
- r.errInvalidToken("string")
- return ""
- }
-
- ret := bytesToStr(r.token.byteValue)
- r.consume()
- return ret
-}
-
-// String reads a string literal.
-func (r *Lexer) String() string {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.kind != tokenString {
- r.errInvalidToken("string")
- return ""
-
- }
- ret := string(r.token.byteValue)
- r.consume()
- return ret
-}
-
-// Bool reads a true or false boolean keyword.
-func (r *Lexer) Bool() bool {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.kind != tokenBool {
- r.errInvalidToken("bool")
- return false
-
- }
- ret := r.token.boolValue
- r.consume()
- return ret
-}
-
-func (r *Lexer) number() string {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
- if !r.Ok() || r.token.kind != tokenNumber {
- r.errInvalidToken("number")
- return ""
-
- }
- ret := bytesToStr(r.token.byteValue)
- r.consume()
- return ret
-}
-
-func (r *Lexer) Uint8() uint8 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 8)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint8(n)
-}
-
-func (r *Lexer) Uint16() uint16 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 16)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint16(n)
-}
-
-func (r *Lexer) Uint32() uint32 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint32(n)
-}
-
-func (r *Lexer) Uint64() uint64 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return n
-}
-
-func (r *Lexer) Uint() uint {
- return uint(r.Uint64())
-}
-
-func (r *Lexer) Int8() int8 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 8)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int8(n)
-}
-
-func (r *Lexer) Int16() int16 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 16)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int16(n)
-}
-
-func (r *Lexer) Int32() int32 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 32)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int32(n)
-}
-
-func (r *Lexer) Int64() int64 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return n
-}
-
-func (r *Lexer) Int() int {
- return int(r.Int64())
-}
-
-func (r *Lexer) Uint8Str() uint8 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 8)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint8(n)
-}
-
-func (r *Lexer) Uint16Str() uint16 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 16)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint16(n)
-}
-
-func (r *Lexer) Uint32Str() uint32 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return uint32(n)
-}
-
-func (r *Lexer) Uint64Str() uint64 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return n
-}
-
-func (r *Lexer) UintStr() uint {
- return uint(r.Uint64Str())
-}
-
-func (r *Lexer) Int8Str() int8 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 8)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int8(n)
-}
-
-func (r *Lexer) Int16Str() int16 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 16)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int16(n)
-}
-
-func (r *Lexer) Int32Str() int32 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 32)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return int32(n)
-}
-
-func (r *Lexer) Int64Str() int64 {
- s := r.UnsafeString()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return n
-}
-
-func (r *Lexer) IntStr() int {
- return int(r.Int64Str())
-}
-
-func (r *Lexer) Float32() float32 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseFloat(s, 32)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return float32(n)
-}
-
-func (r *Lexer) Float64() float64 {
- s := r.number()
- if !r.Ok() {
- return 0
- }
-
- n, err := strconv.ParseFloat(s, 64)
- if err != nil {
- r.err = &LexerError{
- Reason: err.Error(),
- }
- }
- return n
-}
-
-func (r *Lexer) Error() error {
- return r.err
-}
-
-func (r *Lexer) AddError(e error) {
- if r.err == nil {
- r.err = e
- }
-}
-
-// Interface fetches an interface{} analogous to the 'encoding/json' package.
-func (r *Lexer) Interface() interface{} {
- if r.token.kind == tokenUndef && r.Ok() {
- r.fetchToken()
- }
-
- if !r.Ok() {
- return nil
- }
- switch r.token.kind {
- case tokenString:
- return r.String()
- case tokenNumber:
- return r.Float64()
- case tokenBool:
- return r.Bool()
- case tokenNull:
- r.Null()
- return nil
- }
-
- if r.token.delimValue == '{' {
- r.consume()
-
- ret := map[string]interface{}{}
- for !r.IsDelim('}') {
- key := r.String()
- r.WantColon()
- ret[key] = r.Interface()
- r.WantComma()
- }
- r.Delim('}')
-
- if r.Ok() {
- return ret
- } else {
- return nil
- }
- } else if r.token.delimValue == '[' {
- r.consume()
-
- var ret []interface{}
- for !r.IsDelim(']') {
- ret = append(ret, r.Interface())
- r.WantComma()
- }
- r.Delim(']')
-
- if r.Ok() {
- return ret
- } else {
- return nil
- }
- }
- r.errSyntax()
- return nil
-}
-
-// WantComma requires a comma to be present before fetching next token.
-func (r *Lexer) WantComma() {
- r.wantSep = ','
- r.firstElement = false
-}
-
-// WantColon requires a colon to be present before fetching next token.
-func (r *Lexer) WantColon() {
- r.wantSep = ':'
- r.firstElement = false
-}
diff --git a/archived/event-adapter/vendor/github.com/mailru/easyjson/jwriter/writer.go b/archived/event-adapter/vendor/github.com/mailru/easyjson/jwriter/writer.go
deleted file mode 100644
index 907675f9c..000000000
--- a/archived/event-adapter/vendor/github.com/mailru/easyjson/jwriter/writer.go
+++ /dev/null
@@ -1,273 +0,0 @@
-// Package jwriter contains a JSON writer.
-package jwriter
-
-import (
- "io"
- "strconv"
- "unicode/utf8"
-
- "github.com/mailru/easyjson/buffer"
-)
-
-// Writer is a JSON writer.
-type Writer struct {
- Error error
- Buffer buffer.Buffer
-}
-
-// Size returns the size of the data that was written out.
-func (w *Writer) Size() int {
- return w.Buffer.Size()
-}
-
-// DumpTo outputs the data to given io.Writer, resetting the buffer.
-func (w *Writer) DumpTo(out io.Writer) (written int, err error) {
- return w.Buffer.DumpTo(out)
-}
-
-// BuildBytes returns writer data as a single byte slice.
-func (w *Writer) BuildBytes() ([]byte, error) {
- if w.Error != nil {
- return nil, w.Error
- }
-
- return w.Buffer.BuildBytes(), nil
-}
-
-// RawByte appends raw binary data to the buffer.
-func (w *Writer) RawByte(c byte) {
- w.Buffer.AppendByte(c)
-}
-
-// RawByte appends raw binary data to the buffer.
-func (w *Writer) RawString(s string) {
- w.Buffer.AppendString(s)
-}
-
-// RawByte appends raw binary data to the buffer or sets the error if it is given. Useful for
-// calling with results of MarshalJSON-like functions.
-func (w *Writer) Raw(data []byte, err error) {
- switch {
- case w.Error != nil:
- return
- case err != nil:
- w.Error = err
- case len(data) > 0:
- w.Buffer.AppendBytes(data)
- default:
- w.RawString("null")
- }
-}
-
-func (w *Writer) Uint8(n uint8) {
- w.Buffer.EnsureSpace(3)
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
-}
-
-func (w *Writer) Uint16(n uint16) {
- w.Buffer.EnsureSpace(5)
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
-}
-
-func (w *Writer) Uint32(n uint32) {
- w.Buffer.EnsureSpace(10)
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
-}
-
-func (w *Writer) Uint(n uint) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
-}
-
-func (w *Writer) Uint64(n uint64) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, n, 10)
-}
-
-func (w *Writer) Int8(n int8) {
- w.Buffer.EnsureSpace(4)
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
-}
-
-func (w *Writer) Int16(n int16) {
- w.Buffer.EnsureSpace(6)
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
-}
-
-func (w *Writer) Int32(n int32) {
- w.Buffer.EnsureSpace(11)
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
-}
-
-func (w *Writer) Int(n int) {
- w.Buffer.EnsureSpace(21)
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
-}
-
-func (w *Writer) Int64(n int64) {
- w.Buffer.EnsureSpace(21)
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, n, 10)
-}
-
-func (w *Writer) Uint8Str(n uint8) {
- w.Buffer.EnsureSpace(3)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Uint16Str(n uint16) {
- w.Buffer.EnsureSpace(5)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Uint32Str(n uint32) {
- w.Buffer.EnsureSpace(10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) UintStr(n uint) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, uint64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Uint64Str(n uint64) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendUint(w.Buffer.Buf, n, 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Int8Str(n int8) {
- w.Buffer.EnsureSpace(4)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Int16Str(n int16) {
- w.Buffer.EnsureSpace(6)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Int32Str(n int32) {
- w.Buffer.EnsureSpace(11)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) IntStr(n int) {
- w.Buffer.EnsureSpace(21)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, int64(n), 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Int64Str(n int64) {
- w.Buffer.EnsureSpace(21)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
- w.Buffer.Buf = strconv.AppendInt(w.Buffer.Buf, n, 10)
- w.Buffer.Buf = append(w.Buffer.Buf, '"')
-}
-
-func (w *Writer) Float32(n float32) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, float64(n), 'g', -1, 32)
-}
-
-func (w *Writer) Float64(n float64) {
- w.Buffer.EnsureSpace(20)
- w.Buffer.Buf = strconv.AppendFloat(w.Buffer.Buf, n, 'g', -1, 64)
-}
-
-func (w *Writer) Bool(v bool) {
- w.Buffer.EnsureSpace(5)
- if v {
- w.Buffer.Buf = append(w.Buffer.Buf, "true"...)
- } else {
- w.Buffer.Buf = append(w.Buffer.Buf, "false"...)
- }
-}
-
-const chars = "0123456789abcdef"
-
-func (w *Writer) String(s string) {
- w.Buffer.AppendByte('"')
-
- // Portions of the string that contain no escapes are appended as
- // byte slices.
-
- p := 0 // last non-escape symbol
-
- for i := 0; i < len(s); {
- // single-with character
- if c := s[i]; c < utf8.RuneSelf {
- var escape byte
- switch c {
- case '\t':
- escape = 't'
- case '\r':
- escape = 'r'
- case '\n':
- escape = 'n'
- case '\\':
- escape = '\\'
- case '"':
- escape = '"'
- case '<', '>':
- // do nothing
- default:
- if c >= 0x20 {
- // no escaping is required
- i++
- continue
- }
- }
- if escape != 0 {
- w.Buffer.AppendString(s[p:i])
- w.Buffer.AppendByte('\\')
- w.Buffer.AppendByte(escape)
- } else {
- w.Buffer.AppendString(s[p:i])
- w.Buffer.AppendString(`\u00`)
- w.Buffer.AppendByte(chars[c>>4])
- w.Buffer.AppendByte(chars[c&0xf])
- }
- i++
- p = i
- continue
- }
-
- // broken utf
- runeValue, runeWidth := utf8.DecodeRuneInString(s[i:])
- if runeValue == utf8.RuneError && runeWidth == 1 {
- w.Buffer.AppendString(s[p:i])
- w.Buffer.AppendString(`\ufffd`)
- i++
- p = i
- continue
- }
-
- // jsonp stuff - tab separator and line separator
- if runeValue == '\u2028' || runeValue == '\u2029' {
- w.Buffer.AppendString(s[p:i])
- w.Buffer.AppendString(`\u202`)
- w.Buffer.AppendByte(chars[runeValue&0xf])
- i += runeWidth
- p = i
- continue
- }
- i += runeWidth
- }
- w.Buffer.AppendString(s[p:])
- w.Buffer.AppendByte('"')
-}
diff --git a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE b/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE
deleted file mode 100644
index 13f15dfce..000000000
--- a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2013 Matt T. Proud
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go b/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
deleted file mode 100644
index 66d9b5458..000000000
--- a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "encoding/binary"
- "errors"
- "io"
-
- "github.com/golang/protobuf/proto"
-)
-
-var errInvalidVarint = errors.New("invalid varint32 encountered")
-
-// ReadDelimited decodes a message from the provided length-delimited stream,
-// where the length is encoded as 32-bit varint prefix to the message body.
-// It returns the total number of bytes read and any applicable error. This is
-// roughly equivalent to the companion Java API's
-// MessageLite#parseDelimitedFrom. As per the reader contract, this function
-// calls r.Read repeatedly as required until exactly one message including its
-// prefix is read and decoded (or an error has occurred). The function never
-// reads more bytes from the stream than required. The function never returns
-// an error if a message has been read and decoded correctly, even if the end
-// of the stream has been reached in doing so. In that case, any subsequent
-// calls return (0, io.EOF).
-func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
- // Per AbstractParser#parsePartialDelimitedFrom with
- // CodedInputStream#readRawVarint32.
- headerBuf := make([]byte, binary.MaxVarintLen32)
- var bytesRead, varIntBytes int
- var messageLength uint64
- for varIntBytes == 0 { // i.e. no varint has been decoded yet.
- if bytesRead >= len(headerBuf) {
- return bytesRead, errInvalidVarint
- }
- // We have to read byte by byte here to avoid reading more bytes
- // than required. Each read byte is appended to what we have
- // read before.
- newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1])
- if newBytesRead == 0 {
- if err != nil {
- return bytesRead, err
- }
- // A Reader should not return (0, nil), but if it does,
- // it should be treated as no-op (according to the
- // Reader contract). So let's go on...
- continue
- }
- bytesRead += newBytesRead
- // Now present everything read so far to the varint decoder and
- // see if a varint can be decoded already.
- messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead])
- }
-
- messageBuf := make([]byte, messageLength)
- newBytesRead, err := io.ReadFull(r, messageBuf)
- bytesRead += newBytesRead
- if err != nil {
- return bytesRead, err
- }
-
- return bytesRead, proto.Unmarshal(messageBuf, m)
-}
diff --git a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go b/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go
deleted file mode 100644
index c318385cb..000000000
--- a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package pbutil provides record length-delimited Protocol Buffer streaming.
-package pbutil
diff --git a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go b/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
deleted file mode 100644
index 4b76ea9a1..000000000
--- a/archived/event-adapter/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "encoding/binary"
- "io"
-
- "github.com/golang/protobuf/proto"
-)
-
-// WriteDelimited encodes and dumps a message to the provided writer prefixed
-// with a 32-bit varint indicating the length of the encoded message, producing
-// a length-delimited record stream, which can be used to chain together
-// encoded messages of the same type together in a file. It returns the total
-// number of bytes written and any applicable error. This is roughly
-// equivalent to the companion Java API's MessageLite#writeDelimitedTo.
-func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
- buffer, err := proto.Marshal(m)
- if err != nil {
- return 0, err
- }
-
- buf := make([]byte, binary.MaxVarintLen32)
- encodedLength := binary.PutUvarint(buf, uint64(len(buffer)))
-
- sync, err := w.Write(buf[:encodedLength])
- if err != nil {
- return sync, err
- }
-
- n, err = w.Write(buffer)
- return n + sync, err
-}
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.mailmap b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.mailmap
deleted file mode 100644
index ba611cb21..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.mailmap
+++ /dev/null
@@ -1 +0,0 @@
-Stephen J Day
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.pullapprove.yml b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.pullapprove.yml
deleted file mode 100644
index 45fa4b9ec..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.pullapprove.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-approve_by_comment: true
-approve_regex: '^(Approved|lgtm|LGTM|:shipit:|:star:|:\+1:|:ship:)'
-reject_regex: ^Rejected
-reset_on_push: true
-author_approval: ignored
-signed_off_by:
- required: true
-reviewers:
- teams:
- - go-digest-maintainers
- name: default
- required: 2
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.travis.yml b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.travis.yml
deleted file mode 100644
index 7ea4ed1d2..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: go
-go:
- - 1.7
- - master
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md
deleted file mode 100644
index e4d962ac1..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# Contributing to Docker open source projects
-
-Want to hack on this project? Awesome! Here are instructions to get you started.
-
-This project is a part of the [Docker](https://www.docker.com) project, and follows
-the same rules and principles. If you're already familiar with the way
-Docker does things, you'll feel right at home.
-
-Otherwise, go read Docker's
-[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md),
-[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md),
-[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and
-[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md).
-
-For an in-depth description of our contribution process, visit the
-contributors guide: [Understand how to contribute](https://docs.docker.com/opensource/workflow/make-a-contribution/)
-
-### Sign your work
-
-The sign-off is a simple line at the end of the explanation for the patch. Your
-signature certifies that you wrote the patch or otherwise have the right to pass
-it on as an open-source patch. The rules are pretty simple: if you can certify
-the below (from [developercertificate.org](http://developercertificate.org/)):
-
-```
-Developer Certificate of Origin
-Version 1.1
-
-Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
-1 Letterman Drive
-Suite D4700
-San Francisco, CA, 94129
-
-Everyone is permitted to copy and distribute verbatim copies of this
-license document, but changing it is not allowed.
-
-
-Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-(a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
-(b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
-(c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
-(d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
-```
-
-Then you just add a line to every git commit message:
-
- Signed-off-by: Joe Smith
-
-Use your real name (sorry, no pseudonyms or anonymous contributions.)
-
-If you set your `user.name` and `user.email` git configs, you can sign your
-commit automatically with `git commit -s`.
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.code b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.code
deleted file mode 100644
index 0ea3ff81e..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.code
+++ /dev/null
@@ -1,191 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- https://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- Copyright 2016 Docker, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- https://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.docs b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.docs
deleted file mode 100644
index e26cd4fc8..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/LICENSE.docs
+++ /dev/null
@@ -1,425 +0,0 @@
-Attribution-ShareAlike 4.0 International
-
-=======================================================================
-
-Creative Commons Corporation ("Creative Commons") is not a law firm and
-does not provide legal services or legal advice. Distribution of
-Creative Commons public licenses does not create a lawyer-client or
-other relationship. Creative Commons makes its licenses and related
-information available on an "as-is" basis. Creative Commons gives no
-warranties regarding its licenses, any material licensed under their
-terms and conditions, or any related information. Creative Commons
-disclaims all liability for damages resulting from their use to the
-fullest extent possible.
-
-Using Creative Commons Public Licenses
-
-Creative Commons public licenses provide a standard set of terms and
-conditions that creators and other rights holders may use to share
-original works of authorship and other material subject to copyright
-and certain other rights specified in the public license below. The
-following considerations are for informational purposes only, are not
-exhaustive, and do not form part of our licenses.
-
- Considerations for licensors: Our public licenses are
- intended for use by those authorized to give the public
- permission to use material in ways otherwise restricted by
- copyright and certain other rights. Our licenses are
- irrevocable. Licensors should read and understand the terms
- and conditions of the license they choose before applying it.
- Licensors should also secure all rights necessary before
- applying our licenses so that the public can reuse the
- material as expected. Licensors should clearly mark any
- material not subject to the license. This includes other CC-
- licensed material, or material used under an exception or
- limitation to copyright. More considerations for licensors:
- wiki.creativecommons.org/Considerations_for_licensors
-
- Considerations for the public: By using one of our public
- licenses, a licensor grants the public permission to use the
- licensed material under specified terms and conditions. If
- the licensor's permission is not necessary for any reason--for
- example, because of any applicable exception or limitation to
- copyright--then that use is not regulated by the license. Our
- licenses grant only permissions under copyright and certain
- other rights that a licensor has authority to grant. Use of
- the licensed material may still be restricted for other
- reasons, including because others have copyright or other
- rights in the material. A licensor may make special requests,
- such as asking that all changes be marked or described.
- Although not required by our licenses, you are encouraged to
- respect those requests where reasonable. More_considerations
- for the public:
- wiki.creativecommons.org/Considerations_for_licensees
-
-=======================================================================
-
-Creative Commons Attribution-ShareAlike 4.0 International Public
-License
-
-By exercising the Licensed Rights (defined below), You accept and agree
-to be bound by the terms and conditions of this Creative Commons
-Attribution-ShareAlike 4.0 International Public License ("Public
-License"). To the extent this Public License may be interpreted as a
-contract, You are granted the Licensed Rights in consideration of Your
-acceptance of these terms and conditions, and the Licensor grants You
-such rights in consideration of benefits the Licensor receives from
-making the Licensed Material available under these terms and
-conditions.
-
-
-Section 1 -- Definitions.
-
- a. Adapted Material means material subject to Copyright and Similar
- Rights that is derived from or based upon the Licensed Material
- and in which the Licensed Material is translated, altered,
- arranged, transformed, or otherwise modified in a manner requiring
- permission under the Copyright and Similar Rights held by the
- Licensor. For purposes of this Public License, where the Licensed
- Material is a musical work, performance, or sound recording,
- Adapted Material is always produced where the Licensed Material is
- synched in timed relation with a moving image.
-
- b. Adapter's License means the license You apply to Your Copyright
- and Similar Rights in Your contributions to Adapted Material in
- accordance with the terms and conditions of this Public License.
-
- c. BY-SA Compatible License means a license listed at
- creativecommons.org/compatiblelicenses, approved by Creative
- Commons as essentially the equivalent of this Public License.
-
- d. Copyright and Similar Rights means copyright and/or similar rights
- closely related to copyright including, without limitation,
- performance, broadcast, sound recording, and Sui Generis Database
- Rights, without regard to how the rights are labeled or
- categorized. For purposes of this Public License, the rights
- specified in Section 2(b)(1)-(2) are not Copyright and Similar
- Rights.
-
- e. Effective Technological Measures means those measures that, in the
- absence of proper authority, may not be circumvented under laws
- fulfilling obligations under Article 11 of the WIPO Copyright
- Treaty adopted on December 20, 1996, and/or similar international
- agreements.
-
- f. Exceptions and Limitations means fair use, fair dealing, and/or
- any other exception or limitation to Copyright and Similar Rights
- that applies to Your use of the Licensed Material.
-
- g. License Elements means the license attributes listed in the name
- of a Creative Commons Public License. The License Elements of this
- Public License are Attribution and ShareAlike.
-
- h. Licensed Material means the artistic or literary work, database,
- or other material to which the Licensor applied this Public
- License.
-
- i. Licensed Rights means the rights granted to You subject to the
- terms and conditions of this Public License, which are limited to
- all Copyright and Similar Rights that apply to Your use of the
- Licensed Material and that the Licensor has authority to license.
-
- j. Licensor means the individual(s) or entity(ies) granting rights
- under this Public License.
-
- k. Share means to provide material to the public by any means or
- process that requires permission under the Licensed Rights, such
- as reproduction, public display, public performance, distribution,
- dissemination, communication, or importation, and to make material
- available to the public including in ways that members of the
- public may access the material from a place and at a time
- individually chosen by them.
-
- l. Sui Generis Database Rights means rights other than copyright
- resulting from Directive 96/9/EC of the European Parliament and of
- the Council of 11 March 1996 on the legal protection of databases,
- as amended and/or succeeded, as well as other essentially
- equivalent rights anywhere in the world.
-
- m. You means the individual or entity exercising the Licensed Rights
- under this Public License. Your has a corresponding meaning.
-
-
-Section 2 -- Scope.
-
- a. License grant.
-
- 1. Subject to the terms and conditions of this Public License,
- the Licensor hereby grants You a worldwide, royalty-free,
- non-sublicensable, non-exclusive, irrevocable license to
- exercise the Licensed Rights in the Licensed Material to:
-
- a. reproduce and Share the Licensed Material, in whole or
- in part; and
-
- b. produce, reproduce, and Share Adapted Material.
-
- 2. Exceptions and Limitations. For the avoidance of doubt, where
- Exceptions and Limitations apply to Your use, this Public
- License does not apply, and You do not need to comply with
- its terms and conditions.
-
- 3. Term. The term of this Public License is specified in Section
- 6(a).
-
- 4. Media and formats; technical modifications allowed. The
- Licensor authorizes You to exercise the Licensed Rights in
- all media and formats whether now known or hereafter created,
- and to make technical modifications necessary to do so. The
- Licensor waives and/or agrees not to assert any right or
- authority to forbid You from making technical modifications
- necessary to exercise the Licensed Rights, including
- technical modifications necessary to circumvent Effective
- Technological Measures. For purposes of this Public License,
- simply making modifications authorized by this Section 2(a)
- (4) never produces Adapted Material.
-
- 5. Downstream recipients.
-
- a. Offer from the Licensor -- Licensed Material. Every
- recipient of the Licensed Material automatically
- receives an offer from the Licensor to exercise the
- Licensed Rights under the terms and conditions of this
- Public License.
-
- b. Additional offer from the Licensor -- Adapted Material.
- Every recipient of Adapted Material from You
- automatically receives an offer from the Licensor to
- exercise the Licensed Rights in the Adapted Material
- under the conditions of the Adapter's License You apply.
-
- c. No downstream restrictions. You may not offer or impose
- any additional or different terms or conditions on, or
- apply any Effective Technological Measures to, the
- Licensed Material if doing so restricts exercise of the
- Licensed Rights by any recipient of the Licensed
- Material.
-
- 6. No endorsement. Nothing in this Public License constitutes or
- may be construed as permission to assert or imply that You
- are, or that Your use of the Licensed Material is, connected
- with, or sponsored, endorsed, or granted official status by,
- the Licensor or others designated to receive attribution as
- provided in Section 3(a)(1)(A)(i).
-
- b. Other rights.
-
- 1. Moral rights, such as the right of integrity, are not
- licensed under this Public License, nor are publicity,
- privacy, and/or other similar personality rights; however, to
- the extent possible, the Licensor waives and/or agrees not to
- assert any such rights held by the Licensor to the limited
- extent necessary to allow You to exercise the Licensed
- Rights, but not otherwise.
-
- 2. Patent and trademark rights are not licensed under this
- Public License.
-
- 3. To the extent possible, the Licensor waives any right to
- collect royalties from You for the exercise of the Licensed
- Rights, whether directly or through a collecting society
- under any voluntary or waivable statutory or compulsory
- licensing scheme. In all other cases the Licensor expressly
- reserves any right to collect such royalties.
-
-
-Section 3 -- License Conditions.
-
-Your exercise of the Licensed Rights is expressly made subject to the
-following conditions.
-
- a. Attribution.
-
- 1. If You Share the Licensed Material (including in modified
- form), You must:
-
- a. retain the following if it is supplied by the Licensor
- with the Licensed Material:
-
- i. identification of the creator(s) of the Licensed
- Material and any others designated to receive
- attribution, in any reasonable manner requested by
- the Licensor (including by pseudonym if
- designated);
-
- ii. a copyright notice;
-
- iii. a notice that refers to this Public License;
-
- iv. a notice that refers to the disclaimer of
- warranties;
-
- v. a URI or hyperlink to the Licensed Material to the
- extent reasonably practicable;
-
- b. indicate if You modified the Licensed Material and
- retain an indication of any previous modifications; and
-
- c. indicate the Licensed Material is licensed under this
- Public License, and include the text of, or the URI or
- hyperlink to, this Public License.
-
- 2. You may satisfy the conditions in Section 3(a)(1) in any
- reasonable manner based on the medium, means, and context in
- which You Share the Licensed Material. For example, it may be
- reasonable to satisfy the conditions by providing a URI or
- hyperlink to a resource that includes the required
- information.
-
- 3. If requested by the Licensor, You must remove any of the
- information required by Section 3(a)(1)(A) to the extent
- reasonably practicable.
-
- b. ShareAlike.
-
- In addition to the conditions in Section 3(a), if You Share
- Adapted Material You produce, the following conditions also apply.
-
- 1. The Adapter's License You apply must be a Creative Commons
- license with the same License Elements, this version or
- later, or a BY-SA Compatible License.
-
- 2. You must include the text of, or the URI or hyperlink to, the
- Adapter's License You apply. You may satisfy this condition
- in any reasonable manner based on the medium, means, and
- context in which You Share Adapted Material.
-
- 3. You may not offer or impose any additional or different terms
- or conditions on, or apply any Effective Technological
- Measures to, Adapted Material that restrict exercise of the
- rights granted under the Adapter's License You apply.
-
-
-Section 4 -- Sui Generis Database Rights.
-
-Where the Licensed Rights include Sui Generis Database Rights that
-apply to Your use of the Licensed Material:
-
- a. for the avoidance of doubt, Section 2(a)(1) grants You the right
- to extract, reuse, reproduce, and Share all or a substantial
- portion of the contents of the database;
-
- b. if You include all or a substantial portion of the database
- contents in a database in which You have Sui Generis Database
- Rights, then the database in which You have Sui Generis Database
- Rights (but not its individual contents) is Adapted Material,
-
- including for purposes of Section 3(b); and
- c. You must comply with the conditions in Section 3(a) if You Share
- all or a substantial portion of the contents of the database.
-
-For the avoidance of doubt, this Section 4 supplements and does not
-replace Your obligations under this Public License where the Licensed
-Rights include other Copyright and Similar Rights.
-
-
-Section 5 -- Disclaimer of Warranties and Limitation of Liability.
-
- a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
- EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
- AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
- ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
- IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
- WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
- ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
- KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
- ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
-
- b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
- TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
- NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
- INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
- COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
- USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
- ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
- DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
- IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
-
- c. The disclaimer of warranties and limitation of liability provided
- above shall be interpreted in a manner that, to the extent
- possible, most closely approximates an absolute disclaimer and
- waiver of all liability.
-
-
-Section 6 -- Term and Termination.
-
- a. This Public License applies for the term of the Copyright and
- Similar Rights licensed here. However, if You fail to comply with
- this Public License, then Your rights under this Public License
- terminate automatically.
-
- b. Where Your right to use the Licensed Material has terminated under
- Section 6(a), it reinstates:
-
- 1. automatically as of the date the violation is cured, provided
- it is cured within 30 days of Your discovery of the
- violation; or
-
- 2. upon express reinstatement by the Licensor.
-
- For the avoidance of doubt, this Section 6(b) does not affect any
- right the Licensor may have to seek remedies for Your violations
- of this Public License.
-
- c. For the avoidance of doubt, the Licensor may also offer the
- Licensed Material under separate terms or conditions or stop
- distributing the Licensed Material at any time; however, doing so
- will not terminate this Public License.
-
- d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
- License.
-
-
-Section 7 -- Other Terms and Conditions.
-
- a. The Licensor shall not be bound by any additional or different
- terms or conditions communicated by You unless expressly agreed.
-
- b. Any arrangements, understandings, or agreements regarding the
- Licensed Material not stated herein are separate from and
- independent of the terms and conditions of this Public License.
-
-
-Section 8 -- Interpretation.
-
- a. For the avoidance of doubt, this Public License does not, and
- shall not be interpreted to, reduce, limit, restrict, or impose
- conditions on any use of the Licensed Material that could lawfully
- be made without permission under this Public License.
-
- b. To the extent possible, if any provision of this Public License is
- deemed unenforceable, it shall be automatically reformed to the
- minimum extent necessary to make it enforceable. If the provision
- cannot be reformed, it shall be severed from this Public License
- without affecting the enforceability of the remaining terms and
- conditions.
-
- c. No term or condition of this Public License will be waived and no
- failure to comply consented to unless expressly agreed to by the
- Licensor.
-
- d. Nothing in this Public License constitutes or may be interpreted
- as a limitation upon, or waiver of, any privileges and immunities
- that apply to the Licensor or You, including from the legal
- processes of any jurisdiction or authority.
-
-
-=======================================================================
-
-Creative Commons is not a party to its public licenses.
-Notwithstanding, Creative Commons may elect to apply one of its public
-licenses to material it publishes and in those instances will be
-considered the "Licensor." Except for the limited purpose of indicating
-that material is shared under a Creative Commons public license or as
-otherwise permitted by the Creative Commons policies published at
-creativecommons.org/policies, Creative Commons does not authorize the
-use of the trademark "Creative Commons" or any other trademark or logo
-of Creative Commons without its prior written consent including,
-without limitation, in connection with any unauthorized modifications
-to any of its public licenses or any other arrangements,
-understandings, or agreements concerning use of licensed material. For
-the avoidance of doubt, this paragraph does not form part of the public
-licenses.
-
-Creative Commons may be contacted at creativecommons.org.
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/MAINTAINERS b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/MAINTAINERS
deleted file mode 100644
index 42a29795d..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/MAINTAINERS
+++ /dev/null
@@ -1,9 +0,0 @@
-Aaron Lehmann (@aaronlehmann)
-Brandon Philips (@philips)
-Brendan Burns (@brendandburns)
-Derek McGowan (@dmcgowan)
-Jason Bouzane (@jbouzane)
-John Starks (@jstarks)
-Jonathan Boulle (@jonboulle)
-Stephen Day (@stevvooe)
-Vincent Batts (@vbatts)
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/README.md b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/README.md
deleted file mode 100644
index 0f5a04092..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# go-digest
-
-[![GoDoc](https://godoc.org/github.com/opencontainers/go-digest?status.svg)](https://godoc.org/github.com/opencontainers/go-digest) [![Go Report Card](https://goreportcard.com/badge/github.com/opencontainers/go-digest)](https://goreportcard.com/report/github.com/opencontainers/go-digest) [![Build Status](https://travis-ci.org/opencontainers/go-digest.svg?branch=master)](https://travis-ci.org/opencontainers/go-digest)
-
-Common digest package used across the container ecosystem.
-
-Please see the [godoc](https://godoc.org/github.com/opencontainers/go-digest) for more information.
-
-# What is a digest?
-
-A digest is just a hash.
-
-The most common use case for a digest is to create a content
-identifier for use in [Content Addressable Storage](https://en.wikipedia.org/wiki/Content-addressable_storage)
-systems:
-
-```go
-id := digest.FromBytes([]byte("my content"))
-```
-
-In the example above, the id can be used to uniquely identify
-the byte slice "my content". This allows two disparate applications
-to agree on a verifiable identifier without having to trust one
-another.
-
-An identifying digest can be verified, as follows:
-
-```go
-if id != digest.FromBytes([]byte("my content")) {
- return errors.New("the content has changed!")
-}
-```
-
-A `Verifier` type can be used to handle cases where an `io.Reader`
-makes more sense:
-
-```go
-rd := getContent()
-verifier := id.Verifier()
-io.Copy(verifier, rd)
-
-if !verifier.Verified() {
- return errors.New("the content has changed!")
-}
-```
-
-Using [Merkle DAGs](https://en.wikipedia.org/wiki/Merkle_tree), this
-can power a rich, safe, content distribution system.
-
-# Usage
-
-While the [godoc](https://godoc.org/github.com/opencontainers/go-digest) is
-considered the best resource, a few important items need to be called
-out when using this package.
-
-1. Make sure to import the hash implementations into your application
- or the package will panic. You should have something like the
- following in the main (or other entrypoint) of your application:
-
- ```go
- import (
- _ "crypto/sha256"
- _ "crypto/sha512"
- )
- ```
- This may seem inconvenient but it allows you replace the hash
- implementations with others, such as https://github.com/stevvooe/resumable.
-
-2. Even though `digest.Digest` may be assemable as a string, _always_
- verify your input with `digest.Parse` or use `Digest.Validate`
- when accepting untrusted input. While there are measures to
- avoid common problems, this will ensure you have valid digests
- in the rest of your application.
-
-# Stability
-
-The Go API, at this stage, is considered stable, unless otherwise noted.
-
-As always, before using a package export, read the [godoc](https://godoc.org/github.com/opencontainers/go-digest).
-
-# Contributing
-
-This package is considered fairly complete. It has been in production
-in thousands (millions?) of deployments and is fairly battle-hardened.
-New additions will be met with skepticism. If you think there is a
-missing feature, please file a bug clearly describing the problem and
-the alternatives you tried before submitting a PR.
-
-# Reporting security issues
-
-Please DO NOT file a public issue, instead send your report privately to
-security@opencontainers.org.
-
-The maintainers take security seriously. If you discover a security issue,
-please bring it to their attention right away!
-
-If you are reporting a security issue, do not create an issue or file a pull
-request on GitHub. Instead, disclose the issue responsibly by sending an email
-to security@opencontainers.org (which is inhabited only by the maintainers of
-the various OCI projects).
-
-# Copyright and license
-
-Copyright © 2016 Docker, Inc. All rights reserved, except as follows. Code is released under the [Apache 2.0 license](LICENSE.code). This `README.md` file and the [`CONTRIBUTING.md`](CONTRIBUTING.md) file are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file [`LICENSE.docs`](LICENSE.docs). You may obtain a duplicate copy of the same license, titled CC BY-SA 4.0, at http://creativecommons.org/licenses/by-sa/4.0/.
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/algorithm.go b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/algorithm.go
deleted file mode 100644
index 8813bd26f..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/algorithm.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2017 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package digest
-
-import (
- "crypto"
- "fmt"
- "hash"
- "io"
- "regexp"
-)
-
-// Algorithm identifies and implementation of a digester by an identifier.
-// Note the that this defines both the hash algorithm used and the string
-// encoding.
-type Algorithm string
-
-// supported digest types
-const (
- SHA256 Algorithm = "sha256" // sha256 with hex encoding (lower case only)
- SHA384 Algorithm = "sha384" // sha384 with hex encoding (lower case only)
- SHA512 Algorithm = "sha512" // sha512 with hex encoding (lower case only)
-
- // Canonical is the primary digest algorithm used with the distribution
- // project. Other digests may be used but this one is the primary storage
- // digest.
- Canonical = SHA256
-)
-
-var (
- // TODO(stevvooe): Follow the pattern of the standard crypto package for
- // registration of digests. Effectively, we are a registerable set and
- // common symbol access.
-
- // algorithms maps values to hash.Hash implementations. Other algorithms
- // may be available but they cannot be calculated by the digest package.
- algorithms = map[Algorithm]crypto.Hash{
- SHA256: crypto.SHA256,
- SHA384: crypto.SHA384,
- SHA512: crypto.SHA512,
- }
-
- // anchoredEncodedRegexps contains anchored regular expressions for hex-encoded digests.
- // Note that /A-F/ disallowed.
- anchoredEncodedRegexps = map[Algorithm]*regexp.Regexp{
- SHA256: regexp.MustCompile(`^[a-f0-9]{64}$`),
- SHA384: regexp.MustCompile(`^[a-f0-9]{96}$`),
- SHA512: regexp.MustCompile(`^[a-f0-9]{128}$`),
- }
-)
-
-// Available returns true if the digest type is available for use. If this
-// returns false, Digester and Hash will return nil.
-func (a Algorithm) Available() bool {
- h, ok := algorithms[a]
- if !ok {
- return false
- }
-
- // check availability of the hash, as well
- return h.Available()
-}
-
-func (a Algorithm) String() string {
- return string(a)
-}
-
-// Size returns number of bytes returned by the hash.
-func (a Algorithm) Size() int {
- h, ok := algorithms[a]
- if !ok {
- return 0
- }
- return h.Size()
-}
-
-// Set implemented to allow use of Algorithm as a command line flag.
-func (a *Algorithm) Set(value string) error {
- if value == "" {
- *a = Canonical
- } else {
- // just do a type conversion, support is queried with Available.
- *a = Algorithm(value)
- }
-
- if !a.Available() {
- return ErrDigestUnsupported
- }
-
- return nil
-}
-
-// Digester returns a new digester for the specified algorithm. If the algorithm
-// does not have a digester implementation, nil will be returned. This can be
-// checked by calling Available before calling Digester.
-func (a Algorithm) Digester() Digester {
- return &digester{
- alg: a,
- hash: a.Hash(),
- }
-}
-
-// Hash returns a new hash as used by the algorithm. If not available, the
-// method will panic. Check Algorithm.Available() before calling.
-func (a Algorithm) Hash() hash.Hash {
- if !a.Available() {
- // Empty algorithm string is invalid
- if a == "" {
- panic(fmt.Sprintf("empty digest algorithm, validate before calling Algorithm.Hash()"))
- }
-
- // NOTE(stevvooe): A missing hash is usually a programming error that
- // must be resolved at compile time. We don't import in the digest
- // package to allow users to choose their hash implementation (such as
- // when using stevvooe/resumable or a hardware accelerated package).
- //
- // Applications that may want to resolve the hash at runtime should
- // call Algorithm.Available before call Algorithm.Hash().
- panic(fmt.Sprintf("%v not available (make sure it is imported)", a))
- }
-
- return algorithms[a].New()
-}
-
-// Encode encodes the raw bytes of a digest, typically from a hash.Hash, into
-// the encoded portion of the digest.
-func (a Algorithm) Encode(d []byte) string {
- // TODO(stevvooe): Currently, all algorithms use a hex encoding. When we
- // add support for back registration, we can modify this accordingly.
- return fmt.Sprintf("%x", d)
-}
-
-// FromReader returns the digest of the reader using the algorithm.
-func (a Algorithm) FromReader(rd io.Reader) (Digest, error) {
- digester := a.Digester()
-
- if _, err := io.Copy(digester.Hash(), rd); err != nil {
- return "", err
- }
-
- return digester.Digest(), nil
-}
-
-// FromBytes digests the input and returns a Digest.
-func (a Algorithm) FromBytes(p []byte) Digest {
- digester := a.Digester()
-
- if _, err := digester.Hash().Write(p); err != nil {
- // Writes to a Hash should never fail. None of the existing
- // hash implementations in the stdlib or hashes vendored
- // here can return errors from Write. Having a panic in this
- // condition instead of having FromBytes return an error value
- // avoids unnecessary error handling paths in all callers.
- panic("write to hash function returned error: " + err.Error())
- }
-
- return digester.Digest()
-}
-
-// FromString digests the string input and returns a Digest.
-func (a Algorithm) FromString(s string) Digest {
- return a.FromBytes([]byte(s))
-}
-
-// Validate validates the encoded portion string
-func (a Algorithm) Validate(encoded string) error {
- r, ok := anchoredEncodedRegexps[a]
- if !ok {
- return ErrDigestUnsupported
- }
- // Digests much always be hex-encoded, ensuring that their hex portion will
- // always be size*2
- if a.Size()*2 != len(encoded) {
- return ErrDigestInvalidLength
- }
- if r.MatchString(encoded) {
- return nil
- }
- return ErrDigestInvalidFormat
-}
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digest.go b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digest.go
deleted file mode 100644
index ad398cba2..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digest.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2017 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package digest
-
-import (
- "fmt"
- "hash"
- "io"
- "regexp"
- "strings"
-)
-
-// Digest allows simple protection of hex formatted digest strings, prefixed
-// by their algorithm. Strings of type Digest have some guarantee of being in
-// the correct format and it provides quick access to the components of a
-// digest string.
-//
-// The following is an example of the contents of Digest types:
-//
-// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
-//
-// This allows to abstract the digest behind this type and work only in those
-// terms.
-type Digest string
-
-// NewDigest returns a Digest from alg and a hash.Hash object.
-func NewDigest(alg Algorithm, h hash.Hash) Digest {
- return NewDigestFromBytes(alg, h.Sum(nil))
-}
-
-// NewDigestFromBytes returns a new digest from the byte contents of p.
-// Typically, this can come from hash.Hash.Sum(...) or xxx.SumXXX(...)
-// functions. This is also useful for rebuilding digests from binary
-// serializations.
-func NewDigestFromBytes(alg Algorithm, p []byte) Digest {
- return NewDigestFromEncoded(alg, alg.Encode(p))
-}
-
-// NewDigestFromHex is deprecated. Please use NewDigestFromEncoded.
-func NewDigestFromHex(alg, hex string) Digest {
- return NewDigestFromEncoded(Algorithm(alg), hex)
-}
-
-// NewDigestFromEncoded returns a Digest from alg and the encoded digest.
-func NewDigestFromEncoded(alg Algorithm, encoded string) Digest {
- return Digest(fmt.Sprintf("%s:%s", alg, encoded))
-}
-
-// DigestRegexp matches valid digest types.
-var DigestRegexp = regexp.MustCompile(`[a-z0-9]+(?:[.+_-][a-z0-9]+)*:[a-zA-Z0-9=_-]+`)
-
-// DigestRegexpAnchored matches valid digest types, anchored to the start and end of the match.
-var DigestRegexpAnchored = regexp.MustCompile(`^` + DigestRegexp.String() + `$`)
-
-var (
- // ErrDigestInvalidFormat returned when digest format invalid.
- ErrDigestInvalidFormat = fmt.Errorf("invalid checksum digest format")
-
- // ErrDigestInvalidLength returned when digest has invalid length.
- ErrDigestInvalidLength = fmt.Errorf("invalid checksum digest length")
-
- // ErrDigestUnsupported returned when the digest algorithm is unsupported.
- ErrDigestUnsupported = fmt.Errorf("unsupported digest algorithm")
-)
-
-// Parse parses s and returns the validated digest object. An error will
-// be returned if the format is invalid.
-func Parse(s string) (Digest, error) {
- d := Digest(s)
- return d, d.Validate()
-}
-
-// FromReader consumes the content of rd until io.EOF, returning canonical digest.
-func FromReader(rd io.Reader) (Digest, error) {
- return Canonical.FromReader(rd)
-}
-
-// FromBytes digests the input and returns a Digest.
-func FromBytes(p []byte) Digest {
- return Canonical.FromBytes(p)
-}
-
-// FromString digests the input and returns a Digest.
-func FromString(s string) Digest {
- return Canonical.FromString(s)
-}
-
-// Validate checks that the contents of d is a valid digest, returning an
-// error if not.
-func (d Digest) Validate() error {
- s := string(d)
- i := strings.Index(s, ":")
- if i <= 0 || i+1 == len(s) {
- return ErrDigestInvalidFormat
- }
- algorithm, encoded := Algorithm(s[:i]), s[i+1:]
- if !algorithm.Available() {
- if !DigestRegexpAnchored.MatchString(s) {
- return ErrDigestInvalidFormat
- }
- return ErrDigestUnsupported
- }
- return algorithm.Validate(encoded)
-}
-
-// Algorithm returns the algorithm portion of the digest. This will panic if
-// the underlying digest is not in a valid format.
-func (d Digest) Algorithm() Algorithm {
- return Algorithm(d[:d.sepIndex()])
-}
-
-// Verifier returns a writer object that can be used to verify a stream of
-// content against the digest. If the digest is invalid, the method will panic.
-func (d Digest) Verifier() Verifier {
- return hashVerifier{
- hash: d.Algorithm().Hash(),
- digest: d,
- }
-}
-
-// Encoded returns the encoded portion of the digest. This will panic if the
-// underlying digest is not in a valid format.
-func (d Digest) Encoded() string {
- return string(d[d.sepIndex()+1:])
-}
-
-// Hex is deprecated. Please use Digest.Encoded.
-func (d Digest) Hex() string {
- return d.Encoded()
-}
-
-func (d Digest) String() string {
- return string(d)
-}
-
-func (d Digest) sepIndex() int {
- i := strings.Index(string(d), ":")
-
- if i < 0 {
- panic(fmt.Sprintf("no ':' separator in digest %q", d))
- }
-
- return i
-}
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digester.go b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digester.go
deleted file mode 100644
index 36fa2728e..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/digester.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package digest
-
-import "hash"
-
-// Digester calculates the digest of written data. Writes should go directly
-// to the return value of Hash, while calling Digest will return the current
-// value of the digest.
-type Digester interface {
- Hash() hash.Hash // provides direct access to underlying hash instance.
- Digest() Digest
-}
-
-// digester provides a simple digester definition that embeds a hasher.
-type digester struct {
- alg Algorithm
- hash hash.Hash
-}
-
-func (d *digester) Hash() hash.Hash {
- return d.hash
-}
-
-func (d *digester) Digest() Digest {
- return NewDigest(d.alg, d.hash)
-}
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/doc.go b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/doc.go
deleted file mode 100644
index 491ea1ef1..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/doc.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2017 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package digest provides a generalized type to opaquely represent message
-// digests and their operations within the registry. The Digest type is
-// designed to serve as a flexible identifier in a content-addressable system.
-// More importantly, it provides tools and wrappers to work with
-// hash.Hash-based digests with little effort.
-//
-// Basics
-//
-// The format of a digest is simply a string with two parts, dubbed the
-// "algorithm" and the "digest", separated by a colon:
-//
-// :
-//
-// An example of a sha256 digest representation follows:
-//
-// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
-//
-// In this case, the string "sha256" is the algorithm and the hex bytes are
-// the "digest".
-//
-// Because the Digest type is simply a string, once a valid Digest is
-// obtained, comparisons are cheap, quick and simple to express with the
-// standard equality operator.
-//
-// Verification
-//
-// The main benefit of using the Digest type is simple verification against a
-// given digest. The Verifier interface, modeled after the stdlib hash.Hash
-// interface, provides a common write sink for digest verification. After
-// writing is complete, calling the Verifier.Verified method will indicate
-// whether or not the stream of bytes matches the target digest.
-//
-// Missing Features
-//
-// In addition to the above, we intend to add the following features to this
-// package:
-//
-// 1. A Digester type that supports write sink digest calculation.
-//
-// 2. Suspend and resume of ongoing digest calculations to support efficient digest verification in the registry.
-//
-package digest
diff --git a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/verifiers.go b/archived/event-adapter/vendor/github.com/opencontainers/go-digest/verifiers.go
deleted file mode 100644
index 32125e918..000000000
--- a/archived/event-adapter/vendor/github.com/opencontainers/go-digest/verifiers.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2017 Docker, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package digest
-
-import (
- "hash"
- "io"
-)
-
-// Verifier presents a general verification interface to be used with message
-// digests and other byte stream verifications. Users instantiate a Verifier
-// from one of the various methods, write the data under test to it then check
-// the result with the Verified method.
-type Verifier interface {
- io.Writer
-
- // Verified will return true if the content written to Verifier matches
- // the digest.
- Verified() bool
-}
-
-type hashVerifier struct {
- digest Digest
- hash hash.Hash
-}
-
-func (hv hashVerifier) Write(p []byte) (n int, err error) {
- return hv.hash.Write(p)
-}
-
-func (hv hashVerifier) Verified() bool {
- return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash)
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/CONTRIBUTORS b/archived/event-adapter/vendor/github.com/pborman/uuid/CONTRIBUTORS
deleted file mode 100644
index b382a04ed..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/CONTRIBUTORS
+++ /dev/null
@@ -1 +0,0 @@
-Paul Borman
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/LICENSE b/archived/event-adapter/vendor/github.com/pborman/uuid/LICENSE
deleted file mode 100644
index 5dc68268d..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-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.
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/dce.go b/archived/event-adapter/vendor/github.com/pborman/uuid/dce.go
deleted file mode 100644
index 50a0f2d09..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/dce.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2011 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 {
- uuid := NewUUID()
- if uuid != nil {
- uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2
- uuid[9] = byte(domain)
- binary.BigEndian.PutUint32(uuid[0:], id)
- }
- return uuid
-}
-
-// NewDCEPerson returns a DCE Security (Version 2) UUID in the person
-// domain with the id returned by os.Getuid.
-//
-// NewDCEPerson(Person, uint32(os.Getuid()))
-func NewDCEPerson() UUID {
- 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.
-//
-// NewDCEGroup(Group, uint32(os.Getgid()))
-func NewDCEGroup() UUID {
- return NewDCESecurity(Group, uint32(os.Getgid()))
-}
-
-// Domain returns the domain for a Version 2 UUID or false.
-func (uuid UUID) Domain() (Domain, bool) {
- if v, _ := uuid.Version(); v != 2 {
- return 0, false
- }
- return Domain(uuid[9]), true
-}
-
-// Id returns the id for a Version 2 UUID or false.
-func (uuid UUID) Id() (uint32, bool) {
- if v, _ := uuid.Version(); v != 2 {
- return 0, false
- }
- return binary.BigEndian.Uint32(uuid[0:4]), true
-}
-
-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))
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/doc.go b/archived/event-adapter/vendor/github.com/pborman/uuid/doc.go
deleted file mode 100644
index d8bd013e6..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/doc.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2011 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.
-
-// The uuid package generates and inspects UUIDs.
-//
-// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security Services.
-package uuid
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/hash.go b/archived/event-adapter/vendor/github.com/pborman/uuid/hash.go
deleted file mode 100644
index cdd4192fd..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/hash.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2011 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 Name Space IDs and UUIDs
-var (
- NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
- NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
- NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
- NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
- NIL = Parse("00000000-0000-0000-0000-000000000000")
-)
-
-// NewHash returns a new UUID dervied 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([]byte(data))
- s := h.Sum(nil)
- uuid := make([]byte, 16)
- 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.
-//
-// 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.
-//
-// NewHash(sha1.New(), space, data, 5)
-func NewSHA1(space UUID, data []byte) UUID {
- return NewHash(sha1.New(), space, data, 5)
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/json.go b/archived/event-adapter/vendor/github.com/pborman/uuid/json.go
deleted file mode 100644
index 760580a50..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/json.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 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 "errors"
-
-func (u UUID) MarshalJSON() ([]byte, error) {
- if len(u) == 0 {
- return []byte(`""`), nil
- }
- return []byte(`"` + u.String() + `"`), nil
-}
-
-func (u *UUID) UnmarshalJSON(data []byte) error {
- if len(data) == 0 || string(data) == `""` {
- return nil
- }
- if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' {
- return errors.New("invalid UUID format")
- }
- data = data[1 : len(data)-1]
- uu := Parse(string(data))
- if uu == nil {
- return errors.New("invalid UUID format")
- }
- *u = uu
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/node.go b/archived/event-adapter/vendor/github.com/pborman/uuid/node.go
deleted file mode 100644
index dd0a8ac18..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/node.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2011 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 "net"
-
-var (
- interfaces []net.Interface // cached list of interfaces
- ifname string // name of interface being used
- nodeID []byte // hardware for version 1 UUIDs
-)
-
-// 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 {
- 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 {
- if interfaces == nil {
- var err error
- interfaces, err = net.Interfaces()
- if err != nil && name != "" {
- return false
- }
- }
-
- for _, ifs := range interfaces {
- if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
- if setNodeID(ifs.HardwareAddr) {
- ifname = ifs.Name
- 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 == "" {
- if nodeID == nil {
- nodeID = make([]byte, 6)
- }
- 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 {
- if nodeID == nil {
- SetNodeInterface("")
- }
- nid := make([]byte, 6)
- copy(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 setNodeID(id) {
- ifname = "user"
- return true
- }
- return false
-}
-
-func setNodeID(id []byte) bool {
- if len(id) < 6 {
- return false
- }
- if nodeID == nil {
- nodeID = make([]byte, 6)
- }
- copy(nodeID, id)
- 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 {
- if len(uuid) != 16 {
- return nil
- }
- node := make([]byte, 6)
- copy(node, uuid[10:])
- return node
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/time.go b/archived/event-adapter/vendor/github.com/pborman/uuid/time.go
deleted file mode 100644
index 7ebc9bef1..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/time.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2014 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 (
- mu sync.Mutex
- lasttime uint64 // last time we returned
- clock_seq 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 mu.Unlock()
- mu.Lock()
- return getTime()
-}
-
-func getTime() (Time, uint16, error) {
- t := timeNow()
-
- // If we don't have a clock sequence already, set one.
- if clock_seq == 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 {
- clock_seq = ((clock_seq + 1) & 0x3fff) | 0x8000
- }
- lasttime = now
- return Time(now), clock_seq, 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 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) sequence is generated
-// for
-func ClockSequence() int {
- defer mu.Unlock()
- mu.Lock()
- return clockSequence()
-}
-
-func clockSequence() int {
- if clock_seq == 0 {
- setClockSequence(-1)
- }
- return int(clock_seq & 0x3fff)
-}
-
-// SetClockSeq 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 mu.Unlock()
- mu.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])
- }
- old_seq := clock_seq
- clock_seq = uint16(seq&0x3fff) | 0x8000 // Set our variant
- if old_seq != clock_seq {
- lasttime = 0
- }
-}
-
-// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
-// uuid. It returns false if uuid is not valid. The time is only well defined
-// for version 1 and 2 UUIDs.
-func (uuid UUID) Time() (Time, bool) {
- if len(uuid) != 16 {
- return 0, false
- }
- 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), true
-}
-
-// ClockSequence returns the clock sequence encoded in uuid. It returns false
-// if uuid is not valid. The clock sequence is only well defined for version 1
-// and 2 UUIDs.
-func (uuid UUID) ClockSequence() (int, bool) {
- if len(uuid) != 16 {
- return 0, false
- }
- return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff, true
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/util.go b/archived/event-adapter/vendor/github.com/pborman/uuid/util.go
deleted file mode 100644
index de40b102c..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/util.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2011 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 = []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 the the first two hex bytes of x into a byte.
-func xtob(x string) (byte, bool) {
- b1 := xvalues[x[0]]
- b2 := xvalues[x[1]]
- return (b1 << 4) | b2, b1 != 255 && b2 != 255
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/uuid.go b/archived/event-adapter/vendor/github.com/pborman/uuid/uuid.go
deleted file mode 100644
index 2920fae63..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/uuid.go
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2011 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"
- "fmt"
- "io"
- "strings"
-)
-
-// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
-// 4122.
-type UUID []byte
-
-// A Version represents a UUIDs version.
-type Version byte
-
-// A Variant represents a UUIDs 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
-
-// New returns a new random (version 4) UUID as a string. It is a convenience
-// function for NewRandom().String().
-func New() string {
- return NewRandom().String()
-}
-
-// Parse decodes s into a UUID or returns nil. Both the UUID form of
-// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
-// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded.
-func Parse(s string) UUID {
- if len(s) == 36+9 {
- if strings.ToLower(s[:9]) != "urn:uuid:" {
- return nil
- }
- s = s[9:]
- } else if len(s) != 36 {
- return nil
- }
- if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
- return nil
- }
- uuid := make([]byte, 16)
- for i, x := range []int{
- 0, 2, 4, 6,
- 9, 11,
- 14, 16,
- 19, 21,
- 24, 26, 28, 30, 32, 34} {
- if v, ok := xtob(s[x:]); !ok {
- return nil
- } else {
- uuid[i] = v
- }
- }
- return uuid
-}
-
-// Equal returns true if uuid1 and uuid2 are equal.
-func Equal(uuid1, uuid2 UUID) bool {
- return bytes.Equal(uuid1, uuid2)
-}
-
-// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-// , or "" if uuid is invalid.
-func (uuid UUID) String() string {
- if uuid == nil || len(uuid) != 16 {
- return ""
- }
- b := []byte(uuid)
- return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x",
- b[:4], b[4:6], b[6:8], b[8:10], b[10:])
-}
-
-// 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 {
- if uuid == nil || len(uuid) != 16 {
- return ""
- }
- b := []byte(uuid)
- return fmt.Sprintf("urn:uuid:%08x-%04x-%04x-%04x-%012x",
- b[:4], b[4:6], b[6:8], b[8:10], b[10:])
-}
-
-// Variant returns the variant encoded in uuid. It returns Invalid if
-// uuid is invalid.
-func (uuid UUID) Variant() Variant {
- if len(uuid) != 16 {
- return Invalid
- }
- 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
- }
- panic("unreachable")
-}
-
-// Version returns the verison of uuid. It returns false if uuid is not
-// valid.
-func (uuid UUID) Version() (Version, bool) {
- if len(uuid) != 16 {
- return 0, false
- }
- return Version(uuid[6] >> 4), true
-}
-
-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 implents 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
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/version1.go b/archived/event-adapter/vendor/github.com/pborman/uuid/version1.go
deleted file mode 100644
index 0127eacfa..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/version1.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2011 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.
-func NewUUID() UUID {
- if nodeID == nil {
- SetNodeInterface("")
- }
-
- now, seq, err := GetTime()
- if err != nil {
- return nil
- }
-
- uuid := make([]byte, 16)
-
- time_low := uint32(now & 0xffffffff)
- time_mid := uint16((now >> 32) & 0xffff)
- time_hi := uint16((now >> 48) & 0x0fff)
- time_hi |= 0x1000 // Version 1
-
- binary.BigEndian.PutUint32(uuid[0:], time_low)
- binary.BigEndian.PutUint16(uuid[4:], time_mid)
- binary.BigEndian.PutUint16(uuid[6:], time_hi)
- binary.BigEndian.PutUint16(uuid[8:], seq)
- copy(uuid[10:], nodeID)
-
- return uuid
-}
diff --git a/archived/event-adapter/vendor/github.com/pborman/uuid/version4.go b/archived/event-adapter/vendor/github.com/pborman/uuid/version4.go
deleted file mode 100644
index b3d4a368d..000000000
--- a/archived/event-adapter/vendor/github.com/pborman/uuid/version4.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2011 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
-
-// Random returns a Random (Version 4) UUID or panics.
-//
-// The strength of the UUIDs is based on the strength of the crypto/rand
-// package.
-//
-// A note about uniqueness derived from 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 {
- uuid := make([]byte, 16)
- randomBits([]byte(uuid))
- uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
- uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
- return uuid
-}
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/.gitignore b/archived/event-adapter/vendor/github.com/pkg/errors/.gitignore
deleted file mode 100644
index daf913b1b..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/.travis.yml b/archived/event-adapter/vendor/github.com/pkg/errors/.travis.yml
deleted file mode 100644
index 024e28466..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: go
-go_import_path: github.com/pkg/errors
-go:
- - 1.4.3
- - 1.5.4
- - 1.6.2
- - tip
-
-script:
- - go test -v ./...
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/LICENSE b/archived/event-adapter/vendor/github.com/pkg/errors/LICENSE
deleted file mode 100644
index 835ba3e75..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Dave Cheney
-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.
-
-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 HOLDER 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.
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/README.md b/archived/event-adapter/vendor/github.com/pkg/errors/README.md
deleted file mode 100644
index 273db3c98..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors)
-
-Package errors provides simple error handling primitives.
-
-`go get github.com/pkg/errors`
-
-The traditional error handling idiom in Go is roughly akin to
-```go
-if err != nil {
- return err
-}
-```
-which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
-
-## Adding context to an error
-
-The errors.Wrap function returns a new error that adds context to the original error. For example
-```go
-_, err := ioutil.ReadAll(r)
-if err != nil {
- return errors.Wrap(err, "read failed")
-}
-```
-## Retrieving the cause of an error
-
-Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
-```go
-type causer interface {
- Cause() error
-}
-```
-`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
-```go
-switch err := errors.Cause(err).(type) {
-case *MyError:
- // handle specifically
-default:
- // unknown error
-}
-```
-
-[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
-
-## Contributing
-
-We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
-
-Before proposing a change, please discuss your change by raising an issue.
-
-## Licence
-
-BSD-2-Clause
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/appveyor.yml b/archived/event-adapter/vendor/github.com/pkg/errors/appveyor.yml
deleted file mode 100644
index a932eade0..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/appveyor.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-version: build-{build}.{branch}
-
-clone_folder: C:\gopath\src\github.com\pkg\errors
-shallow_clone: true # for startup speed
-
-environment:
- GOPATH: C:\gopath
-
-platform:
- - x64
-
-# http://www.appveyor.com/docs/installed-software
-install:
- # some helpful output for debugging builds
- - go version
- - go env
- # pre-installed MinGW at C:\MinGW is 32bit only
- # but MSYS2 at C:\msys64 has mingw64
- - set PATH=C:\msys64\mingw64\bin;%PATH%
- - gcc --version
- - g++ --version
-
-build_script:
- - go install -v ./...
-
-test_script:
- - set PATH=C:\gopath\bin;%PATH%
- - go test -v ./...
-
-#artifacts:
-# - path: '%GOPATH%\bin\*.exe'
-deploy: off
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/errors.go b/archived/event-adapter/vendor/github.com/pkg/errors/errors.go
deleted file mode 100644
index 75780c991..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/errors.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Package errors provides simple error handling primitives.
-//
-// The traditional error handling idiom in Go is roughly akin to
-//
-// if err != nil {
-// return err
-// }
-//
-// which applied recursively up the call stack results in error reports
-// without context or debugging information. The errors package allows
-// programmers to add context to the failure path in their code in a way
-// that does not destroy the original value of the error.
-//
-// Adding context to an error
-//
-// The errors.Wrap function returns a new error that adds context to the
-// original error. For example
-//
-// _, err := ioutil.ReadAll(r)
-// if err != nil {
-// return errors.Wrap(err, "read failed")
-// }
-//
-// Retrieving the cause of an error
-//
-// Using errors.Wrap constructs a stack of errors, adding context to the
-// preceding error. Depending on the nature of the error it may be necessary
-// to reverse the operation of errors.Wrap to retrieve the original error
-// for inspection. Any error value which implements this interface
-//
-// type causer interface {
-// Cause() error
-// }
-//
-// can be inspected by errors.Cause. errors.Cause will recursively retrieve
-// the topmost error which does not implement causer, which is assumed to be
-// the original cause. For example:
-//
-// switch err := errors.Cause(err).(type) {
-// case *MyError:
-// // handle specifically
-// default:
-// // unknown error
-// }
-//
-// causer interface is not exported by this package, but is considered a part
-// of stable public API.
-//
-// Formatted printing of errors
-//
-// All error values returned from this package implement fmt.Formatter and can
-// be formatted by the fmt package. The following verbs are supported
-//
-// %s print the error. If the error has a Cause it will be
-// printed recursively
-// %v see %s
-// %+v extended format. Each Frame of the error's StackTrace will
-// be printed in detail.
-//
-// Retrieving the stack trace of an error or wrapper
-//
-// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
-// invoked. This information can be retrieved with the following interface.
-//
-// type stackTracer interface {
-// StackTrace() errors.StackTrace
-// }
-//
-// Where errors.StackTrace is defined as
-//
-// type StackTrace []Frame
-//
-// The Frame type represents a call site in the stack trace. Frame supports
-// the fmt.Formatter interface that can be used for printing information about
-// the stack trace of this error. For example:
-//
-// if err, ok := err.(stackTracer); ok {
-// for _, f := range err.StackTrace() {
-// fmt.Printf("%+s:%d", f)
-// }
-// }
-//
-// stackTracer interface is not exported by this package, but is considered a part
-// of stable public API.
-//
-// See the documentation for Frame.Format for more details.
-package errors
-
-import (
- "fmt"
- "io"
-)
-
-// New returns an error with the supplied message.
-// New also records the stack trace at the point it was called.
-func New(message string) error {
- return &fundamental{
- msg: message,
- stack: callers(),
- }
-}
-
-// Errorf formats according to a format specifier and returns the string
-// as a value that satisfies error.
-// Errorf also records the stack trace at the point it was called.
-func Errorf(format string, args ...interface{}) error {
- return &fundamental{
- msg: fmt.Sprintf(format, args...),
- stack: callers(),
- }
-}
-
-// fundamental is an error that has a message and a stack, but no caller.
-type fundamental struct {
- msg string
- *stack
-}
-
-func (f *fundamental) Error() string { return f.msg }
-
-func (f *fundamental) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- io.WriteString(s, f.msg)
- f.stack.Format(s, verb)
- return
- }
- fallthrough
- case 's', 'q':
- io.WriteString(s, f.msg)
- }
-}
-
-type withStack struct {
- error
- *stack
-}
-
-func (w *withStack) Cause() error { return w.error }
-
-func (w *withStack) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- fmt.Fprintf(s, "%+v", w.Cause())
- w.stack.Format(s, verb)
- return
- }
- fallthrough
- case 's':
- io.WriteString(s, w.Error())
- case 'q':
- fmt.Fprintf(s, "%q", w.Error())
- }
-}
-
-// Wrap returns an error annotating err with message.
-// If err is nil, Wrap returns nil.
-func Wrap(err error, message string) error {
- if err == nil {
- return nil
- }
- err = &withMessage{
- cause: err,
- msg: message,
- }
- return &withStack{
- err,
- callers(),
- }
-}
-
-// Wrapf returns an error annotating err with the format specifier.
-// If err is nil, Wrapf returns nil.
-func Wrapf(err error, format string, args ...interface{}) error {
- if err == nil {
- return nil
- }
- err = &withMessage{
- cause: err,
- msg: fmt.Sprintf(format, args...),
- }
- return &withStack{
- err,
- callers(),
- }
-}
-
-type withMessage struct {
- cause error
- msg string
-}
-
-func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
-func (w *withMessage) Cause() error { return w.cause }
-
-func (w *withMessage) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- fmt.Fprintf(s, "%+v\n", w.Cause())
- io.WriteString(s, w.msg)
- return
- }
- fallthrough
- case 's', 'q':
- io.WriteString(s, w.Error())
- }
-}
-
-// Cause returns the underlying cause of the error, if possible.
-// An error value has a cause if it implements the following
-// interface:
-//
-// type causer interface {
-// Cause() error
-// }
-//
-// If the error does not implement Cause, the original error will
-// be returned. If the error is nil, nil will be returned without further
-// investigation.
-func Cause(err error) error {
- type causer interface {
- Cause() error
- }
-
- for err != nil {
- cause, ok := err.(causer)
- if !ok {
- break
- }
- err = cause.Cause()
- }
- return err
-}
diff --git a/archived/event-adapter/vendor/github.com/pkg/errors/stack.go b/archived/event-adapter/vendor/github.com/pkg/errors/stack.go
deleted file mode 100644
index 6b1f2891a..000000000
--- a/archived/event-adapter/vendor/github.com/pkg/errors/stack.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package errors
-
-import (
- "fmt"
- "io"
- "path"
- "runtime"
- "strings"
-)
-
-// Frame represents a program counter inside a stack frame.
-type Frame uintptr
-
-// pc returns the program counter for this frame;
-// multiple frames may have the same PC value.
-func (f Frame) pc() uintptr { return uintptr(f) - 1 }
-
-// file returns the full path to the file that contains the
-// function for this Frame's pc.
-func (f Frame) file() string {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return "unknown"
- }
- file, _ := fn.FileLine(f.pc())
- return file
-}
-
-// line returns the line number of source code of the
-// function for this Frame's pc.
-func (f Frame) line() int {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return 0
- }
- _, line := fn.FileLine(f.pc())
- return line
-}
-
-// Format formats the frame according to the fmt.Formatter interface.
-//
-// %s source file
-// %d source line
-// %n function name
-// %v equivalent to %s:%d
-//
-// Format accepts flags that alter the printing of some verbs, as follows:
-//
-// %+s path of source file relative to the compile time GOPATH
-// %+v equivalent to %+s:%d
-func (f Frame) Format(s fmt.State, verb rune) {
- switch verb {
- case 's':
- switch {
- case s.Flag('+'):
- pc := f.pc()
- fn := runtime.FuncForPC(pc)
- if fn == nil {
- io.WriteString(s, "unknown")
- } else {
- file, _ := fn.FileLine(pc)
- fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
- }
- default:
- io.WriteString(s, path.Base(f.file()))
- }
- case 'd':
- fmt.Fprintf(s, "%d", f.line())
- case 'n':
- name := runtime.FuncForPC(f.pc()).Name()
- io.WriteString(s, funcname(name))
- case 'v':
- f.Format(s, 's')
- io.WriteString(s, ":")
- f.Format(s, 'd')
- }
-}
-
-// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
-type StackTrace []Frame
-
-func (st StackTrace) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- switch {
- case s.Flag('+'):
- for _, f := range st {
- fmt.Fprintf(s, "\n%+v", f)
- }
- case s.Flag('#'):
- fmt.Fprintf(s, "%#v", []Frame(st))
- default:
- fmt.Fprintf(s, "%v", []Frame(st))
- }
- case 's':
- fmt.Fprintf(s, "%s", []Frame(st))
- }
-}
-
-// stack represents a stack of program counters.
-type stack []uintptr
-
-func (s *stack) Format(st fmt.State, verb rune) {
- switch verb {
- case 'v':
- switch {
- case st.Flag('+'):
- for _, pc := range *s {
- f := Frame(pc)
- fmt.Fprintf(st, "\n%+v", f)
- }
- }
- }
-}
-
-func (s *stack) StackTrace() StackTrace {
- f := make([]Frame, len(*s))
- for i := 0; i < len(f); i++ {
- f[i] = Frame((*s)[i])
- }
- return f
-}
-
-func callers() *stack {
- const depth = 32
- var pcs [depth]uintptr
- n := runtime.Callers(3, pcs[:])
- var st stack = pcs[0:n]
- return &st
-}
-
-// funcname removes the path prefix component of a function's name reported by func.Name().
-func funcname(name string) string {
- i := strings.LastIndex(name, "/")
- name = name[i+1:]
- i = strings.Index(name, ".")
- return name[i+1:]
-}
-
-func trimGOPATH(name, file string) string {
- // Here we want to get the source file path relative to the compile time
- // GOPATH. As of Go 1.6.x there is no direct way to know the compiled
- // GOPATH at runtime, but we can infer the number of path segments in the
- // GOPATH. We note that fn.Name() returns the function name qualified by
- // the import path, which does not include the GOPATH. Thus we can trim
- // segments from the beginning of the file path until the number of path
- // separators remaining is one more than the number of path separators in
- // the function name. For example, given:
- //
- // GOPATH /home/user
- // file /home/user/src/pkg/sub/file.go
- // fn.Name() pkg/sub.Type.Method
- //
- // We want to produce:
- //
- // pkg/sub/file.go
- //
- // From this we can easily see that fn.Name() has one less path separator
- // than our desired output. We count separators from the end of the file
- // path until it finds two more than in the function name and then move
- // one character forward to preserve the initial path segment without a
- // leading separator.
- const sep = "/"
- goal := strings.Count(name, sep) + 2
- i := len(file)
- for n := 0; n < goal; n++ {
- i = strings.LastIndex(file[:i], sep)
- if i == -1 {
- // not enough separators found, set i so that the slice expression
- // below leaves file unmodified
- i = -len(sep)
- break
- }
- }
- // get back to 0 or trim the leading separator
- file = file[i+len(sep):]
- return file
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/AUTHORS.md b/archived/event-adapter/vendor/github.com/prometheus/client_golang/AUTHORS.md
deleted file mode 100644
index b67a4f5a4..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/AUTHORS.md
+++ /dev/null
@@ -1,18 +0,0 @@
-The Prometheus project was started by Matt T. Proud (emeritus) and
-Julius Volz in 2012.
-
-Maintainers of this repository:
-
-* Björn Rabenstein
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Bernerd Schaefer
-* Björn Rabenstein
-* Daniel Bornkessel
-* Jeff Younker
-* Julius Volz
-* Matt T. Proud
-* Tobias Schmidt
-
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/LICENSE b/archived/event-adapter/vendor/github.com/prometheus/client_golang/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/NOTICE b/archived/event-adapter/vendor/github.com/prometheus/client_golang/NOTICE
deleted file mode 100644
index 37e4a7d41..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/NOTICE
+++ /dev/null
@@ -1,28 +0,0 @@
-Prometheus instrumentation library for Go applications
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
-
-
-The following components are included in this product:
-
-goautoneg
-http://bitbucket.org/ww/goautoneg
-Copyright 2011, Open Knowledge Foundation Ltd.
-See README.txt for license details.
-
-perks - a fork of https://github.com/bmizerany/perks
-https://github.com/beorn7/perks
-Copyright 2013-2015 Blake Mizerany, Björn Rabenstein
-See https://github.com/beorn7/perks/blob/master/README.md for license details.
-
-Go support for Protocol Buffers - Google's data interchange format
-http://github.com/golang/protobuf/
-Copyright 2010 The Go Authors
-See source code for license details.
-
-Support for streaming Protocol Buffer messages for the Go language (golang).
-https://github.com/matttproud/golang_protobuf_extensions
-Copyright 2013 Matt T. Proud
-Licensed under the Apache License, Version 2.0
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/.gitignore b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
deleted file mode 100644
index 3460f0346..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-command-line-arguments.test
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/README.md b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/README.md
deleted file mode 100644
index 81032bed8..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Overview
-This is the [Prometheus](http://www.prometheus.io) telemetric
-instrumentation client [Go](http://golang.org) client library. It
-enable authors to define process-space metrics for their servers and
-expose them through a web service interface for extraction,
-aggregation, and a whole slew of other post processing techniques.
-
-# Installing
- $ go get github.com/prometheus/client_golang/prometheus
-
-# Example
-```go
-package main
-
-import (
- "net/http"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-var (
- indexed = prometheus.NewCounter(prometheus.CounterOpts{
- Namespace: "my_company",
- Subsystem: "indexer",
- Name: "documents_indexed",
- Help: "The number of documents indexed.",
- })
- size = prometheus.NewGauge(prometheus.GaugeOpts{
- Namespace: "my_company",
- Subsystem: "storage",
- Name: "documents_total_size_bytes",
- Help: "The total size of all documents in the storage.",
- })
-)
-
-func main() {
- http.Handle("/metrics", prometheus.Handler())
-
- indexed.Inc()
- size.Set(5)
-
- http.ListenAndServe(":8080", nil)
-}
-
-func init() {
- prometheus.MustRegister(indexed)
- prometheus.MustRegister(size)
-}
-```
-
-# Documentation
-
-[![GoDoc](https://godoc.org/github.com/prometheus/client_golang?status.png)](https://godoc.org/github.com/prometheus/client_golang)
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/collector.go
deleted file mode 100644
index c04688009..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/collector.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Collector is the interface implemented by anything that can be used by
-// Prometheus to collect metrics. A Collector has to be registered for
-// collection. See Register, MustRegister, RegisterOrGet, and MustRegisterOrGet.
-//
-// The stock metrics provided by this package (like Gauge, Counter, Summary) are
-// also Collectors (which only ever collect one metric, namely itself). An
-// implementer of Collector may, however, collect multiple metrics in a
-// coordinated fashion and/or create metrics on the fly. Examples for collectors
-// already implemented in this library are the metric vectors (i.e. collection
-// of multiple instances of the same Metric but with different label values)
-// like GaugeVec or SummaryVec, and the ExpvarCollector.
-type Collector interface {
- // Describe sends the super-set of all possible descriptors of metrics
- // collected by this Collector to the provided channel and returns once
- // the last descriptor has been sent. The sent descriptors fulfill the
- // consistency and uniqueness requirements described in the Desc
- // documentation. (It is valid if one and the same Collector sends
- // duplicate descriptors. Those duplicates are simply ignored. However,
- // two different Collectors must not send duplicate descriptors.) This
- // method idempotently sends the same descriptors throughout the
- // lifetime of the Collector. If a Collector encounters an error while
- // executing this method, it must send an invalid descriptor (created
- // with NewInvalidDesc) to signal the error to the registry.
- Describe(chan<- *Desc)
- // Collect is called by Prometheus when collecting metrics. The
- // implementation sends each collected metric via the provided channel
- // and returns once the last metric has been sent. The descriptor of
- // each sent metric is one of those returned by Describe. Returned
- // metrics that share the same descriptor must differ in their variable
- // label values. This method may be called concurrently and must
- // therefore be implemented in a concurrency safe way. Blocking occurs
- // at the expense of total performance of rendering all registered
- // metrics. Ideally, Collector implementations support concurrent
- // readers.
- Collect(chan<- Metric)
-}
-
-// SelfCollector implements Collector for a single Metric so that that the
-// Metric collects itself. Add it as an anonymous field to a struct that
-// implements Metric, and call Init with the Metric itself as an argument.
-type SelfCollector struct {
- self Metric
-}
-
-// Init provides the SelfCollector with a reference to the metric it is supposed
-// to collect. It is usually called within the factory function to create a
-// metric. See example.
-func (c *SelfCollector) Init(self Metric) {
- c.self = self
-}
-
-// Describe implements Collector.
-func (c *SelfCollector) Describe(ch chan<- *Desc) {
- ch <- c.self.Desc()
-}
-
-// Collect implements Collector.
-func (c *SelfCollector) Collect(ch chan<- Metric) {
- ch <- c.self
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/counter.go
deleted file mode 100644
index a2952d1c8..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/counter.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "hash/fnv"
-)
-
-// Counter is a Metric that represents a single numerical value that only ever
-// goes up. That implies that it cannot be used to count items whose number can
-// also go down, e.g. the number of currently running goroutines. Those
-// "counters" are represented by Gauges.
-//
-// A Counter is typically used to count requests served, tasks completed, errors
-// occurred, etc.
-//
-// To create Counter instances, use NewCounter.
-type Counter interface {
- Metric
- Collector
-
- // Set is used to set the Counter to an arbitrary value. It is only used
- // if you have to transfer a value from an external counter into this
- // Prometheus metric. Do not use it for regular handling of a
- // Prometheus counter (as it can be used to break the contract of
- // monotonically increasing values).
- Set(float64)
- // Inc increments the counter by 1.
- Inc()
- // Add adds the given value to the counter. It panics if the value is <
- // 0.
- Add(float64)
-}
-
-// CounterOpts is an alias for Opts. See there for doc comments.
-type CounterOpts Opts
-
-// NewCounter creates a new Counter based on the provided CounterOpts.
-func NewCounter(opts CounterOpts) Counter {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- )
- result := &counter{value: value{desc: desc, valType: CounterValue, labelPairs: desc.constLabelPairs}}
- result.Init(result) // Init self-collection.
- return result
-}
-
-type counter struct {
- value
-}
-
-func (c *counter) Add(v float64) {
- if v < 0 {
- panic(errors.New("counter cannot decrease in value"))
- }
- c.value.Add(v)
-}
-
-// CounterVec is a Collector that bundles a set of Counters that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. number of HTTP requests, partitioned by response code and
-// method). Create instances with NewCounterVec.
-//
-// CounterVec embeds MetricVec. See there for a full list of methods with
-// detailed documentation.
-type CounterVec struct {
- MetricVec
-}
-
-// NewCounterVec creates a new CounterVec based on the provided CounterOpts and
-// partitioned by the given label names. At least one label name must be
-// provided.
-func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &CounterVec{
- MetricVec: MetricVec{
- children: map[uint64]Metric{},
- desc: desc,
- hash: fnv.New64a(),
- newMetric: func(lvs ...string) Metric {
- result := &counter{value: value{
- desc: desc,
- valType: CounterValue,
- labelPairs: makeLabelPairs(desc, lvs),
- }}
- result.Init(result) // Init self-collection.
- return result
- },
- },
- }
-}
-
-// GetMetricWithLabelValues replaces the method of the same name in
-// MetricVec. The difference is that this method returns a Counter and not a
-// Metric so that no type conversion is required.
-func (m *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) {
- metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// GetMetricWith replaces the method of the same name in MetricVec. The
-// difference is that this method returns a Counter and not a Metric so that no
-// type conversion is required.
-func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) {
- metric, err := m.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. By not returning an
-// error, WithLabelValues allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (m *CounterVec) WithLabelValues(lvs ...string) Counter {
- return m.MetricVec.WithLabelValues(lvs...).(Counter)
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. By not returning an error, With allows shortcuts like
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-func (m *CounterVec) With(labels Labels) Counter {
- return m.MetricVec.With(labels).(Counter)
-}
-
-// CounterFunc is a Counter whose value is determined at collect time by calling a
-// provided function.
-//
-// To create CounterFunc instances, use NewCounterFunc.
-type CounterFunc interface {
- Metric
- Collector
-}
-
-// NewCounterFunc creates a new CounterFunc based on the provided
-// CounterOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a CounterFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe. The function should also honor
-// the contract for a Counter (values only go up, not down), but compliance will
-// not be checked.
-func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), CounterValue, function)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/desc.go
deleted file mode 100644
index fcde784d6..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/desc.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package prometheus
-
-import (
- "bytes"
- "errors"
- "fmt"
- "hash/fnv"
- "regexp"
- "sort"
- "strings"
-
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-var (
- metricNameRE = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_:]*$`)
- labelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
-)
-
-// reservedLabelPrefix is a prefix which is not legal in user-supplied
-// label names.
-const reservedLabelPrefix = "__"
-
-// Labels represents a collection of label name -> value mappings. This type is
-// commonly used with the With(Labels) and GetMetricWith(Labels) methods of
-// metric vector Collectors, e.g.:
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-//
-// The other use-case is the specification of constant label pairs in Opts or to
-// create a Desc.
-type Labels map[string]string
-
-// Desc is the descriptor used by every Prometheus Metric. It is essentially
-// the immutable meta-data of a Metric. The normal Metric implementations
-// included in this package manage their Desc under the hood. Users only have to
-// deal with Desc if they use advanced features like the ExpvarCollector or
-// custom Collectors and Metrics.
-//
-// Descriptors registered with the same registry have to fulfill certain
-// consistency and uniqueness criteria if they share the same fully-qualified
-// name: They must have the same help string and the same label names (aka label
-// dimensions) in each, constLabels and variableLabels, but they must differ in
-// the values of the constLabels.
-//
-// Descriptors that share the same fully-qualified names and the same label
-// values of their constLabels are considered equal.
-//
-// Use NewDesc to create new Desc instances.
-type Desc struct {
- // fqName has been built from Namespace, Subsystem, and Name.
- fqName string
- // help provides some helpful information about this metric.
- help string
- // constLabelPairs contains precalculated DTO label pairs based on
- // the constant labels.
- constLabelPairs []*dto.LabelPair
- // VariableLabels contains names of labels for which the metric
- // maintains variable values.
- variableLabels []string
- // id is a hash of the values of the ConstLabels and fqName. This
- // must be unique among all registered descriptors and can therefore be
- // used as an identifier of the descriptor.
- id uint64
- // dimHash is a hash of the label names (preset and variable) and the
- // Help string. Each Desc with the same fqName must have the same
- // dimHash.
- dimHash uint64
- // err is an error that occured during construction. It is reported on
- // registration time.
- err error
-}
-
-// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
-// and will be reported on registration time. variableLabels and constLabels can
-// be nil if no such labels should be set. fqName and help must not be empty.
-//
-// variableLabels only contain the label names. Their label values are variable
-// and therefore not part of the Desc. (They are managed within the Metric.)
-//
-// For constLabels, the label values are constant. Therefore, they are fully
-// specified in the Desc. See the Opts documentation for the implications of
-// constant labels.
-func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *Desc {
- d := &Desc{
- fqName: fqName,
- help: help,
- variableLabels: variableLabels,
- }
- if help == "" {
- d.err = errors.New("empty help string")
- return d
- }
- if !metricNameRE.MatchString(fqName) {
- d.err = fmt.Errorf("%q is not a valid metric name", fqName)
- return d
- }
- // labelValues contains the label values of const labels (in order of
- // their sorted label names) plus the fqName (at position 0).
- labelValues := make([]string, 1, len(constLabels)+1)
- labelValues[0] = fqName
- labelNames := make([]string, 0, len(constLabels)+len(variableLabels))
- labelNameSet := map[string]struct{}{}
- // First add only the const label names and sort them...
- for labelName := range constLabels {
- if !checkLabelName(labelName) {
- d.err = fmt.Errorf("%q is not a valid label name", labelName)
- return d
- }
- labelNames = append(labelNames, labelName)
- labelNameSet[labelName] = struct{}{}
- }
- sort.Strings(labelNames)
- // ... so that we can now add const label values in the order of their names.
- for _, labelName := range labelNames {
- labelValues = append(labelValues, constLabels[labelName])
- }
- // Now add the variable label names, but prefix them with something that
- // cannot be in a regular label name. That prevents matching the label
- // dimension with a different mix between preset and variable labels.
- for _, labelName := range variableLabels {
- if !checkLabelName(labelName) {
- d.err = fmt.Errorf("%q is not a valid label name", labelName)
- return d
- }
- labelNames = append(labelNames, "$"+labelName)
- labelNameSet[labelName] = struct{}{}
- }
- if len(labelNames) != len(labelNameSet) {
- d.err = errors.New("duplicate label names")
- return d
- }
- h := fnv.New64a()
- var b bytes.Buffer // To copy string contents into, avoiding []byte allocations.
- for _, val := range labelValues {
- b.Reset()
- b.WriteString(val)
- b.WriteByte(separatorByte)
- h.Write(b.Bytes())
- }
- d.id = h.Sum64()
- // Sort labelNames so that order doesn't matter for the hash.
- sort.Strings(labelNames)
- // Now hash together (in this order) the help string and the sorted
- // label names.
- h.Reset()
- b.Reset()
- b.WriteString(help)
- b.WriteByte(separatorByte)
- h.Write(b.Bytes())
- for _, labelName := range labelNames {
- b.Reset()
- b.WriteString(labelName)
- b.WriteByte(separatorByte)
- h.Write(b.Bytes())
- }
- d.dimHash = h.Sum64()
-
- d.constLabelPairs = make([]*dto.LabelPair, 0, len(constLabels))
- for n, v := range constLabels {
- d.constLabelPairs = append(d.constLabelPairs, &dto.LabelPair{
- Name: proto.String(n),
- Value: proto.String(v),
- })
- }
- sort.Sort(LabelPairSorter(d.constLabelPairs))
- return d
-}
-
-// NewInvalidDesc returns an invalid descriptor, i.e. a descriptor with the
-// provided error set. If a collector returning such a descriptor is registered,
-// registration will fail with the provided error. NewInvalidDesc can be used by
-// a Collector to signal inability to describe itself.
-func NewInvalidDesc(err error) *Desc {
- return &Desc{
- err: err,
- }
-}
-
-func (d *Desc) String() string {
- lpStrings := make([]string, 0, len(d.constLabelPairs))
- for _, lp := range d.constLabelPairs {
- lpStrings = append(
- lpStrings,
- fmt.Sprintf("%s=%q", lp.GetName(), lp.GetValue()),
- )
- }
- return fmt.Sprintf(
- "Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: %v}",
- d.fqName,
- d.help,
- strings.Join(lpStrings, ","),
- d.variableLabels,
- )
-}
-
-func checkLabelName(l string) bool {
- return labelNameRE.MatchString(l) &&
- !strings.HasPrefix(l, reservedLabelPrefix)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/doc.go
deleted file mode 100644
index 425fe8793..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/doc.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package prometheus provides embeddable metric primitives for servers and
-// standardized exposition of telemetry through a web services interface.
-//
-// All exported functions and methods are safe to be used concurrently unless
-// specified otherwise.
-//
-// To expose metrics registered with the Prometheus registry, an HTTP server
-// needs to know about the Prometheus handler. The usual endpoint is "/metrics".
-//
-// http.Handle("/metrics", prometheus.Handler())
-//
-// As a starting point a very basic usage example:
-//
-// package main
-//
-// import (
-// "net/http"
-//
-// "github.com/prometheus/client_golang/prometheus"
-// )
-//
-// var (
-// cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
-// Name: "cpu_temperature_celsius",
-// Help: "Current temperature of the CPU.",
-// })
-// hdFailures = prometheus.NewCounter(prometheus.CounterOpts{
-// Name: "hd_errors_total",
-// Help: "Number of hard-disk errors.",
-// })
-// )
-//
-// func init() {
-// prometheus.MustRegister(cpuTemp)
-// prometheus.MustRegister(hdFailures)
-// }
-//
-// func main() {
-// cpuTemp.Set(65.3)
-// hdFailures.Inc()
-//
-// http.Handle("/metrics", prometheus.Handler())
-// http.ListenAndServe(":8080", nil)
-// }
-//
-//
-// This is a complete program that exports two metrics, a Gauge and a Counter.
-// It also exports some stats about the HTTP usage of the /metrics
-// endpoint. (See the Handler function for more detail.)
-//
-// Two more advanced metric types are the Summary and Histogram.
-//
-// In addition to the fundamental metric types Gauge, Counter, Summary, and
-// Histogram, a very important part of the Prometheus data model is the
-// partitioning of samples along dimensions called labels, which results in
-// metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec,
-// and HistogramVec.
-//
-// Those are all the parts needed for basic usage. Detailed documentation and
-// examples are provided below.
-//
-// Everything else this package offers is essentially for "power users" only. A
-// few pointers to "power user features":
-//
-// All the various ...Opts structs have a ConstLabels field for labels that
-// never change their value (which is only useful under special circumstances,
-// see documentation of the Opts type).
-//
-// The Untyped metric behaves like a Gauge, but signals the Prometheus server
-// not to assume anything about its type.
-//
-// Functions to fine-tune how the metric registry works: EnableCollectChecks,
-// PanicOnCollectError, Register, Unregister, SetMetricFamilyInjectionHook.
-//
-// For custom metric collection, there are two entry points: Custom Metric
-// implementations and custom Collector implementations. A Metric is the
-// fundamental unit in the Prometheus data model: a sample at a point in time
-// together with its meta-data (like its fully-qualified name and any number of
-// pairs of label name and label value) that knows how to marshal itself into a
-// data transfer object (aka DTO, implemented as a protocol buffer). A Collector
-// gets registered with the Prometheus registry and manages the collection of
-// one or more Metrics. Many parts of this package are building blocks for
-// Metrics and Collectors. Desc is the metric descriptor, actually used by all
-// metrics under the hood, and by Collectors to describe the Metrics to be
-// collected, but only to be dealt with by users if they implement their own
-// Metrics or Collectors. To create a Desc, the BuildFQName function will come
-// in handy. Other useful components for Metric and Collector implementation
-// include: LabelPairSorter to sort the DTO version of label pairs,
-// NewConstMetric and MustNewConstMetric to create "throw away" Metrics at
-// collection time, MetricVec to bundle custom Metrics into a metric vector
-// Collector, SelfCollector to make a custom Metric collect itself.
-//
-// A good example for a custom Collector is the ExpVarCollector included in this
-// package, which exports variables exported via the "expvar" package as
-// Prometheus metrics.
-package prometheus
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/expvar.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/expvar.go
deleted file mode 100644
index 0f7630d53..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/expvar.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "encoding/json"
- "expvar"
-)
-
-// ExpvarCollector collects metrics from the expvar interface. It provides a
-// quick way to expose numeric values that are already exported via expvar as
-// Prometheus metrics. Note that the data models of expvar and Prometheus are
-// fundamentally different, and that the ExpvarCollector is inherently
-// slow. Thus, the ExpvarCollector is probably great for experiments and
-// prototying, but you should seriously consider a more direct implementation of
-// Prometheus metrics for monitoring production systems.
-//
-// Use NewExpvarCollector to create new instances.
-type ExpvarCollector struct {
- exports map[string]*Desc
-}
-
-// NewExpvarCollector returns a newly allocated ExpvarCollector that still has
-// to be registered with the Prometheus registry.
-//
-// The exports map has the following meaning:
-//
-// The keys in the map correspond to expvar keys, i.e. for every expvar key you
-// want to export as Prometheus metric, you need an entry in the exports
-// map. The descriptor mapped to each key describes how to export the expvar
-// value. It defines the name and the help string of the Prometheus metric
-// proxying the expvar value. The type will always be Untyped.
-//
-// For descriptors without variable labels, the expvar value must be a number or
-// a bool. The number is then directly exported as the Prometheus sample
-// value. (For a bool, 'false' translates to 0 and 'true' to 1). Expvar values
-// that are not numbers or bools are silently ignored.
-//
-// If the descriptor has one variable label, the expvar value must be an expvar
-// map. The keys in the expvar map become the various values of the one
-// Prometheus label. The values in the expvar map must be numbers or bools again
-// as above.
-//
-// For descriptors with more than one variable label, the expvar must be a
-// nested expvar map, i.e. where the values of the topmost map are maps again
-// etc. until a depth is reached that corresponds to the number of labels. The
-// leaves of that structure must be numbers or bools as above to serve as the
-// sample values.
-//
-// Anything that does not fit into the scheme above is silently ignored.
-func NewExpvarCollector(exports map[string]*Desc) *ExpvarCollector {
- return &ExpvarCollector{
- exports: exports,
- }
-}
-
-// Describe implements Collector.
-func (e *ExpvarCollector) Describe(ch chan<- *Desc) {
- for _, desc := range e.exports {
- ch <- desc
- }
-}
-
-// Collect implements Collector.
-func (e *ExpvarCollector) Collect(ch chan<- Metric) {
- for name, desc := range e.exports {
- var m Metric
- expVar := expvar.Get(name)
- if expVar == nil {
- continue
- }
- var v interface{}
- labels := make([]string, len(desc.variableLabels))
- if err := json.Unmarshal([]byte(expVar.String()), &v); err != nil {
- ch <- NewInvalidMetric(desc, err)
- continue
- }
- var processValue func(v interface{}, i int)
- processValue = func(v interface{}, i int) {
- if i >= len(labels) {
- copiedLabels := append(make([]string, 0, len(labels)), labels...)
- switch v := v.(type) {
- case float64:
- m = MustNewConstMetric(desc, UntypedValue, v, copiedLabels...)
- case bool:
- if v {
- m = MustNewConstMetric(desc, UntypedValue, 1, copiedLabels...)
- } else {
- m = MustNewConstMetric(desc, UntypedValue, 0, copiedLabels...)
- }
- default:
- return
- }
- ch <- m
- return
- }
- vm, ok := v.(map[string]interface{})
- if !ok {
- return
- }
- for lv, val := range vm {
- labels[i] = lv
- processValue(val, i+1)
- }
- }
- processValue(v, 0)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
deleted file mode 100644
index ba8a402ca..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "hash/fnv"
-
-// Gauge is a Metric that represents a single numerical value that can
-// arbitrarily go up and down.
-//
-// A Gauge is typically used for measured values like temperatures or current
-// memory usage, but also "counts" that can go up and down, like the number of
-// running goroutines.
-//
-// To create Gauge instances, use NewGauge.
-type Gauge interface {
- Metric
- Collector
-
- // Set sets the Gauge to an arbitrary value.
- Set(float64)
- // Inc increments the Gauge by 1.
- Inc()
- // Dec decrements the Gauge by 1.
- Dec()
- // Add adds the given value to the Gauge. (The value can be
- // negative, resulting in a decrease of the Gauge.)
- Add(float64)
- // Sub subtracts the given value from the Gauge. (The value can be
- // negative, resulting in an increase of the Gauge.)
- Sub(float64)
-}
-
-// GaugeOpts is an alias for Opts. See there for doc comments.
-type GaugeOpts Opts
-
-// NewGauge creates a new Gauge based on the provided GaugeOpts.
-func NewGauge(opts GaugeOpts) Gauge {
- return newValue(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), GaugeValue, 0)
-}
-
-// GaugeVec is a Collector that bundles a set of Gauges that all share the same
-// Desc, but have different values for their variable labels. This is used if
-// you want to count the same thing partitioned by various dimensions
-// (e.g. number of operations queued, partitioned by user and operation
-// type). Create instances with NewGaugeVec.
-type GaugeVec struct {
- MetricVec
-}
-
-// NewGaugeVec creates a new GaugeVec based on the provided GaugeOpts and
-// partitioned by the given label names. At least one label name must be
-// provided.
-func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &GaugeVec{
- MetricVec: MetricVec{
- children: map[uint64]Metric{},
- desc: desc,
- hash: fnv.New64a(),
- newMetric: func(lvs ...string) Metric {
- return newValue(desc, GaugeValue, 0, lvs...)
- },
- },
- }
-}
-
-// GetMetricWithLabelValues replaces the method of the same name in
-// MetricVec. The difference is that this method returns a Gauge and not a
-// Metric so that no type conversion is required.
-func (m *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) {
- metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// GetMetricWith replaces the method of the same name in MetricVec. The
-// difference is that this method returns a Gauge and not a Metric so that no
-// type conversion is required.
-func (m *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) {
- metric, err := m.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. By not returning an
-// error, WithLabelValues allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (m *GaugeVec) WithLabelValues(lvs ...string) Gauge {
- return m.MetricVec.WithLabelValues(lvs...).(Gauge)
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. By not returning an error, With allows shortcuts like
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-func (m *GaugeVec) With(labels Labels) Gauge {
- return m.MetricVec.With(labels).(Gauge)
-}
-
-// GaugeFunc is a Gauge whose value is determined at collect time by calling a
-// provided function.
-//
-// To create GaugeFunc instances, use NewGaugeFunc.
-type GaugeFunc interface {
- Metric
- Collector
-}
-
-// NewGaugeFunc creates a new GaugeFunc based on the provided GaugeOpts. The
-// value reported is determined by calling the given function from within the
-// Write method. Take into account that metric collection may happen
-// concurrently. If that results in concurrent calls to Write, like in the case
-// where a GaugeFunc is directly registered with Prometheus, the provided
-// function must be concurrency-safe.
-func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), GaugeValue, function)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
deleted file mode 100644
index 8be247695..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
+++ /dev/null
@@ -1,263 +0,0 @@
-package prometheus
-
-import (
- "fmt"
- "runtime"
- "runtime/debug"
- "time"
-)
-
-type goCollector struct {
- goroutines Gauge
- gcDesc *Desc
-
- // metrics to describe and collect
- metrics memStatsMetrics
-}
-
-// NewGoCollector returns a collector which exports metrics about the current
-// go process.
-func NewGoCollector() *goCollector {
- return &goCollector{
- goroutines: NewGauge(GaugeOpts{
- Namespace: "go",
- Name: "goroutines",
- Help: "Number of goroutines that currently exist.",
- }),
- gcDesc: NewDesc(
- "go_gc_duration_seconds",
- "A summary of the GC invocation durations.",
- nil, nil),
- metrics: memStatsMetrics{
- {
- desc: NewDesc(
- memstatNamespace("alloc_bytes"),
- "Number of bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("alloc_bytes_total"),
- "Total number of bytes allocated, even if freed.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("sys_bytes"),
- "Number of bytes obtained by system. Sum of all system allocations.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("lookups_total"),
- "Total number of pointer lookups.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mallocs_total"),
- "Total number of mallocs.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("frees_total"),
- "Total number of frees.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_alloc_bytes"),
- "Number of heap bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_sys_bytes"),
- "Number of heap bytes obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_idle_bytes"),
- "Number of heap bytes waiting to be used.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_inuse_bytes"),
- "Number of heap bytes that are in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_released_bytes_total"),
- "Total number of heap bytes released to OS.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_objects"),
- "Number of allocated objects.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_inuse_bytes"),
- "Number of bytes in use by the stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_sys_bytes"),
- "Number of bytes obtained from system for stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_inuse_bytes"),
- "Number of bytes in use by mspan structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_sys_bytes"),
- "Number of bytes used for mspan structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_inuse_bytes"),
- "Number of bytes in use by mcache structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_sys_bytes"),
- "Number of bytes used for mcache structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("buck_hash_sys_bytes"),
- "Number of bytes used by the profiling bucket hash table.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("gc_sys_bytes"),
- "Number of bytes used for garbage collection system metadata.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("other_sys_bytes"),
- "Number of bytes used for other system allocations.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("next_gc_bytes"),
- "Number of heap bytes when next garbage collection will take place.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("last_gc_time_seconds"),
- "Number of seconds since 1970 of last garbage collection.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.LastGC*10 ^ 9) },
- valType: GaugeValue,
- },
- },
- }
-}
-
-func memstatNamespace(s string) string {
- return fmt.Sprintf("go_memstats_%s", s)
-}
-
-// Describe returns all descriptions of the collector.
-func (c *goCollector) Describe(ch chan<- *Desc) {
- ch <- c.goroutines.Desc()
- ch <- c.gcDesc
-
- for _, i := range c.metrics {
- ch <- i.desc
- }
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *goCollector) Collect(ch chan<- Metric) {
- c.goroutines.Set(float64(runtime.NumGoroutine()))
- ch <- c.goroutines
-
- var stats debug.GCStats
- stats.PauseQuantiles = make([]time.Duration, 5)
- debug.ReadGCStats(&stats)
-
- quantiles := make(map[float64]float64)
- for idx, pq := range stats.PauseQuantiles[1:] {
- quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds()
- }
- quantiles[0.0] = stats.PauseQuantiles[0].Seconds()
- ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), float64(stats.PauseTotal.Seconds()), quantiles)
-
- ms := &runtime.MemStats{}
- runtime.ReadMemStats(ms)
- for _, i := range c.metrics {
- ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
- }
-}
-
-// memStatsMetrics provide description, value, and value type for memstat metrics.
-type memStatsMetrics []struct {
- desc *Desc
- eval func(*runtime.MemStats) float64
- valType ValueType
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
deleted file mode 100644
index f98a41bc8..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
+++ /dev/null
@@ -1,450 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "hash/fnv"
- "math"
- "sort"
- "sync/atomic"
-
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// A Histogram counts individual observations from an event or sample stream in
-// configurable buckets. Similar to a summary, it also provides a sum of
-// observations and an observation count.
-//
-// On the Prometheus server, quantiles can be calculated from a Histogram using
-// the histogram_quantile function in the query language.
-//
-// Note that Histograms, in contrast to Summaries, can be aggregated with the
-// Prometheus query language (see the documentation for detailed
-// procedures). However, Histograms require the user to pre-define suitable
-// buckets, and they are in general less accurate. The Observe method of a
-// Histogram has a very low performance overhead in comparison with the Observe
-// method of a Summary.
-//
-// To create Histogram instances, use NewHistogram.
-type Histogram interface {
- Metric
- Collector
-
- // Observe adds a single observation to the histogram.
- Observe(float64)
-}
-
-// bucketLabel is used for the label that defines the upper bound of a
-// bucket of a histogram ("le" -> "less or equal").
-const bucketLabel = "le"
-
-var (
- // DefBuckets are the default Histogram buckets. The default buckets are
- // tailored to broadly measure the response time (in seconds) of a
- // network service. Most likely, however, you will be required to define
- // buckets customized to your use case.
- DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
-
- errBucketLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in histograms", bucketLabel,
- )
-)
-
-// LinearBuckets creates 'count' buckets, each 'width' wide, where the lowest
-// bucket has an upper bound of 'start'. The final +Inf bucket is not counted
-// and not included in the returned slice. The returned slice is meant to be
-// used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is zero or negative.
-func LinearBuckets(start, width float64, count int) []float64 {
- if count < 1 {
- panic("LinearBuckets needs a positive count")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start += width
- }
- return buckets
-}
-
-// ExponentialBuckets creates 'count' buckets, where the lowest bucket has an
-// upper bound of 'start' and each following bucket's upper bound is 'factor'
-// times the previous bucket's upper bound. The final +Inf bucket is not counted
-// and not included in the returned slice. The returned slice is meant to be
-// used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is 0 or negative, if 'start' is 0 or negative,
-// or if 'factor' is less than or equal 1.
-func ExponentialBuckets(start, factor float64, count int) []float64 {
- if count < 1 {
- panic("ExponentialBuckets needs a positive count")
- }
- if start <= 0 {
- panic("ExponentialBuckets needs a positive start value")
- }
- if factor <= 1 {
- panic("ExponentialBuckets needs a factor greater than 1")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start *= factor
- }
- return buckets
-}
-
-// HistogramOpts bundles the options for creating a Histogram metric. It is
-// mandatory to set Name and Help to a non-empty string. All other fields are
-// optional and can safely be left at their zero value.
-type HistogramOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Histogram (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Histogram must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Histogram. Mandatory!
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this
- // Histogram. Histograms with the same fully-qualified name must have the
- // same label names in their ConstLabels.
- //
- // Note that in most cases, labels have a value that varies during the
- // lifetime of a process. Those labels are usually managed with a
- // HistogramVec. ConstLabels serve only special purposes. One is for the
- // special case where the value of a label does not change during the
- // lifetime of a process, e.g. if the revision of the running binary is
- // put into a label. Another, more advanced purpose is if more than one
- // Collector needs to collect Histograms with the same fully-qualified
- // name. In that case, those Summaries must differ in the values of
- // their ConstLabels. See the Collector examples.
- //
- // If the value of a label never changes (not even between binaries),
- // that label most likely should not be a label at all (but part of the
- // metric name).
- ConstLabels Labels
-
- // Buckets defines the buckets into which observations are counted. Each
- // element in the slice is the upper inclusive bound of a bucket. The
- // values must be sorted in strictly increasing order. There is no need
- // to add a highest bucket with +Inf bound, it will be added
- // implicitly. The default value is DefBuckets.
- Buckets []float64
-}
-
-// NewHistogram creates a new Histogram based on the provided HistogramOpts. It
-// panics if the buckets in HistogramOpts are not in strictly increasing order.
-func NewHistogram(opts HistogramOpts) Histogram {
- return newHistogram(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram {
- if len(desc.variableLabels) != len(labelValues) {
- panic(errInconsistentCardinality)
- }
-
- for _, n := range desc.variableLabels {
- if n == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
-
- if len(opts.Buckets) == 0 {
- opts.Buckets = DefBuckets
- }
-
- h := &histogram{
- desc: desc,
- upperBounds: opts.Buckets,
- labelPairs: makeLabelPairs(desc, labelValues),
- }
- for i, upperBound := range h.upperBounds {
- if i < len(h.upperBounds)-1 {
- if upperBound >= h.upperBounds[i+1] {
- panic(fmt.Errorf(
- "histogram buckets must be in increasing order: %f >= %f",
- upperBound, h.upperBounds[i+1],
- ))
- }
- } else {
- if math.IsInf(upperBound, +1) {
- // The +Inf bucket is implicit. Remove it here.
- h.upperBounds = h.upperBounds[:i]
- }
- }
- }
- // Finally we know the final length of h.upperBounds and can make counts.
- h.counts = make([]uint64, len(h.upperBounds))
-
- h.Init(h) // Init self-collection.
- return h
-}
-
-type histogram struct {
- // sumBits contains the bits of the float64 representing the sum of all
- // observations. sumBits and count have to go first in the struct to
- // guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- sumBits uint64
- count uint64
-
- SelfCollector
- // Note that there is no mutex required.
-
- desc *Desc
-
- upperBounds []float64
- counts []uint64
-
- labelPairs []*dto.LabelPair
-}
-
-func (h *histogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *histogram) Observe(v float64) {
- // TODO(beorn7): For small numbers of buckets (<30), a linear search is
- // slightly faster than the binary search. If we really care, we could
- // switch from one search strategy to the other depending on the number
- // of buckets.
- //
- // Microbenchmarks (BenchmarkHistogramNoLabels):
- // 11 buckets: 38.3 ns/op linear - binary 48.7 ns/op
- // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op
- // 300 buckets: 154 ns/op linear - binary 61.6 ns/op
- i := sort.SearchFloat64s(h.upperBounds, v)
- if i < len(h.counts) {
- atomic.AddUint64(&h.counts[i], 1)
- }
- atomic.AddUint64(&h.count, 1)
- for {
- oldBits := atomic.LoadUint64(&h.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&h.sumBits, oldBits, newBits) {
- break
- }
- }
-}
-
-func (h *histogram) Write(out *dto.Metric) error {
- his := &dto.Histogram{}
- buckets := make([]*dto.Bucket, len(h.upperBounds))
-
- his.SampleSum = proto.Float64(math.Float64frombits(atomic.LoadUint64(&h.sumBits)))
- his.SampleCount = proto.Uint64(atomic.LoadUint64(&h.count))
- var count uint64
- for i, upperBound := range h.upperBounds {
- count += atomic.LoadUint64(&h.counts[i])
- buckets[i] = &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(upperBound),
- }
- }
- his.Bucket = buckets
- out.Histogram = his
- out.Label = h.labelPairs
- return nil
-}
-
-// HistogramVec is a Collector that bundles a set of Histograms that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewHistogramVec.
-type HistogramVec struct {
- MetricVec
-}
-
-// NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and
-// partitioned by the given label names. At least one label name must be
-// provided.
-func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &HistogramVec{
- MetricVec: MetricVec{
- children: map[uint64]Metric{},
- desc: desc,
- hash: fnv.New64a(),
- newMetric: func(lvs ...string) Metric {
- return newHistogram(desc, opts, lvs...)
- },
- },
- }
-}
-
-// GetMetricWithLabelValues replaces the method of the same name in
-// MetricVec. The difference is that this method returns a Histogram and not a
-// Metric so that no type conversion is required.
-func (m *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Histogram, error) {
- metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Histogram), err
- }
- return nil, err
-}
-
-// GetMetricWith replaces the method of the same name in MetricVec. The
-// difference is that this method returns a Histogram and not a Metric so that no
-// type conversion is required.
-func (m *HistogramVec) GetMetricWith(labels Labels) (Histogram, error) {
- metric, err := m.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Histogram), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. By not returning an
-// error, WithLabelValues allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (m *HistogramVec) WithLabelValues(lvs ...string) Histogram {
- return m.MetricVec.WithLabelValues(lvs...).(Histogram)
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. By not returning an error, With allows shortcuts like
-// myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (m *HistogramVec) With(labels Labels) Histogram {
- return m.MetricVec.With(labels).(Histogram)
-}
-
-type constHistogram struct {
- desc *Desc
- count uint64
- sum float64
- buckets map[float64]uint64
- labelPairs []*dto.LabelPair
-}
-
-func (h *constHistogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *constHistogram) Write(out *dto.Metric) error {
- his := &dto.Histogram{}
- buckets := make([]*dto.Bucket, 0, len(h.buckets))
-
- his.SampleCount = proto.Uint64(h.count)
- his.SampleSum = proto.Float64(h.sum)
-
- for upperBound, count := range h.buckets {
- buckets = append(buckets, &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(upperBound),
- })
- }
-
- if len(buckets) > 0 {
- sort.Sort(buckSort(buckets))
- }
- his.Bucket = buckets
-
- out.Histogram = his
- out.Label = h.labelPairs
-
- return nil
-}
-
-// NewConstHistogram returns a metric representing a Prometheus histogram with
-// fixed values for the count, sum, and bucket counts. As those parameters
-// cannot be changed, the returned value does not implement the Histogram
-// interface (but only the Metric interface). Users of this package will not
-// have much use for it in regular operations. However, when implementing custom
-// Collectors, it is useful as a throw-away metric that is generated on the fly
-// to send it to Prometheus in the Collect method.
-//
-// buckets is a map of upper bounds to cumulative counts, excluding the +Inf
-// bucket.
-//
-// NewConstHistogram returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc.
-func NewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) (Metric, error) {
- if len(desc.variableLabels) != len(labelValues) {
- return nil, errInconsistentCardinality
- }
- return &constHistogram{
- desc: desc,
- count: count,
- sum: sum,
- buckets: buckets,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstHistogram is a version of NewConstHistogram that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) Metric {
- m, err := NewConstHistogram(desc, count, sum, buckets, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type buckSort []*dto.Bucket
-
-func (s buckSort) Len() int {
- return len(s)
-}
-
-func (s buckSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s buckSort) Less(i, j int) bool {
- return s[i].GetUpperBound() < s[j].GetUpperBound()
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/http.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/http.go
deleted file mode 100644
index eabe60246..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/http.go
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "bufio"
- "io"
- "net"
- "net/http"
- "strconv"
- "strings"
- "time"
-)
-
-var instLabels = []string{"method", "code"}
-
-type nower interface {
- Now() time.Time
-}
-
-type nowFunc func() time.Time
-
-func (n nowFunc) Now() time.Time {
- return n()
-}
-
-var now nower = nowFunc(func() time.Time {
- return time.Now()
-})
-
-func nowSeries(t ...time.Time) nower {
- return nowFunc(func() time.Time {
- defer func() {
- t = t[1:]
- }()
-
- return t[0]
- })
-}
-
-// InstrumentHandler wraps the given HTTP handler for instrumentation. It
-// registers four metric collectors (if not already done) and reports HTTP
-// metrics to the (newly or already) registered collectors: http_requests_total
-// (CounterVec), http_request_duration_microseconds (Summary),
-// http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each
-// has a constant label named "handler" with the provided handlerName as
-// value. http_requests_total is a metric vector partitioned by HTTP method
-// (label name "method") and HTTP status code (label name "code").
-func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc {
- return InstrumentHandlerFunc(handlerName, handler.ServeHTTP)
-}
-
-// InstrumentHandlerFunc wraps the given function for instrumentation. It
-// otherwise works in the same way as InstrumentHandler.
-func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
- return InstrumentHandlerFuncWithOpts(
- SummaryOpts{
- Subsystem: "http",
- ConstLabels: Labels{"handler": handlerName},
- },
- handlerFunc,
- )
-}
-
-// InstrumentHandlerWithOpts works like InstrumentHandler but provides more
-// flexibility (at the cost of a more complex call syntax). As
-// InstrumentHandler, this function registers four metric collectors, but it
-// uses the provided SummaryOpts to create them. However, the fields "Name" and
-// "Help" in the SummaryOpts are ignored. "Name" is replaced by
-// "requests_total", "request_duration_microseconds", "request_size_bytes", and
-// "response_size_bytes", respectively. "Help" is replaced by an appropriate
-// help string. The names of the variable labels of the http_requests_total
-// CounterVec are "method" (get, post, etc.), and "code" (HTTP status code).
-//
-// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the
-// behavior of InstrumentHandler:
-//
-// prometheus.InstrumentHandlerWithOpts(
-// prometheus.SummaryOpts{
-// Subsystem: "http",
-// ConstLabels: prometheus.Labels{"handler": handlerName},
-// },
-// handler,
-// )
-//
-// Technical detail: "requests_total" is a CounterVec, not a SummaryVec, so it
-// cannot use SummaryOpts. Instead, a CounterOpts struct is created internally,
-// and all its fields are set to the equally named fields in the provided
-// SummaryOpts.
-func InstrumentHandlerWithOpts(opts SummaryOpts, handler http.Handler) http.HandlerFunc {
- return InstrumentHandlerFuncWithOpts(opts, handler.ServeHTTP)
-}
-
-// InstrumentHandlerFuncWithOpts works like InstrumentHandlerFunc but provides
-// more flexibility (at the cost of a more complex call syntax). See
-// InstrumentHandlerWithOpts for details how the provided SummaryOpts are used.
-func InstrumentHandlerFuncWithOpts(opts SummaryOpts, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
- reqCnt := NewCounterVec(
- CounterOpts{
- Namespace: opts.Namespace,
- Subsystem: opts.Subsystem,
- Name: "requests_total",
- Help: "Total number of HTTP requests made.",
- ConstLabels: opts.ConstLabels,
- },
- instLabels,
- )
-
- opts.Name = "request_duration_microseconds"
- opts.Help = "The HTTP request latencies in microseconds."
- reqDur := NewSummary(opts)
-
- opts.Name = "request_size_bytes"
- opts.Help = "The HTTP request sizes in bytes."
- reqSz := NewSummary(opts)
-
- opts.Name = "response_size_bytes"
- opts.Help = "The HTTP response sizes in bytes."
- resSz := NewSummary(opts)
-
- regReqCnt := MustRegisterOrGet(reqCnt).(*CounterVec)
- regReqDur := MustRegisterOrGet(reqDur).(Summary)
- regReqSz := MustRegisterOrGet(reqSz).(Summary)
- regResSz := MustRegisterOrGet(resSz).(Summary)
-
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- now := time.Now()
-
- delegate := &responseWriterDelegator{ResponseWriter: w}
- out := make(chan int)
- urlLen := 0
- if r.URL != nil {
- urlLen = len(r.URL.String())
- }
- go computeApproximateRequestSize(r, out, urlLen)
-
- _, cn := w.(http.CloseNotifier)
- _, fl := w.(http.Flusher)
- _, hj := w.(http.Hijacker)
- _, rf := w.(io.ReaderFrom)
- var rw http.ResponseWriter
- if cn && fl && hj && rf {
- rw = &fancyResponseWriterDelegator{delegate}
- } else {
- rw = delegate
- }
- handlerFunc(rw, r)
-
- elapsed := float64(time.Since(now)) / float64(time.Microsecond)
-
- method := sanitizeMethod(r.Method)
- code := sanitizeCode(delegate.status)
- regReqCnt.WithLabelValues(method, code).Inc()
- regReqDur.Observe(elapsed)
- regResSz.Observe(float64(delegate.written))
- regReqSz.Observe(float64(<-out))
- })
-}
-
-func computeApproximateRequestSize(r *http.Request, out chan int, s int) {
- s += len(r.Method)
- s += len(r.Proto)
- for name, values := range r.Header {
- s += len(name)
- for _, value := range values {
- s += len(value)
- }
- }
- s += len(r.Host)
-
- // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL.
-
- if r.ContentLength != -1 {
- s += int(r.ContentLength)
- }
- out <- s
-}
-
-type responseWriterDelegator struct {
- http.ResponseWriter
-
- handler, method string
- status int
- written int64
- wroteHeader bool
-}
-
-func (r *responseWriterDelegator) WriteHeader(code int) {
- r.status = code
- r.wroteHeader = true
- r.ResponseWriter.WriteHeader(code)
-}
-
-func (r *responseWriterDelegator) Write(b []byte) (int, error) {
- if !r.wroteHeader {
- r.WriteHeader(http.StatusOK)
- }
- n, err := r.ResponseWriter.Write(b)
- r.written += int64(n)
- return n, err
-}
-
-type fancyResponseWriterDelegator struct {
- *responseWriterDelegator
-}
-
-func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool {
- return f.ResponseWriter.(http.CloseNotifier).CloseNotify()
-}
-
-func (f *fancyResponseWriterDelegator) Flush() {
- f.ResponseWriter.(http.Flusher).Flush()
-}
-
-func (f *fancyResponseWriterDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- return f.ResponseWriter.(http.Hijacker).Hijack()
-}
-
-func (f *fancyResponseWriterDelegator) ReadFrom(r io.Reader) (int64, error) {
- if !f.wroteHeader {
- f.WriteHeader(http.StatusOK)
- }
- n, err := f.ResponseWriter.(io.ReaderFrom).ReadFrom(r)
- f.written += n
- return n, err
-}
-
-func sanitizeMethod(m string) string {
- switch m {
- case "GET", "get":
- return "get"
- case "PUT", "put":
- return "put"
- case "HEAD", "head":
- return "head"
- case "POST", "post":
- return "post"
- case "DELETE", "delete":
- return "delete"
- case "CONNECT", "connect":
- return "connect"
- case "OPTIONS", "options":
- return "options"
- case "NOTIFY", "notify":
- return "notify"
- default:
- return strings.ToLower(m)
- }
-}
-
-func sanitizeCode(s int) string {
- switch s {
- case 100:
- return "100"
- case 101:
- return "101"
-
- case 200:
- return "200"
- case 201:
- return "201"
- case 202:
- return "202"
- case 203:
- return "203"
- case 204:
- return "204"
- case 205:
- return "205"
- case 206:
- return "206"
-
- case 300:
- return "300"
- case 301:
- return "301"
- case 302:
- return "302"
- case 304:
- return "304"
- case 305:
- return "305"
- case 307:
- return "307"
-
- case 400:
- return "400"
- case 401:
- return "401"
- case 402:
- return "402"
- case 403:
- return "403"
- case 404:
- return "404"
- case 405:
- return "405"
- case 406:
- return "406"
- case 407:
- return "407"
- case 408:
- return "408"
- case 409:
- return "409"
- case 410:
- return "410"
- case 411:
- return "411"
- case 412:
- return "412"
- case 413:
- return "413"
- case 414:
- return "414"
- case 415:
- return "415"
- case 416:
- return "416"
- case 417:
- return "417"
- case 418:
- return "418"
-
- case 500:
- return "500"
- case 501:
- return "501"
- case 502:
- return "502"
- case 503:
- return "503"
- case 504:
- return "504"
- case 505:
- return "505"
-
- case 428:
- return "428"
- case 429:
- return "429"
- case 431:
- return "431"
- case 511:
- return "511"
-
- default:
- return strconv.Itoa(s)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/metric.go
deleted file mode 100644
index 86fd81c10..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/metric.go
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "strings"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-const separatorByte byte = 255
-
-// A Metric models a single sample value with its meta data being exported to
-// Prometheus. Implementers of Metric in this package inclued Gauge, Counter,
-// Untyped, and Summary. Users can implement their own Metric types, but that
-// should be rarely needed. See the example for SelfCollector, which is also an
-// example for a user-implemented Metric.
-type Metric interface {
- // Desc returns the descriptor for the Metric. This method idempotently
- // returns the same descriptor throughout the lifetime of the
- // Metric. The returned descriptor is immutable by contract. A Metric
- // unable to describe itself must return an invalid descriptor (created
- // with NewInvalidDesc).
- Desc() *Desc
- // Write encodes the Metric into a "Metric" Protocol Buffer data
- // transmission object.
- //
- // Implementers of custom Metric types must observe concurrency safety
- // as reads of this metric may occur at any time, and any blocking
- // occurs at the expense of total performance of rendering all
- // registered metrics. Ideally Metric implementations should support
- // concurrent readers.
- //
- // The Prometheus client library attempts to minimize memory allocations
- // and will provide a pre-existing reset dto.Metric pointer. Prometheus
- // may recycle the dto.Metric proto message, so Metric implementations
- // should just populate the provided dto.Metric and then should not keep
- // any reference to it.
- //
- // While populating dto.Metric, labels must be sorted lexicographically.
- // (Implementers may find LabelPairSorter useful for that.)
- Write(*dto.Metric) error
-}
-
-// Opts bundles the options for creating most Metric types. Each metric
-// implementation XXX has its own XXXOpts type, but in most cases, it is just be
-// an alias of this type (which might change when the requirement arises.)
-//
-// It is mandatory to set Name and Help to a non-empty string. All other fields
-// are optional and can safely be left at their zero value.
-type Opts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Metric (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the metric must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this metric. Mandatory!
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // Note that in most cases, labels have a value that varies during the
- // lifetime of a process. Those labels are usually managed with a metric
- // vector collector (like CounterVec, GaugeVec, UntypedVec). ConstLabels
- // serve only special purposes. One is for the special case where the
- // value of a label does not change during the lifetime of a process,
- // e.g. if the revision of the running binary is put into a
- // label. Another, more advanced purpose is if more than one Collector
- // needs to collect Metrics with the same fully-qualified name. In that
- // case, those Metrics must differ in the values of their
- // ConstLabels. See the Collector examples.
- //
- // If the value of a label never changes (not even between binaries),
- // that label most likely should not be a label at all (but part of the
- // metric name).
- ConstLabels Labels
-}
-
-// BuildFQName joins the given three name components by "_". Empty name
-// components are ignored. If the name parameter itself is empty, an empty
-// string is returned, no matter what. Metric implementations included in this
-// library use this function internally to generate the fully-qualified metric
-// name from the name component in their Opts. Users of the library will only
-// need this function if they implement their own Metric or instantiate a Desc
-// (with NewDesc) directly.
-func BuildFQName(namespace, subsystem, name string) string {
- if name == "" {
- return ""
- }
- switch {
- case namespace != "" && subsystem != "":
- return strings.Join([]string{namespace, subsystem, name}, "_")
- case namespace != "":
- return strings.Join([]string{namespace, name}, "_")
- case subsystem != "":
- return strings.Join([]string{subsystem, name}, "_")
- }
- return name
-}
-
-// LabelPairSorter implements sort.Interface. It is used to sort a slice of
-// dto.LabelPair pointers. This is useful for implementing the Write method of
-// custom metrics.
-type LabelPairSorter []*dto.LabelPair
-
-func (s LabelPairSorter) Len() int {
- return len(s)
-}
-
-func (s LabelPairSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s LabelPairSorter) Less(i, j int) bool {
- return s[i].GetName() < s[j].GetName()
-}
-
-type hashSorter []uint64
-
-func (s hashSorter) Len() int {
- return len(s)
-}
-
-func (s hashSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s hashSorter) Less(i, j int) bool {
- return s[i] < s[j]
-}
-
-type invalidMetric struct {
- desc *Desc
- err error
-}
-
-// NewInvalidMetric returns a metric whose Write method always returns the
-// provided error. It is useful if a Collector finds itself unable to collect
-// a metric and wishes to report an error to the registry.
-func NewInvalidMetric(desc *Desc, err error) Metric {
- return &invalidMetric{desc, err}
-}
-
-func (m *invalidMetric) Desc() *Desc { return m.desc }
-
-func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
deleted file mode 100644
index d8cf0eda3..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "github.com/prometheus/procfs"
-
-type processCollector struct {
- pid int
- collectFn func(chan<- Metric)
- pidFn func() (int, error)
- cpuTotal Counter
- openFDs, maxFDs Gauge
- vsize, rss Gauge
- startTime Gauge
-}
-
-// NewProcessCollector returns a collector which exports the current state of
-// process metrics including cpu, memory and file descriptor usage as well as
-// the process start time for the given process id under the given namespace.
-func NewProcessCollector(pid int, namespace string) *processCollector {
- return NewProcessCollectorPIDFn(
- func() (int, error) { return pid, nil },
- namespace,
- )
-}
-
-// NewProcessCollectorPIDFn returns a collector which exports the current state
-// of process metrics including cpu, memory and file descriptor usage as well
-// as the process start time under the given namespace. The given pidFn is
-// called on each collect and is used to determine the process to export
-// metrics for.
-func NewProcessCollectorPIDFn(
- pidFn func() (int, error),
- namespace string,
-) *processCollector {
- c := processCollector{
- pidFn: pidFn,
- collectFn: func(chan<- Metric) {},
-
- cpuTotal: NewCounter(CounterOpts{
- Namespace: namespace,
- Name: "process_cpu_seconds_total",
- Help: "Total user and system CPU time spent in seconds.",
- }),
- openFDs: NewGauge(GaugeOpts{
- Namespace: namespace,
- Name: "process_open_fds",
- Help: "Number of open file descriptors.",
- }),
- maxFDs: NewGauge(GaugeOpts{
- Namespace: namespace,
- Name: "process_max_fds",
- Help: "Maximum number of open file descriptors.",
- }),
- vsize: NewGauge(GaugeOpts{
- Namespace: namespace,
- Name: "process_virtual_memory_bytes",
- Help: "Virtual memory size in bytes.",
- }),
- rss: NewGauge(GaugeOpts{
- Namespace: namespace,
- Name: "process_resident_memory_bytes",
- Help: "Resident memory size in bytes.",
- }),
- startTime: NewGauge(GaugeOpts{
- Namespace: namespace,
- Name: "process_start_time_seconds",
- Help: "Start time of the process since unix epoch in seconds.",
- }),
- }
-
- // Set up process metric collection if supported by the runtime.
- if _, err := procfs.NewStat(); err == nil {
- c.collectFn = c.processCollect
- }
-
- return &c
-}
-
-// Describe returns all descriptions of the collector.
-func (c *processCollector) Describe(ch chan<- *Desc) {
- ch <- c.cpuTotal.Desc()
- ch <- c.openFDs.Desc()
- ch <- c.maxFDs.Desc()
- ch <- c.vsize.Desc()
- ch <- c.rss.Desc()
- ch <- c.startTime.Desc()
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *processCollector) Collect(ch chan<- Metric) {
- c.collectFn(ch)
-}
-
-// TODO(ts): Bring back error reporting by reverting 7faf9e7 as soon as the
-// client allows users to configure the error behavior.
-func (c *processCollector) processCollect(ch chan<- Metric) {
- pid, err := c.pidFn()
- if err != nil {
- return
- }
-
- p, err := procfs.NewProc(pid)
- if err != nil {
- return
- }
-
- if stat, err := p.NewStat(); err == nil {
- c.cpuTotal.Set(stat.CPUTime())
- ch <- c.cpuTotal
- c.vsize.Set(float64(stat.VirtualMemory()))
- ch <- c.vsize
- c.rss.Set(float64(stat.ResidentMemory()))
- ch <- c.rss
-
- if startTime, err := stat.StartTime(); err == nil {
- c.startTime.Set(startTime)
- ch <- c.startTime
- }
- }
-
- if fds, err := p.FileDescriptorsLen(); err == nil {
- c.openFDs.Set(float64(fds))
- ch <- c.openFDs
- }
-
- if limits, err := p.NewLimits(); err == nil {
- c.maxFDs.Set(float64(limits.OpenFiles))
- ch <- c.maxFDs
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/push.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/push.go
deleted file mode 100644
index 1c33848a3..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/push.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Copyright (c) 2013, The Prometheus Authors
-// All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found
-// in the LICENSE file.
-
-package prometheus
-
-// Push triggers a metric collection by the default registry and pushes all
-// collected metrics to the Pushgateway specified by addr. See the Pushgateway
-// documentation for detailed implications of the job and instance
-// parameter. instance can be left empty. You can use just host:port or ip:port
-// as url, in which case 'http://' is added automatically. You can also include
-// the schema in the URL. However, do not include the '/metrics/jobs/...' part.
-//
-// Note that all previously pushed metrics with the same job and instance will
-// be replaced with the metrics pushed by this call. (It uses HTTP method 'PUT'
-// to push to the Pushgateway.)
-func Push(job, instance, url string) error {
- return defRegistry.Push(job, instance, url, "PUT")
-}
-
-// PushAdd works like Push, but only previously pushed metrics with the same
-// name (and the same job and instance) will be replaced. (It uses HTTP method
-// 'POST' to push to the Pushgateway.)
-func PushAdd(job, instance, url string) error {
- return defRegistry.Push(job, instance, url, "POST")
-}
-
-// PushCollectors works like Push, but it does not collect from the default
-// registry. Instead, it collects from the provided collectors. It is a
-// convenient way to push only a few metrics.
-func PushCollectors(job, instance, url string, collectors ...Collector) error {
- return pushCollectors(job, instance, url, "PUT", collectors...)
-}
-
-// PushAddCollectors works like PushAdd, but it does not collect from the
-// default registry. Instead, it collects from the provided collectors. It is a
-// convenient way to push only a few metrics.
-func PushAddCollectors(job, instance, url string, collectors ...Collector) error {
- return pushCollectors(job, instance, url, "POST", collectors...)
-}
-
-func pushCollectors(job, instance, url, method string, collectors ...Collector) error {
- r := newRegistry()
- for _, collector := range collectors {
- if _, err := r.Register(collector); err != nil {
- return err
- }
- }
- return r.Push(job, instance, url, method)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/registry.go
deleted file mode 100644
index 5970aaeeb..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/registry.go
+++ /dev/null
@@ -1,726 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Copyright (c) 2013, The Prometheus Authors
-// All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found
-// in the LICENSE file.
-
-package prometheus
-
-import (
- "bytes"
- "compress/gzip"
- "errors"
- "fmt"
- "hash/fnv"
- "io"
- "net/http"
- "net/url"
- "os"
- "sort"
- "strings"
- "sync"
-
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/expfmt"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-var (
- defRegistry = newDefaultRegistry()
- errAlreadyReg = errors.New("duplicate metrics collector registration attempted")
-)
-
-// Constants relevant to the HTTP interface.
-const (
- // APIVersion is the version of the format of the exported data. This
- // will match this library's version, which subscribes to the Semantic
- // Versioning scheme.
- APIVersion = "0.0.4"
-
- // DelimitedTelemetryContentType is the content type set on telemetry
- // data responses in delimited protobuf format.
- DelimitedTelemetryContentType = `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`
- // TextTelemetryContentType is the content type set on telemetry data
- // responses in text format.
- TextTelemetryContentType = `text/plain; version=` + APIVersion
- // ProtoTextTelemetryContentType is the content type set on telemetry
- // data responses in protobuf text format. (Only used for debugging.)
- ProtoTextTelemetryContentType = `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=text`
- // ProtoCompactTextTelemetryContentType is the content type set on
- // telemetry data responses in protobuf compact text format. (Only used
- // for debugging.)
- ProtoCompactTextTelemetryContentType = `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text`
-
- // Constants for object pools.
- numBufs = 4
- numMetricFamilies = 1000
- numMetrics = 10000
-
- // Capacity for the channel to collect metrics and descriptors.
- capMetricChan = 1000
- capDescChan = 10
-
- contentTypeHeader = "Content-Type"
- contentLengthHeader = "Content-Length"
- contentEncodingHeader = "Content-Encoding"
-
- acceptEncodingHeader = "Accept-Encoding"
- acceptHeader = "Accept"
-)
-
-// Handler returns the HTTP handler for the global Prometheus registry. It is
-// already instrumented with InstrumentHandler (using "prometheus" as handler
-// name). Usually the handler is used to handle the "/metrics" endpoint.
-func Handler() http.Handler {
- return InstrumentHandler("prometheus", defRegistry)
-}
-
-// UninstrumentedHandler works in the same way as Handler, but the returned HTTP
-// handler is not instrumented. This is useful if no instrumentation is desired
-// (for whatever reason) or if the instrumentation has to happen with a
-// different handler name (or with a different instrumentation approach
-// altogether). See the InstrumentHandler example.
-func UninstrumentedHandler() http.Handler {
- return defRegistry
-}
-
-// Register registers a new Collector to be included in metrics collection. It
-// returns an error if the descriptors provided by the Collector are invalid or
-// if they - in combination with descriptors of already registered Collectors -
-// do not fulfill the consistency and uniqueness criteria described in the Desc
-// documentation.
-//
-// Do not register the same Collector multiple times concurrently. (Registering
-// the same Collector twice would result in an error anyway, but on top of that,
-// it is not safe to do so concurrently.)
-func Register(m Collector) error {
- _, err := defRegistry.Register(m)
- return err
-}
-
-// MustRegister works like Register but panics where Register would have
-// returned an error.
-func MustRegister(m Collector) {
- err := Register(m)
- if err != nil {
- panic(err)
- }
-}
-
-// RegisterOrGet works like Register but does not return an error if a Collector
-// is registered that equals a previously registered Collector. (Two Collectors
-// are considered equal if their Describe method yields the same set of
-// descriptors.) Instead, the previously registered Collector is returned (which
-// is helpful if the new and previously registered Collectors are equal but not
-// identical, i.e. not pointers to the same object).
-//
-// As for Register, it is still not safe to call RegisterOrGet with the same
-// Collector multiple times concurrently.
-func RegisterOrGet(m Collector) (Collector, error) {
- return defRegistry.RegisterOrGet(m)
-}
-
-// MustRegisterOrGet works like Register but panics where RegisterOrGet would
-// have returned an error.
-func MustRegisterOrGet(m Collector) Collector {
- existing, err := RegisterOrGet(m)
- if err != nil {
- panic(err)
- }
- return existing
-}
-
-// Unregister unregisters the Collector that equals the Collector passed in as
-// an argument. (Two Collectors are considered equal if their Describe method
-// yields the same set of descriptors.) The function returns whether a Collector
-// was unregistered.
-func Unregister(c Collector) bool {
- return defRegistry.Unregister(c)
-}
-
-// SetMetricFamilyInjectionHook sets a function that is called whenever metrics
-// are collected. The hook function must be set before metrics collection begins
-// (i.e. call SetMetricFamilyInjectionHook before setting the HTTP handler.) The
-// MetricFamily protobufs returned by the hook function are merged with the
-// metrics collected in the usual way.
-//
-// This is a way to directly inject MetricFamily protobufs managed and owned by
-// the caller. The caller has full responsibility. As no registration of the
-// injected metrics has happened, there is no descriptor to check against, and
-// there are no registration-time checks. If collect-time checks are disabled
-// (see function EnableCollectChecks), no sanity checks are performed on the
-// returned protobufs at all. If collect-checks are enabled, type and uniqueness
-// checks are performed, but no further consistency checks (which would require
-// knowledge of a metric descriptor).
-//
-// Sorting concerns: The caller is responsible for sorting the label pairs in
-// each metric. However, the order of metrics will be sorted by the registry as
-// it is required anyway after merging with the metric families collected
-// conventionally.
-//
-// The function must be callable at any time and concurrently.
-func SetMetricFamilyInjectionHook(hook func() []*dto.MetricFamily) {
- defRegistry.metricFamilyInjectionHook = hook
-}
-
-// PanicOnCollectError sets the behavior whether a panic is caused upon an error
-// while metrics are collected and served to the HTTP endpoint. By default, an
-// internal server error (status code 500) is served with an error message.
-func PanicOnCollectError(b bool) {
- defRegistry.panicOnCollectError = b
-}
-
-// EnableCollectChecks enables (or disables) additional consistency checks
-// during metrics collection. These additional checks are not enabled by default
-// because they inflict a performance penalty and the errors they check for can
-// only happen if the used Metric and Collector types have internal programming
-// errors. It can be helpful to enable these checks while working with custom
-// Collectors or Metrics whose correctness is not well established yet.
-func EnableCollectChecks(b bool) {
- defRegistry.collectChecksEnabled = b
-}
-
-// encoder is a function that writes a dto.MetricFamily to an io.Writer in a
-// certain encoding. It returns the number of bytes written and any error
-// encountered. Note that pbutil.WriteDelimited and pbutil.MetricFamilyToText
-// are encoders.
-type encoder func(io.Writer, *dto.MetricFamily) (int, error)
-
-type registry struct {
- mtx sync.RWMutex
- collectorsByID map[uint64]Collector // ID is a hash of the descIDs.
- descIDs map[uint64]struct{}
- dimHashesByName map[string]uint64
- bufPool chan *bytes.Buffer
- metricFamilyPool chan *dto.MetricFamily
- metricPool chan *dto.Metric
- metricFamilyInjectionHook func() []*dto.MetricFamily
-
- panicOnCollectError, collectChecksEnabled bool
-}
-
-func (r *registry) Register(c Collector) (Collector, error) {
- descChan := make(chan *Desc, capDescChan)
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
-
- newDescIDs := map[uint64]struct{}{}
- newDimHashesByName := map[string]uint64{}
- var collectorID uint64 // Just a sum of all desc IDs.
- var duplicateDescErr error
-
- r.mtx.Lock()
- defer r.mtx.Unlock()
- // Coduct various tests...
- for desc := range descChan {
-
- // Is the descriptor valid at all?
- if desc.err != nil {
- return c, fmt.Errorf("descriptor %s is invalid: %s", desc, desc.err)
- }
-
- // Is the descID unique?
- // (In other words: Is the fqName + constLabel combination unique?)
- if _, exists := r.descIDs[desc.id]; exists {
- duplicateDescErr = fmt.Errorf("descriptor %s already exists with the same fully-qualified name and const label values", desc)
- }
- // If it is not a duplicate desc in this collector, add it to
- // the collectorID. (We allow duplicate descs within the same
- // collector, but their existence must be a no-op.)
- if _, exists := newDescIDs[desc.id]; !exists {
- newDescIDs[desc.id] = struct{}{}
- collectorID += desc.id
- }
-
- // Are all the label names and the help string consistent with
- // previous descriptors of the same name?
- // First check existing descriptors...
- if dimHash, exists := r.dimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return nil, fmt.Errorf("a previously registered descriptor with the same fully-qualified name as %s has different label names or a different help string", desc)
- }
- } else {
- // ...then check the new descriptors already seen.
- if dimHash, exists := newDimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return nil, fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc)
- }
- } else {
- newDimHashesByName[desc.fqName] = desc.dimHash
- }
- }
- }
- // Did anything happen at all?
- if len(newDescIDs) == 0 {
- return nil, errors.New("collector has no descriptors")
- }
- if existing, exists := r.collectorsByID[collectorID]; exists {
- return existing, errAlreadyReg
- }
- // If the collectorID is new, but at least one of the descs existed
- // before, we are in trouble.
- if duplicateDescErr != nil {
- return nil, duplicateDescErr
- }
-
- // Only after all tests have passed, actually register.
- r.collectorsByID[collectorID] = c
- for hash := range newDescIDs {
- r.descIDs[hash] = struct{}{}
- }
- for name, dimHash := range newDimHashesByName {
- r.dimHashesByName[name] = dimHash
- }
- return c, nil
-}
-
-func (r *registry) RegisterOrGet(m Collector) (Collector, error) {
- existing, err := r.Register(m)
- if err != nil && err != errAlreadyReg {
- return nil, err
- }
- return existing, nil
-}
-
-func (r *registry) Unregister(c Collector) bool {
- descChan := make(chan *Desc, capDescChan)
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
-
- descIDs := map[uint64]struct{}{}
- var collectorID uint64 // Just a sum of the desc IDs.
- for desc := range descChan {
- if _, exists := descIDs[desc.id]; !exists {
- collectorID += desc.id
- descIDs[desc.id] = struct{}{}
- }
- }
-
- r.mtx.RLock()
- if _, exists := r.collectorsByID[collectorID]; !exists {
- r.mtx.RUnlock()
- return false
- }
- r.mtx.RUnlock()
-
- r.mtx.Lock()
- defer r.mtx.Unlock()
-
- delete(r.collectorsByID, collectorID)
- for id := range descIDs {
- delete(r.descIDs, id)
- }
- // dimHashesByName is left untouched as those must be consistent
- // throughout the lifetime of a program.
- return true
-}
-
-func (r *registry) Push(job, instance, pushURL, method string) error {
- if !strings.Contains(pushURL, "://") {
- pushURL = "http://" + pushURL
- }
- pushURL = fmt.Sprintf("%s/metrics/jobs/%s", pushURL, url.QueryEscape(job))
- if instance != "" {
- pushURL += "/instances/" + url.QueryEscape(instance)
- }
- buf := r.getBuf()
- defer r.giveBuf(buf)
- if err := r.writePB(expfmt.NewEncoder(buf, expfmt.FmtProtoDelim)); err != nil {
- if r.panicOnCollectError {
- panic(err)
- }
- return err
- }
- req, err := http.NewRequest(method, pushURL, buf)
- if err != nil {
- return err
- }
- req.Header.Set(contentTypeHeader, DelimitedTelemetryContentType)
- resp, err := http.DefaultClient.Do(req)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
- if resp.StatusCode != 202 {
- return fmt.Errorf("unexpected status code %d while pushing to %s", resp.StatusCode, pushURL)
- }
- return nil
-}
-
-func (r *registry) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- contentType := expfmt.Negotiate(req.Header)
- buf := r.getBuf()
- defer r.giveBuf(buf)
- writer, encoding := decorateWriter(req, buf)
- if err := r.writePB(expfmt.NewEncoder(writer, contentType)); err != nil {
- if r.panicOnCollectError {
- panic(err)
- }
- http.Error(w, "An error has occurred:\n\n"+err.Error(), http.StatusInternalServerError)
- return
- }
- if closer, ok := writer.(io.Closer); ok {
- closer.Close()
- }
- header := w.Header()
- header.Set(contentTypeHeader, string(contentType))
- header.Set(contentLengthHeader, fmt.Sprint(buf.Len()))
- if encoding != "" {
- header.Set(contentEncodingHeader, encoding)
- }
- w.Write(buf.Bytes())
-}
-
-func (r *registry) writePB(encoder expfmt.Encoder) error {
- var metricHashes map[uint64]struct{}
- if r.collectChecksEnabled {
- metricHashes = make(map[uint64]struct{})
- }
- metricChan := make(chan Metric, capMetricChan)
- wg := sync.WaitGroup{}
-
- r.mtx.RLock()
- metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName))
-
- // Scatter.
- // (Collectors could be complex and slow, so we call them all at once.)
- wg.Add(len(r.collectorsByID))
- go func() {
- wg.Wait()
- close(metricChan)
- }()
- for _, collector := range r.collectorsByID {
- go func(collector Collector) {
- defer wg.Done()
- collector.Collect(metricChan)
- }(collector)
- }
- r.mtx.RUnlock()
-
- // Drain metricChan in case of premature return.
- defer func() {
- for _ = range metricChan {
- }
- }()
-
- // Gather.
- for metric := range metricChan {
- // This could be done concurrently, too, but it required locking
- // of metricFamiliesByName (and of metricHashes if checks are
- // enabled). Most likely not worth it.
- desc := metric.Desc()
- metricFamily, ok := metricFamiliesByName[desc.fqName]
- if !ok {
- metricFamily = r.getMetricFamily()
- defer r.giveMetricFamily(metricFamily)
- metricFamily.Name = proto.String(desc.fqName)
- metricFamily.Help = proto.String(desc.help)
- metricFamiliesByName[desc.fqName] = metricFamily
- }
- dtoMetric := r.getMetric()
- defer r.giveMetric(dtoMetric)
- if err := metric.Write(dtoMetric); err != nil {
- // TODO: Consider different means of error reporting so
- // that a single erroneous metric could be skipped
- // instead of blowing up the whole collection.
- return fmt.Errorf("error collecting metric %v: %s", desc, err)
- }
- switch {
- case metricFamily.Type != nil:
- // Type already set. We are good.
- case dtoMetric.Gauge != nil:
- metricFamily.Type = dto.MetricType_GAUGE.Enum()
- case dtoMetric.Counter != nil:
- metricFamily.Type = dto.MetricType_COUNTER.Enum()
- case dtoMetric.Summary != nil:
- metricFamily.Type = dto.MetricType_SUMMARY.Enum()
- case dtoMetric.Untyped != nil:
- metricFamily.Type = dto.MetricType_UNTYPED.Enum()
- case dtoMetric.Histogram != nil:
- metricFamily.Type = dto.MetricType_HISTOGRAM.Enum()
- default:
- return fmt.Errorf("empty metric collected: %s", dtoMetric)
- }
- if r.collectChecksEnabled {
- if err := r.checkConsistency(metricFamily, dtoMetric, desc, metricHashes); err != nil {
- return err
- }
- }
- metricFamily.Metric = append(metricFamily.Metric, dtoMetric)
- }
-
- if r.metricFamilyInjectionHook != nil {
- for _, mf := range r.metricFamilyInjectionHook() {
- existingMF, exists := metricFamiliesByName[mf.GetName()]
- if !exists {
- metricFamiliesByName[mf.GetName()] = mf
- if r.collectChecksEnabled {
- for _, m := range mf.Metric {
- if err := r.checkConsistency(mf, m, nil, metricHashes); err != nil {
- return err
- }
- }
- }
- continue
- }
- for _, m := range mf.Metric {
- if r.collectChecksEnabled {
- if err := r.checkConsistency(existingMF, m, nil, metricHashes); err != nil {
- return err
- }
- }
- existingMF.Metric = append(existingMF.Metric, m)
- }
- }
- }
-
- // Now that MetricFamilies are all set, sort their Metrics
- // lexicographically by their label values.
- for _, mf := range metricFamiliesByName {
- sort.Sort(metricSorter(mf.Metric))
- }
-
- // Write out MetricFamilies sorted by their name.
- names := make([]string, 0, len(metricFamiliesByName))
- for name := range metricFamiliesByName {
- names = append(names, name)
- }
- sort.Strings(names)
-
- for _, name := range names {
- if err := encoder.Encode(metricFamiliesByName[name]); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (r *registry) checkConsistency(metricFamily *dto.MetricFamily, dtoMetric *dto.Metric, desc *Desc, metricHashes map[uint64]struct{}) error {
-
- // Type consistency with metric family.
- if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil ||
- metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil ||
- metricFamily.GetType() == dto.MetricType_SUMMARY && dtoMetric.Summary == nil ||
- metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil ||
- metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil {
- return fmt.Errorf(
- "collected metric %s %s is not a %s",
- metricFamily.GetName(), dtoMetric, metricFamily.GetType(),
- )
- }
-
- // Is the metric unique (i.e. no other metric with the same name and the same label values)?
- h := fnv.New64a()
- var buf bytes.Buffer
- buf.WriteString(metricFamily.GetName())
- buf.WriteByte(separatorByte)
- h.Write(buf.Bytes())
- // Make sure label pairs are sorted. We depend on it for the consistency
- // check. Label pairs must be sorted by contract. But the point of this
- // method is to check for contract violations. So we better do the sort
- // now.
- sort.Sort(LabelPairSorter(dtoMetric.Label))
- for _, lp := range dtoMetric.Label {
- buf.Reset()
- buf.WriteString(lp.GetValue())
- buf.WriteByte(separatorByte)
- h.Write(buf.Bytes())
- }
- metricHash := h.Sum64()
- if _, exists := metricHashes[metricHash]; exists {
- return fmt.Errorf(
- "collected metric %s %s was collected before with the same name and label values",
- metricFamily.GetName(), dtoMetric,
- )
- }
- metricHashes[metricHash] = struct{}{}
-
- if desc == nil {
- return nil // Nothing left to check if we have no desc.
- }
-
- // Desc consistency with metric family.
- if metricFamily.GetName() != desc.fqName {
- return fmt.Errorf(
- "collected metric %s %s has name %q but should have %q",
- metricFamily.GetName(), dtoMetric, metricFamily.GetName(), desc.fqName,
- )
- }
- if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- metricFamily.GetName(), dtoMetric, metricFamily.GetHelp(), desc.help,
- )
- }
-
- // Is the desc consistent with the content of the metric?
- lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label))
- lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...)
- for _, l := range desc.variableLabels {
- lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
- Name: proto.String(l),
- })
- }
- if len(lpsFromDesc) != len(dtoMetric.Label) {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- sort.Sort(LabelPairSorter(lpsFromDesc))
- for i, lpFromDesc := range lpsFromDesc {
- lpFromMetric := dtoMetric.Label[i]
- if lpFromDesc.GetName() != lpFromMetric.GetName() ||
- lpFromDesc.Value != nil && lpFromDesc.GetValue() != lpFromMetric.GetValue() {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- }
-
- r.mtx.RLock() // Remaining checks need the read lock.
- defer r.mtx.RUnlock()
-
- // Is the desc registered?
- if _, exist := r.descIDs[desc.id]; !exist {
- return fmt.Errorf(
- "collected metric %s %s with unregistered descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
-
- return nil
-}
-
-func (r *registry) getBuf() *bytes.Buffer {
- select {
- case buf := <-r.bufPool:
- return buf
- default:
- return &bytes.Buffer{}
- }
-}
-
-func (r *registry) giveBuf(buf *bytes.Buffer) {
- buf.Reset()
- select {
- case r.bufPool <- buf:
- default:
- }
-}
-
-func (r *registry) getMetricFamily() *dto.MetricFamily {
- select {
- case mf := <-r.metricFamilyPool:
- return mf
- default:
- return &dto.MetricFamily{}
- }
-}
-
-func (r *registry) giveMetricFamily(mf *dto.MetricFamily) {
- mf.Reset()
- select {
- case r.metricFamilyPool <- mf:
- default:
- }
-}
-
-func (r *registry) getMetric() *dto.Metric {
- select {
- case m := <-r.metricPool:
- return m
- default:
- return &dto.Metric{}
- }
-}
-
-func (r *registry) giveMetric(m *dto.Metric) {
- m.Reset()
- select {
- case r.metricPool <- m:
- default:
- }
-}
-
-func newRegistry() *registry {
- return ®istry{
- collectorsByID: map[uint64]Collector{},
- descIDs: map[uint64]struct{}{},
- dimHashesByName: map[string]uint64{},
- bufPool: make(chan *bytes.Buffer, numBufs),
- metricFamilyPool: make(chan *dto.MetricFamily, numMetricFamilies),
- metricPool: make(chan *dto.Metric, numMetrics),
- }
-}
-
-func newDefaultRegistry() *registry {
- r := newRegistry()
- r.Register(NewProcessCollector(os.Getpid(), ""))
- r.Register(NewGoCollector())
- return r
-}
-
-// decorateWriter wraps a writer to handle gzip compression if requested. It
-// returns the decorated writer and the appropriate "Content-Encoding" header
-// (which is empty if no compression is enabled).
-func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) {
- header := request.Header.Get(acceptEncodingHeader)
- parts := strings.Split(header, ",")
- for _, part := range parts {
- part := strings.TrimSpace(part)
- if part == "gzip" || strings.HasPrefix(part, "gzip;") {
- return gzip.NewWriter(writer), "gzip"
- }
- }
- return writer, ""
-}
-
-type metricSorter []*dto.Metric
-
-func (s metricSorter) Len() int {
- return len(s)
-}
-
-func (s metricSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s metricSorter) Less(i, j int) bool {
- if len(s[i].Label) != len(s[j].Label) {
- // This should not happen. The metrics are
- // inconsistent. However, we have to deal with the fact, as
- // people might use custom collectors or metric family injection
- // to create inconsistent metrics. So let's simply compare the
- // number of labels in this case. That will still yield
- // reproducible sorting.
- return len(s[i].Label) < len(s[j].Label)
- }
- for n, lp := range s[i].Label {
- vi := lp.GetValue()
- vj := s[j].Label[n].GetValue()
- if vi != vj {
- return vi < vj
- }
- }
- return true
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/summary.go
deleted file mode 100644
index fe81e004f..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/summary.go
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "hash/fnv"
- "math"
- "sort"
- "sync"
- "time"
-
- "github.com/beorn7/perks/quantile"
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// quantileLabel is used for the label that defines the quantile in a
-// summary.
-const quantileLabel = "quantile"
-
-// A Summary captures individual observations from an event or sample stream and
-// summarizes them in a manner similar to traditional summary statistics: 1. sum
-// of observations, 2. observation count, 3. rank estimations.
-//
-// A typical use-case is the observation of request latencies. By default, a
-// Summary provides the median, the 90th and the 99th percentile of the latency
-// as rank estimations.
-//
-// Note that the rank estimations cannot be aggregated in a meaningful way with
-// the Prometheus query language (i.e. you cannot average or add them). If you
-// need aggregatable quantiles (e.g. you want the 99th percentile latency of all
-// queries served across all instances of a service), consider the Histogram
-// metric type. See the Prometheus documentation for more details.
-//
-// To create Summary instances, use NewSummary.
-type Summary interface {
- Metric
- Collector
-
- // Observe adds a single observation to the summary.
- Observe(float64)
-}
-
-var (
- // DefObjectives are the default Summary quantile values.
- DefObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}
-
- errQuantileLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in summaries", quantileLabel,
- )
-)
-
-// Default values for SummaryOpts.
-const (
- // DefMaxAge is the default duration for which observations stay
- // relevant.
- DefMaxAge time.Duration = 10 * time.Minute
- // DefAgeBuckets is the default number of buckets used to calculate the
- // age of observations.
- DefAgeBuckets = 5
- // DefBufCap is the standard buffer size for collecting Summary observations.
- DefBufCap = 500
-)
-
-// SummaryOpts bundles the options for creating a Summary metric. It is
-// mandatory to set Name and Help to a non-empty string. All other fields are
-// optional and can safely be left at their zero value.
-type SummaryOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Summary (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Summary must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Summary. Mandatory!
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this
- // Summary. Summaries with the same fully-qualified name must have the
- // same label names in their ConstLabels.
- //
- // Note that in most cases, labels have a value that varies during the
- // lifetime of a process. Those labels are usually managed with a
- // SummaryVec. ConstLabels serve only special purposes. One is for the
- // special case where the value of a label does not change during the
- // lifetime of a process, e.g. if the revision of the running binary is
- // put into a label. Another, more advanced purpose is if more than one
- // Collector needs to collect Summaries with the same fully-qualified
- // name. In that case, those Summaries must differ in the values of
- // their ConstLabels. See the Collector examples.
- //
- // If the value of a label never changes (not even between binaries),
- // that label most likely should not be a label at all (but part of the
- // metric name).
- ConstLabels Labels
-
- // Objectives defines the quantile rank estimates with their respective
- // absolute error. If Objectives[q] = e, then the value reported
- // for q will be the φ-quantile value for some φ between q-e and q+e.
- // The default value is DefObjectives.
- Objectives map[float64]float64
-
- // MaxAge defines the duration for which an observation stays relevant
- // for the summary. Must be positive. The default value is DefMaxAge.
- MaxAge time.Duration
-
- // AgeBuckets is the number of buckets used to exclude observations that
- // are older than MaxAge from the summary. A higher number has a
- // resource penalty, so only increase it if the higher resolution is
- // really required. For very high observation rates, you might want to
- // reduce the number of age buckets. With only one age bucket, you will
- // effectively see a complete reset of the summary each time MaxAge has
- // passed. The default value is DefAgeBuckets.
- AgeBuckets uint32
-
- // BufCap defines the default sample stream buffer size. The default
- // value of DefBufCap should suffice for most uses. If there is a need
- // to increase the value, a multiple of 500 is recommended (because that
- // is the internal buffer size of the underlying package
- // "github.com/bmizerany/perks/quantile").
- BufCap uint32
-}
-
-// TODO: Great fuck-up with the sliding-window decay algorithm... The Merge
-// method of perk/quantile is actually not working as advertised - and it might
-// be unfixable, as the underlying algorithm is apparently not capable of
-// merging summaries in the first place. To avoid using Merge, we are currently
-// adding observations to _each_ age bucket, i.e. the effort to add a sample is
-// essentially multiplied by the number of age buckets. When rotating age
-// buckets, we empty the previous head stream. On scrape time, we simply take
-// the quantiles from the head stream (no merging required). Result: More effort
-// on observation time, less effort on scrape time, which is exactly the
-// opposite of what we try to accomplish, but at least the results are correct.
-//
-// The quite elegant previous contraption to merge the age buckets efficiently
-// on scrape time (see code up commit 6b9530d72ea715f0ba612c0120e6e09fbf1d49d0)
-// can't be used anymore.
-
-// NewSummary creates a new Summary based on the provided SummaryOpts.
-func NewSummary(opts SummaryOpts) Summary {
- return newSummary(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
- if len(desc.variableLabels) != len(labelValues) {
- panic(errInconsistentCardinality)
- }
-
- for _, n := range desc.variableLabels {
- if n == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
-
- if len(opts.Objectives) == 0 {
- opts.Objectives = DefObjectives
- }
-
- if opts.MaxAge < 0 {
- panic(fmt.Errorf("illegal max age MaxAge=%v", opts.MaxAge))
- }
- if opts.MaxAge == 0 {
- opts.MaxAge = DefMaxAge
- }
-
- if opts.AgeBuckets == 0 {
- opts.AgeBuckets = DefAgeBuckets
- }
-
- if opts.BufCap == 0 {
- opts.BufCap = DefBufCap
- }
-
- s := &summary{
- desc: desc,
-
- objectives: opts.Objectives,
- sortedObjectives: make([]float64, 0, len(opts.Objectives)),
-
- labelPairs: makeLabelPairs(desc, labelValues),
-
- hotBuf: make([]float64, 0, opts.BufCap),
- coldBuf: make([]float64, 0, opts.BufCap),
- streamDuration: opts.MaxAge / time.Duration(opts.AgeBuckets),
- }
- s.headStreamExpTime = time.Now().Add(s.streamDuration)
- s.hotBufExpTime = s.headStreamExpTime
-
- for i := uint32(0); i < opts.AgeBuckets; i++ {
- s.streams = append(s.streams, s.newStream())
- }
- s.headStream = s.streams[0]
-
- for qu := range s.objectives {
- s.sortedObjectives = append(s.sortedObjectives, qu)
- }
- sort.Float64s(s.sortedObjectives)
-
- s.Init(s) // Init self-collection.
- return s
-}
-
-type summary struct {
- SelfCollector
-
- bufMtx sync.Mutex // Protects hotBuf and hotBufExpTime.
- mtx sync.Mutex // Protects every other moving part.
- // Lock bufMtx before mtx if both are needed.
-
- desc *Desc
-
- objectives map[float64]float64
- sortedObjectives []float64
-
- labelPairs []*dto.LabelPair
-
- sum float64
- cnt uint64
-
- hotBuf, coldBuf []float64
-
- streams []*quantile.Stream
- streamDuration time.Duration
- headStream *quantile.Stream
- headStreamIdx int
- headStreamExpTime, hotBufExpTime time.Time
-}
-
-func (s *summary) Desc() *Desc {
- return s.desc
-}
-
-func (s *summary) Observe(v float64) {
- s.bufMtx.Lock()
- defer s.bufMtx.Unlock()
-
- now := time.Now()
- if now.After(s.hotBufExpTime) {
- s.asyncFlush(now)
- }
- s.hotBuf = append(s.hotBuf, v)
- if len(s.hotBuf) == cap(s.hotBuf) {
- s.asyncFlush(now)
- }
-}
-
-func (s *summary) Write(out *dto.Metric) error {
- sum := &dto.Summary{}
- qs := make([]*dto.Quantile, 0, len(s.objectives))
-
- s.bufMtx.Lock()
- s.mtx.Lock()
- // Swap bufs even if hotBuf is empty to set new hotBufExpTime.
- s.swapBufs(time.Now())
- s.bufMtx.Unlock()
-
- s.flushColdBuf()
- sum.SampleCount = proto.Uint64(s.cnt)
- sum.SampleSum = proto.Float64(s.sum)
-
- for _, rank := range s.sortedObjectives {
- var q float64
- if s.headStream.Count() == 0 {
- q = math.NaN()
- } else {
- q = s.headStream.Query(rank)
- }
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- s.mtx.Unlock()
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
- return nil
-}
-
-func (s *summary) newStream() *quantile.Stream {
- return quantile.NewTargeted(s.objectives)
-}
-
-// asyncFlush needs bufMtx locked.
-func (s *summary) asyncFlush(now time.Time) {
- s.mtx.Lock()
- s.swapBufs(now)
-
- // Unblock the original goroutine that was responsible for the mutation
- // that triggered the compaction. But hold onto the global non-buffer
- // state mutex until the operation finishes.
- go func() {
- s.flushColdBuf()
- s.mtx.Unlock()
- }()
-}
-
-// rotateStreams needs mtx AND bufMtx locked.
-func (s *summary) maybeRotateStreams() {
- for !s.hotBufExpTime.Equal(s.headStreamExpTime) {
- s.headStream.Reset()
- s.headStreamIdx++
- if s.headStreamIdx >= len(s.streams) {
- s.headStreamIdx = 0
- }
- s.headStream = s.streams[s.headStreamIdx]
- s.headStreamExpTime = s.headStreamExpTime.Add(s.streamDuration)
- }
-}
-
-// flushColdBuf needs mtx locked.
-func (s *summary) flushColdBuf() {
- for _, v := range s.coldBuf {
- for _, stream := range s.streams {
- stream.Insert(v)
- }
- s.cnt++
- s.sum += v
- }
- s.coldBuf = s.coldBuf[0:0]
- s.maybeRotateStreams()
-}
-
-// swapBufs needs mtx AND bufMtx locked, coldBuf must be empty.
-func (s *summary) swapBufs(now time.Time) {
- if len(s.coldBuf) != 0 {
- panic("coldBuf is not empty")
- }
- s.hotBuf, s.coldBuf = s.coldBuf, s.hotBuf
- // hotBuf is now empty and gets new expiration set.
- for now.After(s.hotBufExpTime) {
- s.hotBufExpTime = s.hotBufExpTime.Add(s.streamDuration)
- }
-}
-
-type quantSort []*dto.Quantile
-
-func (s quantSort) Len() int {
- return len(s)
-}
-
-func (s quantSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s quantSort) Less(i, j int) bool {
- return s[i].GetQuantile() < s[j].GetQuantile()
-}
-
-// SummaryVec is a Collector that bundles a set of Summaries that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewSummaryVec.
-type SummaryVec struct {
- MetricVec
-}
-
-// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and
-// partitioned by the given label names. At least one label name must be
-// provided.
-func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &SummaryVec{
- MetricVec: MetricVec{
- children: map[uint64]Metric{},
- desc: desc,
- hash: fnv.New64a(),
- newMetric: func(lvs ...string) Metric {
- return newSummary(desc, opts, lvs...)
- },
- },
- }
-}
-
-// GetMetricWithLabelValues replaces the method of the same name in
-// MetricVec. The difference is that this method returns a Summary and not a
-// Metric so that no type conversion is required.
-func (m *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Summary, error) {
- metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Summary), err
- }
- return nil, err
-}
-
-// GetMetricWith replaces the method of the same name in MetricVec. The
-// difference is that this method returns a Summary and not a Metric so that no
-// type conversion is required.
-func (m *SummaryVec) GetMetricWith(labels Labels) (Summary, error) {
- metric, err := m.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Summary), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. By not returning an
-// error, WithLabelValues allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (m *SummaryVec) WithLabelValues(lvs ...string) Summary {
- return m.MetricVec.WithLabelValues(lvs...).(Summary)
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. By not returning an error, With allows shortcuts like
-// myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (m *SummaryVec) With(labels Labels) Summary {
- return m.MetricVec.With(labels).(Summary)
-}
-
-type constSummary struct {
- desc *Desc
- count uint64
- sum float64
- quantiles map[float64]float64
- labelPairs []*dto.LabelPair
-}
-
-func (s *constSummary) Desc() *Desc {
- return s.desc
-}
-
-func (s *constSummary) Write(out *dto.Metric) error {
- sum := &dto.Summary{}
- qs := make([]*dto.Quantile, 0, len(s.quantiles))
-
- sum.SampleCount = proto.Uint64(s.count)
- sum.SampleSum = proto.Float64(s.sum)
-
- for rank, q := range s.quantiles {
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
-
- return nil
-}
-
-// NewConstSummary returns a metric representing a Prometheus summary with fixed
-// values for the count, sum, and quantiles. As those parameters cannot be
-// changed, the returned value does not implement the Summary interface (but
-// only the Metric interface). Users of this package will not have much use for
-// it in regular operations. However, when implementing custom Collectors, it is
-// useful as a throw-away metric that is generated on the fly to send it to
-// Prometheus in the Collect method.
-//
-// quantiles maps ranks to quantile values. For example, a median latency of
-// 0.23s and a 99th percentile latency of 0.56s would be expressed as:
-// map[float64]float64{0.5: 0.23, 0.99: 0.56}
-//
-// NewConstSummary returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc.
-func NewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) (Metric, error) {
- if len(desc.variableLabels) != len(labelValues) {
- return nil, errInconsistentCardinality
- }
- return &constSummary{
- desc: desc,
- count: count,
- sum: sum,
- quantiles: quantiles,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstSummary is a version of NewConstSummary that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) Metric {
- m, err := NewConstSummary(desc, count, sum, quantiles, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/untyped.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
deleted file mode 100644
index c65ab1c53..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "hash/fnv"
-
-// Untyped is a Metric that represents a single numerical value that can
-// arbitrarily go up and down.
-//
-// An Untyped metric works the same as a Gauge. The only difference is that to
-// no type information is implied.
-//
-// To create Untyped instances, use NewUntyped.
-type Untyped interface {
- Metric
- Collector
-
- // Set sets the Untyped metric to an arbitrary value.
- Set(float64)
- // Inc increments the Untyped metric by 1.
- Inc()
- // Dec decrements the Untyped metric by 1.
- Dec()
- // Add adds the given value to the Untyped metric. (The value can be
- // negative, resulting in a decrease.)
- Add(float64)
- // Sub subtracts the given value from the Untyped metric. (The value can
- // be negative, resulting in an increase.)
- Sub(float64)
-}
-
-// UntypedOpts is an alias for Opts. See there for doc comments.
-type UntypedOpts Opts
-
-// NewUntyped creates a new Untyped metric from the provided UntypedOpts.
-func NewUntyped(opts UntypedOpts) Untyped {
- return newValue(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), UntypedValue, 0)
-}
-
-// UntypedVec is a Collector that bundles a set of Untyped metrics that all
-// share the same Desc, but have different values for their variable
-// labels. This is used if you want to count the same thing partitioned by
-// various dimensions. Create instances with NewUntypedVec.
-type UntypedVec struct {
- MetricVec
-}
-
-// NewUntypedVec creates a new UntypedVec based on the provided UntypedOpts and
-// partitioned by the given label names. At least one label name must be
-// provided.
-func NewUntypedVec(opts UntypedOpts, labelNames []string) *UntypedVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &UntypedVec{
- MetricVec: MetricVec{
- children: map[uint64]Metric{},
- desc: desc,
- hash: fnv.New64a(),
- newMetric: func(lvs ...string) Metric {
- return newValue(desc, UntypedValue, 0, lvs...)
- },
- },
- }
-}
-
-// GetMetricWithLabelValues replaces the method of the same name in
-// MetricVec. The difference is that this method returns an Untyped and not a
-// Metric so that no type conversion is required.
-func (m *UntypedVec) GetMetricWithLabelValues(lvs ...string) (Untyped, error) {
- metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Untyped), err
- }
- return nil, err
-}
-
-// GetMetricWith replaces the method of the same name in MetricVec. The
-// difference is that this method returns an Untyped and not a Metric so that no
-// type conversion is required.
-func (m *UntypedVec) GetMetricWith(labels Labels) (Untyped, error) {
- metric, err := m.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Untyped), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. By not returning an
-// error, WithLabelValues allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (m *UntypedVec) WithLabelValues(lvs ...string) Untyped {
- return m.MetricVec.WithLabelValues(lvs...).(Untyped)
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. By not returning an error, With allows shortcuts like
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-func (m *UntypedVec) With(labels Labels) Untyped {
- return m.MetricVec.With(labels).(Untyped)
-}
-
-// UntypedFunc is an Untyped whose value is determined at collect time by
-// calling a provided function.
-//
-// To create UntypedFunc instances, use NewUntypedFunc.
-type UntypedFunc interface {
- Metric
- Collector
-}
-
-// NewUntypedFunc creates a new UntypedFunc based on the provided
-// UntypedOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where an UntypedFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), UntypedValue, function)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/value.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/value.go
deleted file mode 100644
index b54ac11e8..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/value.go
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "math"
- "sort"
- "sync/atomic"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/golang/protobuf/proto"
-)
-
-// ValueType is an enumeration of metric types that represent a simple value.
-type ValueType int
-
-// Possible values for the ValueType enum.
-const (
- _ ValueType = iota
- CounterValue
- GaugeValue
- UntypedValue
-)
-
-var errInconsistentCardinality = errors.New("inconsistent label cardinality")
-
-// value is a generic metric for simple values. It implements Metric, Collector,
-// Counter, Gauge, and Untyped. Its effective type is determined by
-// ValueType. This is a low-level building block used by the library to back the
-// implementations of Counter, Gauge, and Untyped.
-type value struct {
- // valBits containst the bits of the represented float64 value. It has
- // to go first in the struct to guarantee alignment for atomic
- // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- valBits uint64
-
- SelfCollector
-
- desc *Desc
- valType ValueType
- labelPairs []*dto.LabelPair
-}
-
-// newValue returns a newly allocated value with the given Desc, ValueType,
-// sample value and label values. It panics if the number of label
-// values is different from the number of variable labels in Desc.
-func newValue(desc *Desc, valueType ValueType, val float64, labelValues ...string) *value {
- if len(labelValues) != len(desc.variableLabels) {
- panic(errInconsistentCardinality)
- }
- result := &value{
- desc: desc,
- valType: valueType,
- valBits: math.Float64bits(val),
- labelPairs: makeLabelPairs(desc, labelValues),
- }
- result.Init(result)
- return result
-}
-
-func (v *value) Desc() *Desc {
- return v.desc
-}
-
-func (v *value) Set(val float64) {
- atomic.StoreUint64(&v.valBits, math.Float64bits(val))
-}
-
-func (v *value) Inc() {
- v.Add(1)
-}
-
-func (v *value) Dec() {
- v.Add(-1)
-}
-
-func (v *value) Add(val float64) {
- for {
- oldBits := atomic.LoadUint64(&v.valBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + val)
- if atomic.CompareAndSwapUint64(&v.valBits, oldBits, newBits) {
- return
- }
- }
-}
-
-func (v *value) Sub(val float64) {
- v.Add(val * -1)
-}
-
-func (v *value) Write(out *dto.Metric) error {
- val := math.Float64frombits(atomic.LoadUint64(&v.valBits))
- return populateMetric(v.valType, val, v.labelPairs, out)
-}
-
-// valueFunc is a generic metric for simple values retrieved on collect time
-// from a function. It implements Metric and Collector. Its effective type is
-// determined by ValueType. This is a low-level building block used by the
-// library to back the implementations of CounterFunc, GaugeFunc, and
-// UntypedFunc.
-type valueFunc struct {
- SelfCollector
-
- desc *Desc
- valType ValueType
- function func() float64
- labelPairs []*dto.LabelPair
-}
-
-// newValueFunc returns a newly allocated valueFunc with the given Desc and
-// ValueType. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a valueFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func newValueFunc(desc *Desc, valueType ValueType, function func() float64) *valueFunc {
- result := &valueFunc{
- desc: desc,
- valType: valueType,
- function: function,
- labelPairs: makeLabelPairs(desc, nil),
- }
- result.Init(result)
- return result
-}
-
-func (v *valueFunc) Desc() *Desc {
- return v.desc
-}
-
-func (v *valueFunc) Write(out *dto.Metric) error {
- return populateMetric(v.valType, v.function(), v.labelPairs, out)
-}
-
-// NewConstMetric returns a metric with one fixed value that cannot be
-// changed. Users of this package will not have much use for it in regular
-// operations. However, when implementing custom Collectors, it is useful as a
-// throw-away metric that is generated on the fly to send it to Prometheus in
-// the Collect method. NewConstMetric returns an error if the length of
-// labelValues is not consistent with the variable labels in Desc.
-func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
- if len(desc.variableLabels) != len(labelValues) {
- return nil, errInconsistentCardinality
- }
- return &constMetric{
- desc: desc,
- valType: valueType,
- val: value,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstMetric is a version of NewConstMetric that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) Metric {
- m, err := NewConstMetric(desc, valueType, value, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type constMetric struct {
- desc *Desc
- valType ValueType
- val float64
- labelPairs []*dto.LabelPair
-}
-
-func (m *constMetric) Desc() *Desc {
- return m.desc
-}
-
-func (m *constMetric) Write(out *dto.Metric) error {
- return populateMetric(m.valType, m.val, m.labelPairs, out)
-}
-
-func populateMetric(
- t ValueType,
- v float64,
- labelPairs []*dto.LabelPair,
- m *dto.Metric,
-) error {
- m.Label = labelPairs
- switch t {
- case CounterValue:
- m.Counter = &dto.Counter{Value: proto.Float64(v)}
- case GaugeValue:
- m.Gauge = &dto.Gauge{Value: proto.Float64(v)}
- case UntypedValue:
- m.Untyped = &dto.Untyped{Value: proto.Float64(v)}
- default:
- return fmt.Errorf("encountered unknown type %v", t)
- }
- return nil
-}
-
-func makeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
- totalLen := len(desc.variableLabels) + len(desc.constLabelPairs)
- if totalLen == 0 {
- // Super fast path.
- return nil
- }
- if len(desc.variableLabels) == 0 {
- // Moderately fast path.
- return desc.constLabelPairs
- }
- labelPairs := make([]*dto.LabelPair, 0, totalLen)
- for i, n := range desc.variableLabels {
- labelPairs = append(labelPairs, &dto.LabelPair{
- Name: proto.String(n),
- Value: proto.String(labelValues[i]),
- })
- }
- for _, lp := range desc.constLabelPairs {
- labelPairs = append(labelPairs, lp)
- }
- sort.Sort(LabelPairSorter(labelPairs))
- return labelPairs
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/vec.go
deleted file mode 100644
index a1f3bdf37..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_golang/prometheus/vec.go
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "bytes"
- "fmt"
- "hash"
- "sync"
-)
-
-// MetricVec is a Collector to bundle metrics of the same name that
-// differ in their label values. MetricVec is usually not used directly but as a
-// building block for implementations of vectors of a given metric
-// type. GaugeVec, CounterVec, SummaryVec, and UntypedVec are examples already
-// provided in this package.
-type MetricVec struct {
- mtx sync.RWMutex // Protects not only children, but also hash and buf.
- children map[uint64]Metric
- desc *Desc
-
- // hash is our own hash instance to avoid repeated allocations.
- hash hash.Hash64
- // buf is used to copy string contents into it for hashing,
- // again to avoid allocations.
- buf bytes.Buffer
-
- newMetric func(labelValues ...string) Metric
-}
-
-// Describe implements Collector. The length of the returned slice
-// is always one.
-func (m *MetricVec) Describe(ch chan<- *Desc) {
- ch <- m.desc
-}
-
-// Collect implements Collector.
-func (m *MetricVec) Collect(ch chan<- Metric) {
- m.mtx.RLock()
- defer m.mtx.RUnlock()
-
- for _, metric := range m.children {
- ch <- metric
- }
-}
-
-// GetMetricWithLabelValues returns the Metric for the given slice of label
-// values (same order as the VariableLabels in Desc). If that combination of
-// label values is accessed for the first time, a new Metric is created.
-//
-// It is possible to call this method without using the returned Metric to only
-// create the new Metric but leave it at its start value (e.g. a Summary or
-// Histogram without any observations). See also the SummaryVec example.
-//
-// Keeping the Metric for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Metric from the MetricVec. In that case, the
-// Metric will still exist, but it will not be exported anymore, even if a
-// Metric with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of VariableLabels in Desc.
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (m *MetricVec) GetMetricWithLabelValues(lvs ...string) (Metric, error) {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return nil, err
- }
- return m.getOrCreateMetric(h, lvs...), nil
-}
-
-// GetMetricWith returns the Metric for the given Labels map (the label names
-// must match those of the VariableLabels in Desc). If that label map is
-// accessed for the first time, a new Metric is created. Implications of
-// creating a Metric without using it and keeping the Metric for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc.
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (m *MetricVec) GetMetricWith(labels Labels) (Metric, error) {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- h, err := m.hashLabels(labels)
- if err != nil {
- return nil, err
- }
- lvs := make([]string, len(labels))
- for i, label := range m.desc.variableLabels {
- lvs[i] = labels[label]
- }
- return m.getOrCreateMetric(h, lvs...), nil
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics if an error
-// occurs. The method allows neat syntax like:
-// httpReqs.WithLabelValues("404", "POST").Inc()
-func (m *MetricVec) WithLabelValues(lvs ...string) Metric {
- metric, err := m.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return metric
-}
-
-// With works as GetMetricWith, but panics if an error occurs. The method allows
-// neat syntax like:
-// httpReqs.With(Labels{"status":"404", "method":"POST"}).Inc()
-func (m *MetricVec) With(labels Labels) Metric {
- metric, err := m.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return metric
-}
-
-// DeleteLabelValues removes the metric where the variable labels are the same
-// as those passed in as labels (same order as the VariableLabels in Desc). It
-// returns true if a metric was deleted.
-//
-// It is not an error if the number of label values is not the same as the
-// number of VariableLabels in Desc. However, such inconsistent label count can
-// never match an actual Metric, so the method will always return false in that
-// case.
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider Delete(Labels) as an
-// alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the CounterVec example.
-func (m *MetricVec) DeleteLabelValues(lvs ...string) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return false
- }
- if _, has := m.children[h]; !has {
- return false
- }
- delete(m.children, h)
- return true
-}
-
-// Delete deletes the metric where the variable labels are the same as those
-// passed in as labels. It returns true if a metric was deleted.
-//
-// It is not an error if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in the Desc of the MetricVec. However, such
-// inconsistent Labels can never match an actual Metric, so the method will
-// always return false in that case.
-//
-// This method is used for the same purpose as DeleteLabelValues(...string). See
-// there for pros and cons of the two methods.
-func (m *MetricVec) Delete(labels Labels) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- h, err := m.hashLabels(labels)
- if err != nil {
- return false
- }
- if _, has := m.children[h]; !has {
- return false
- }
- delete(m.children, h)
- return true
-}
-
-// Reset deletes all metrics in this vector.
-func (m *MetricVec) Reset() {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- for h := range m.children {
- delete(m.children, h)
- }
-}
-
-func (m *MetricVec) hashLabelValues(vals []string) (uint64, error) {
- if len(vals) != len(m.desc.variableLabels) {
- return 0, errInconsistentCardinality
- }
- m.hash.Reset()
- for _, val := range vals {
- m.buf.Reset()
- m.buf.WriteString(val)
- m.hash.Write(m.buf.Bytes())
- }
- return m.hash.Sum64(), nil
-}
-
-func (m *MetricVec) hashLabels(labels Labels) (uint64, error) {
- if len(labels) != len(m.desc.variableLabels) {
- return 0, errInconsistentCardinality
- }
- m.hash.Reset()
- for _, label := range m.desc.variableLabels {
- val, ok := labels[label]
- if !ok {
- return 0, fmt.Errorf("label name %q missing in label map", label)
- }
- m.buf.Reset()
- m.buf.WriteString(val)
- m.hash.Write(m.buf.Bytes())
- }
- return m.hash.Sum64(), nil
-}
-
-func (m *MetricVec) getOrCreateMetric(hash uint64, labelValues ...string) Metric {
- metric, ok := m.children[hash]
- if !ok {
- // Copy labelValues. Otherwise, they would be allocated even if we don't go
- // down this code path.
- copiedLabelValues := append(make([]string, 0, len(labelValues)), labelValues...)
- metric = m.newMetric(copiedLabelValues...)
- m.children[hash] = metric
- }
- return metric
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_model/AUTHORS.md b/archived/event-adapter/vendor/github.com/prometheus/client_model/AUTHORS.md
deleted file mode 100644
index e8b3efa6a..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_model/AUTHORS.md
+++ /dev/null
@@ -1,13 +0,0 @@
-The Prometheus project was started by Matt T. Proud (emeritus) and
-Julius Volz in 2012.
-
-Maintainers of this repository:
-
-* Björn Rabenstein
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Björn Rabenstein
-* Matt T. Proud
-* Tobias Schmidt
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_model/LICENSE b/archived/event-adapter/vendor/github.com/prometheus/client_model/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_model/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_model/NOTICE b/archived/event-adapter/vendor/github.com/prometheus/client_model/NOTICE
deleted file mode 100644
index 20110e410..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_model/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Data model artifacts for Prometheus.
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/archived/event-adapter/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/archived/event-adapter/vendor/github.com/prometheus/client_model/go/metrics.pb.go
deleted file mode 100644
index b065f8683..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/client_model/go/metrics.pb.go
+++ /dev/null
@@ -1,364 +0,0 @@
-// Code generated by protoc-gen-go.
-// source: metrics.proto
-// DO NOT EDIT!
-
-/*
-Package io_prometheus_client is a generated protocol buffer package.
-
-It is generated from these files:
- metrics.proto
-
-It has these top-level messages:
- LabelPair
- Gauge
- Counter
- Quantile
- Summary
- Untyped
- Histogram
- Bucket
- Metric
- MetricFamily
-*/
-package io_prometheus_client
-
-import proto "github.com/golang/protobuf/proto"
-import math "math"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = math.Inf
-
-type MetricType int32
-
-const (
- MetricType_COUNTER MetricType = 0
- MetricType_GAUGE MetricType = 1
- MetricType_SUMMARY MetricType = 2
- MetricType_UNTYPED MetricType = 3
- MetricType_HISTOGRAM MetricType = 4
-)
-
-var MetricType_name = map[int32]string{
- 0: "COUNTER",
- 1: "GAUGE",
- 2: "SUMMARY",
- 3: "UNTYPED",
- 4: "HISTOGRAM",
-}
-var MetricType_value = map[string]int32{
- "COUNTER": 0,
- "GAUGE": 1,
- "SUMMARY": 2,
- "UNTYPED": 3,
- "HISTOGRAM": 4,
-}
-
-func (x MetricType) Enum() *MetricType {
- p := new(MetricType)
- *p = x
- return p
-}
-func (x MetricType) String() string {
- return proto.EnumName(MetricType_name, int32(x))
-}
-func (x *MetricType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(MetricType_value, data, "MetricType")
- if err != nil {
- return err
- }
- *x = MetricType(value)
- return nil
-}
-
-type LabelPair struct {
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *LabelPair) Reset() { *m = LabelPair{} }
-func (m *LabelPair) String() string { return proto.CompactTextString(m) }
-func (*LabelPair) ProtoMessage() {}
-
-func (m *LabelPair) GetName() string {
- if m != nil && m.Name != nil {
- return *m.Name
- }
- return ""
-}
-
-func (m *LabelPair) GetValue() string {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return ""
-}
-
-type Gauge struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Gauge) Reset() { *m = Gauge{} }
-func (m *Gauge) String() string { return proto.CompactTextString(m) }
-func (*Gauge) ProtoMessage() {}
-
-func (m *Gauge) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Counter struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Counter) Reset() { *m = Counter{} }
-func (m *Counter) String() string { return proto.CompactTextString(m) }
-func (*Counter) ProtoMessage() {}
-
-func (m *Counter) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Quantile struct {
- Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"`
- Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Quantile) Reset() { *m = Quantile{} }
-func (m *Quantile) String() string { return proto.CompactTextString(m) }
-func (*Quantile) ProtoMessage() {}
-
-func (m *Quantile) GetQuantile() float64 {
- if m != nil && m.Quantile != nil {
- return *m.Quantile
- }
- return 0
-}
-
-func (m *Quantile) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Summary struct {
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count" json:"sample_count,omitempty"`
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum" json:"sample_sum,omitempty"`
- Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Summary) Reset() { *m = Summary{} }
-func (m *Summary) String() string { return proto.CompactTextString(m) }
-func (*Summary) ProtoMessage() {}
-
-func (m *Summary) GetSampleCount() uint64 {
- if m != nil && m.SampleCount != nil {
- return *m.SampleCount
- }
- return 0
-}
-
-func (m *Summary) GetSampleSum() float64 {
- if m != nil && m.SampleSum != nil {
- return *m.SampleSum
- }
- return 0
-}
-
-func (m *Summary) GetQuantile() []*Quantile {
- if m != nil {
- return m.Quantile
- }
- return nil
-}
-
-type Untyped struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Untyped) Reset() { *m = Untyped{} }
-func (m *Untyped) String() string { return proto.CompactTextString(m) }
-func (*Untyped) ProtoMessage() {}
-
-func (m *Untyped) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Histogram struct {
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count" json:"sample_count,omitempty"`
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum" json:"sample_sum,omitempty"`
- Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Histogram) Reset() { *m = Histogram{} }
-func (m *Histogram) String() string { return proto.CompactTextString(m) }
-func (*Histogram) ProtoMessage() {}
-
-func (m *Histogram) GetSampleCount() uint64 {
- if m != nil && m.SampleCount != nil {
- return *m.SampleCount
- }
- return 0
-}
-
-func (m *Histogram) GetSampleSum() float64 {
- if m != nil && m.SampleSum != nil {
- return *m.SampleSum
- }
- return 0
-}
-
-func (m *Histogram) GetBucket() []*Bucket {
- if m != nil {
- return m.Bucket
- }
- return nil
-}
-
-type Bucket struct {
- CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count" json:"cumulative_count,omitempty"`
- UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound" json:"upper_bound,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Bucket) Reset() { *m = Bucket{} }
-func (m *Bucket) String() string { return proto.CompactTextString(m) }
-func (*Bucket) ProtoMessage() {}
-
-func (m *Bucket) GetCumulativeCount() uint64 {
- if m != nil && m.CumulativeCount != nil {
- return *m.CumulativeCount
- }
- return 0
-}
-
-func (m *Bucket) GetUpperBound() float64 {
- if m != nil && m.UpperBound != nil {
- return *m.UpperBound
- }
- return 0
-}
-
-type Metric struct {
- Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
- Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"`
- Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"`
- Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"`
- Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"`
- Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"`
- TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms" json:"timestamp_ms,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Metric) Reset() { *m = Metric{} }
-func (m *Metric) String() string { return proto.CompactTextString(m) }
-func (*Metric) ProtoMessage() {}
-
-func (m *Metric) GetLabel() []*LabelPair {
- if m != nil {
- return m.Label
- }
- return nil
-}
-
-func (m *Metric) GetGauge() *Gauge {
- if m != nil {
- return m.Gauge
- }
- return nil
-}
-
-func (m *Metric) GetCounter() *Counter {
- if m != nil {
- return m.Counter
- }
- return nil
-}
-
-func (m *Metric) GetSummary() *Summary {
- if m != nil {
- return m.Summary
- }
- return nil
-}
-
-func (m *Metric) GetUntyped() *Untyped {
- if m != nil {
- return m.Untyped
- }
- return nil
-}
-
-func (m *Metric) GetHistogram() *Histogram {
- if m != nil {
- return m.Histogram
- }
- return nil
-}
-
-func (m *Metric) GetTimestampMs() int64 {
- if m != nil && m.TimestampMs != nil {
- return *m.TimestampMs
- }
- return 0
-}
-
-type MetricFamily struct {
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"`
- Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"`
- Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *MetricFamily) Reset() { *m = MetricFamily{} }
-func (m *MetricFamily) String() string { return proto.CompactTextString(m) }
-func (*MetricFamily) ProtoMessage() {}
-
-func (m *MetricFamily) GetName() string {
- if m != nil && m.Name != nil {
- return *m.Name
- }
- return ""
-}
-
-func (m *MetricFamily) GetHelp() string {
- if m != nil && m.Help != nil {
- return *m.Help
- }
- return ""
-}
-
-func (m *MetricFamily) GetType() MetricType {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return MetricType_COUNTER
-}
-
-func (m *MetricFamily) GetMetric() []*Metric {
- if m != nil {
- return m.Metric
- }
- return nil
-}
-
-func init() {
- proto.RegisterEnum("io.prometheus.client.MetricType", MetricType_name, MetricType_value)
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/AUTHORS.md b/archived/event-adapter/vendor/github.com/prometheus/common/AUTHORS.md
deleted file mode 100644
index cec1574cc..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/AUTHORS.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Maintainers of this repository:
-
-* Fabian Reinartz
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Björn Rabenstein
-* Fabian Reinartz
-* Julius Volz
-* Miguel Molina
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/LICENSE b/archived/event-adapter/vendor/github.com/prometheus/common/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/NOTICE b/archived/event-adapter/vendor/github.com/prometheus/common/NOTICE
deleted file mode 100644
index 636a2c1a5..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Common libraries shared by Prometheus Go components.
-Copyright 2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/decode.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/decode.go
deleted file mode 100644
index b72c9bede..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/decode.go
+++ /dev/null
@@ -1,411 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "fmt"
- "io"
- "math"
- "mime"
- "net/http"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/matttproud/golang_protobuf_extensions/pbutil"
- "github.com/prometheus/common/model"
-)
-
-// Decoder types decode an input stream into metric families.
-type Decoder interface {
- Decode(*dto.MetricFamily) error
-}
-
-type DecodeOptions struct {
- // Timestamp is added to each value from the stream that has no explicit timestamp set.
- Timestamp model.Time
-}
-
-// ResponseFormat extracts the correct format from a HTTP response header.
-// If no matching format can be found FormatUnknown is returned.
-func ResponseFormat(h http.Header) Format {
- ct := h.Get(hdrContentType)
-
- mediatype, params, err := mime.ParseMediaType(ct)
- if err != nil {
- return FmtUnknown
- }
-
- const (
- textType = "text/plain"
- jsonType = "application/json"
- )
-
- switch mediatype {
- case ProtoType:
- if p, ok := params["proto"]; ok && p != ProtoProtocol {
- return FmtUnknown
- }
- if e, ok := params["encoding"]; ok && e != "delimited" {
- return FmtUnknown
- }
- return FmtProtoDelim
-
- case textType:
- if v, ok := params["version"]; ok && v != TextVersion {
- return FmtUnknown
- }
- return FmtText
-
- case jsonType:
- var prometheusAPIVersion string
-
- if params["schema"] == "prometheus/telemetry" && params["version"] != "" {
- prometheusAPIVersion = params["version"]
- } else {
- prometheusAPIVersion = h.Get("X-Prometheus-API-Version")
- }
-
- switch prometheusAPIVersion {
- case "0.0.2", "":
- return fmtJSON2
- default:
- return FmtUnknown
- }
- }
-
- return FmtUnknown
-}
-
-// NewDecoder returns a new decoder based on the given input format.
-// If the input format does not imply otherwise, a text format decoder is returned.
-func NewDecoder(r io.Reader, format Format) Decoder {
- switch format {
- case FmtProtoDelim:
- return &protoDecoder{r: r}
- case fmtJSON2:
- return newJSON2Decoder(r)
- }
- return &textDecoder{r: r}
-}
-
-// protoDecoder implements the Decoder interface for protocol buffers.
-type protoDecoder struct {
- r io.Reader
-}
-
-// Decode implements the Decoder interface.
-func (d *protoDecoder) Decode(v *dto.MetricFamily) error {
- _, err := pbutil.ReadDelimited(d.r, v)
- return err
-}
-
-// textDecoder implements the Decoder interface for the text protcol.
-type textDecoder struct {
- r io.Reader
- p TextParser
- fams []*dto.MetricFamily
-}
-
-// Decode implements the Decoder interface.
-func (d *textDecoder) Decode(v *dto.MetricFamily) error {
- // TODO(fabxc): Wrap this as a line reader to make streaming safer.
- if len(d.fams) == 0 {
- // No cached metric families, read everything and parse metrics.
- fams, err := d.p.TextToMetricFamilies(d.r)
- if err != nil {
- return err
- }
- if len(fams) == 0 {
- return io.EOF
- }
- d.fams = make([]*dto.MetricFamily, 0, len(fams))
- for _, f := range fams {
- d.fams = append(d.fams, f)
- }
- }
-
- *v = *d.fams[0]
- d.fams = d.fams[1:]
-
- return nil
-}
-
-type SampleDecoder struct {
- Dec Decoder
- Opts *DecodeOptions
-
- f dto.MetricFamily
-}
-
-func (sd *SampleDecoder) Decode(s *model.Vector) error {
- if err := sd.Dec.Decode(&sd.f); err != nil {
- return err
- }
- *s = extractSamples(&sd.f, sd.Opts)
- return nil
-}
-
-// Extract samples builds a slice of samples from the provided metric families.
-func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) model.Vector {
- var all model.Vector
- for _, f := range fams {
- all = append(all, extractSamples(f, o)...)
- }
- return all
-}
-
-func extractSamples(f *dto.MetricFamily, o *DecodeOptions) model.Vector {
- switch f.GetType() {
- case dto.MetricType_COUNTER:
- return extractCounter(o, f)
- case dto.MetricType_GAUGE:
- return extractGauge(o, f)
- case dto.MetricType_SUMMARY:
- return extractSummary(o, f)
- case dto.MetricType_UNTYPED:
- return extractUntyped(o, f)
- case dto.MetricType_HISTOGRAM:
- return extractHistogram(o, f)
- }
- panic("expfmt.extractSamples: unknown metric family type")
-}
-
-func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Counter == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Counter.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Gauge == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Gauge.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Untyped == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Untyped.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Summary == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- for _, q := range m.Summary.Quantile {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- // BUG(matt): Update other names to "quantile".
- lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetValue()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleCount()),
- Timestamp: timestamp,
- })
- }
-
- return samples
-}
-
-func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Histogram == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- infSeen := false
-
- for _, q := range m.Histogram.Bucket {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- if math.IsInf(q.GetUpperBound(), +1) {
- infSeen = true
- }
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetCumulativeCount()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- count := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleCount()),
- Timestamp: timestamp,
- }
- samples = append(samples, count)
-
- if !infSeen {
- // Append an infinity bucket sample.
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf")
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: count.Value,
- Timestamp: timestamp,
- })
- }
- }
-
- return samples
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/encode.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/encode.go
deleted file mode 100644
index 392ca90ee..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/encode.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "fmt"
- "io"
- "net/http"
-
- "bitbucket.org/ww/goautoneg"
- "github.com/golang/protobuf/proto"
- "github.com/matttproud/golang_protobuf_extensions/pbutil"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Encoder types encode metric families into an underlying wire protocol.
-type Encoder interface {
- Encode(*dto.MetricFamily) error
-}
-
-type encoder func(*dto.MetricFamily) error
-
-func (e encoder) Encode(v *dto.MetricFamily) error {
- return e(v)
-}
-
-// Negotiate returns the Content-Type based on the given Accept header.
-// If no appropriate accepted type is found, FmtText is returned.
-func Negotiate(h http.Header) Format {
- for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) {
- // Check for protocol buffer
- if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
- switch ac.Params["encoding"] {
- case "delimited":
- return FmtProtoDelim
- case "text":
- return FmtProtoText
- case "compact-text":
- return FmtProtoCompact
- }
- }
- // Check for text format.
- ver := ac.Params["version"]
- if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
- return FmtText
- }
- }
- return FmtText
-}
-
-// NewEncoder returns a new encoder based on content type negotiation.
-func NewEncoder(w io.Writer, format Format) Encoder {
- switch format {
- case FmtProtoDelim:
- return encoder(func(v *dto.MetricFamily) error {
- _, err := pbutil.WriteDelimited(w, v)
- return err
- })
- case FmtProtoCompact:
- return encoder(func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, v.String())
- return err
- })
- case FmtProtoText:
- return encoder(func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, proto.MarshalTextString(v))
- return err
- })
- case FmtText:
- return encoder(func(v *dto.MetricFamily) error {
- _, err := MetricFamilyToText(w, v)
- return err
- })
- }
- panic("expfmt.NewEncoder: unknown format")
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/expfmt.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/expfmt.go
deleted file mode 100644
index 366fbde98..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/expfmt.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// A package for reading and writing Prometheus metrics.
-package expfmt
-
-type Format string
-
-const (
- TextVersion = "0.0.4"
-
- ProtoType = `application/vnd.google.protobuf`
- ProtoProtocol = `io.prometheus.client.MetricFamily`
- ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
-
- // The Content-Type values for the different wire protocols.
- FmtUnknown Format = ``
- FmtText Format = `text/plain; version=` + TextVersion
- FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
- FmtProtoText Format = ProtoFmt + ` encoding=text`
- FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
-
- // fmtJSON2 is hidden as it is deprecated.
- fmtJSON2 Format = `application/json; version=0.0.2`
-)
-
-const (
- hdrContentType = "Content-Type"
- hdrAccept = "Accept"
-)
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/fuzz.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/fuzz.go
deleted file mode 100644
index 14f920146..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/fuzz.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Build only when actually fuzzing
-// +build gofuzz
-
-package expfmt
-
-import "bytes"
-
-// Fuzz text metric parser with with github.com/dvyukov/go-fuzz:
-//
-// go-fuzz-build github.com/prometheus/client_golang/text
-// go-fuzz -bin text-fuzz.zip -workdir fuzz
-//
-// Further input samples should go in the folder fuzz/corpus.
-func Fuzz(in []byte) int {
- parser := TextParser{}
- _, err := parser.TextToMetricFamilies(bytes.NewReader(in))
-
- if err != nil {
- return 0
- }
-
- return 1
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/json_decode.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/json_decode.go
deleted file mode 100644
index 67e3a0d4d..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/json_decode.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "sort"
-
- "github.com/golang/protobuf/proto"
- dto "github.com/prometheus/client_model/go"
-
- "github.com/prometheus/common/model"
-)
-
-type json2Decoder struct {
- dec *json.Decoder
- fams []*dto.MetricFamily
-}
-
-func newJSON2Decoder(r io.Reader) Decoder {
- return &json2Decoder{
- dec: json.NewDecoder(r),
- }
-}
-
-type histogram002 struct {
- Labels model.LabelSet `json:"labels"`
- Values map[string]float64 `json:"value"`
-}
-
-type counter002 struct {
- Labels model.LabelSet `json:"labels"`
- Value float64 `json:"value"`
-}
-
-func protoLabelSet(base, ext model.LabelSet) []*dto.LabelPair {
- labels := base.Clone().Merge(ext)
- delete(labels, model.MetricNameLabel)
-
- names := make([]string, 0, len(labels))
- for ln := range labels {
- names = append(names, string(ln))
- }
- sort.Strings(names)
-
- pairs := make([]*dto.LabelPair, 0, len(labels))
-
- for _, ln := range names {
- lv := labels[model.LabelName(ln)]
-
- pairs = append(pairs, &dto.LabelPair{
- Name: proto.String(ln),
- Value: proto.String(string(lv)),
- })
- }
-
- return pairs
-}
-
-func (d *json2Decoder) more() error {
- var entities []struct {
- BaseLabels model.LabelSet `json:"baseLabels"`
- Docstring string `json:"docstring"`
- Metric struct {
- Type string `json:"type"`
- Values json.RawMessage `json:"value"`
- } `json:"metric"`
- }
-
- if err := d.dec.Decode(&entities); err != nil {
- return err
- }
- for _, e := range entities {
- f := &dto.MetricFamily{
- Name: proto.String(string(e.BaseLabels[model.MetricNameLabel])),
- Help: proto.String(e.Docstring),
- Type: dto.MetricType_UNTYPED.Enum(),
- Metric: []*dto.Metric{},
- }
-
- d.fams = append(d.fams, f)
-
- switch e.Metric.Type {
- case "counter", "gauge":
- var values []counter002
-
- if err := json.Unmarshal(e.Metric.Values, &values); err != nil {
- return fmt.Errorf("could not extract %s value: %s", e.Metric.Type, err)
- }
-
- for _, ctr := range values {
- f.Metric = append(f.Metric, &dto.Metric{
- Label: protoLabelSet(e.BaseLabels, ctr.Labels),
- Untyped: &dto.Untyped{
- Value: proto.Float64(ctr.Value),
- },
- })
- }
-
- case "histogram":
- var values []histogram002
-
- if err := json.Unmarshal(e.Metric.Values, &values); err != nil {
- return fmt.Errorf("could not extract %s value: %s", e.Metric.Type, err)
- }
-
- for _, hist := range values {
- quants := make([]string, 0, len(values))
- for q := range hist.Values {
- quants = append(quants, q)
- }
-
- sort.Strings(quants)
-
- for _, q := range quants {
- value := hist.Values[q]
- // The correct label is "quantile" but to not break old expressions
- // this remains "percentile"
- hist.Labels["percentile"] = model.LabelValue(q)
-
- f.Metric = append(f.Metric, &dto.Metric{
- Label: protoLabelSet(e.BaseLabels, hist.Labels),
- Untyped: &dto.Untyped{
- Value: proto.Float64(value),
- },
- })
- }
- }
-
- default:
- return fmt.Errorf("unknown metric type %q", e.Metric.Type)
- }
- }
- return nil
-}
-
-// Decode implements the Decoder interface.
-func (d *json2Decoder) Decode(v *dto.MetricFamily) error {
- if len(d.fams) == 0 {
- if err := d.more(); err != nil {
- return err
- }
- }
-
- *v = *d.fams[0]
- d.fams = d.fams[1:]
-
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_create.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_create.go
deleted file mode 100644
index 0bb9c14cc..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_create.go
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bytes"
- "fmt"
- "io"
- "math"
- "strings"
-
- dto "github.com/prometheus/client_model/go"
- "github.com/prometheus/common/model"
-)
-
-// MetricFamilyToText converts a MetricFamily proto message into text format and
-// writes the resulting lines to 'out'. It returns the number of bytes written
-// and any error encountered. This function does not perform checks on the
-// content of the metric and label names, i.e. invalid metric or label names
-// will result in invalid text format output.
-// This method fulfills the type 'prometheus.encoder'.
-func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
- var written int
-
- // Fail-fast checks.
- if len(in.Metric) == 0 {
- return written, fmt.Errorf("MetricFamily has no metrics: %s", in)
- }
- name := in.GetName()
- if name == "" {
- return written, fmt.Errorf("MetricFamily has no name: %s", in)
- }
-
- // Comments, first HELP, then TYPE.
- if in.Help != nil {
- n, err := fmt.Fprintf(
- out, "# HELP %s %s\n",
- name, escapeString(*in.Help, false),
- )
- written += n
- if err != nil {
- return written, err
- }
- }
- metricType := in.GetType()
- n, err := fmt.Fprintf(
- out, "# TYPE %s %s\n",
- name, strings.ToLower(metricType.String()),
- )
- written += n
- if err != nil {
- return written, err
- }
-
- // Finally the samples, one line for each.
- for _, metric := range in.Metric {
- switch metricType {
- case dto.MetricType_COUNTER:
- if metric.Counter == nil {
- return written, fmt.Errorf(
- "expected counter in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- name, metric, "", "",
- metric.Counter.GetValue(),
- out,
- )
- case dto.MetricType_GAUGE:
- if metric.Gauge == nil {
- return written, fmt.Errorf(
- "expected gauge in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- name, metric, "", "",
- metric.Gauge.GetValue(),
- out,
- )
- case dto.MetricType_UNTYPED:
- if metric.Untyped == nil {
- return written, fmt.Errorf(
- "expected untyped in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- name, metric, "", "",
- metric.Untyped.GetValue(),
- out,
- )
- case dto.MetricType_SUMMARY:
- if metric.Summary == nil {
- return written, fmt.Errorf(
- "expected summary in metric %s %s", name, metric,
- )
- }
- for _, q := range metric.Summary.Quantile {
- n, err = writeSample(
- name, metric,
- model.QuantileLabel, fmt.Sprint(q.GetQuantile()),
- q.GetValue(),
- out,
- )
- written += n
- if err != nil {
- return written, err
- }
- }
- n, err = writeSample(
- name+"_sum", metric, "", "",
- metric.Summary.GetSampleSum(),
- out,
- )
- if err != nil {
- return written, err
- }
- written += n
- n, err = writeSample(
- name+"_count", metric, "", "",
- float64(metric.Summary.GetSampleCount()),
- out,
- )
- case dto.MetricType_HISTOGRAM:
- if metric.Histogram == nil {
- return written, fmt.Errorf(
- "expected histogram in metric %s %s", name, metric,
- )
- }
- infSeen := false
- for _, q := range metric.Histogram.Bucket {
- n, err = writeSample(
- name+"_bucket", metric,
- model.BucketLabel, fmt.Sprint(q.GetUpperBound()),
- float64(q.GetCumulativeCount()),
- out,
- )
- written += n
- if err != nil {
- return written, err
- }
- if math.IsInf(q.GetUpperBound(), +1) {
- infSeen = true
- }
- }
- if !infSeen {
- n, err = writeSample(
- name+"_bucket", metric,
- model.BucketLabel, "+Inf",
- float64(metric.Histogram.GetSampleCount()),
- out,
- )
- if err != nil {
- return written, err
- }
- written += n
- }
- n, err = writeSample(
- name+"_sum", metric, "", "",
- metric.Histogram.GetSampleSum(),
- out,
- )
- if err != nil {
- return written, err
- }
- written += n
- n, err = writeSample(
- name+"_count", metric, "", "",
- float64(metric.Histogram.GetSampleCount()),
- out,
- )
- default:
- return written, fmt.Errorf(
- "unexpected type in metric %s %s", name, metric,
- )
- }
- written += n
- if err != nil {
- return written, err
- }
- }
- return written, nil
-}
-
-// writeSample writes a single sample in text format to out, given the metric
-// name, the metric proto message itself, optionally an additional label name
-// and value (use empty strings if not required), and the value. The function
-// returns the number of bytes written and any error encountered.
-func writeSample(
- name string,
- metric *dto.Metric,
- additionalLabelName, additionalLabelValue string,
- value float64,
- out io.Writer,
-) (int, error) {
- var written int
- n, err := fmt.Fprint(out, name)
- written += n
- if err != nil {
- return written, err
- }
- n, err = labelPairsToText(
- metric.Label,
- additionalLabelName, additionalLabelValue,
- out,
- )
- written += n
- if err != nil {
- return written, err
- }
- n, err = fmt.Fprintf(out, " %v", value)
- written += n
- if err != nil {
- return written, err
- }
- if metric.TimestampMs != nil {
- n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs)
- written += n
- if err != nil {
- return written, err
- }
- }
- n, err = out.Write([]byte{'\n'})
- written += n
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// labelPairsToText converts a slice of LabelPair proto messages plus the
-// explicitly given additional label pair into text formatted as required by the
-// text format and writes it to 'out'. An empty slice in combination with an
-// empty string 'additionalLabelName' results in nothing being
-// written. Otherwise, the label pairs are written, escaped as required by the
-// text format, and enclosed in '{...}'. The function returns the number of
-// bytes written and any error encountered.
-func labelPairsToText(
- in []*dto.LabelPair,
- additionalLabelName, additionalLabelValue string,
- out io.Writer,
-) (int, error) {
- if len(in) == 0 && additionalLabelName == "" {
- return 0, nil
- }
- var written int
- separator := '{'
- for _, lp := range in {
- n, err := fmt.Fprintf(
- out, `%c%s="%s"`,
- separator, lp.GetName(), escapeString(lp.GetValue(), true),
- )
- written += n
- if err != nil {
- return written, err
- }
- separator = ','
- }
- if additionalLabelName != "" {
- n, err := fmt.Fprintf(
- out, `%c%s="%s"`,
- separator, additionalLabelName,
- escapeString(additionalLabelValue, true),
- )
- written += n
- if err != nil {
- return written, err
- }
- }
- n, err := out.Write([]byte{'}'})
- written += n
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// escapeString replaces '\' by '\\', new line character by '\n', and - if
-// includeDoubleQuote is true - '"' by '\"'.
-func escapeString(v string, includeDoubleQuote bool) string {
- result := bytes.NewBuffer(make([]byte, 0, len(v)))
- for _, c := range v {
- switch {
- case c == '\\':
- result.WriteString(`\\`)
- case includeDoubleQuote && c == '"':
- result.WriteString(`\"`)
- case c == '\n':
- result.WriteString(`\n`)
- default:
- result.WriteRune(c)
- }
- }
- return result.String()
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_parse.go b/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_parse.go
deleted file mode 100644
index 84433bc4f..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/expfmt/text_parse.go
+++ /dev/null
@@ -1,746 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/model"
-)
-
-// A stateFn is a function that represents a state in a state machine. By
-// executing it, the state is progressed to the next state. The stateFn returns
-// another stateFn, which represents the new state. The end state is represented
-// by nil.
-type stateFn func() stateFn
-
-// ParseError signals errors while parsing the simple and flat text-based
-// exchange format.
-type ParseError struct {
- Line int
- Msg string
-}
-
-// Error implements the error interface.
-func (e ParseError) Error() string {
- return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg)
-}
-
-// TextParser is used to parse the simple and flat text-based exchange format. Its
-// nil value is ready to use.
-type TextParser struct {
- metricFamiliesByName map[string]*dto.MetricFamily
- buf *bufio.Reader // Where the parsed input is read through.
- err error // Most recent error.
- lineCount int // Tracks the line count for error messages.
- currentByte byte // The most recent byte read.
- currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes.
- currentMF *dto.MetricFamily
- currentMetric *dto.Metric
- currentLabelPair *dto.LabelPair
-
- // The remaining member variables are only used for summaries/histograms.
- currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le'
- // Summary specific.
- summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentQuantile float64
- // Histogram specific.
- histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentBucket float64
- // These tell us if the currently processed line ends on '_count' or
- // '_sum' respectively and belong to a summary/histogram, representing the sample
- // count and sum of that summary/histogram.
- currentIsSummaryCount, currentIsSummarySum bool
- currentIsHistogramCount, currentIsHistogramSum bool
-}
-
-// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange
-// format and creates MetricFamily proto messages. It returns the MetricFamily
-// proto messages in a map where the metric names are the keys, along with any
-// error encountered.
-//
-// If the input contains duplicate metrics (i.e. lines with the same metric name
-// and exactly the same label set), the resulting MetricFamily will contain
-// duplicate Metric proto messages. Similar is true for duplicate label
-// names. Checks for duplicates have to be performed separately, if required.
-// Also note that neither the metrics within each MetricFamily are sorted nor
-// the label pairs within each Metric. Sorting is not required for the most
-// frequent use of this method, which is sample ingestion in the Prometheus
-// server. However, for presentation purposes, you might want to sort the
-// metrics, and in some cases, you must sort the labels, e.g. for consumption by
-// the metric family injection hook of the Prometheus registry.
-//
-// Summaries and histograms are rather special beasts. You would probably not
-// use them in the simple text format anyway. This method can deal with
-// summaries and histograms if they are presented in exactly the way the
-// text.Create function creates them.
-//
-// This method must not be called concurrently. If you want to parse different
-// input concurrently, instantiate a separate Parser for each goroutine.
-func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) {
- p.reset(in)
- for nextState := p.startOfLine; nextState != nil; nextState = nextState() {
- // Magic happens here...
- }
- // Get rid of empty metric families.
- for k, mf := range p.metricFamiliesByName {
- if len(mf.GetMetric()) == 0 {
- delete(p.metricFamiliesByName, k)
- }
- }
- return p.metricFamiliesByName, p.err
-}
-
-func (p *TextParser) reset(in io.Reader) {
- p.metricFamiliesByName = map[string]*dto.MetricFamily{}
- if p.buf == nil {
- p.buf = bufio.NewReader(in)
- } else {
- p.buf.Reset(in)
- }
- p.err = nil
- p.lineCount = 0
- if p.summaries == nil || len(p.summaries) > 0 {
- p.summaries = map[uint64]*dto.Metric{}
- }
- if p.histograms == nil || len(p.histograms) > 0 {
- p.histograms = map[uint64]*dto.Metric{}
- }
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
-}
-
-// startOfLine represents the state where the next byte read from p.buf is the
-// start of a line (or whitespace leading up to it).
-func (p *TextParser) startOfLine() stateFn {
- p.lineCount++
- if p.skipBlankTab(); p.err != nil {
- // End of input reached. This is the only case where
- // that is not an error but a signal that we are done.
- p.err = nil
- return nil
- }
- switch p.currentByte {
- case '#':
- return p.startComment
- case '\n':
- return p.startOfLine // Empty line, start the next one.
- }
- return p.readingMetricName
-}
-
-// startComment represents the state where the next byte read from p.buf is the
-// start of a comment (or whitespace leading up to it).
-func (p *TextParser) startComment() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- // If we have hit the end of line already, there is nothing left
- // to do. This is not considered a syntax error.
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- keyword := p.currentToken.String()
- if keyword != "HELP" && keyword != "TYPE" {
- // Generic comment, ignore by fast forwarding to end of line.
- for p.currentByte != '\n' {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return nil // Unexpected end of input.
- }
- }
- return p.startOfLine
- }
- // There is something. Next has to be a metric name.
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenAsMetricName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- if !isBlankOrTab(p.currentByte) {
- p.parseError("invalid metric name in comment")
- return nil
- }
- p.setOrCreateCurrentMF()
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- switch keyword {
- case "HELP":
- return p.readingHelp
- case "TYPE":
- return p.readingType
- }
- panic(fmt.Sprintf("code error: unexpected keyword %q", keyword))
-}
-
-// readingMetricName represents the state where the last byte read (now in
-// p.currentByte) is the first byte of a metric name.
-func (p *TextParser) readingMetricName() stateFn {
- if p.readTokenAsMetricName(); p.err != nil {
- return nil
- }
- if p.currentToken.Len() == 0 {
- p.parseError("invalid metric name")
- return nil
- }
- p.setOrCreateCurrentMF()
- // Now is the time to fix the type if it hasn't happened yet.
- if p.currentMF.Type == nil {
- p.currentMF.Type = dto.MetricType_UNTYPED.Enum()
- }
- p.currentMetric = &dto.Metric{}
- // Do not append the newly created currentMetric to
- // currentMF.Metric right now. First wait if this is a summary,
- // and the metric exists already, which we can only know after
- // having read all the labels.
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingLabels
-}
-
-// readingLabels represents the state where the last byte read (now in
-// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the
-// first byte of the value (otherwise).
-func (p *TextParser) readingLabels() stateFn {
- // Summaries/histograms are special. We have to reset the
- // currentLabels map, currentQuantile and currentBucket before starting to
- // read labels.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- p.currentLabels = map[string]string{}
- p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName()
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
- }
- if p.currentByte != '{' {
- return p.readingValue
- }
- return p.startLabelName
-}
-
-// startLabelName represents the state where the next byte read from p.buf is
-// the start of a label name (or whitespace leading up to it).
-func (p *TextParser) startLabelName() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '}' {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- }
- if p.readTokenAsLabelName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() == 0 {
- p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName()))
- return nil
- }
- p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())}
- if p.currentLabelPair.GetName() == string(model.MetricNameLabel) {
- p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel))
- return nil
- }
- // Special summary/histogram treatment. Don't add 'quantile' and 'le'
- // labels to 'real' labels.
- if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) &&
- !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) {
- p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair)
- }
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '=' {
- p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte))
- return nil
- }
- return p.startLabelValue
-}
-
-// startLabelValue represents the state where the next byte read from p.buf is
-// the start of a (quoted) label value (or whitespace leading up to it).
-func (p *TextParser) startLabelValue() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '"' {
- p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte))
- return nil
- }
- if p.readTokenAsLabelValue(); p.err != nil {
- return nil
- }
- p.currentLabelPair.Value = proto.String(p.currentToken.String())
- // Special treatment of summaries:
- // - Quantile labels are special, will result in dto.Quantile later.
- // - Other labels have to be added to currentLabels for signature calculation.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if p.currentLabelPair.GetName() == model.QuantileLabel {
- if p.currentQuantile, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- // Similar special treatment of histograms.
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if p.currentLabelPair.GetName() == model.BucketLabel {
- if p.currentBucket, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- switch p.currentByte {
- case ',':
- return p.startLabelName
-
- case '}':
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- default:
- p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value))
- return nil
- }
-}
-
-// readingValue represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the sample value (i.e. a float).
-func (p *TextParser) readingValue() stateFn {
- // When we are here, we have read all the labels, so for the
- // special case of a summary/histogram, we can finally find out
- // if the metric already exists.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- signature := model.LabelsToSignature(p.currentLabels)
- if summary := p.summaries[signature]; summary != nil {
- p.currentMetric = summary
- } else {
- p.summaries[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- signature := model.LabelsToSignature(p.currentLabels)
- if histogram := p.histograms[signature]; histogram != nil {
- p.currentMetric = histogram
- } else {
- p.histograms[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else {
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- value, err := strconv.ParseFloat(p.currentToken.String(), 64)
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String()))
- return nil
- }
- switch p.currentMF.GetType() {
- case dto.MetricType_COUNTER:
- p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)}
- case dto.MetricType_GAUGE:
- p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)}
- case dto.MetricType_UNTYPED:
- p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)}
- case dto.MetricType_SUMMARY:
- // *sigh*
- if p.currentMetric.Summary == nil {
- p.currentMetric.Summary = &dto.Summary{}
- }
- switch {
- case p.currentIsSummaryCount:
- p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsSummarySum:
- p.currentMetric.Summary.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentQuantile):
- p.currentMetric.Summary.Quantile = append(
- p.currentMetric.Summary.Quantile,
- &dto.Quantile{
- Quantile: proto.Float64(p.currentQuantile),
- Value: proto.Float64(value),
- },
- )
- }
- case dto.MetricType_HISTOGRAM:
- // *sigh*
- if p.currentMetric.Histogram == nil {
- p.currentMetric.Histogram = &dto.Histogram{}
- }
- switch {
- case p.currentIsHistogramCount:
- p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsHistogramSum:
- p.currentMetric.Histogram.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentBucket):
- p.currentMetric.Histogram.Bucket = append(
- p.currentMetric.Histogram.Bucket,
- &dto.Bucket{
- UpperBound: proto.Float64(p.currentBucket),
- CumulativeCount: proto.Uint64(uint64(value)),
- },
- )
- }
- default:
- p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName())
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- return p.startTimestamp
-}
-
-// startTimestamp represents the state where the next byte read from p.buf is
-// the start of the timestamp (or whitespace leading up to it).
-func (p *TextParser) startTimestamp() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64)
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String()))
- return nil
- }
- p.currentMetric.TimestampMs = proto.Int64(timestamp)
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() > 0 {
- p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String()))
- return nil
- }
- return p.startOfLine
-}
-
-// readingHelp represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the docstring after 'HELP'.
-func (p *TextParser) readingHelp() stateFn {
- if p.currentMF.Help != nil {
- p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the docstring.
- if p.readTokenUntilNewline(true); p.err != nil {
- return nil // Unexpected end of input.
- }
- p.currentMF.Help = proto.String(p.currentToken.String())
- return p.startOfLine
-}
-
-// readingType represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the type hint after 'HELP'.
-func (p *TextParser) readingType() stateFn {
- if p.currentMF.Type != nil {
- p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the type.
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())]
- if !ok {
- p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String()))
- return nil
- }
- p.currentMF.Type = dto.MetricType(metricType).Enum()
- return p.startOfLine
-}
-
-// parseError sets p.err to a ParseError at the current line with the given
-// message.
-func (p *TextParser) parseError(msg string) {
- p.err = ParseError{
- Line: p.lineCount,
- Msg: msg,
- }
-}
-
-// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte
-// that is neither ' ' nor '\t'. That byte is left in p.currentByte.
-func (p *TextParser) skipBlankTab() {
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) {
- return
- }
- }
-}
-
-// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do
-// anything if p.currentByte is neither ' ' nor '\t'.
-func (p *TextParser) skipBlankTabIfCurrentBlankTab() {
- if isBlankOrTab(p.currentByte) {
- p.skipBlankTab()
- }
-}
-
-// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The
-// first byte considered is the byte already read (now in p.currentByte). The
-// first whitespace byte encountered is still copied into p.currentByte, but not
-// into p.currentToken.
-func (p *TextParser) readTokenUntilWhitespace() {
- p.currentToken.Reset()
- for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first
-// byte considered is the byte already read (now in p.currentByte). The first
-// newline byte encountered is still copied into p.currentByte, but not into
-// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are
-// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All
-// other escape sequences are invalid and cause an error.
-func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) {
- p.currentToken.Reset()
- escaped := false
- for p.err == nil {
- if recognizeEscapeSequence && escaped {
- switch p.currentByte {
- case '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- } else {
- switch p.currentByte {
- case '\n':
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenAsMetricName copies a metric name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a metric name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsMetricName() {
- p.currentToken.Reset()
- if !isValidMetricNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidMetricNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelName copies a label name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a label name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelName() {
- p.currentToken.Reset()
- if !isValidLabelNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidLabelNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelValue copies a label value from p.buf into p.currentToken.
-// In contrast to the other 'readTokenAs...' functions, which start with the
-// last read byte in p.currentByte, this method ignores p.currentByte and starts
-// with reading a new byte from p.buf. The first byte not part of a label value
-// is still copied into p.currentByte, but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelValue() {
- p.currentToken.Reset()
- escaped := false
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return
- }
- if escaped {
- switch p.currentByte {
- case '"', '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- continue
- }
- switch p.currentByte {
- case '"':
- return
- case '\n':
- p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String()))
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
-}
-
-func (p *TextParser) setOrCreateCurrentMF() {
- p.currentIsSummaryCount = false
- p.currentIsSummarySum = false
- p.currentIsHistogramCount = false
- p.currentIsHistogramSum = false
- name := p.currentToken.String()
- if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil {
- return
- }
- // Try out if this is a _sum or _count for a summary/histogram.
- summaryName := summaryMetricName(name)
- if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if isCount(name) {
- p.currentIsSummaryCount = true
- }
- if isSum(name) {
- p.currentIsSummarySum = true
- }
- return
- }
- }
- histogramName := histogramMetricName(name)
- if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if isCount(name) {
- p.currentIsHistogramCount = true
- }
- if isSum(name) {
- p.currentIsHistogramSum = true
- }
- return
- }
- }
- p.currentMF = &dto.MetricFamily{Name: proto.String(name)}
- p.metricFamiliesByName[name] = p.currentMF
-}
-
-func isValidLabelNameStart(b byte) bool {
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_'
-}
-
-func isValidLabelNameContinuation(b byte) bool {
- return isValidLabelNameStart(b) || (b >= '0' && b <= '9')
-}
-
-func isValidMetricNameStart(b byte) bool {
- return isValidLabelNameStart(b) || b == ':'
-}
-
-func isValidMetricNameContinuation(b byte) bool {
- return isValidLabelNameContinuation(b) || b == ':'
-}
-
-func isBlankOrTab(b byte) bool {
- return b == ' ' || b == '\t'
-}
-
-func isCount(name string) bool {
- return len(name) > 6 && name[len(name)-6:] == "_count"
-}
-
-func isSum(name string) bool {
- return len(name) > 4 && name[len(name)-4:] == "_sum"
-}
-
-func isBucket(name string) bool {
- return len(name) > 7 && name[len(name)-7:] == "_bucket"
-}
-
-func summaryMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- default:
- return name
- }
-}
-
-func histogramMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- case isBucket(name):
- return name[:len(name)-7]
- default:
- return name
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/alert.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/alert.go
deleted file mode 100644
index b027e9f3d..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/alert.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "time"
-)
-
-type AlertStatus string
-
-const (
- AlertFiring AlertStatus = "firing"
- AlertResolved AlertStatus = "resolved"
-)
-
-// Alert is a generic representation of an alert in the Prometheus eco-system.
-type Alert struct {
- // Label value pairs for purpose of aggregation, matching, and disposition
- // dispatching. This must minimally include an "alertname" label.
- Labels LabelSet `json:"labels"`
-
- // Extra key/value information which does not define alert identity.
- Annotations LabelSet `json:"annotations"`
-
- // The known time range for this alert. Both ends are optional.
- StartsAt time.Time `json:"startsAt,omitempty"`
- EndsAt time.Time `json:"endsAt,omitempty"`
-}
-
-// Name returns the name of the alert. It is equivalent to the "alertname" label.
-func (a *Alert) Name() string {
- return string(a.Labels[AlertNameLabel])
-}
-
-// Fingerprint returns a unique hash for the alert. It is equivalent to
-// the fingerprint of the alert's label set.
-func (a *Alert) Fingerprint() Fingerprint {
- return a.Labels.Fingerprint()
-}
-
-func (a *Alert) String() string {
- s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7])
- if a.Resolved() {
- return s + "[resolved]"
- }
- return s + "[active]"
-}
-
-// Resolved returns true iff the activity interval ended in the past.
-func (a *Alert) Resolved() bool {
- if a.EndsAt.IsZero() {
- return false
- }
- return !a.EndsAt.After(time.Now())
-}
-
-// Status returns the status of the alert.
-func (a *Alert) Status() AlertStatus {
- if a.Resolved() {
- return AlertResolved
- }
- return AlertFiring
-}
-
-// Alert is a list of alerts that can be sorted in chronological order.
-type Alerts []*Alert
-
-func (as Alerts) Len() int { return len(as) }
-func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] }
-
-func (as Alerts) Less(i, j int) bool {
- if as[i].StartsAt.Before(as[j].StartsAt) {
- return true
- }
- if as[i].EndsAt.Before(as[j].EndsAt) {
- return true
- }
- return as[i].Fingerprint() < as[j].Fingerprint()
-}
-
-// HasFiring returns true iff one of the alerts is not resolved.
-func (as Alerts) HasFiring() bool {
- for _, a := range as {
- if !a.Resolved() {
- return true
- }
- }
- return false
-}
-
-// Status returns StatusFiring iff at least one of the alerts is firing.
-func (as Alerts) Status() AlertStatus {
- if as.HasFiring() {
- return AlertFiring
- }
- return AlertResolved
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/fingerprinting.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/fingerprinting.go
deleted file mode 100644
index fc4de4106..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/fingerprinting.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "strconv"
-)
-
-// Fingerprint provides a hash-capable representation of a Metric.
-// For our purposes, FNV-1A 64-bit is used.
-type Fingerprint uint64
-
-// FingerprintFromString transforms a string representation into a Fingerprint.
-func FingerprintFromString(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- return Fingerprint(num), err
-}
-
-// ParseFingerprint parses the input string into a fingerprint.
-func ParseFingerprint(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- if err != nil {
- return 0, err
- }
- return Fingerprint(num), nil
-}
-
-func (f Fingerprint) String() string {
- return fmt.Sprintf("%016x", uint64(f))
-}
-
-// Fingerprints represents a collection of Fingerprint subject to a given
-// natural sorting scheme. It implements sort.Interface.
-type Fingerprints []Fingerprint
-
-// Len implements sort.Interface.
-func (f Fingerprints) Len() int {
- return len(f)
-}
-
-// Less implements sort.Interface.
-func (f Fingerprints) Less(i, j int) bool {
- return f[i] < f[j]
-}
-
-// Swap implements sort.Interface.
-func (f Fingerprints) Swap(i, j int) {
- f[i], f[j] = f[j], f[i]
-}
-
-// FingerprintSet is a set of Fingerprints.
-type FingerprintSet map[Fingerprint]struct{}
-
-// Equal returns true if both sets contain the same elements (and not more).
-func (s FingerprintSet) Equal(o FingerprintSet) bool {
- if len(s) != len(o) {
- return false
- }
-
- for k := range s {
- if _, ok := o[k]; !ok {
- return false
- }
- }
-
- return true
-}
-
-// Intersection returns the elements contained in both sets.
-func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet {
- myLength, otherLength := len(s), len(o)
- if myLength == 0 || otherLength == 0 {
- return FingerprintSet{}
- }
-
- subSet := s
- superSet := o
-
- if otherLength < myLength {
- subSet = o
- superSet = s
- }
-
- out := FingerprintSet{}
-
- for k := range subSet {
- if _, ok := superSet[k]; ok {
- out[k] = struct{}{}
- }
- }
-
- return out
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/labels.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/labels.go
deleted file mode 100644
index 6459c8f79..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/labels.go
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "sort"
- "strings"
-)
-
-const (
- // AlertNameLabel is the name of the label containing the an alert's name.
- AlertNameLabel = "alertname"
-
- // ExportedLabelPrefix is the prefix to prepend to the label names present in
- // exported metrics if a label of the same name is added by the server.
- ExportedLabelPrefix = "exported_"
-
- // MetricNameLabel is the label name indicating the metric name of a
- // timeseries.
- MetricNameLabel = "__name__"
-
- // SchemeLabel is the name of the label that holds the scheme on which to
- // scrape a target.
- SchemeLabel = "__scheme__"
-
- // AddressLabel is the name of the label that holds the address of
- // a scrape target.
- AddressLabel = "__address__"
-
- // MetricsPathLabel is the name of the label that holds the path on which to
- // scrape a target.
- MetricsPathLabel = "__metrics_path__"
-
- // ReservedLabelPrefix is a prefix which is not legal in user-supplied
- // label names.
- ReservedLabelPrefix = "__"
-
- // MetaLabelPrefix is a prefix for labels that provide meta information.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series.
- MetaLabelPrefix = "__meta_"
-
- // TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series. This is reserved for use in
- // Prometheus configuration files by users.
- TmpLabelPrefix = "__tmp_"
-
- // ParamLabelPrefix is a prefix for labels that provide URL parameters
- // used to scrape a target.
- ParamLabelPrefix = "__param_"
-
- // JobLabel is the label name indicating the job from which a timeseries
- // was scraped.
- JobLabel = "job"
-
- // InstanceLabel is the label name used for the instance label.
- InstanceLabel = "instance"
-
- // BucketLabel is used for the label that defines the upper bound of a
- // bucket of a histogram ("le" -> "less or equal").
- BucketLabel = "le"
-
- // QuantileLabel is used for the label that defines the quantile in a
- // summary.
- QuantileLabel = "quantile"
-)
-
-// LabelNameRE is a regular expression matching valid label names.
-var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
-
-// A LabelName is a key for a LabelSet or Metric. It has a value associated
-// therewith.
-type LabelName string
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- if !LabelNameRE.MatchString(s) {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (ln *LabelName) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- if !LabelNameRE.MatchString(s) {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// LabelNames is a sortable LabelName slice. In implements sort.Interface.
-type LabelNames []LabelName
-
-func (l LabelNames) Len() int {
- return len(l)
-}
-
-func (l LabelNames) Less(i, j int) bool {
- return l[i] < l[j]
-}
-
-func (l LabelNames) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-func (l LabelNames) String() string {
- labelStrings := make([]string, 0, len(l))
- for _, label := range l {
- labelStrings = append(labelStrings, string(label))
- }
- return strings.Join(labelStrings, ", ")
-}
-
-// A LabelValue is an associated value for a LabelName.
-type LabelValue string
-
-// LabelValues is a sortable LabelValue slice. It implements sort.Interface.
-type LabelValues []LabelValue
-
-func (l LabelValues) Len() int {
- return len(l)
-}
-
-func (l LabelValues) Less(i, j int) bool {
- return sort.StringsAreSorted([]string{string(l[i]), string(l[j])})
-}
-
-func (l LabelValues) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-// LabelPair pairs a name with a value.
-type LabelPair struct {
- Name LabelName
- Value LabelValue
-}
-
-// LabelPairs is a sortable slice of LabelPair pointers. It implements
-// sort.Interface.
-type LabelPairs []*LabelPair
-
-func (l LabelPairs) Len() int {
- return len(l)
-}
-
-func (l LabelPairs) Less(i, j int) bool {
- switch {
- case l[i].Name > l[j].Name:
- return false
- case l[i].Name < l[j].Name:
- return true
- case l[i].Value > l[j].Value:
- return false
- case l[i].Value < l[j].Value:
- return true
- default:
- return false
- }
-}
-
-func (l LabelPairs) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/labelset.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/labelset.go
deleted file mode 100644
index 142b9d1e2..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/labelset.go
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "sort"
- "strings"
-)
-
-// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet
-// may be fully-qualified down to the point where it may resolve to a single
-// Metric in the data store or not. All operations that occur within the realm
-// of a LabelSet can emit a vector of Metric entities to which the LabelSet may
-// match.
-type LabelSet map[LabelName]LabelValue
-
-func (ls LabelSet) Equal(o LabelSet) bool {
- if len(ls) != len(o) {
- return false
- }
- for ln, lv := range ls {
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if olv != lv {
- return false
- }
- }
- return true
-}
-
-// Before compares the metrics, using the following criteria:
-//
-// If m has fewer labels than o, it is before o. If it has more, it is not.
-//
-// If the number of labels is the same, the superset of all label names is
-// sorted alphanumerically. The first differing label pair found in that order
-// determines the outcome: If the label does not exist at all in m, then m is
-// before o, and vice versa. Otherwise the label value is compared
-// alphanumerically.
-//
-// If m and o are equal, the method returns false.
-func (ls LabelSet) Before(o LabelSet) bool {
- if len(ls) < len(o) {
- return true
- }
- if len(ls) > len(o) {
- return false
- }
-
- lns := make(LabelNames, 0, len(ls)+len(o))
- for ln := range ls {
- lns = append(lns, ln)
- }
- for ln := range o {
- lns = append(lns, ln)
- }
- // It's probably not worth it to de-dup lns.
- sort.Sort(lns)
- for _, ln := range lns {
- mlv, ok := ls[ln]
- if !ok {
- return true
- }
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if mlv < olv {
- return true
- }
- if mlv > olv {
- return false
- }
- }
- return false
-}
-
-func (ls LabelSet) Clone() LabelSet {
- lsn := make(LabelSet, len(ls))
- for ln, lv := range ls {
- lsn[ln] = lv
- }
- return lsn
-}
-
-// Merge is a helper function to non-destructively merge two label sets.
-func (l LabelSet) Merge(other LabelSet) LabelSet {
- result := make(LabelSet, len(l))
-
- for k, v := range l {
- result[k] = v
- }
-
- for k, v := range other {
- result[k] = v
- }
-
- return result
-}
-
-func (l LabelSet) String() string {
- lstrs := make([]string, 0, len(l))
- for l, v := range l {
- lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v))
- }
-
- sort.Strings(lstrs)
- return fmt.Sprintf("{%s}", strings.Join(lstrs, ", "))
-}
-
-// Fingerprint returns the LabelSet's fingerprint.
-func (ls LabelSet) Fingerprint() Fingerprint {
- return labelSetToFingerprint(ls)
-}
-
-// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (ls LabelSet) FastFingerprint() Fingerprint {
- return labelSetToFastFingerprint(ls)
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *LabelSet) UnmarshalJSON(b []byte) error {
- var m map[LabelName]LabelValue
- if err := json.Unmarshal(b, &m); err != nil {
- return err
- }
- // encoding/json only unmarshals maps of the form map[string]T. It treats
- // LabelName as a string and does not call its UnmarshalJSON method.
- // Thus, we have to replicate the behavior here.
- for ln := range m {
- if !LabelNameRE.MatchString(string(ln)) {
- return fmt.Errorf("%q is not a valid label name", ln)
- }
- }
- *l = LabelSet(m)
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/metric.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/metric.go
deleted file mode 100644
index 25fc3c942..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/metric.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "sort"
- "strings"
-)
-
-var separator = []byte{0}
-
-// A Metric is similar to a LabelSet, but the key difference is that a Metric is
-// a singleton and refers to one and only one stream of samples.
-type Metric LabelSet
-
-// Equal compares the metrics.
-func (m Metric) Equal(o Metric) bool {
- return LabelSet(m).Equal(LabelSet(o))
-}
-
-// Before compares the metrics' underlying label sets.
-func (m Metric) Before(o Metric) bool {
- return LabelSet(m).Before(LabelSet(o))
-}
-
-// Clone returns a copy of the Metric.
-func (m Metric) Clone() Metric {
- clone := Metric{}
- for k, v := range m {
- clone[k] = v
- }
- return clone
-}
-
-func (m Metric) String() string {
- metricName, hasName := m[MetricNameLabel]
- numLabels := len(m) - 1
- if !hasName {
- numLabels = len(m)
- }
- labelStrings := make([]string, 0, numLabels)
- for label, value := range m {
- if label != MetricNameLabel {
- labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value))
- }
- }
-
- switch numLabels {
- case 0:
- if hasName {
- return string(metricName)
- }
- return "{}"
- default:
- sort.Strings(labelStrings)
- return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", "))
- }
-}
-
-// Fingerprint returns a Metric's Fingerprint.
-func (m Metric) Fingerprint() Fingerprint {
- return LabelSet(m).Fingerprint()
-}
-
-// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (m Metric) FastFingerprint() Fingerprint {
- return LabelSet(m).FastFingerprint()
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/model.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/model.go
deleted file mode 100644
index 88f013a47..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/model.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package model contains common data structures that are shared across
-// Prometheus componenets and libraries.
-package model
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/signature.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/signature.go
deleted file mode 100644
index 28f370065..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/signature.go
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "bytes"
- "hash"
- "hash/fnv"
- "sort"
- "sync"
-)
-
-// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is
-// used to separate label names, label values, and other strings from each other
-// when calculating their combined hash value (aka signature aka fingerprint).
-const SeparatorByte byte = 255
-
-var (
- // cache the signature of an empty label set.
- emptyLabelSignature = fnv.New64a().Sum64()
-
- hashAndBufPool sync.Pool
-)
-
-type hashAndBuf struct {
- h hash.Hash64
- b bytes.Buffer
-}
-
-func getHashAndBuf() *hashAndBuf {
- hb := hashAndBufPool.Get()
- if hb == nil {
- return &hashAndBuf{h: fnv.New64a()}
- }
- return hb.(*hashAndBuf)
-}
-
-func putHashAndBuf(hb *hashAndBuf) {
- hb.h.Reset()
- hb.b.Reset()
- hashAndBufPool.Put(hb)
-}
-
-// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a
-// given label set. (Collisions are possible but unlikely if the number of label
-// sets the function is applied to is small.)
-func LabelsToSignature(labels map[string]string) uint64 {
- if len(labels) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make([]string, 0, len(labels))
- for labelName := range labels {
- labelNames = append(labelNames, labelName)
- }
- sort.Strings(labelNames)
-
- hb := getHashAndBuf()
- defer putHashAndBuf(hb)
-
- for _, labelName := range labelNames {
- hb.b.WriteString(labelName)
- hb.b.WriteByte(SeparatorByte)
- hb.b.WriteString(labels[labelName])
- hb.b.WriteByte(SeparatorByte)
- hb.h.Write(hb.b.Bytes())
- hb.b.Reset()
- }
- return hb.h.Sum64()
-}
-
-// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as
-// parameter (rather than a label map) and returns a Fingerprint.
-func labelSetToFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- labelNames := make(LabelNames, 0, len(ls))
- for labelName := range ls {
- labelNames = append(labelNames, labelName)
- }
- sort.Sort(labelNames)
-
- hb := getHashAndBuf()
- defer putHashAndBuf(hb)
-
- for _, labelName := range labelNames {
- hb.b.WriteString(string(labelName))
- hb.b.WriteByte(SeparatorByte)
- hb.b.WriteString(string(ls[labelName]))
- hb.b.WriteByte(SeparatorByte)
- hb.h.Write(hb.b.Bytes())
- hb.b.Reset()
- }
- return Fingerprint(hb.h.Sum64())
-}
-
-// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a
-// faster and less allocation-heavy hash function, which is more susceptible to
-// create hash collisions. Therefore, collision detection should be applied.
-func labelSetToFastFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- var result uint64
- hb := getHashAndBuf()
- defer putHashAndBuf(hb)
-
- for labelName, labelValue := range ls {
- hb.b.WriteString(string(labelName))
- hb.b.WriteByte(SeparatorByte)
- hb.b.WriteString(string(labelValue))
- hb.h.Write(hb.b.Bytes())
- result ^= hb.h.Sum64()
- hb.h.Reset()
- hb.b.Reset()
- }
- return Fingerprint(result)
-}
-
-// SignatureForLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and only includes the labels with the
-// specified LabelNames into the signature calculation. The labels passed in
-// will be sorted by this function.
-func SignatureForLabels(m Metric, labels ...LabelName) uint64 {
- if len(m) == 0 || len(labels) == 0 {
- return emptyLabelSignature
- }
-
- sort.Sort(LabelNames(labels))
-
- hb := getHashAndBuf()
- defer putHashAndBuf(hb)
-
- for _, label := range labels {
- hb.b.WriteString(string(label))
- hb.b.WriteByte(SeparatorByte)
- hb.b.WriteString(string(m[label]))
- hb.b.WriteByte(SeparatorByte)
- hb.h.Write(hb.b.Bytes())
- hb.b.Reset()
- }
- return hb.h.Sum64()
-}
-
-// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and excludes the labels with any of the
-// specified LabelNames from the signature calculation.
-func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 {
- if len(m) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make(LabelNames, 0, len(m))
- for labelName := range m {
- if _, exclude := labels[labelName]; !exclude {
- labelNames = append(labelNames, labelName)
- }
- }
- if len(labelNames) == 0 {
- return emptyLabelSignature
- }
- sort.Sort(labelNames)
-
- hb := getHashAndBuf()
- defer putHashAndBuf(hb)
-
- for _, labelName := range labelNames {
- hb.b.WriteString(string(labelName))
- hb.b.WriteByte(SeparatorByte)
- hb.b.WriteString(string(m[labelName]))
- hb.b.WriteByte(SeparatorByte)
- hb.h.Write(hb.b.Bytes())
- hb.b.Reset()
- }
- return hb.h.Sum64()
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/silence.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/silence.go
deleted file mode 100644
index b4b96eae9..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/silence.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "time"
-)
-
-// Matcher describes a matches the value of a given label.
-type Matcher struct {
- Name LabelName `json:"name"`
- Value string `json:"value"`
- IsRegex bool `json:"isRegex"`
-}
-
-func (m *Matcher) UnmarshalJSON(b []byte) error {
- type plain Matcher
- if err := json.Unmarshal(b, (*plain)(m)); err != nil {
- return err
- }
-
- if len(m.Name) == 0 {
- return fmt.Errorf("label name in matcher must not be empty")
- }
- if m.IsRegex {
- if _, err := regexp.Compile(m.Value); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Silence defines the representation of a silence definiton
-// in the Prometheus eco-system.
-type Silence struct {
- ID uint64 `json:"id,omitempty"`
-
- Matchers []*Matcher `json:"matchers"`
-
- StartsAt time.Time `json:"startsAt"`
- EndsAt time.Time `json:"endsAt"`
-
- CreatedAt time.Time `json:"createdAt,omitempty"`
- CreatedBy string `json:"createdBy"`
- Comment string `json:"comment,omitempty"`
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/time.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/time.go
deleted file mode 100644
index ebc8bf6cc..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/time.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "math"
- "regexp"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- // MinimumTick is the minimum supported time resolution. This has to be
- // at least time.Second in order for the code below to work.
- minimumTick = time.Millisecond
- // second is the Time duration equivalent to one second.
- second = int64(time.Second / minimumTick)
- // The number of nanoseconds per minimum tick.
- nanosPerTick = int64(minimumTick / time.Nanosecond)
-
- // Earliest is the earliest Time representable. Handy for
- // initializing a high watermark.
- Earliest = Time(math.MinInt64)
- // Latest is the latest Time representable. Handy for initializing
- // a low watermark.
- Latest = Time(math.MaxInt64)
-)
-
-// Time is the number of milliseconds since the epoch
-// (1970-01-01 00:00 UTC) excluding leap seconds.
-type Time int64
-
-// Interval describes and interval between two timestamps.
-type Interval struct {
- Start, End Time
-}
-
-// Now returns the current time as a Time.
-func Now() Time {
- return TimeFromUnixNano(time.Now().UnixNano())
-}
-
-// TimeFromUnix returns the Time equivalent to the Unix Time t
-// provided in seconds.
-func TimeFromUnix(t int64) Time {
- return Time(t * second)
-}
-
-// TimeFromUnixNano returns the Time equivalent to the Unix Time
-// t provided in nanoseconds.
-func TimeFromUnixNano(t int64) Time {
- return Time(t / nanosPerTick)
-}
-
-// Equal reports whether two Times represent the same instant.
-func (t Time) Equal(o Time) bool {
- return t == o
-}
-
-// Before reports whether the Time t is before o.
-func (t Time) Before(o Time) bool {
- return t < o
-}
-
-// After reports whether the Time t is after o.
-func (t Time) After(o Time) bool {
- return t > o
-}
-
-// Add returns the Time t + d.
-func (t Time) Add(d time.Duration) Time {
- return t + Time(d/minimumTick)
-}
-
-// Sub returns the Duration t - o.
-func (t Time) Sub(o Time) time.Duration {
- return time.Duration(t-o) * minimumTick
-}
-
-// Time returns the time.Time representation of t.
-func (t Time) Time() time.Time {
- return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick)
-}
-
-// Unix returns t as a Unix time, the number of seconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) Unix() int64 {
- return int64(t) / second
-}
-
-// UnixNano returns t as a Unix time, the number of nanoseconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) UnixNano() int64 {
- return int64(t) * nanosPerTick
-}
-
-// The number of digits after the dot.
-var dotPrecision = int(math.Log10(float64(second)))
-
-// String returns a string representation of the Time.
-func (t Time) String() string {
- return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64)
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (t Time) MarshalJSON() ([]byte, error) {
- return []byte(t.String()), nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (t *Time) UnmarshalJSON(b []byte) error {
- p := strings.Split(string(b), ".")
- switch len(p) {
- case 1:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- *t = Time(v * second)
-
- case 2:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- v *= second
-
- prec := dotPrecision - len(p[1])
- if prec < 0 {
- p[1] = p[1][:dotPrecision]
- } else if prec > 0 {
- p[1] = p[1] + strings.Repeat("0", prec)
- }
-
- va, err := strconv.ParseInt(p[1], 10, 32)
- if err != nil {
- return err
- }
-
- *t = Time(v + va)
-
- default:
- return fmt.Errorf("invalid time %q", string(b))
- }
- return nil
-}
-
-// Duration wraps time.Duration. It is used to parse the custom duration format
-// from YAML.
-// This type should not propagate beyond the scope of input/output processing.
-type Duration time.Duration
-
-// StringToDuration parses a string into a time.Duration, assuming that a year
-// a day always has 24h.
-func ParseDuration(durationStr string) (Duration, error) {
- matches := durationRE.FindStringSubmatch(durationStr)
- if len(matches) != 3 {
- return 0, fmt.Errorf("not a valid duration string: %q", durationStr)
- }
- durSeconds, _ := strconv.Atoi(matches[1])
- dur := time.Duration(durSeconds) * time.Second
- unit := matches[2]
- switch unit {
- case "d":
- dur *= 60 * 60 * 24
- case "h":
- dur *= 60 * 60
- case "m":
- dur *= 60
- case "s":
- dur *= 1
- default:
- return 0, fmt.Errorf("invalid time unit in duration string: %q", unit)
- }
- return Duration(dur), nil
-}
-
-var durationRE = regexp.MustCompile("^([0-9]+)([ywdhms]+)$")
-
-func (d Duration) String() string {
- seconds := int64(time.Duration(d) / time.Second)
- factors := map[string]int64{
- "d": 60 * 60 * 24,
- "h": 60 * 60,
- "m": 60,
- "s": 1,
- }
- unit := "s"
- switch int64(0) {
- case seconds % factors["d"]:
- unit = "d"
- case seconds % factors["h"]:
- unit = "h"
- case seconds % factors["m"]:
- unit = "m"
- }
- return fmt.Sprintf("%v%v", seconds/factors[unit], unit)
-}
-
-// MarshalYAML implements the yaml.Marshaler interface.
-func (d Duration) MarshalYAML() (interface{}, error) {
- return d.String(), nil
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- dur, err := ParseDuration(s)
- if err != nil {
- return err
- }
- *d = dur
- return nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/common/model/value.go b/archived/event-adapter/vendor/github.com/prometheus/common/model/value.go
deleted file mode 100644
index 10ffb0bd6..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/common/model/value.go
+++ /dev/null
@@ -1,395 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "sort"
- "strconv"
- "strings"
-)
-
-// A SampleValue is a representation of a value for a given sample at a given
-// time.
-type SampleValue float64
-
-// MarshalJSON implements json.Marshaler.
-func (v SampleValue) MarshalJSON() ([]byte, error) {
- return json.Marshal(v.String())
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (v *SampleValue) UnmarshalJSON(b []byte) error {
- if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
- return fmt.Errorf("sample value must be a quoted string")
- }
- f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64)
- if err != nil {
- return err
- }
- *v = SampleValue(f)
- return nil
-}
-
-func (v SampleValue) Equal(o SampleValue) bool {
- return v == o
-}
-
-func (v SampleValue) String() string {
- return strconv.FormatFloat(float64(v), 'f', -1, 64)
-}
-
-// SamplePair pairs a SampleValue with a Timestamp.
-type SamplePair struct {
- Timestamp Time
- Value SampleValue
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s SamplePair) MarshalJSON() ([]byte, error) {
- t, err := json.Marshal(s.Timestamp)
- if err != nil {
- return nil, err
- }
- v, err := json.Marshal(s.Value)
- if err != nil {
- return nil, err
- }
- return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *SamplePair) UnmarshalJSON(b []byte) error {
- v := [...]json.Unmarshaler{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Equal returns true if this SamplePair and o have equal Values and equal
-// Timestamps.
-func (s *SamplePair) Equal(o *SamplePair) bool {
- return s == o || (s.Value == o.Value && s.Timestamp.Equal(o.Timestamp))
-}
-
-func (s SamplePair) String() string {
- return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp)
-}
-
-// Sample is a sample pair associated with a metric.
-type Sample struct {
- Metric Metric `json:"metric"`
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-// Equal compares first the metrics, then the timestamp, then the value.
-func (s *Sample) Equal(o *Sample) bool {
- if s == o {
- return true
- }
-
- if !s.Metric.Equal(o.Metric) {
- return false
- }
- if !s.Timestamp.Equal(o.Timestamp) {
- return false
- }
- if s.Value != o.Value {
- return false
- }
-
- return true
-}
-
-func (s Sample) String() string {
- return fmt.Sprintf("%s => %s", s.Metric, SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- })
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Sample) MarshalJSON() ([]byte, error) {
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- }
-
- return json.Marshal(&v)
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Sample) UnmarshalJSON(b []byte) error {
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- }
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- s.Metric = v.Metric
- s.Timestamp = v.Value.Timestamp
- s.Value = v.Value.Value
-
- return nil
-}
-
-// Samples is a sortable Sample slice. It implements sort.Interface.
-type Samples []*Sample
-
-func (s Samples) Len() int {
- return len(s)
-}
-
-// Less compares first the metrics, then the timestamp.
-func (s Samples) Less(i, j int) bool {
- switch {
- case s[i].Metric.Before(s[j].Metric):
- return true
- case s[j].Metric.Before(s[i].Metric):
- return false
- case s[i].Timestamp.Before(s[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-func (s Samples) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (s Samples) Equal(o Samples) bool {
- if len(s) != len(o) {
- return false
- }
-
- for i, sample := range s {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// SampleStream is a stream of Values belonging to an attached COWMetric.
-type SampleStream struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
-}
-
-func (ss SampleStream) String() string {
- vals := make([]string, len(ss.Values))
- for i, v := range ss.Values {
- vals[i] = v.String()
- }
- return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n"))
-}
-
-// Value is a generic interface for values resulting from a query evaluation.
-type Value interface {
- Type() ValueType
- String() string
-}
-
-func (Matrix) Type() ValueType { return ValMatrix }
-func (Vector) Type() ValueType { return ValVector }
-func (*Scalar) Type() ValueType { return ValScalar }
-func (*String) Type() ValueType { return ValString }
-
-type ValueType int
-
-const (
- ValNone ValueType = iota
- ValScalar
- ValVector
- ValMatrix
- ValString
-)
-
-// MarshalJSON implements json.Marshaler.
-func (et ValueType) MarshalJSON() ([]byte, error) {
- return json.Marshal(et.String())
-}
-
-func (et *ValueType) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- switch s {
- case "":
- *et = ValNone
- case "scalar":
- *et = ValScalar
- case "vector":
- *et = ValVector
- case "matrix":
- *et = ValMatrix
- case "string":
- *et = ValString
- default:
- return fmt.Errorf("unknown value type %q", s)
- }
- return nil
-}
-
-func (e ValueType) String() string {
- switch e {
- case ValNone:
- return ""
- case ValScalar:
- return "scalar"
- case ValVector:
- return "vector"
- case ValMatrix:
- return "matrix"
- case ValString:
- return "string"
- }
- panic("ValueType.String: unhandled value type")
-}
-
-// Scalar is a scalar value evaluated at the set timestamp.
-type Scalar struct {
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s Scalar) String() string {
- return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp)
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Scalar) MarshalJSON() ([]byte, error) {
- v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64)
- return json.Marshal([...]interface{}{s.Timestamp, string(v)})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Scalar) UnmarshalJSON(b []byte) error {
- var f string
- v := [...]interface{}{&s.Timestamp, &f}
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- value, err := strconv.ParseFloat(f, 64)
- if err != nil {
- return fmt.Errorf("error parsing sample value: %s", err)
- }
- s.Value = SampleValue(value)
- return nil
-}
-
-// String is a string value evaluated at the set timestamp.
-type String struct {
- Value string `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s *String) String() string {
- return s.Value
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s String) MarshalJSON() ([]byte, error) {
- return json.Marshal([]interface{}{s.Timestamp, s.Value})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *String) UnmarshalJSON(b []byte) error {
- v := [...]interface{}{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Vector is basically only an alias for Samples, but the
-// contract is that in a Vector, all Samples have the same timestamp.
-type Vector []*Sample
-
-func (vec Vector) String() string {
- entries := make([]string, len(vec))
- for i, s := range vec {
- entries[i] = s.String()
- }
- return strings.Join(entries, "\n")
-}
-
-func (vec Vector) Len() int { return len(vec) }
-func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] }
-
-// Less compares first the metrics, then the timestamp.
-func (vec Vector) Less(i, j int) bool {
- switch {
- case vec[i].Metric.Before(vec[j].Metric):
- return true
- case vec[j].Metric.Before(vec[i].Metric):
- return false
- case vec[i].Timestamp.Before(vec[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (vec Vector) Equal(o Vector) bool {
- if len(vec) != len(o) {
- return false
- }
-
- for i, sample := range vec {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// Matrix is a list of time series.
-type Matrix []*SampleStream
-
-func (m Matrix) Len() int { return len(m) }
-func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) }
-func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] }
-
-func (mat Matrix) String() string {
- matCp := make(Matrix, len(mat))
- copy(matCp, mat)
- sort.Sort(matCp)
-
- strs := make([]string, len(matCp))
-
- for i, ss := range matCp {
- strs[i] = ss.String()
- }
-
- return strings.Join(strs, "\n")
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/.travis.yml b/archived/event-adapter/vendor/github.com/prometheus/procfs/.travis.yml
deleted file mode 100644
index 25e169dd0..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.3
- - 1.4
- - 1.5
- - tip
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/AUTHORS.md b/archived/event-adapter/vendor/github.com/prometheus/procfs/AUTHORS.md
deleted file mode 100644
index f1c27ccb0..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/AUTHORS.md
+++ /dev/null
@@ -1,20 +0,0 @@
-The Prometheus project was started by Matt T. Proud (emeritus) and
-Julius Volz in 2012.
-
-Maintainers of this repository:
-
-* Tobias Schmidt
-
-The following individuals have contributed code to this repository
-(listed in alphabetical order):
-
-* Armen Baghumian
-* Bjoern Rabenstein
-* David Cournapeau
-* Ji-Hoon, Seol
-* Jonas Große Sundrup
-* Julius Volz
-* Matthias Rampke
-* Nicky Gerritsen
-* Rémi Audebert
-* Tobias Schmidt
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/archived/event-adapter/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
deleted file mode 100644
index 5705f0fbe..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Contributing
-
-Prometheus uses GitHub to manage reviews of pull requests.
-
-* If you have a trivial fix or improvement, go ahead and create a pull
- request, addressing (with `@...`) one or more of the maintainers
- (see [AUTHORS.md](AUTHORS.md)) in the description of the pull request.
-
-* If you plan to do something more involved, first discuss your ideas
- on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
- This will avoid unnecessary work and surely give you and us a good deal
- of inspiration.
-
-* Relevant coding style guidelines are the [Go Code Review
- Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
- and the _Formatting and style_ section of Peter Bourgon's [Go: Best
- Practices for Production
- Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/LICENSE b/archived/event-adapter/vendor/github.com/prometheus/procfs/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/Makefile b/archived/event-adapter/vendor/github.com/prometheus/procfs/Makefile
deleted file mode 100644
index e8acbbc5e..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-ci:
- go fmt
- go vet
- go test -v ./...
- go get github.com/golang/lint/golint
- golint *.go
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/NOTICE b/archived/event-adapter/vendor/github.com/prometheus/procfs/NOTICE
deleted file mode 100644
index 53c5e9aa1..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-procfs provides functions to retrieve system, kernel and process
-metrics from the pseudo-filesystem proc.
-
-Copyright 2014-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/README.md b/archived/event-adapter/vendor/github.com/prometheus/procfs/README.md
deleted file mode 100644
index 6e7ee6b8b..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# procfs
-
-This procfs package provides functions to retrieve system, kernel and process
-metrics from the pseudo-filesystem proc.
-
-*WARNING*: This package is a work in progress. Its API may still break in
-backwards-incompatible ways without warnings. Use it at your own risk.
-
-[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs)
-[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs)
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/doc.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/doc.go
deleted file mode 100644
index e2acd6d40..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/doc.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package procfs provides functions to retrieve system, kernel and process
-// metrics from the pseudo-filesystem proc.
-//
-// Example:
-//
-// package main
-//
-// import (
-// "fmt"
-// "log"
-//
-// "github.com/prometheus/procfs"
-// )
-//
-// func main() {
-// p, err := procfs.Self()
-// if err != nil {
-// log.Fatalf("could not get process: %s", err)
-// }
-//
-// stat, err := p.NewStat()
-// if err != nil {
-// log.Fatalf("could not get process stat: %s", err)
-// }
-//
-// fmt.Printf("command: %s\n", stat.Comm)
-// fmt.Printf("cpu time: %fs\n", stat.CPUTime())
-// fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
-// fmt.Printf("rss: %dB\n", stat.ResidentMemory())
-// }
-//
-package procfs
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/fs.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/fs.go
deleted file mode 100644
index 6a8d97b11..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/fs.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package procfs
-
-import (
- "fmt"
- "os"
- "path"
-)
-
-// FS represents the pseudo-filesystem proc, which provides an interface to
-// kernel data structures.
-type FS string
-
-// DefaultMountPoint is the common mount point of the proc filesystem.
-const DefaultMountPoint = "/proc"
-
-// NewFS returns a new FS mounted under the given mountPoint. It will error
-// if the mount point can't be read.
-func NewFS(mountPoint string) (FS, error) {
- info, err := os.Stat(mountPoint)
- if err != nil {
- return "", fmt.Errorf("could not read %s: %s", mountPoint, err)
- }
- if !info.IsDir() {
- return "", fmt.Errorf("mount point %s is not a directory", mountPoint)
- }
-
- return FS(mountPoint), nil
-}
-
-func (fs FS) stat(p string) (os.FileInfo, error) {
- return os.Stat(path.Join(string(fs), p))
-}
-
-func (fs FS) open(p string) (*os.File, error) {
- return os.Open(path.Join(string(fs), p))
-}
-
-func (fs FS) readlink(p string) (string, error) {
- return os.Readlink(path.Join(string(fs), p))
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/ipvs.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/ipvs.go
deleted file mode 100644
index 26da5000e..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/ipvs.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package procfs
-
-import (
- "bufio"
- "encoding/hex"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net"
- "strconv"
- "strings"
-)
-
-// IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.
-type IPVSStats struct {
- // Total count of connections.
- Connections uint64
- // Total incoming packages processed.
- IncomingPackets uint64
- // Total outgoing packages processed.
- OutgoingPackets uint64
- // Total incoming traffic.
- IncomingBytes uint64
- // Total outgoing traffic.
- OutgoingBytes uint64
-}
-
-// IPVSBackendStatus holds current metrics of one virtual / real address pair.
-type IPVSBackendStatus struct {
- // The local (virtual) IP address.
- LocalAddress net.IP
- // The local (virtual) port.
- LocalPort uint16
- // The transport protocol (TCP, UDP).
- Proto string
- // The remote (real) IP address.
- RemoteAddress net.IP
- // The remote (real) port.
- RemotePort uint16
- // The current number of active connections for this virtual/real address pair.
- ActiveConn uint64
- // The current number of inactive connections for this virtual/real address pair.
- InactConn uint64
- // The current weight of this virtual/real address pair.
- Weight uint64
-}
-
-// NewIPVSStats reads the IPVS statistics.
-func NewIPVSStats() (IPVSStats, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return IPVSStats{}, err
- }
-
- return fs.NewIPVSStats()
-}
-
-// NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem.
-func (fs FS) NewIPVSStats() (IPVSStats, error) {
- file, err := fs.open("net/ip_vs_stats")
- if err != nil {
- return IPVSStats{}, err
- }
- defer file.Close()
-
- return parseIPVSStats(file)
-}
-
-// parseIPVSStats performs the actual parsing of `ip_vs_stats`.
-func parseIPVSStats(file io.Reader) (IPVSStats, error) {
- var (
- statContent []byte
- statLines []string
- statFields []string
- stats IPVSStats
- )
-
- statContent, err := ioutil.ReadAll(file)
- if err != nil {
- return IPVSStats{}, err
- }
-
- statLines = strings.SplitN(string(statContent), "\n", 4)
- if len(statLines) != 4 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: too short")
- }
-
- statFields = strings.Fields(statLines[2])
- if len(statFields) != 5 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: unexpected number of fields")
- }
-
- stats.Connections, err = strconv.ParseUint(statFields[0], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingPackets, err = strconv.ParseUint(statFields[1], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingPackets, err = strconv.ParseUint(statFields[2], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingBytes, err = strconv.ParseUint(statFields[3], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingBytes, err = strconv.ParseUint(statFields[4], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
-
- return stats, nil
-}
-
-// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs.
-func NewIPVSBackendStatus() ([]IPVSBackendStatus, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return []IPVSBackendStatus{}, err
- }
-
- return fs.NewIPVSBackendStatus()
-}
-
-// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.
-func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error) {
- file, err := fs.open("net/ip_vs")
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- return parseIPVSBackendStatus(file)
-}
-
-func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
- var (
- status []IPVSBackendStatus
- scanner = bufio.NewScanner(file)
- proto string
- localAddress net.IP
- localPort uint16
- err error
- )
-
- for scanner.Scan() {
- fields := strings.Fields(string(scanner.Text()))
- if len(fields) == 0 {
- continue
- }
- switch {
- case fields[0] == "IP" || fields[0] == "Prot" || fields[1] == "RemoteAddress:Port":
- continue
- case fields[0] == "TCP" || fields[0] == "UDP":
- if len(fields) < 2 {
- continue
- }
- proto = fields[0]
- localAddress, localPort, err = parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- case fields[0] == "->":
- if len(fields) < 6 {
- continue
- }
- remoteAddress, remotePort, err := parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- weight, err := strconv.ParseUint(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- activeConn, err := strconv.ParseUint(fields[4], 10, 64)
- if err != nil {
- return nil, err
- }
- inactConn, err := strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- status = append(status, IPVSBackendStatus{
- LocalAddress: localAddress,
- LocalPort: localPort,
- RemoteAddress: remoteAddress,
- RemotePort: remotePort,
- Proto: proto,
- Weight: weight,
- ActiveConn: activeConn,
- InactConn: inactConn,
- })
- }
- }
- return status, nil
-}
-
-func parseIPPort(s string) (net.IP, uint16, error) {
- tmp := strings.SplitN(s, ":", 2)
-
- if len(tmp) != 2 {
- return nil, 0, fmt.Errorf("invalid IP:Port: %s", s)
- }
-
- if len(tmp[0]) != 8 && len(tmp[0]) != 32 {
- return nil, 0, fmt.Errorf("invalid IP: %s", tmp[0])
- }
-
- ip, err := hex.DecodeString(tmp[0])
- if err != nil {
- return nil, 0, err
- }
-
- port, err := strconv.ParseUint(tmp[1], 16, 16)
- if err != nil {
- return nil, 0, err
- }
-
- return ip, uint16(port), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/mdstat.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/mdstat.go
deleted file mode 100644
index 09ed6b5eb..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/mdstat.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "path"
- "regexp"
- "strconv"
- "strings"
-)
-
-var (
- statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
- buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
-)
-
-// MDStat holds info parsed from /proc/mdstat.
-type MDStat struct {
- // Name of the device.
- Name string
- // activity-state of the device.
- ActivityState string
- // Number of active disks.
- DisksActive int64
- // Total number of disks the device consists of.
- DisksTotal int64
- // Number of blocks the device holds.
- BlocksTotal int64
- // Number of blocks on the device that are in sync.
- BlocksSynced int64
-}
-
-// ParseMDStat parses an mdstat-file and returns a struct with the relevant infos.
-func (fs FS) ParseMDStat() (mdstates []MDStat, err error) {
- mdStatusFilePath := path.Join(string(fs), "mdstat")
- content, err := ioutil.ReadFile(mdStatusFilePath)
- if err != nil {
- return []MDStat{}, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err)
- }
-
- mdStatusFile := string(content)
-
- lines := strings.Split(mdStatusFile, "\n")
- var currentMD string
-
- // Each md has at least the deviceline, statusline and one empty line afterwards
- // so we will have probably something of the order len(lines)/3 devices
- // so we use that for preallocation.
- estimateMDs := len(lines) / 3
- mdStates := make([]MDStat, 0, estimateMDs)
-
- for i, l := range lines {
- if l == "" {
- // Skip entirely empty lines.
- continue
- }
-
- if l[0] == ' ' {
- // Those lines are not the beginning of a md-section.
- continue
- }
-
- if strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") {
- // We aren't interested in lines with general info.
- continue
- }
-
- mainLine := strings.Split(l, " ")
- if len(mainLine) < 3 {
- return mdStates, fmt.Errorf("error parsing mdline: %s", l)
- }
- currentMD = mainLine[0] // name of md-device
- activityState := mainLine[2] // activity status of said md-device
-
- if len(lines) <= i+3 {
- return mdStates, fmt.Errorf("error parsing %s: entry for %s has fewer lines than expected", mdStatusFilePath, currentMD)
- }
-
- active, total, size, err := evalStatusline(lines[i+1]) // parse statusline, always present
- if err != nil {
- return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err)
- }
-
- //
- // Now get the number of synced blocks.
- //
-
- // Get the line number of the syncing-line.
- var j int
- if strings.Contains(lines[i+2], "bitmap") { // then skip the bitmap line
- j = i + 3
- } else {
- j = i + 2
- }
-
- // If device is syncing at the moment, get the number of currently synced bytes,
- // otherwise that number equals the size of the device.
- syncedBlocks := size
- if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") {
- syncedBlocks, err = evalBuildline(lines[j])
- if err != nil {
- return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err)
- }
- }
-
- mdStates = append(mdStates, MDStat{currentMD, activityState, active, total, size, syncedBlocks})
-
- }
-
- return mdStates, nil
-}
-
-func evalStatusline(statusline string) (active, total, size int64, err error) {
- matches := statuslineRE.FindStringSubmatch(statusline)
-
- // +1 to make it more obvious that the whole string containing the info is also returned as matches[0].
- if len(matches) != 3+1 {
- return 0, 0, 0, fmt.Errorf("unexpected number matches found in statusline: %s", statusline)
- }
-
- size, err = strconv.ParseInt(matches[1], 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("%s in statusline: %s", err, statusline)
- }
-
- total, err = strconv.ParseInt(matches[2], 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("%s in statusline: %s", err, statusline)
- }
-
- active, err = strconv.ParseInt(matches[3], 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("%s in statusline: %s", err, statusline)
- }
-
- return active, total, size, nil
-}
-
-// Gets the size that has already been synced out of the sync-line.
-func evalBuildline(buildline string) (int64, error) {
- matches := buildlineRE.FindStringSubmatch(buildline)
-
- // +1 to make it more obvious that the whole string containing the info is also returned as matches[0].
- if len(matches) < 1+1 {
- return 0, fmt.Errorf("too few matches found in buildline: %s", buildline)
- }
-
- if len(matches) > 1+1 {
- return 0, fmt.Errorf("too many matches found in buildline: %s", buildline)
- }
-
- syncedSize, err := strconv.ParseInt(matches[1], 10, 64)
- if err != nil {
- return 0, fmt.Errorf("%s in buildline: %s", err, buildline)
- }
-
- return syncedSize, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/proc.go
deleted file mode 100644
index efc850278..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "path"
- "strconv"
- "strings"
-)
-
-// Proc provides information about a running process.
-type Proc struct {
- // The process ID.
- PID int
-
- fs FS
-}
-
-// Procs represents a list of Proc structs.
-type Procs []Proc
-
-func (p Procs) Len() int { return len(p) }
-func (p Procs) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID }
-
-// Self returns a process for the current process read via /proc/self.
-func Self() (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Proc{}, err
- }
- return fs.Self()
-}
-
-// NewProc returns a process for the given pid under /proc.
-func NewProc(pid int) (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Proc{}, err
- }
- return fs.NewProc(pid)
-}
-
-// AllProcs returns a list of all currently avaible processes under /proc.
-func AllProcs() (Procs, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Procs{}, err
- }
- return fs.AllProcs()
-}
-
-// Self returns a process for the current process.
-func (fs FS) Self() (Proc, error) {
- p, err := fs.readlink("self")
- if err != nil {
- return Proc{}, err
- }
- pid, err := strconv.Atoi(strings.Replace(p, string(fs), "", -1))
- if err != nil {
- return Proc{}, err
- }
- return fs.NewProc(pid)
-}
-
-// NewProc returns a process for the given pid.
-func (fs FS) NewProc(pid int) (Proc, error) {
- if _, err := fs.stat(strconv.Itoa(pid)); err != nil {
- return Proc{}, err
- }
- return Proc{PID: pid, fs: fs}, nil
-}
-
-// AllProcs returns a list of all currently avaible processes.
-func (fs FS) AllProcs() (Procs, error) {
- d, err := fs.open("")
- if err != nil {
- return Procs{}, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return Procs{}, fmt.Errorf("could not read %s: %s", d.Name(), err)
- }
-
- p := Procs{}
- for _, n := range names {
- pid, err := strconv.ParseInt(n, 10, 64)
- if err != nil {
- continue
- }
- p = append(p, Proc{PID: int(pid), fs: fs})
- }
-
- return p, nil
-}
-
-// CmdLine returns the command line of a process.
-func (p Proc) CmdLine() ([]string, error) {
- f, err := p.open("cmdline")
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- data, err := ioutil.ReadAll(f)
- if err != nil {
- return nil, err
- }
-
- if len(data) < 1 {
- return []string{}, nil
- }
-
- return strings.Split(string(data[:len(data)-1]), string(byte(0))), nil
-}
-
-// Executable returns the absolute path of the executable command of a process.
-func (p Proc) Executable() (string, error) {
- exe, err := p.readlink("exe")
-
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return exe, err
-}
-
-// FileDescriptors returns the currently open file descriptors of a process.
-func (p Proc) FileDescriptors() ([]uintptr, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- fds := make([]uintptr, len(names))
- for i, n := range names {
- fd, err := strconv.ParseInt(n, 10, 32)
- if err != nil {
- return nil, fmt.Errorf("could not parse fd %s: %s", n, err)
- }
- fds[i] = uintptr(fd)
- }
-
- return fds, nil
-}
-
-// FileDescriptorTargets returns the targets of all file descriptors of a process.
-// If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.
-func (p Proc) FileDescriptorTargets() ([]string, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- targets := make([]string, len(names))
-
- for i, name := range names {
- target, err := p.readlink("fd/" + name)
- if err == nil {
- targets[i] = target
- }
- }
-
- return targets, nil
-}
-
-// FileDescriptorsLen returns the number of currently open file descriptors of
-// a process.
-func (p Proc) FileDescriptorsLen() (int, error) {
- fds, err := p.fileDescriptors()
- if err != nil {
- return 0, err
- }
-
- return len(fds), nil
-}
-
-func (p Proc) fileDescriptors() ([]string, error) {
- d, err := p.open("fd")
- if err != nil {
- return nil, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return nil, fmt.Errorf("could not read %s: %s", d.Name(), err)
- }
-
- return names, nil
-}
-
-func (p Proc) open(pa string) (*os.File, error) {
- return p.fs.open(path.Join(strconv.Itoa(p.PID), pa))
-}
-
-func (p Proc) readlink(pa string) (string, error) {
- return p.fs.readlink(path.Join(strconv.Itoa(p.PID), pa))
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_io.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_io.go
deleted file mode 100644
index 7c6dc8697..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_io.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
-)
-
-// ProcIO models the content of /proc//io.
-type ProcIO struct {
- // Chars read.
- RChar uint64
- // Chars written.
- WChar uint64
- // Read syscalls.
- SyscR uint64
- // Write syscalls.
- SyscW uint64
- // Bytes read.
- ReadBytes uint64
- // Bytes written.
- WriteBytes uint64
- // Bytes written, but taking into account truncation. See
- // Documentation/filesystems/proc.txt in the kernel sources for
- // detailed explanation.
- CancelledWriteBytes int64
-}
-
-// NewIO creates a new ProcIO instance from a given Proc instance.
-func (p Proc) NewIO() (ProcIO, error) {
- pio := ProcIO{}
-
- f, err := p.open("io")
- if err != nil {
- return pio, err
- }
- defer f.Close()
-
- data, err := ioutil.ReadAll(f)
- if err != nil {
- return pio, err
- }
-
- ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" +
- "read_bytes: %d\nwrite_bytes: %d\n" +
- "cancelled_write_bytes: %d\n"
-
- _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR,
- &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes)
- if err != nil {
- return pio, err
- }
-
- return pio, nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_limits.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_limits.go
deleted file mode 100644
index 9f080b9f6..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_limits.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package procfs
-
-import (
- "bufio"
- "fmt"
- "regexp"
- "strconv"
-)
-
-// ProcLimits represents the soft limits for each of the process's resource
-// limits.
-type ProcLimits struct {
- CPUTime int
- FileSize int
- DataSize int
- StackSize int
- CoreFileSize int
- ResidentSet int
- Processes int
- OpenFiles int
- LockedMemory int
- AddressSpace int
- FileLocks int
- PendingSignals int
- MsqqueueSize int
- NicePriority int
- RealtimePriority int
- RealtimeTimeout int
-}
-
-const (
- limitsFields = 3
- limitsUnlimited = "unlimited"
-)
-
-var (
- limitsDelimiter = regexp.MustCompile(" +")
-)
-
-// NewLimits returns the current soft limits of the process.
-func (p Proc) NewLimits() (ProcLimits, error) {
- f, err := p.open("limits")
- if err != nil {
- return ProcLimits{}, err
- }
- defer f.Close()
-
- var (
- l = ProcLimits{}
- s = bufio.NewScanner(f)
- )
- for s.Scan() {
- fields := limitsDelimiter.Split(s.Text(), limitsFields)
- if len(fields) != limitsFields {
- return ProcLimits{}, fmt.Errorf(
- "couldn't parse %s line %s", f.Name(), s.Text())
- }
-
- switch fields[0] {
- case "Max cpu time":
- l.CPUTime, err = parseInt(fields[1])
- case "Max file size":
- l.FileLocks, err = parseInt(fields[1])
- case "Max data size":
- l.DataSize, err = parseInt(fields[1])
- case "Max stack size":
- l.StackSize, err = parseInt(fields[1])
- case "Max core file size":
- l.CoreFileSize, err = parseInt(fields[1])
- case "Max resident set":
- l.ResidentSet, err = parseInt(fields[1])
- case "Max processes":
- l.Processes, err = parseInt(fields[1])
- case "Max open files":
- l.OpenFiles, err = parseInt(fields[1])
- case "Max locked memory":
- l.LockedMemory, err = parseInt(fields[1])
- case "Max address space":
- l.AddressSpace, err = parseInt(fields[1])
- case "Max file locks":
- l.FileLocks, err = parseInt(fields[1])
- case "Max pending signals":
- l.PendingSignals, err = parseInt(fields[1])
- case "Max msgqueue size":
- l.MsqqueueSize, err = parseInt(fields[1])
- case "Max nice priority":
- l.NicePriority, err = parseInt(fields[1])
- case "Max realtime priority":
- l.RealtimePriority, err = parseInt(fields[1])
- case "Max realtime timeout":
- l.RealtimeTimeout, err = parseInt(fields[1])
- }
-
- if err != nil {
- return ProcLimits{}, err
- }
- }
-
- return l, s.Err()
-}
-
-func parseInt(s string) (int, error) {
- if s == limitsUnlimited {
- return -1, nil
- }
- i, err := strconv.ParseInt(s, 10, 32)
- if err != nil {
- return 0, fmt.Errorf("couldn't parse value %s: %s", s, err)
- }
- return int(i), nil
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_stat.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_stat.go
deleted file mode 100644
index 30a403b6c..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/proc_stat.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package procfs
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
-)
-
-// Originally, this USER_HZ value was dynamically retrieved via a sysconf call which
-// required cgo. However, that caused a lot of problems regarding
-// cross-compilation. Alternatives such as running a binary to determine the
-// value, or trying to derive it in some other way were all problematic.
-// After much research it was determined that USER_HZ is actually hardcoded to
-// 100 on all Go-supported platforms as of the time of this writing. This is
-// why we decided to hardcode it here as well. It is not impossible that there
-// could be systems with exceptions, but they should be very exotic edge cases,
-// and in that case, the worst outcome will be two misreported metrics.
-//
-// See also the following discussions:
-//
-// - https://github.com/prometheus/node_exporter/issues/52
-// - https://github.com/prometheus/procfs/pull/2
-// - http://stackoverflow.com/questions/17410841/how-does-user-hz-solve-the-jiffy-scaling-issue
-const userHZ = 100
-
-// ProcStat provides status information about the process,
-// read from /proc/[pid]/stat.
-type ProcStat struct {
- // The process ID.
- PID int
- // The filename of the executable.
- Comm string
- // The process state.
- State string
- // The PID of the parent of this process.
- PPID int
- // The process group ID of the process.
- PGRP int
- // The session ID of the process.
- Session int
- // The controlling terminal of the process.
- TTY int
- // The ID of the foreground process group of the controlling terminal of
- // the process.
- TPGID int
- // The kernel flags word of the process.
- Flags uint
- // The number of minor faults the process has made which have not required
- // loading a memory page from disk.
- MinFlt uint
- // The number of minor faults that the process's waited-for children have
- // made.
- CMinFlt uint
- // The number of major faults the process has made which have required
- // loading a memory page from disk.
- MajFlt uint
- // The number of major faults that the process's waited-for children have
- // made.
- CMajFlt uint
- // Amount of time that this process has been scheduled in user mode,
- // measured in clock ticks.
- UTime uint
- // Amount of time that this process has been scheduled in kernel mode,
- // measured in clock ticks.
- STime uint
- // Amount of time that this process's waited-for children have been
- // scheduled in user mode, measured in clock ticks.
- CUTime uint
- // Amount of time that this process's waited-for children have been
- // scheduled in kernel mode, measured in clock ticks.
- CSTime uint
- // For processes running a real-time scheduling policy, this is the negated
- // scheduling priority, minus one.
- Priority int
- // The nice value, a value in the range 19 (low priority) to -20 (high
- // priority).
- Nice int
- // Number of threads in this process.
- NumThreads int
- // The time the process started after system boot, the value is expressed
- // in clock ticks.
- Starttime uint64
- // Virtual memory size in bytes.
- VSize int
- // Resident set size in pages.
- RSS int
-
- fs FS
-}
-
-// NewStat returns the current status information of the process.
-func (p Proc) NewStat() (ProcStat, error) {
- f, err := p.open("stat")
- if err != nil {
- return ProcStat{}, err
- }
- defer f.Close()
-
- data, err := ioutil.ReadAll(f)
- if err != nil {
- return ProcStat{}, err
- }
-
- var (
- ignore int
-
- s = ProcStat{PID: p.PID, fs: p.fs}
- l = bytes.Index(data, []byte("("))
- r = bytes.LastIndex(data, []byte(")"))
- )
-
- if l < 0 || r < 0 {
- return ProcStat{}, fmt.Errorf(
- "unexpected format, couldn't extract comm: %s",
- data,
- )
- }
-
- s.Comm = string(data[l+1 : r])
- _, err = fmt.Fscan(
- bytes.NewBuffer(data[r+2:]),
- &s.State,
- &s.PPID,
- &s.PGRP,
- &s.Session,
- &s.TTY,
- &s.TPGID,
- &s.Flags,
- &s.MinFlt,
- &s.CMinFlt,
- &s.MajFlt,
- &s.CMajFlt,
- &s.UTime,
- &s.STime,
- &s.CUTime,
- &s.CSTime,
- &s.Priority,
- &s.Nice,
- &s.NumThreads,
- &ignore,
- &s.Starttime,
- &s.VSize,
- &s.RSS,
- )
- if err != nil {
- return ProcStat{}, err
- }
-
- return s, nil
-}
-
-// VirtualMemory returns the virtual memory size in bytes.
-func (s ProcStat) VirtualMemory() int {
- return s.VSize
-}
-
-// ResidentMemory returns the resident memory size in bytes.
-func (s ProcStat) ResidentMemory() int {
- return s.RSS * os.Getpagesize()
-}
-
-// StartTime returns the unix timestamp of the process in seconds.
-func (s ProcStat) StartTime() (float64, error) {
- stat, err := s.fs.NewStat()
- if err != nil {
- return 0, err
- }
- return float64(stat.BootTime) + (float64(s.Starttime) / userHZ), nil
-}
-
-// CPUTime returns the total CPU user and system time in seconds.
-func (s ProcStat) CPUTime() float64 {
- return float64(s.UTime+s.STime) / userHZ
-}
diff --git a/archived/event-adapter/vendor/github.com/prometheus/procfs/stat.go b/archived/event-adapter/vendor/github.com/prometheus/procfs/stat.go
deleted file mode 100644
index 26fefb0fa..000000000
--- a/archived/event-adapter/vendor/github.com/prometheus/procfs/stat.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package procfs
-
-import (
- "bufio"
- "fmt"
- "strconv"
- "strings"
-)
-
-// Stat represents kernel/system statistics.
-type Stat struct {
- // Boot time in seconds since the Epoch.
- BootTime int64
-}
-
-// NewStat returns kernel/system statistics read from /proc/stat.
-func NewStat() (Stat, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Stat{}, err
- }
-
- return fs.NewStat()
-}
-
-// NewStat returns an information about current kernel/system statistics.
-func (fs FS) NewStat() (Stat, error) {
- f, err := fs.open("stat")
- if err != nil {
- return Stat{}, err
- }
- defer f.Close()
-
- s := bufio.NewScanner(f)
- for s.Scan() {
- line := s.Text()
- if !strings.HasPrefix(line, "btime") {
- continue
- }
- fields := strings.Fields(line)
- if len(fields) != 2 {
- return Stat{}, fmt.Errorf("couldn't parse %s line %s", f.Name(), line)
- }
- i, err := strconv.ParseInt(fields[1], 10, 32)
- if err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s: %s", fields[1], err)
- }
- return Stat{BootTime: i}, nil
- }
- if err := s.Err(); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s: %s", f.Name(), err)
- }
-
- return Stat{}, fmt.Errorf("couldn't parse %s, missing btime", f.Name())
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/.gitignore b/archived/event-adapter/vendor/github.com/spf13/cobra/.gitignore
deleted file mode 100644
index 1b8c7c261..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/.gitignore
+++ /dev/null
@@ -1,36 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-# Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore
-# swap
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-# session
-Session.vim
-# temporary
-.netrwhist
-*~
-# auto-generated tag files
-tags
-
-*.exe
-
-cobra.test
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/.mailmap b/archived/event-adapter/vendor/github.com/spf13/cobra/.mailmap
deleted file mode 100644
index 94ec53068..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/.mailmap
+++ /dev/null
@@ -1,3 +0,0 @@
-Steve Francia
-Bjørn Erik Pedersen
-Fabiano Franz
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/.travis.yml b/archived/event-adapter/vendor/github.com/spf13/cobra/.travis.yml
deleted file mode 100644
index 6e84be54d..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: go
-go:
- - 1.4.3
- - 1.5.4
- - 1.6.3
- - tip
-
-matrix:
- allow_failures:
- - go: tip
-
-before_install:
- - mkdir -p bin
- - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck
- - chmod +x bin/shellcheck
-script:
- - PATH=$PATH:$PWD/bin go test -v ./...
- - go build
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/LICENSE.txt b/archived/event-adapter/vendor/github.com/spf13/cobra/LICENSE.txt
deleted file mode 100644
index 298f0e266..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/LICENSE.txt
+++ /dev/null
@@ -1,174 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/README.md b/archived/event-adapter/vendor/github.com/spf13/cobra/README.md
deleted file mode 100644
index b338a0e44..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/README.md
+++ /dev/null
@@ -1,898 +0,0 @@
-![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png)
-
-Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.
-
-Many of the most widely used Go projects are built using Cobra including:
-
-* [Kubernetes](http://kubernetes.io/)
-* [Hugo](http://gohugo.io)
-* [rkt](https://github.com/coreos/rkt)
-* [etcd](https://github.com/coreos/etcd)
-* [Docker (distribution)](https://github.com/docker/distribution)
-* [OpenShift](https://www.openshift.com/)
-* [Delve](https://github.com/derekparker/delve)
-* [GopherJS](http://www.gopherjs.org/)
-* [CockroachDB](http://www.cockroachlabs.com/)
-* [Bleve](http://www.blevesearch.com/)
-* [ProjectAtomic (enterprise)](http://www.projectatomic.io/)
-* [Parse (CLI)](https://parse.com/)
-* [GiantSwarm's swarm](https://github.com/giantswarm/cli)
-* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack)
-
-
-[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra)
-[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra)
-[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra)
-
-![cobra](https://cloud.githubusercontent.com/assets/173412/10911369/84832a8e-8212-11e5-9f82-cc96660a4794.gif)
-
-# Overview
-
-Cobra is a library providing a simple interface to create powerful modern CLI
-interfaces similar to git & go tools.
-
-Cobra is also an application that will generate your application scaffolding to rapidly
-develop a Cobra-based application.
-
-Cobra provides:
-* Easy subcommand-based CLIs: `app server`, `app fetch`, etc.
-* Fully POSIX-compliant flags (including short & long versions)
-* Nested subcommands
-* Global, local and cascading flags
-* Easy generation of applications & commands with `cobra create appname` & `cobra add cmdname`
-* Intelligent suggestions (`app srver`... did you mean `app server`?)
-* Automatic help generation for commands and flags
-* Automatic detailed help for `app help [command]`
-* Automatic help flag recognition of `-h`, `--help`, etc.
-* Automatically generated bash autocomplete for your application
-* Automatically generated man pages for your application
-* Command aliases so you can change things without breaking them
-* The flexibilty to define your own help, usage, etc.
-* Optional tight integration with [viper](http://github.com/spf13/viper) for 12-factor apps
-
-Cobra has an exceptionally clean interface and simple design without needless
-constructors or initialization methods.
-
-Applications built with Cobra commands are designed to be as user-friendly as
-possible. Flags can be placed before or after the command (as long as a
-confusing space isn’t provided). Both short and long flags can be used. A
-command need not even be fully typed. Help is automatically generated and
-available for the application or for a specific command using either the help
-command or the `--help` flag.
-
-# Concepts
-
-Cobra is built on a structure of commands, arguments & flags.
-
-**Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions.
-
-The best applications will read like sentences when used. Users will know how
-to use the application because they will natively understand how to use it.
-
-The pattern to follow is
-`APPNAME VERB NOUN --ADJECTIVE.`
- or
-`APPNAME COMMAND ARG --FLAG`
-
-A few good real world examples may better illustrate this point.
-
-In the following example, 'server' is a command, and 'port' is a flag:
-
- > hugo server --port=1313
-
-In this command we are telling Git to clone the url bare.
-
- > git clone URL --bare
-
-## Commands
-
-Command is the central point of the application. Each interaction that
-the application supports will be contained in a Command. A command can
-have children commands and optionally run an action.
-
-In the example above, 'server' is the command.
-
-A Command has the following structure:
-
-```go
-type Command struct {
- Use string // The one-line usage message.
- Short string // The short description shown in the 'help' output.
- Long string // The long message shown in the 'help ' output.
- Run func(cmd *Command, args []string) // Run runs the command.
-}
-```
-
-## Flags
-
-A Flag is a way to modify the behavior of a command. Cobra supports
-fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/).
-A Cobra command can define flags that persist through to children commands
-and flags that are only available to that command.
-
-In the example above, 'port' is the flag.
-
-Flag functionality is provided by the [pflag
-library](https://github.com/ogier/pflag), a fork of the flag standard library
-which maintains the same interface while adding POSIX compliance.
-
-## Usage
-
-Cobra works by creating a set of commands and then organizing them into a tree.
-The tree defines the structure of the application.
-
-Once each command is defined with its corresponding flags, then the
-tree is assigned to the commander which is finally executed.
-
-# Installing
-Using Cobra is easy. First, use `go get` to install the latest version
-of the library. This command will install the `cobra` generator executible
-along with the library:
-
- > go get -v github.com/spf13/cobra/cobra
-
-Next, include Cobra in your application:
-
-```go
-import "github.com/spf13/cobra"
-```
-
-# Getting Started
-
-While you are welcome to provide your own organization, typically a Cobra based
-application will follow the following organizational structure.
-
-```
- ▾ appName/
- ▾ cmd/
- add.go
- your.go
- commands.go
- here.go
- main.go
-```
-
-In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra.
-
-```go
-package main
-
-import "{pathToYourApp}/cmd"
-
-func main() {
- if err := cmd.RootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(-1)
- }
-}
-```
-
-## Using the Cobra Generator
-
-Cobra provides its own program that will create your application and add any
-commands you want. It's the easiest way to incorporate Cobra into your application.
-
-In order to use the cobra command, compile it using the following command:
-
- > go install github.com/spf13/cobra/cobra
-
-This will create the cobra executable under your go path bin directory!
-
-### cobra init
-
-The `cobra init [yourApp]` command will create your initial application code
-for you. It is a very powerful application that will populate your program with
-the right structure so you can immediately enjoy all the benefits of Cobra. It
-will also automatically apply the license you specify to your application.
-
-Cobra init is pretty smart. You can provide it a full path, or simply a path
-similar to what is expected in the import.
-
-```
-cobra init github.com/spf13/newAppName
-```
-
-### cobra add
-
-Once an application is initialized Cobra can create additional commands for you.
-Let's say you created an app and you wanted the following commands for it:
-
-* app serve
-* app config
-* app config create
-
-In your project directory (where your main.go file is) you would run the following:
-
-```
-cobra add serve
-cobra add config
-cobra add create -p 'configCmd'
-```
-
-Once you have run these three commands you would have an app structure that would look like:
-
-```
- ▾ app/
- ▾ cmd/
- serve.go
- config.go
- create.go
- main.go
-```
-
-at this point you can run `go run main.go` and it would run your app. `go run
-main.go serve`, `go run main.go config`, `go run main.go config create` along
-with `go run main.go help serve`, etc would all work.
-
-Obviously you haven't added your own code to these yet, the commands are ready
-for you to give them their tasks. Have fun.
-
-### Configuring the cobra generator
-
-The cobra generator will be easier to use if you provide a simple configuration
-file which will help you eliminate providing a bunch of repeated information in
-flags over and over.
-
-An example ~/.cobra.yaml file:
-
-```yaml
-author: Steve Francia
-license: MIT
-```
-
-You can specify no license by setting `license` to `none` or you can specify
-a custom license:
-
-```yaml
-license:
- header: This file is part of {{ .appName }}.
- text: |
- {{ .copyright }}
-
- This is my license. There are many like it, but this one is mine.
- My license is my best friend. It is my life. I must master it as I must
- master my life.
-```
-
-## Manually implementing Cobra
-
-To manually implement cobra you need to create a bare main.go file and a RootCmd file.
-You will optionally provide additional commands as you see fit.
-
-### Create the root command
-
-The root command represents your binary itself.
-
-
-#### Manually create rootCmd
-
-Cobra doesn't require any special constructors. Simply create your commands.
-
-Ideally you place this in app/cmd/root.go:
-
-```go
-var RootCmd = &cobra.Command{
- Use: "hugo",
- Short: "Hugo is a very fast static site generator",
- Long: `A Fast and Flexible Static Site Generator built with
- love by spf13 and friends in Go.
- Complete documentation is available at http://hugo.spf13.com`,
- Run: func(cmd *cobra.Command, args []string) {
- // Do Stuff Here
- },
-}
-```
-
-You will additionally define flags and handle configuration in your init() function.
-
-for example cmd/root.go:
-
-```go
-func init() {
- cobra.OnInitialize(initConfig)
- RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
- RootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/")
- RootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution")
- RootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)")
- RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration")
- viper.BindPFlag("author", RootCmd.PersistentFlags().Lookup("author"))
- viper.BindPFlag("projectbase", RootCmd.PersistentFlags().Lookup("projectbase"))
- viper.BindPFlag("useViper", RootCmd.PersistentFlags().Lookup("viper"))
- viper.SetDefault("author", "NAME HERE ")
- viper.SetDefault("license", "apache")
-}
-```
-
-### Create your main.go
-
-With the root command you need to have your main function execute it.
-Execute should be run on the root for clarity, though it can be called on any command.
-
-In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra.
-
-```go
-package main
-
-import "{pathToYourApp}/cmd"
-
-func main() {
- if err := cmd.RootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(-1)
- }
-}
-```
-
-
-### Create additional commands
-
-Additional commands can be defined and typically are each given their own file
-inside of the cmd/ directory.
-
-If you wanted to create a version command you would create cmd/version.go and
-populate it with the following:
-
-```go
-package cmd
-
-import (
- "github.com/spf13/cobra"
-)
-
-func init() {
- RootCmd.AddCommand(versionCmd)
-}
-
-var versionCmd = &cobra.Command{
- Use: "version",
- Short: "Print the version number of Hugo",
- Long: `All software has versions. This is Hugo's`,
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Hugo Static Site Generator v0.9 -- HEAD")
- },
-}
-```
-
-### Attach command to its parent
-
-
-If you notice in the above example we attach the command to its parent. In
-this case the parent is the rootCmd. In this example we are attaching it to the
-root, but commands can be attached at any level.
-
-```go
-RootCmd.AddCommand(versionCmd)
-```
-
-### Remove a command from its parent
-
-Removing a command is not a common action in simple programs, but it allows 3rd
-parties to customize an existing command tree.
-
-In this example, we remove the existing `VersionCmd` command of an existing
-root command, and we replace it with our own version:
-
-```go
-mainlib.RootCmd.RemoveCommand(mainlib.VersionCmd)
-mainlib.RootCmd.AddCommand(versionCmd)
-```
-
-## Working with Flags
-
-Flags provide modifiers to control how the action command operates.
-
-### Assign flags to a command
-
-Since the flags are defined and used in different locations, we need to
-define a variable outside with the correct scope to assign the flag to
-work with.
-
-```go
-var Verbose bool
-var Source string
-```
-
-There are two different approaches to assign a flag.
-
-### Persistent Flags
-
-A flag can be 'persistent' meaning that this flag will be available to the
-command it's assigned to as well as every command under that command. For
-global flags, assign a flag as a persistent flag on the root.
-
-```go
-RootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
-```
-
-### Local Flags
-
-A flag can also be assigned locally which will only apply to that specific command.
-
-```go
-RootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
-```
-
-
-## Example
-
-In the example below, we have defined three commands. Two are at the top level
-and one (cmdTimes) is a child of one of the top commands. In this case the root
-is not executable meaning that a subcommand is required. This is accomplished
-by not providing a 'Run' for the 'rootCmd'.
-
-We have only defined one flag for a single command.
-
-More documentation about flags is available at https://github.com/spf13/pflag
-
-```go
-package main
-
-import (
- "fmt"
- "strings"
-
- "github.com/spf13/cobra"
-)
-
-func main() {
-
- var echoTimes int
-
- var cmdPrint = &cobra.Command{
- Use: "print [string to print]",
- Short: "Print anything to the screen",
- Long: `print is for printing anything back to the screen.
- For many years people have printed back to the screen.
- `,
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Print: " + strings.Join(args, " "))
- },
- }
-
- var cmdEcho = &cobra.Command{
- Use: "echo [string to echo]",
- Short: "Echo anything to the screen",
- Long: `echo is for echoing anything back.
- Echo works a lot like print, except it has a child command.
- `,
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Print: " + strings.Join(args, " "))
- },
- }
-
- var cmdTimes = &cobra.Command{
- Use: "times [# times] [string to echo]",
- Short: "Echo anything to the screen more times",
- Long: `echo things multiple times back to the user by providing
- a count and a string.`,
- Run: func(cmd *cobra.Command, args []string) {
- for i := 0; i < echoTimes; i++ {
- fmt.Println("Echo: " + strings.Join(args, " "))
- }
- },
- }
-
- cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input")
-
- var rootCmd = &cobra.Command{Use: "app"}
- rootCmd.AddCommand(cmdPrint, cmdEcho)
- cmdEcho.AddCommand(cmdTimes)
- rootCmd.Execute()
-}
-```
-
-For a more complete example of a larger application, please checkout [Hugo](http://gohugo.io/).
-
-## The Help Command
-
-Cobra automatically adds a help command to your application when you have subcommands.
-This will be called when a user runs 'app help'. Additionally, help will also
-support all other commands as input. Say, for instance, you have a command called
-'create' without any additional configuration; Cobra will work when 'app help
-create' is called. Every command will automatically have the '--help' flag added.
-
-### Example
-
-The following output is automatically generated by Cobra. Nothing beyond the
-command and flag definitions are needed.
-
- > hugo help
-
- hugo is the main command, used to build your Hugo site.
-
- Hugo is a Fast and Flexible Static Site Generator
- built with love by spf13 and friends in Go.
-
- Complete documentation is available at http://gohugo.io/.
-
- Usage:
- hugo [flags]
- hugo [command]
-
- Available Commands:
- server Hugo runs its own webserver to render the files
- version Print the version number of Hugo
- config Print the site configuration
- check Check content in the source directory
- benchmark Benchmark hugo by building a site a number of times.
- convert Convert your content to different formats
- new Create new content for your site
- list Listing out various types of content
- undraft Undraft changes the content's draft status from 'True' to 'False'
- genautocomplete Generate shell autocompletion script for Hugo
- gendoc Generate Markdown documentation for the Hugo CLI.
- genman Generate man page for Hugo
- import Import your site from others.
-
- Flags:
- -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/
- -D, --buildDrafts[=false]: include content marked as draft
- -F, --buildFuture[=false]: include content with publishdate in the future
- --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
- --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL
- --config="": config file (default is path/config.yaml|json|toml)
- -d, --destination="": filesystem path to write files to
- --disableRSS[=false]: Do not build RSS files
- --disableSitemap[=false]: Do not build Sitemap file
- --editor="": edit new content with this editor, if provided
- --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it
- --log[=false]: Enable Logging
- --logFile="": Log File path (if set, logging enabled automatically)
- --noTimes[=false]: Don't sync modification time of files
- --pluralizeListTitles[=true]: Pluralize titles in lists using inflect
- --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
- -s, --source="": filesystem path to read files relative from
- --stepAnalysis[=false]: display memory and timing of different steps of the program
- -t, --theme="": theme to use (located in /themes/THEMENAME/)
- --uglyURLs[=false]: if true, use /filename.html instead of /filename/
- -v, --verbose[=false]: verbose output
- --verboseLog[=false]: verbose logging
- -w, --watch[=false]: watch filesystem for changes and recreate as needed
-
- Use "hugo [command] --help" for more information about a command.
-
-
-Help is just a command like any other. There is no special logic or behavior
-around it. In fact, you can provide your own if you want.
-
-### Defining your own help
-
-You can provide your own Help command or your own template for the default command to use.
-
-The default help command is
-
-```go
-func (c *Command) initHelp() {
- if c.helpCommand == nil {
- c.helpCommand = &Command{
- Use: "help [command]",
- Short: "Help about any command",
- Long: `Help provides help for any command in the application.
- Simply type ` + c.Name() + ` help [path to command] for full details.`,
- Run: c.HelpFunc(),
- }
- }
- c.AddCommand(c.helpCommand)
-}
-```
-
-You can provide your own command, function or template through the following methods:
-
-```go
-command.SetHelpCommand(cmd *Command)
-
-command.SetHelpFunc(f func(*Command, []string))
-
-command.SetHelpTemplate(s string)
-```
-
-The latter two will also apply to any children commands.
-
-## Usage
-
-When the user provides an invalid flag or invalid command, Cobra responds by
-showing the user the 'usage'.
-
-### Example
-You may recognize this from the help above. That's because the default help
-embeds the usage as part of its output.
-
- Usage:
- hugo [flags]
- hugo [command]
-
- Available Commands:
- server Hugo runs its own webserver to render the files
- version Print the version number of Hugo
- config Print the site configuration
- check Check content in the source directory
- benchmark Benchmark hugo by building a site a number of times.
- convert Convert your content to different formats
- new Create new content for your site
- list Listing out various types of content
- undraft Undraft changes the content's draft status from 'True' to 'False'
- genautocomplete Generate shell autocompletion script for Hugo
- gendoc Generate Markdown documentation for the Hugo CLI.
- genman Generate man page for Hugo
- import Import your site from others.
-
- Flags:
- -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/
- -D, --buildDrafts[=false]: include content marked as draft
- -F, --buildFuture[=false]: include content with publishdate in the future
- --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
- --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL
- --config="": config file (default is path/config.yaml|json|toml)
- -d, --destination="": filesystem path to write files to
- --disableRSS[=false]: Do not build RSS files
- --disableSitemap[=false]: Do not build Sitemap file
- --editor="": edit new content with this editor, if provided
- --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it
- --log[=false]: Enable Logging
- --logFile="": Log File path (if set, logging enabled automatically)
- --noTimes[=false]: Don't sync modification time of files
- --pluralizeListTitles[=true]: Pluralize titles in lists using inflect
- --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
- -s, --source="": filesystem path to read files relative from
- --stepAnalysis[=false]: display memory and timing of different steps of the program
- -t, --theme="": theme to use (located in /themes/THEMENAME/)
- --uglyURLs[=false]: if true, use /filename.html instead of /filename/
- -v, --verbose[=false]: verbose output
- --verboseLog[=false]: verbose logging
- -w, --watch[=false]: watch filesystem for changes and recreate as needed
-
-### Defining your own usage
-You can provide your own usage function or template for Cobra to use.
-
-The default usage function is:
-
-```go
-return func(c *Command) error {
- err := tmpl(c.Out(), c.UsageTemplate(), c)
- return err
-}
-```
-
-Like help, the function and template are overridable through public methods:
-
-```go
-command.SetUsageFunc(f func(*Command) error)
-
-command.SetUsageTemplate(s string)
-```
-
-## PreRun or PostRun Hooks
-
-It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherrited by children if they do not declare their own. These function are run in the following order:
-
-- `PersistentPreRun`
-- `PreRun`
-- `Run`
-- `PostRun`
-- `PersistentPostRun`
-
-An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`:
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-)
-
-func main() {
-
- var rootCmd = &cobra.Command{
- Use: "root [sub]",
- Short: "My root command",
- PersistentPreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args)
- },
- PreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PreRun with args: %v\n", args)
- },
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd Run with args: %v\n", args)
- },
- PostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PostRun with args: %v\n", args)
- },
- PersistentPostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args)
- },
- }
-
- var subCmd = &cobra.Command{
- Use: "sub [no options!]",
- Short: "My subcommand",
- PreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PreRun with args: %v\n", args)
- },
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd Run with args: %v\n", args)
- },
- PostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PostRun with args: %v\n", args)
- },
- PersistentPostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args)
- },
- }
-
- rootCmd.AddCommand(subCmd)
-
- rootCmd.SetArgs([]string{""})
- _ = rootCmd.Execute()
- fmt.Print("\n")
- rootCmd.SetArgs([]string{"sub", "arg1", "arg2"})
- _ = rootCmd.Execute()
-}
-```
-
-
-## Alternative Error Handling
-
-Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top,
-providing a way to handle the errors in one location. The current list of functions that return an error is:
-
-* PersistentPreRunE
-* PreRunE
-* RunE
-* PostRunE
-* PersistentPostRunE
-
-If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage`
-and `SilenceErrors` to `false` on the command. A child command respects these flags if they are set on the parent
-command.
-
-**Example Usage using RunE:**
-
-```go
-package main
-
-import (
- "errors"
- "log"
-
- "github.com/spf13/cobra"
-)
-
-func main() {
- var rootCmd = &cobra.Command{
- Use: "hugo",
- Short: "Hugo is a very fast static site generator",
- Long: `A Fast and Flexible Static Site Generator built with
- love by spf13 and friends in Go.
- Complete documentation is available at http://hugo.spf13.com`,
- RunE: func(cmd *cobra.Command, args []string) error {
- // Do Stuff Here
- return errors.New("some random error")
- },
- }
-
- if err := rootCmd.Execute(); err != nil {
- log.Fatal(err)
- }
-}
-```
-
-## Suggestions when "unknown command" happens
-
-Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example:
-
-```
-$ hugo srever
-Error: unknown command "srever" for "hugo"
-
-Did you mean this?
- server
-
-Run 'hugo --help' for usage.
-```
-
-Suggestions are automatic based on every subcommand registered and use an implementation of [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion.
-
-If you need to disable suggestions or tweak the string distance in your command, use:
-
-```go
-command.DisableSuggestions = true
-```
-
-or
-
-```go
-command.SuggestionsMinimumDistance = 1
-```
-
-You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example:
-
-```
-$ kubectl remove
-Error: unknown command "remove" for "kubectl"
-
-Did you mean this?
- delete
-
-Run 'kubectl help' for usage.
-```
-
-## Generating Markdown-formatted documentation for your command
-
-Cobra can generate a Markdown-formatted document based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Markdown Docs](doc/md_docs.md).
-
-## Generating man pages for your command
-
-Cobra can generate a man page based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Man Docs](doc/man_docs.md).
-
-## Generating bash completions for your command
-
-Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md).
-
-## Debugging
-
-Cobra provides a ‘DebugFlags’ method on a command which, when called, will print
-out everything Cobra knows about the flags for each command.
-
-### Example
-
-```go
-command.DebugFlags()
-```
-
-## Release Notes
-* **0.9.0** June 17, 2014
- * flags can appears anywhere in the args (provided they are unambiguous)
- * --help prints usage screen for app or command
- * Prefix matching for commands
- * Cleaner looking help and usage output
- * Extensive test suite
-* **0.8.0** Nov 5, 2013
- * Reworked interface to remove commander completely
- * Command now primary structure
- * No initialization needed
- * Usage & Help templates & functions definable at any level
- * Updated Readme
-* **0.7.0** Sept 24, 2013
- * Needs more eyes
- * Test suite
- * Support for automatic error messages
- * Support for help command
- * Support for printing to any io.Writer instead of os.Stderr
- * Support for persistent flags which cascade down tree
- * Ready for integration into Hugo
-* **0.1.0** Sept 3, 2013
- * Implement first draft
-
-## Extensions
-
-Libraries for extending Cobra:
-
-* [cmdns](https://github.com/gosuri/cmdns): Enables name spacing a command's immediate children. It provides an alternative way to structure subcommands, similar to `heroku apps:create` and `ovrclk clusters:launch`.
-
-## ToDo
-* Launch proper documentation site
-
-## Contributing
-
-1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
-
-## Contributors
-
-Names in no particular order:
-
-* [spf13](https://github.com/spf13),
-[eparis](https://github.com/eparis),
-[bep](https://github.com/bep), and many more!
-
-## License
-
-Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt)
-
-
-[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/spf13/cobra/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.go b/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.go
deleted file mode 100644
index 236dee67f..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.go
+++ /dev/null
@@ -1,630 +0,0 @@
-package cobra
-
-import (
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-
- "github.com/spf13/pflag"
-)
-
-const (
- BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extentions"
- BashCompCustom = "cobra_annotation_bash_completion_custom"
- BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
- BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
-)
-
-func preamble(out io.Writer, name string) error {
- _, err := fmt.Fprintf(out, "# bash completion for %-36s -*- shell-script -*-\n", name)
- if err != nil {
- return err
- }
- _, err = fmt.Fprint(out, `
-__debug()
-{
- if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
- echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
- fi
-}
-
-# Homebrew on Macs have version 1.3 of bash-completion which doesn't include
-# _init_completion. This is a very minimal version of that function.
-__my_init_completion()
-{
- COMPREPLY=()
- _get_comp_words_by_ref "$@" cur prev words cword
-}
-
-__index_of_word()
-{
- local w word=$1
- shift
- index=0
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- index=$((index+1))
- done
- index=-1
-}
-
-__contains_word()
-{
- local w word=$1; shift
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- done
- return 1
-}
-
-__handle_reply()
-{
- __debug "${FUNCNAME[0]}"
- case $cur in
- -*)
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt -o nospace
- fi
- local allflags
- if [ ${#must_have_one_flag[@]} -ne 0 ]; then
- allflags=("${must_have_one_flag[@]}")
- else
- allflags=("${flags[*]} ${two_word_flags[*]}")
- fi
- COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
- if [[ $(type -t compopt) = "builtin" ]]; then
- [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
- fi
-
- # complete after --flag=abc
- if [[ $cur == *=* ]]; then
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt +o nospace
- fi
-
- local index flag
- flag="${cur%%=*}"
- __index_of_word "${flag}" "${flags_with_completion[@]}"
- if [[ ${index} -ge 0 ]]; then
- COMPREPLY=()
- PREFIX=""
- cur="${cur#*=}"
- ${flags_completion[${index}]}
- if [ -n "${ZSH_VERSION}" ]; then
- # zfs completion needs --flag= prefix
- eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )"
- fi
- fi
- fi
- return 0;
- ;;
- esac
-
- # check if we are handling a flag with special work handling
- local index
- __index_of_word "${prev}" "${flags_with_completion[@]}"
- if [[ ${index} -ge 0 ]]; then
- ${flags_completion[${index}]}
- return
- fi
-
- # we are parsing a flag and don't have a special handler, no completion
- if [[ ${cur} != "${words[cword]}" ]]; then
- return
- fi
-
- local completions
- completions=("${commands[@]}")
- if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
- completions=("${must_have_one_noun[@]}")
- fi
- if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
- completions+=("${must_have_one_flag[@]}")
- fi
- COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
-
- if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
- COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
- fi
-
- if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
- declare -F __custom_func >/dev/null && __custom_func
- fi
-
- __ltrim_colon_completions "$cur"
-}
-
-# The arguments should be in the form "ext1|ext2|extn"
-__handle_filename_extension_flag()
-{
- local ext="$1"
- _filedir "@(${ext})"
-}
-
-__handle_subdirs_in_dir_flag()
-{
- local dir="$1"
- pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
-}
-
-__handle_flag()
-{
- __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- # if a command required a flag, and we found it, unset must_have_one_flag()
- local flagname=${words[c]}
- local flagvalue
- # if the word contained an =
- if [[ ${words[c]} == *"="* ]]; then
- flagvalue=${flagname#*=} # take in as flagvalue after the =
- flagname=${flagname%%=*} # strip everything after the =
- flagname="${flagname}=" # but put the = back
- fi
- __debug "${FUNCNAME[0]}: looking for ${flagname}"
- if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then
- must_have_one_flag=()
- fi
-
- # if you set a flag which only applies to this command, don't show subcommands
- if __contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then
- commands=()
- fi
-
- # keep flag value with flagname as flaghash
- if [ -n "${flagvalue}" ] ; then
- flaghash[${flagname}]=${flagvalue}
- elif [ -n "${words[ $((c+1)) ]}" ] ; then
- flaghash[${flagname}]=${words[ $((c+1)) ]}
- else
- flaghash[${flagname}]="true" # pad "true" for bool flag
- fi
-
- # skip the argument to a two word flag
- if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
- c=$((c+1))
- # if we are looking for a flags value, don't show commands
- if [[ $c -eq $cword ]]; then
- commands=()
- fi
- fi
-
- c=$((c+1))
-
-}
-
-__handle_noun()
-{
- __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
- must_have_one_noun=()
- elif __contains_word "${words[c]}" "${noun_aliases[@]}"; then
- must_have_one_noun=()
- fi
-
- nouns+=("${words[c]}")
- c=$((c+1))
-}
-
-__handle_command()
-{
- __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- local next_command
- if [[ -n ${last_command} ]]; then
- next_command="_${last_command}_${words[c]//:/__}"
- else
- if [[ $c -eq 0 ]]; then
- next_command="_$(basename "${words[c]//:/__}")"
- else
- next_command="_${words[c]//:/__}"
- fi
- fi
- c=$((c+1))
- __debug "${FUNCNAME[0]}: looking for ${next_command}"
- declare -F $next_command >/dev/null && $next_command
-}
-
-__handle_word()
-{
- if [[ $c -ge $cword ]]; then
- __handle_reply
- return
- fi
- __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
- if [[ "${words[c]}" == -* ]]; then
- __handle_flag
- elif __contains_word "${words[c]}" "${commands[@]}"; then
- __handle_command
- elif [[ $c -eq 0 ]] && __contains_word "$(basename "${words[c]}")" "${commands[@]}"; then
- __handle_command
- else
- __handle_noun
- fi
- __handle_word
-}
-
-`)
- return err
-}
-
-func postscript(w io.Writer, name string) error {
- name = strings.Replace(name, ":", "__", -1)
- _, err := fmt.Fprintf(w, "__start_%s()\n", name)
- if err != nil {
- return err
- }
- _, err = fmt.Fprintf(w, `{
- local cur prev words cword
- declare -A flaghash 2>/dev/null || :
- if declare -F _init_completion >/dev/null 2>&1; then
- _init_completion -s || return
- else
- __my_init_completion -n "=" || return
- fi
-
- local c=0
- local flags=()
- local two_word_flags=()
- local local_nonpersistent_flags=()
- local flags_with_completion=()
- local flags_completion=()
- local commands=("%s")
- local must_have_one_flag=()
- local must_have_one_noun=()
- local last_command
- local nouns=()
-
- __handle_word
-}
-
-`, name)
- if err != nil {
- return err
- }
- _, err = fmt.Fprintf(w, `if [[ $(type -t compopt) = "builtin" ]]; then
- complete -o default -F __start_%s %s
-else
- complete -o default -o nospace -F __start_%s %s
-fi
-
-`, name, name, name, name)
- if err != nil {
- return err
- }
- _, err = fmt.Fprintf(w, "# ex: ts=4 sw=4 et filetype=sh\n")
- return err
-}
-
-func writeCommands(cmd *Command, w io.Writer) error {
- if _, err := fmt.Fprintf(w, " commands=()\n"); err != nil {
- return err
- }
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c == cmd.helpCommand {
- continue
- }
- if _, err := fmt.Fprintf(w, " commands+=(%q)\n", c.Name()); err != nil {
- return err
- }
- }
- _, err := fmt.Fprintf(w, "\n")
- return err
-}
-
-func writeFlagHandler(name string, annotations map[string][]string, w io.Writer) error {
- for key, value := range annotations {
- switch key {
- case BashCompFilenameExt:
- _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name)
- if err != nil {
- return err
- }
-
- if len(value) > 0 {
- ext := "__handle_filename_extension_flag " + strings.Join(value, "|")
- _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext)
- } else {
- ext := "_filedir"
- _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext)
- }
- if err != nil {
- return err
- }
- case BashCompCustom:
- _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name)
- if err != nil {
- return err
- }
- if len(value) > 0 {
- handlers := strings.Join(value, "; ")
- _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", handlers)
- } else {
- _, err = fmt.Fprintf(w, " flags_completion+=(:)\n")
- }
- if err != nil {
- return err
- }
- case BashCompSubdirsInDir:
- _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name)
-
- if len(value) == 1 {
- ext := "__handle_subdirs_in_dir_flag " + value[0]
- _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext)
- } else {
- ext := "_filedir -d"
- _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext)
- }
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func writeShortFlag(flag *pflag.Flag, w io.Writer) error {
- b := (len(flag.NoOptDefVal) > 0)
- name := flag.Shorthand
- format := " "
- if !b {
- format += "two_word_"
- }
- format += "flags+=(\"-%s\")\n"
- if _, err := fmt.Fprintf(w, format, name); err != nil {
- return err
- }
- return writeFlagHandler("-"+name, flag.Annotations, w)
-}
-
-func writeFlag(flag *pflag.Flag, w io.Writer) error {
- b := (len(flag.NoOptDefVal) > 0)
- name := flag.Name
- format := " flags+=(\"--%s"
- if !b {
- format += "="
- }
- format += "\")\n"
- if _, err := fmt.Fprintf(w, format, name); err != nil {
- return err
- }
- return writeFlagHandler("--"+name, flag.Annotations, w)
-}
-
-func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error {
- b := (len(flag.NoOptDefVal) > 0)
- name := flag.Name
- format := " local_nonpersistent_flags+=(\"--%s"
- if !b {
- format += "="
- }
- format += "\")\n"
- if _, err := fmt.Fprintf(w, format, name); err != nil {
- return err
- }
- return nil
-}
-
-func writeFlags(cmd *Command, w io.Writer) error {
- _, err := fmt.Fprintf(w, ` flags=()
- two_word_flags=()
- local_nonpersistent_flags=()
- flags_with_completion=()
- flags_completion=()
-
-`)
- if err != nil {
- return err
- }
- localNonPersistentFlags := cmd.LocalNonPersistentFlags()
- var visitErr error
- cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if err := writeFlag(flag, w); err != nil {
- visitErr = err
- return
- }
- if len(flag.Shorthand) > 0 {
- if err := writeShortFlag(flag, w); err != nil {
- visitErr = err
- return
- }
- }
- if localNonPersistentFlags.Lookup(flag.Name) != nil {
- if err := writeLocalNonPersistentFlag(flag, w); err != nil {
- visitErr = err
- return
- }
- }
- })
- if visitErr != nil {
- return visitErr
- }
- cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if err := writeFlag(flag, w); err != nil {
- visitErr = err
- return
- }
- if len(flag.Shorthand) > 0 {
- if err := writeShortFlag(flag, w); err != nil {
- visitErr = err
- return
- }
- }
- })
- if visitErr != nil {
- return visitErr
- }
-
- _, err = fmt.Fprintf(w, "\n")
- return err
-}
-
-func writeRequiredFlag(cmd *Command, w io.Writer) error {
- if _, err := fmt.Fprintf(w, " must_have_one_flag=()\n"); err != nil {
- return err
- }
- flags := cmd.NonInheritedFlags()
- var visitErr error
- flags.VisitAll(func(flag *pflag.Flag) {
- for key := range flag.Annotations {
- switch key {
- case BashCompOneRequiredFlag:
- format := " must_have_one_flag+=(\"--%s"
- b := (flag.Value.Type() == "bool")
- if !b {
- format += "="
- }
- format += "\")\n"
- if _, err := fmt.Fprintf(w, format, flag.Name); err != nil {
- visitErr = err
- return
- }
-
- if len(flag.Shorthand) > 0 {
- if _, err := fmt.Fprintf(w, " must_have_one_flag+=(\"-%s\")\n", flag.Shorthand); err != nil {
- visitErr = err
- return
- }
- }
- }
- }
- })
- return visitErr
-}
-
-func writeRequiredNouns(cmd *Command, w io.Writer) error {
- if _, err := fmt.Fprintf(w, " must_have_one_noun=()\n"); err != nil {
- return err
- }
- sort.Sort(sort.StringSlice(cmd.ValidArgs))
- for _, value := range cmd.ValidArgs {
- if _, err := fmt.Fprintf(w, " must_have_one_noun+=(%q)\n", value); err != nil {
- return err
- }
- }
- return nil
-}
-
-func writeArgAliases(cmd *Command, w io.Writer) error {
- if _, err := fmt.Fprintf(w, " noun_aliases=()\n"); err != nil {
- return err
- }
- sort.Sort(sort.StringSlice(cmd.ArgAliases))
- for _, value := range cmd.ArgAliases {
- if _, err := fmt.Fprintf(w, " noun_aliases+=(%q)\n", value); err != nil {
- return err
- }
- }
- return nil
-}
-
-func gen(cmd *Command, w io.Writer) error {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c == cmd.helpCommand {
- continue
- }
- if err := gen(c, w); err != nil {
- return err
- }
- }
- commandName := cmd.CommandPath()
- commandName = strings.Replace(commandName, " ", "_", -1)
- commandName = strings.Replace(commandName, ":", "__", -1)
- if _, err := fmt.Fprintf(w, "_%s()\n{\n", commandName); err != nil {
- return err
- }
- if _, err := fmt.Fprintf(w, " last_command=%q\n", commandName); err != nil {
- return err
- }
- if err := writeCommands(cmd, w); err != nil {
- return err
- }
- if err := writeFlags(cmd, w); err != nil {
- return err
- }
- if err := writeRequiredFlag(cmd, w); err != nil {
- return err
- }
- if err := writeRequiredNouns(cmd, w); err != nil {
- return err
- }
- if err := writeArgAliases(cmd, w); err != nil {
- return err
- }
- if _, err := fmt.Fprintf(w, "}\n\n"); err != nil {
- return err
- }
- return nil
-}
-
-func (cmd *Command) GenBashCompletion(w io.Writer) error {
- if err := preamble(w, cmd.Name()); err != nil {
- return err
- }
- if len(cmd.BashCompletionFunction) > 0 {
- if _, err := fmt.Fprintf(w, "%s\n", cmd.BashCompletionFunction); err != nil {
- return err
- }
- }
- if err := gen(cmd, w); err != nil {
- return err
- }
- return postscript(w, cmd.Name())
-}
-
-func (cmd *Command) GenBashCompletionFile(filename string) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return cmd.GenBashCompletion(outFile)
-}
-
-// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag, if it exists.
-func (cmd *Command) MarkFlagRequired(name string) error {
- return MarkFlagRequired(cmd.Flags(), name)
-}
-
-// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag, if it exists.
-func (cmd *Command) MarkPersistentFlagRequired(name string) error {
- return MarkFlagRequired(cmd.PersistentFlags(), name)
-}
-
-// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag in the flag set, if it exists.
-func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
- return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"})
-}
-
-// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists.
-// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
-func (cmd *Command) MarkFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(cmd.Flags(), name, extensions...)
-}
-
-// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
-// Generated bash autocompletion will call the bash function f for the flag.
-func (cmd *Command) MarkFlagCustom(name string, f string) error {
- return MarkFlagCustom(cmd.Flags(), name, f)
-}
-
-// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists.
-// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
-func (cmd *Command) MarkPersistentFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(cmd.PersistentFlags(), name, extensions...)
-}
-
-// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists.
-// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
-func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error {
- return flags.SetAnnotation(name, BashCompFilenameExt, extensions)
-}
-
-// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists.
-// Generated bash autocompletion will call the bash function f for the flag.
-func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
- return flags.SetAnnotation(name, BashCompCustom, []string{f})
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.md b/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.md
deleted file mode 100644
index 6e3b71f13..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/bash_completions.md
+++ /dev/null
@@ -1,206 +0,0 @@
-# Generating Bash Completions For Your Own cobra.Command
-
-Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows:
-
-```go
-package main
-
-import (
- "io/ioutil"
- "os"
-
- "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd"
-)
-
-func main() {
- kubectl := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard)
- kubectl.GenBashCompletionFile("out.sh")
-}
-```
-
-That will get you completions of subcommands and flags. If you make additional annotations to your code, you can get even more intelligent and flexible behavior.
-
-## Creating your own custom functions
-
-Some more actual code that works in kubernetes:
-
-```bash
-const (
- bash_completion_func = `__kubectl_parse_get()
-{
- local kubectl_output out
- if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then
- out=($(echo "${kubectl_output}" | awk '{print $1}'))
- COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) )
- fi
-}
-
-__kubectl_get_resource()
-{
- if [[ ${#nouns[@]} -eq 0 ]]; then
- return 1
- fi
- __kubectl_parse_get ${nouns[${#nouns[@]} -1]}
- if [[ $? -eq 0 ]]; then
- return 0
- fi
-}
-
-__custom_func() {
- case ${last_command} in
- kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop)
- __kubectl_get_resource
- return
- ;;
- *)
- ;;
- esac
-}
-`)
-```
-
-And then I set that in my command definition:
-
-```go
-cmds := &cobra.Command{
- Use: "kubectl",
- Short: "kubectl controls the Kubernetes cluster manager",
- Long: `kubectl controls the Kubernetes cluster manager.
-
-Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
- Run: runHelp,
- BashCompletionFunction: bash_completion_func,
-}
-```
-
-The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods!
-
-## Have the completions code complete your 'nouns'
-
-In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like:
-
-```go
-validArgs []string = { "pod", "node", "service", "replicationcontroller" }
-
-cmd := &cobra.Command{
- Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)",
- Short: "Display one or many resources",
- Long: get_long,
- Example: get_example,
- Run: func(cmd *cobra.Command, args []string) {
- err := RunGet(f, out, cmd, args)
- util.CheckErr(err)
- },
- ValidArgs: validArgs,
-}
-```
-
-Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like
-
-```bash
-# kubectl get [tab][tab]
-node pod replicationcontroller service
-```
-
-## Plural form and shortcuts for nouns
-
-If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`:
-
-```go`
-argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" }
-
-cmd := &cobra.Command{
- ...
- ValidArgs: validArgs,
- ArgAliases: argAliases
-}
-```
-
-The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by
-the completion algorithm if entered manually, e.g. in:
-
-```bash
-# kubectl get rc [tab][tab]
-backend frontend database
-```
-
-Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns
-in this example again instead of the replication controllers.
-
-## Mark flags as required
-
-Most of the time completions will only show subcommands. But if a flag is required to make a subcommand work, you probably want it to show up when the user types [tab][tab]. Marking a flag as 'Required' is incredibly easy.
-
-```go
-cmd.MarkFlagRequired("pod")
-cmd.MarkFlagRequired("container")
-```
-
-and you'll get something like
-
-```bash
-# kubectl exec [tab][tab][tab]
--c --container= -p --pod=
-```
-
-# Specify valid filename extensions for flags that take a filename
-
-In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions.
-
-```go
- annotations := []string{"json", "yaml", "yml"}
- annotation := make(map[string][]string)
- annotation[cobra.BashCompFilenameExt] = annotations
-
- flag := &pflag.Flag{
- Name: "filename",
- Shorthand: "f",
- Usage: usage,
- Value: value,
- DefValue: value.String(),
- Annotations: annotation,
- }
- cmd.Flags().AddFlag(flag)
-```
-
-Now when you run a command with this filename flag you'll get something like
-
-```bash
-# kubectl create -f
-test/ example/ rpmbuild/
-hello.yml test.json
-```
-
-So while there are many other files in the CWD it only shows me subdirs and those with valid extensions.
-
-# Specifiy custom flag completion
-
-Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specifiy
-a custom flag completion function with cobra.BashCompCustom:
-
-```go
- annotation := make(map[string][]string)
- annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"}
-
- flag := &pflag.Flag{
- Name: "namespace",
- Usage: usage,
- Annotations: annotation,
- }
- cmd.Flags().AddFlag(flag)
-```
-
-In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction`
-value, e.g.:
-
-```bash
-__kubectl_get_namespaces()
-{
- local template
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
- local kubectl_out
- if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) )
- fi
-}
-```
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/cobra.go b/archived/event-adapter/vendor/github.com/spf13/cobra/cobra.go
deleted file mode 100644
index 93a2c0f3a..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/cobra.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright © 2013 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Commands similar to git, go tools and other modern CLI tools
-// inspired by go, go-Commander, gh and subcommand
-
-package cobra
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
- "strings"
- "text/template"
- "unicode"
-)
-
-var templateFuncs = template.FuncMap{
- "trim": strings.TrimSpace,
- "trimRightSpace": trimRightSpace,
- "appendIfNotPresent": appendIfNotPresent,
- "rpad": rpad,
- "gt": Gt,
- "eq": Eq,
-}
-
-var initializers []func()
-
-// automatic prefix matching can be a dangerous thing to automatically enable in CLI tools.
-// Set this to true to enable it
-var EnablePrefixMatching = false
-
-//EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
-//To disable sorting, set it to false.
-var EnableCommandSorting = true
-
-//AddTemplateFunc adds a template function that's available to Usage and Help
-//template generation.
-func AddTemplateFunc(name string, tmplFunc interface{}) {
- templateFuncs[name] = tmplFunc
-}
-
-//AddTemplateFuncs adds multiple template functions availalble to Usage and
-//Help template generation.
-func AddTemplateFuncs(tmplFuncs template.FuncMap) {
- for k, v := range tmplFuncs {
- templateFuncs[k] = v
- }
-}
-
-//OnInitialize takes a series of func() arguments and appends them to a slice of func().
-func OnInitialize(y ...func()) {
- for _, x := range y {
- initializers = append(initializers, x)
- }
-}
-
-//Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans,
-//Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as
-//ints and then compared.
-func Gt(a interface{}, b interface{}) bool {
- var left, right int64
- av := reflect.ValueOf(a)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- left = int64(av.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- left = av.Int()
- case reflect.String:
- left, _ = strconv.ParseInt(av.String(), 10, 64)
- }
-
- bv := reflect.ValueOf(b)
-
- switch bv.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- right = int64(bv.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- right = bv.Int()
- case reflect.String:
- right, _ = strconv.ParseInt(bv.String(), 10, 64)
- }
-
- return left > right
-}
-
-//Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic.
-func Eq(a interface{}, b interface{}) bool {
- av := reflect.ValueOf(a)
- bv := reflect.ValueOf(b)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- panic("Eq called on unsupported type")
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return av.Int() == bv.Int()
- case reflect.String:
- return av.String() == bv.String()
- }
- return false
-}
-
-func trimRightSpace(s string) string {
- return strings.TrimRightFunc(s, unicode.IsSpace)
-}
-
-// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s
-func appendIfNotPresent(s, stringToAppend string) string {
- if strings.Contains(s, stringToAppend) {
- return s
- }
- return s + " " + stringToAppend
-}
-
-//rpad adds padding to the right of a string
-func rpad(s string, padding int) string {
- template := fmt.Sprintf("%%-%ds", padding)
- return fmt.Sprintf(template, s)
-}
-
-// tmpl executes the given template text on data, writing the result to w.
-func tmpl(w io.Writer, text string, data interface{}) error {
- t := template.New("top")
- t.Funcs(templateFuncs)
- template.Must(t.Parse(text))
- return t.Execute(w, data)
-}
-
-// ld compares two strings and returns the levenshtein distance between them
-func ld(s, t string, ignoreCase bool) int {
- if ignoreCase {
- s = strings.ToLower(s)
- t = strings.ToLower(t)
- }
- d := make([][]int, len(s)+1)
- for i := range d {
- d[i] = make([]int, len(t)+1)
- }
- for i := range d {
- d[i][0] = i
- }
- for j := range d[0] {
- d[0][j] = j
- }
- for j := 1; j <= len(t); j++ {
- for i := 1; i <= len(s); i++ {
- if s[i-1] == t[j-1] {
- d[i][j] = d[i-1][j-1]
- } else {
- min := d[i-1][j]
- if d[i][j-1] < min {
- min = d[i][j-1]
- }
- if d[i-1][j-1] < min {
- min = d[i-1][j-1]
- }
- d[i][j] = min + 1
- }
- }
-
- }
- return d[len(s)][len(t)]
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/command.go b/archived/event-adapter/vendor/github.com/spf13/cobra/command.go
deleted file mode 100644
index 083e4ea7f..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/command.go
+++ /dev/null
@@ -1,1256 +0,0 @@
-// Copyright © 2013 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
-//In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- flag "github.com/spf13/pflag"
-)
-
-// Command is just that, a command for your application.
-// eg. 'go run' ... 'run' is the command. Cobra requires
-// you to define the usage and description as part of your command
-// definition to ensure usability.
-type Command struct {
- // Name is the command name, usually the executable's name.
- name string
- // The one-line usage message.
- Use string
- // An array of aliases that can be used instead of the first word in Use.
- Aliases []string
- // An array of command names for which this command will be suggested - similar to aliases but only suggests.
- SuggestFor []string
- // The short description shown in the 'help' output.
- Short string
- // The long message shown in the 'help ' output.
- Long string
- // Examples of how to use the command
- Example string
- // List of all valid non-flag arguments that are accepted in bash completions
- ValidArgs []string
- // List of aliases for ValidArgs. These are not suggested to the user in the bash
- // completion, but accepted if entered manually.
- ArgAliases []string
- // Custom functions used by the bash autocompletion generator
- BashCompletionFunction string
- // Is this command deprecated and should print this string when used?
- Deprecated string
- // Is this command hidden and should NOT show up in the list of available commands?
- Hidden bool
- // Full set of flags
- flags *flag.FlagSet
- // Set of flags childrens of this command will inherit
- pflags *flag.FlagSet
- // Flags that are declared specifically by this command (not inherited).
- lflags *flag.FlagSet
- // SilenceErrors is an option to quiet errors down stream
- SilenceErrors bool
- // Silence Usage is an option to silence usage when an error occurs.
- SilenceUsage bool
- // The *Run functions are executed in the following order:
- // * PersistentPreRun()
- // * PreRun()
- // * Run()
- // * PostRun()
- // * PersistentPostRun()
- // All functions get the same args, the arguments after the command name
- // PersistentPreRun: children of this command will inherit and execute
- PersistentPreRun func(cmd *Command, args []string)
- // PersistentPreRunE: PersistentPreRun but returns an error
- PersistentPreRunE func(cmd *Command, args []string) error
- // PreRun: children of this command will not inherit.
- PreRun func(cmd *Command, args []string)
- // PreRunE: PreRun but returns an error
- PreRunE func(cmd *Command, args []string) error
- // Run: Typically the actual work function. Most commands will only implement this
- Run func(cmd *Command, args []string)
- // RunE: Run but returns an error
- RunE func(cmd *Command, args []string) error
- // PostRun: run after the Run command.
- PostRun func(cmd *Command, args []string)
- // PostRunE: PostRun but returns an error
- PostRunE func(cmd *Command, args []string) error
- // PersistentPostRun: children of this command will inherit and execute after PostRun
- PersistentPostRun func(cmd *Command, args []string)
- // PersistentPostRunE: PersistentPostRun but returns an error
- PersistentPostRunE func(cmd *Command, args []string) error
- // DisableAutoGenTag remove
- DisableAutoGenTag bool
- // Commands is the list of commands supported by this program.
- commands []*Command
- // Parent Command for this command
- parent *Command
- // max lengths of commands' string lengths for use in padding
- commandsMaxUseLen int
- commandsMaxCommandPathLen int
- commandsMaxNameLen int
- // is commands slice are sorted or not
- commandsAreSorted bool
-
- flagErrorBuf *bytes.Buffer
-
- args []string // actual args parsed from flags
- output *io.Writer // out writer if set in SetOutput(w)
- usageFunc func(*Command) error // Usage can be defined by application
- usageTemplate string // Can be defined by Application
- helpTemplate string // Can be defined by Application
- helpFunc func(*Command, []string) // Help can be defined by application
- helpCommand *Command // The help command
- // The global normalization function that we can use on every pFlag set and children commands
- globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName
-
- // Disable the suggestions based on Levenshtein distance that go along with 'unknown command' messages
- DisableSuggestions bool
- // If displaying suggestions, allows to set the minimum levenshtein distance to display, must be > 0
- SuggestionsMinimumDistance int
-
- // Disable the flag parsing. If this is true all flags will be passed to the command as arguments.
- DisableFlagParsing bool
-}
-
-// os.Args[1:] by default, if desired, can be overridden
-// particularly useful when testing.
-func (c *Command) SetArgs(a []string) {
- c.args = a
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-func (c *Command) SetOutput(output io.Writer) {
- c.output = &output
-}
-
-// Usage can be defined by application
-func (c *Command) SetUsageFunc(f func(*Command) error) {
- c.usageFunc = f
-}
-
-// Can be defined by Application
-func (c *Command) SetUsageTemplate(s string) {
- c.usageTemplate = s
-}
-
-// Can be defined by Application
-func (c *Command) SetHelpFunc(f func(*Command, []string)) {
- c.helpFunc = f
-}
-
-func (c *Command) SetHelpCommand(cmd *Command) {
- c.helpCommand = cmd
-}
-
-// Can be defined by Application
-func (c *Command) SetHelpTemplate(s string) {
- c.helpTemplate = s
-}
-
-// SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands.
-// The user should not have a cyclic dependency on commands.
-func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) {
- c.Flags().SetNormalizeFunc(n)
- c.PersistentFlags().SetNormalizeFunc(n)
- c.globNormFunc = n
-
- for _, command := range c.commands {
- command.SetGlobalNormalizationFunc(n)
- }
-}
-
-func (c *Command) OutOrStdout() io.Writer {
- return c.getOut(os.Stdout)
-}
-
-func (c *Command) OutOrStderr() io.Writer {
- return c.getOut(os.Stderr)
-}
-
-func (c *Command) getOut(def io.Writer) io.Writer {
- if c.output != nil {
- return *c.output
- }
- if c.HasParent() {
- return c.parent.getOut(def)
- }
- return def
-}
-
-// UsageFunc returns either the function set by SetUsageFunc for this command
-// or a parent, or it returns a default usage function
-func (c *Command) UsageFunc() (f func(*Command) error) {
- if c.usageFunc != nil {
- return c.usageFunc
- }
-
- if c.HasParent() {
- return c.parent.UsageFunc()
- }
- return func(c *Command) error {
- c.mergePersistentFlags()
- err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- return err
- }
-}
-
-// Output the usage for the command
-// Used when a user provides invalid input
-// Can be defined by user by overriding UsageFunc
-func (c *Command) Usage() error {
- return c.UsageFunc()(c)
-}
-
-// HelpFunc returns either the function set by SetHelpFunc for this command
-// or a parent, or it returns a function with default help behavior
-func (c *Command) HelpFunc() func(*Command, []string) {
- cmd := c
- for cmd != nil {
- if cmd.helpFunc != nil {
- return cmd.helpFunc
- }
- cmd = cmd.parent
- }
- return func(*Command, []string) {
- c.mergePersistentFlags()
- err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- }
-}
-
-// Output the help for the command
-// Used when a user calls help [command]
-// Can be defined by user by overriding HelpFunc
-func (c *Command) Help() error {
- c.HelpFunc()(c, []string{})
- return nil
-}
-
-func (c *Command) UsageString() string {
- tmpOutput := c.output
- bb := new(bytes.Buffer)
- c.SetOutput(bb)
- c.Usage()
- c.output = tmpOutput
- return bb.String()
-}
-
-var minUsagePadding = 25
-
-func (c *Command) UsagePadding() int {
- if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen {
- return minUsagePadding
- }
- return c.parent.commandsMaxUseLen
-}
-
-var minCommandPathPadding = 11
-
-//
-func (c *Command) CommandPathPadding() int {
- if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
- return minCommandPathPadding
- }
- return c.parent.commandsMaxCommandPathLen
-}
-
-var minNamePadding = 11
-
-func (c *Command) NamePadding() int {
- if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
- return minNamePadding
- }
- return c.parent.commandsMaxNameLen
-}
-
-func (c *Command) UsageTemplate() string {
- if c.usageTemplate != "" {
- return c.usageTemplate
- }
-
- if c.HasParent() {
- return c.parent.UsageTemplate()
- }
- return `Usage:{{if .Runnable}}
- {{if .HasAvailableFlags}}{{appendIfNotPresent .UseLine "[flags]"}}{{else}}{{.UseLine}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
- {{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}}
-
-Aliases:
- {{.NameAndAliases}}
-{{end}}{{if .HasExample}}
-
-Examples:
-{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
-
-Available Commands:{{range .Commands}}{{if .IsAvailableCommand}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableLocalFlags}}
-
-Flags:
-{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{ if .HasAvailableInheritedFlags}}
-
-Global Flags:
-{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
-
-Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
- {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasAvailableSubCommands }}
-
-Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
-`
-}
-
-func (c *Command) HelpTemplate() string {
- if c.helpTemplate != "" {
- return c.helpTemplate
- }
-
- if c.HasParent() {
- return c.parent.HelpTemplate()
- }
- return `{{with or .Long .Short }}{{. | trim}}
-
-{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
-}
-
-// Really only used when casting a command to a commander
-func (c *Command) resetChildrensParents() {
- for _, x := range c.commands {
- x.parent = c
- }
-}
-
-// Test if the named flag is a boolean flag.
-func isBooleanFlag(name string, f *flag.FlagSet) bool {
- flag := f.Lookup(name)
- if flag == nil {
- return false
- }
- return flag.Value.Type() == "bool"
-}
-
-// Test if the named flag is a boolean flag.
-func isBooleanShortFlag(name string, f *flag.FlagSet) bool {
- result := false
- f.VisitAll(func(f *flag.Flag) {
- if f.Shorthand == name && f.Value.Type() == "bool" {
- result = true
- }
- })
- return result
-}
-
-func stripFlags(args []string, c *Command) []string {
- if len(args) < 1 {
- return args
- }
- c.mergePersistentFlags()
-
- commands := []string{}
-
- inQuote := false
- inFlag := false
- for _, y := range args {
- if !inQuote {
- switch {
- case strings.HasPrefix(y, "\""):
- inQuote = true
- case strings.Contains(y, "=\""):
- inQuote = true
- case strings.HasPrefix(y, "--") && !strings.Contains(y, "="):
- // TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
- inFlag = !isBooleanFlag(y[2:], c.Flags())
- case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !isBooleanShortFlag(y[1:], c.Flags()):
- inFlag = true
- case inFlag:
- inFlag = false
- case y == "":
- // strip empty commands, as the go tests expect this to be ok....
- case !strings.HasPrefix(y, "-"):
- commands = append(commands, y)
- inFlag = false
- }
- }
-
- if strings.HasSuffix(y, "\"") && !strings.HasSuffix(y, "\\\"") {
- inQuote = false
- }
- }
-
- return commands
-}
-
-// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like
-// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]).
-func argsMinusFirstX(args []string, x string) []string {
- for i, y := range args {
- if x == y {
- ret := []string{}
- ret = append(ret, args[:i]...)
- ret = append(ret, args[i+1:]...)
- return ret
- }
- }
- return args
-}
-
-// find the target command given the args and command tree
-// Meant to be run on the highest node. Only searches down.
-func (c *Command) Find(args []string) (*Command, []string, error) {
- if c == nil {
- return nil, nil, fmt.Errorf("Called find() on a nil Command")
- }
-
- var innerfind func(*Command, []string) (*Command, []string)
-
- innerfind = func(c *Command, innerArgs []string) (*Command, []string) {
- argsWOflags := stripFlags(innerArgs, c)
- if len(argsWOflags) == 0 {
- return c, innerArgs
- }
- nextSubCmd := argsWOflags[0]
- matches := make([]*Command, 0)
- for _, cmd := range c.commands {
- if cmd.Name() == nextSubCmd || cmd.HasAlias(nextSubCmd) { // exact name or alias match
- return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd))
- }
- if EnablePrefixMatching {
- if strings.HasPrefix(cmd.Name(), nextSubCmd) { // prefix match
- matches = append(matches, cmd)
- }
- for _, x := range cmd.Aliases {
- if strings.HasPrefix(x, nextSubCmd) {
- matches = append(matches, cmd)
- }
- }
- }
- }
-
- // only accept a single prefix match - multiple matches would be ambiguous
- if len(matches) == 1 {
- return innerfind(matches[0], argsMinusFirstX(innerArgs, argsWOflags[0]))
- }
-
- return c, innerArgs
- }
-
- commandFound, a := innerfind(c, args)
- argsWOflags := stripFlags(a, commandFound)
-
- // no subcommand, always take args
- if !commandFound.HasSubCommands() {
- return commandFound, a, nil
- }
-
- // root command with subcommands, do subcommand checking
- if commandFound == c && len(argsWOflags) > 0 {
- suggestionsString := ""
- if !c.DisableSuggestions {
- if c.SuggestionsMinimumDistance <= 0 {
- c.SuggestionsMinimumDistance = 2
- }
- if suggestions := c.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 {
- suggestionsString += "\n\nDid you mean this?\n"
- for _, s := range suggestions {
- suggestionsString += fmt.Sprintf("\t%v\n", s)
- }
- }
- }
- return commandFound, a, fmt.Errorf("unknown command %q for %q%s", argsWOflags[0], commandFound.CommandPath(), suggestionsString)
- }
-
- return commandFound, a, nil
-}
-
-func (c *Command) SuggestionsFor(typedName string) []string {
- suggestions := []string{}
- for _, cmd := range c.commands {
- if cmd.IsAvailableCommand() {
- levenshteinDistance := ld(typedName, cmd.Name(), true)
- suggestByLevenshtein := levenshteinDistance <= c.SuggestionsMinimumDistance
- suggestByPrefix := strings.HasPrefix(strings.ToLower(cmd.Name()), strings.ToLower(typedName))
- if suggestByLevenshtein || suggestByPrefix {
- suggestions = append(suggestions, cmd.Name())
- }
- for _, explicitSuggestion := range cmd.SuggestFor {
- if strings.EqualFold(typedName, explicitSuggestion) {
- suggestions = append(suggestions, cmd.Name())
- }
- }
- }
- }
- return suggestions
-}
-
-func (c *Command) VisitParents(fn func(*Command)) {
- var traverse func(*Command) *Command
-
- traverse = func(x *Command) *Command {
- if x != c {
- fn(x)
- }
- if x.HasParent() {
- return traverse(x.parent)
- }
- return x
- }
- traverse(c)
-}
-
-func (c *Command) Root() *Command {
- var findRoot func(*Command) *Command
-
- findRoot = func(x *Command) *Command {
- if x.HasParent() {
- return findRoot(x.parent)
- }
- return x
- }
-
- return findRoot(c)
-}
-
-// ArgsLenAtDash will return the length of f.Args at the moment when a -- was
-// found during arg parsing. This allows your program to know which args were
-// before the -- and which came after. (Description from
-// https://godoc.org/github.com/spf13/pflag#FlagSet.ArgsLenAtDash).
-func (c *Command) ArgsLenAtDash() int {
- return c.Flags().ArgsLenAtDash()
-}
-
-func (c *Command) execute(a []string) (err error) {
- if c == nil {
- return fmt.Errorf("Called Execute() on a nil Command")
- }
-
- if len(c.Deprecated) > 0 {
- c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated)
- }
-
- // initialize help flag as the last point possible to allow for user
- // overriding
- c.initHelpFlag()
-
- err = c.ParseFlags(a)
- if err != nil {
- return err
- }
- // If help is called, regardless of other flags, return we want help
- // Also say we need help if the command isn't runnable.
- helpVal, err := c.Flags().GetBool("help")
- if err != nil {
- // should be impossible to get here as we always declare a help
- // flag in initHelpFlag()
- c.Println("\"help\" flag declared as non-bool. Please correct your code")
- return err
- }
-
- if helpVal || !c.Runnable() {
- return flag.ErrHelp
- }
-
- c.preRun()
-
- argWoFlags := c.Flags().Args()
- if c.DisableFlagParsing {
- argWoFlags = a
- }
-
- for p := c; p != nil; p = p.Parent() {
- if p.PersistentPreRunE != nil {
- if err := p.PersistentPreRunE(c, argWoFlags); err != nil {
- return err
- }
- break
- } else if p.PersistentPreRun != nil {
- p.PersistentPreRun(c, argWoFlags)
- break
- }
- }
- if c.PreRunE != nil {
- if err := c.PreRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PreRun != nil {
- c.PreRun(c, argWoFlags)
- }
-
- if c.RunE != nil {
- if err := c.RunE(c, argWoFlags); err != nil {
- return err
- }
- } else {
- c.Run(c, argWoFlags)
- }
- if c.PostRunE != nil {
- if err := c.PostRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PostRun != nil {
- c.PostRun(c, argWoFlags)
- }
- for p := c; p != nil; p = p.Parent() {
- if p.PersistentPostRunE != nil {
- if err := p.PersistentPostRunE(c, argWoFlags); err != nil {
- return err
- }
- break
- } else if p.PersistentPostRun != nil {
- p.PersistentPostRun(c, argWoFlags)
- break
- }
- }
-
- return nil
-}
-
-func (c *Command) preRun() {
- for _, x := range initializers {
- x()
- }
-}
-
-func (c *Command) errorMsgFromParse() string {
- s := c.flagErrorBuf.String()
-
- x := strings.Split(s, "\n")
-
- if len(x) > 0 {
- return x[0]
- }
- return ""
-}
-
-// Call execute to use the args (os.Args[1:] by default)
-// and run through the command tree finding appropriate matches
-// for commands and then corresponding flags.
-func (c *Command) Execute() error {
- _, err := c.ExecuteC()
- return err
-}
-
-func (c *Command) ExecuteC() (cmd *Command, err error) {
-
- // Regardless of what command execute is called on, run on Root only
- if c.HasParent() {
- return c.Root().ExecuteC()
- }
-
- // windows hook
- if preExecHookFn != nil {
- preExecHookFn(c)
- }
-
- // initialize help as the last point possible to allow for user
- // overriding
- c.initHelpCmd()
-
- var args []string
-
- // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
- if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
- args = os.Args[1:]
- } else {
- args = c.args
- }
-
- cmd, flags, err := c.Find(args)
- if err != nil {
- // If found parse to a subcommand and then failed, talk about the subcommand
- if cmd != nil {
- c = cmd
- }
- if !c.SilenceErrors {
- c.Println("Error:", err.Error())
- c.Printf("Run '%v --help' for usage.\n", c.CommandPath())
- }
- return c, err
- }
- err = cmd.execute(flags)
- if err != nil {
- // Always show help if requested, even if SilenceErrors is in
- // effect
- if err == flag.ErrHelp {
- cmd.HelpFunc()(cmd, args)
- return cmd, nil
- }
-
- // If root command has SilentErrors flagged,
- // all subcommands should respect it
- if !cmd.SilenceErrors && !c.SilenceErrors {
- c.Println("Error:", err.Error())
- }
-
- // If root command has SilentUsage flagged,
- // all subcommands should respect it
- if !cmd.SilenceUsage && !c.SilenceUsage {
- c.Println(cmd.UsageString())
- }
- return cmd, err
- }
- return cmd, nil
-}
-
-func (c *Command) initHelpFlag() {
- if c.Flags().Lookup("help") == nil {
- c.Flags().BoolP("help", "h", false, "help for "+c.Name())
- }
-}
-
-func (c *Command) initHelpCmd() {
- if c.helpCommand == nil {
- if !c.HasSubCommands() {
- return
- }
-
- c.helpCommand = &Command{
- Use: "help [command]",
- Short: "Help about any command",
- Long: `Help provides help for any command in the application.
- Simply type ` + c.Name() + ` help [path to command] for full details.`,
- PersistentPreRun: func(cmd *Command, args []string) {},
- PersistentPostRun: func(cmd *Command, args []string) {},
-
- Run: func(c *Command, args []string) {
- cmd, _, e := c.Root().Find(args)
- if cmd == nil || e != nil {
- c.Printf("Unknown help topic %#q.", args)
- c.Root().Usage()
- } else {
- cmd.Help()
- }
- },
- }
- }
- c.AddCommand(c.helpCommand)
-}
-
-// Used for testing
-func (c *Command) ResetCommands() {
- c.commands = nil
- c.helpCommand = nil
-}
-
-// Sorts commands by their names
-type commandSorterByName []*Command
-
-func (c commandSorterByName) Len() int { return len(c) }
-func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
-func (c commandSorterByName) Less(i, j int) bool { return c[i].Name() < c[j].Name() }
-
-// Commands returns a sorted slice of child commands.
-func (c *Command) Commands() []*Command {
- // do not sort commands if it already sorted or sorting was disabled
- if EnableCommandSorting && !c.commandsAreSorted {
- sort.Sort(commandSorterByName(c.commands))
- c.commandsAreSorted = true
- }
- return c.commands
-}
-
-// AddCommand adds one or more commands to this parent command.
-func (c *Command) AddCommand(cmds ...*Command) {
- for i, x := range cmds {
- if cmds[i] == c {
- panic("Command can't be a child of itself")
- }
- cmds[i].parent = c
- // update max lengths
- usageLen := len(x.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(x.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(x.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- // If global normalization function exists, update all children
- if c.globNormFunc != nil {
- x.SetGlobalNormalizationFunc(c.globNormFunc)
- }
- c.commands = append(c.commands, x)
- c.commandsAreSorted = false
- }
-}
-
-// RemoveCommand removes one or more commands from a parent command.
-func (c *Command) RemoveCommand(cmds ...*Command) {
- commands := []*Command{}
-main:
- for _, command := range c.commands {
- for _, cmd := range cmds {
- if command == cmd {
- command.parent = nil
- continue main
- }
- }
- commands = append(commands, command)
- }
- c.commands = commands
- // recompute all lengths
- c.commandsMaxUseLen = 0
- c.commandsMaxCommandPathLen = 0
- c.commandsMaxNameLen = 0
- for _, command := range c.commands {
- usageLen := len(command.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(command.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(command.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- }
-}
-
-// Print is a convenience method to Print to the defined output, fallback to Stderr if not set
-func (c *Command) Print(i ...interface{}) {
- fmt.Fprint(c.OutOrStderr(), i...)
-}
-
-// Println is a convenience method to Println to the defined output, fallback to Stderr if not set
-func (c *Command) Println(i ...interface{}) {
- str := fmt.Sprintln(i...)
- c.Print(str)
-}
-
-// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set
-func (c *Command) Printf(format string, i ...interface{}) {
- str := fmt.Sprintf(format, i...)
- c.Print(str)
-}
-
-// CommandPath returns the full path to this command.
-func (c *Command) CommandPath() string {
- str := c.Name()
- x := c
- for x.HasParent() {
- str = x.parent.Name() + " " + str
- x = x.parent
- }
- return str
-}
-
-//The full usage for a given command (including parents)
-func (c *Command) UseLine() string {
- str := ""
- if c.HasParent() {
- str = c.parent.CommandPath() + " "
- }
- return str + c.Use
-}
-
-// For use in determining which flags have been assigned to which commands
-// and which persist
-func (c *Command) DebugFlags() {
- c.Println("DebugFlags called on", c.Name())
- var debugflags func(*Command)
-
- debugflags = func(x *Command) {
- if x.HasFlags() || x.HasPersistentFlags() {
- c.Println(x.Name())
- }
- if x.HasFlags() {
- x.flags.VisitAll(func(f *flag.Flag) {
- if x.HasPersistentFlags() {
- if x.persistentFlag(f.Name) == nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]")
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]")
- }
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]")
- }
- })
- }
- if x.HasPersistentFlags() {
- x.pflags.VisitAll(func(f *flag.Flag) {
- if x.HasFlags() {
- if x.flags.Lookup(f.Name) == nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- })
- }
- c.Println(x.flagErrorBuf)
- if x.HasSubCommands() {
- for _, y := range x.commands {
- debugflags(y)
- }
- }
- }
-
- debugflags(c)
-}
-
-// Name returns the command's name: the first word in the use line.
-func (c *Command) Name() string {
- if c.name != "" {
- return c.name
- }
- name := c.Use
- i := strings.Index(name, " ")
- if i >= 0 {
- name = name[:i]
- }
- return name
-}
-
-// HasAlias determines if a given string is an alias of the command.
-func (c *Command) HasAlias(s string) bool {
- for _, a := range c.Aliases {
- if a == s {
- return true
- }
- }
- return false
-}
-
-func (c *Command) NameAndAliases() string {
- return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ")
-}
-
-func (c *Command) HasExample() bool {
- return len(c.Example) > 0
-}
-
-// Runnable determines if the command is itself runnable
-func (c *Command) Runnable() bool {
- return c.Run != nil || c.RunE != nil
-}
-
-// HasSubCommands determines if the command has children commands
-func (c *Command) HasSubCommands() bool {
- return len(c.commands) > 0
-}
-
-// IsAvailableCommand determines if a command is available as a non-help command
-// (this includes all non deprecated/hidden commands)
-func (c *Command) IsAvailableCommand() bool {
- if len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- if c.HasParent() && c.Parent().helpCommand == c {
- return false
- }
-
- if c.Runnable() || c.HasAvailableSubCommands() {
- return true
- }
-
- return false
-}
-
-// IsHelpCommand determines if a command is a 'help' command; a help command is
-// determined by the fact that it is NOT runnable/hidden/deprecated, and has no
-// sub commands that are runnable/hidden/deprecated
-func (c *Command) IsHelpCommand() bool {
-
- // if a command is runnable, deprecated, or hidden it is not a 'help' command
- if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- // if any non-help sub commands are found, the command is not a 'help' command
- for _, sub := range c.commands {
- if !sub.IsHelpCommand() {
- return false
- }
- }
-
- // the command either has no sub commands, or no non-help sub commands
- return true
-}
-
-// HasHelpSubCommands determines if a command has any avilable 'help' sub commands
-// that need to be shown in the usage/help default template under 'additional help
-// topics'
-func (c *Command) HasHelpSubCommands() bool {
-
- // return true on the first found available 'help' sub command
- for _, sub := range c.commands {
- if sub.IsHelpCommand() {
- return true
- }
- }
-
- // the command either has no sub commands, or no available 'help' sub commands
- return false
-}
-
-// HasAvailableSubCommands determines if a command has available sub commands that
-// need to be shown in the usage/help default template under 'available commands'
-func (c *Command) HasAvailableSubCommands() bool {
-
- // return true on the first found available (non deprecated/help/hidden)
- // sub command
- for _, sub := range c.commands {
- if sub.IsAvailableCommand() {
- return true
- }
- }
-
- // the command either has no sub comamnds, or no available (non deprecated/help/hidden)
- // sub commands
- return false
-}
-
-// Determine if the command is a child command
-func (c *Command) HasParent() bool {
- return c.parent != nil
-}
-
-// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists
-func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
- return c.globNormFunc
-}
-
-// Get the complete FlagSet that applies to this command (local and persistent declared here and by all parents)
-func (c *Command) Flags() *flag.FlagSet {
- if c.flags == nil {
- c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.flags.SetOutput(c.flagErrorBuf)
- }
- return c.flags
-}
-
-// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands
-func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
- persistentFlags := c.PersistentFlags()
-
- out := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.LocalFlags().VisitAll(func(f *flag.Flag) {
- if persistentFlags.Lookup(f.Name) == nil {
- out.AddFlag(f)
- }
- })
- return out
-}
-
-// Get the local FlagSet specifically set in the current command
-func (c *Command) LocalFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- local := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.lflags.VisitAll(func(f *flag.Flag) {
- local.AddFlag(f)
- })
- if !c.HasParent() {
- flag.CommandLine.VisitAll(func(f *flag.Flag) {
- if local.Lookup(f.Name) == nil {
- local.AddFlag(f)
- }
- })
- }
- return local
-}
-
-// All Flags which were inherited from parents commands
-func (c *Command) InheritedFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- inherited := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- local := c.LocalFlags()
-
- var rmerge func(x *Command)
-
- rmerge = func(x *Command) {
- if x.HasPersistentFlags() {
- x.PersistentFlags().VisitAll(func(f *flag.Flag) {
- if inherited.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil {
- inherited.AddFlag(f)
- }
- })
- }
- if x.HasParent() {
- rmerge(x.parent)
- }
- }
-
- if c.HasParent() {
- rmerge(c.parent)
- }
-
- return inherited
-}
-
-// All Flags which were not inherited from parent commands
-func (c *Command) NonInheritedFlags() *flag.FlagSet {
- return c.LocalFlags()
-}
-
-// Get the Persistent FlagSet specifically set in the current command
-func (c *Command) PersistentFlags() *flag.FlagSet {
- if c.pflags == nil {
- c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.pflags.SetOutput(c.flagErrorBuf)
- }
- return c.pflags
-}
-
-// For use in testing
-func (c *Command) ResetFlags() {
- c.flagErrorBuf = new(bytes.Buffer)
- c.flagErrorBuf.Reset()
- c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.flags.SetOutput(c.flagErrorBuf)
- c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.pflags.SetOutput(c.flagErrorBuf)
-}
-
-// Does the command contain any flags (local plus persistent from the entire structure)
-func (c *Command) HasFlags() bool {
- return c.Flags().HasFlags()
-}
-
-// Does the command contain persistent flags
-func (c *Command) HasPersistentFlags() bool {
- return c.PersistentFlags().HasFlags()
-}
-
-// Does the command has flags specifically declared locally
-func (c *Command) HasLocalFlags() bool {
- return c.LocalFlags().HasFlags()
-}
-
-// Does the command have flags inherited from its parent command
-func (c *Command) HasInheritedFlags() bool {
- return c.InheritedFlags().HasFlags()
-}
-
-// Does the command contain any flags (local plus persistent from the entire
-// structure) which are not hidden or deprecated
-func (c *Command) HasAvailableFlags() bool {
- return c.Flags().HasAvailableFlags()
-}
-
-// Does the command contain persistent flags which are not hidden or deprecated
-func (c *Command) HasAvailablePersistentFlags() bool {
- return c.PersistentFlags().HasAvailableFlags()
-}
-
-// Does the command has flags specifically declared locally which are not hidden
-// or deprecated
-func (c *Command) HasAvailableLocalFlags() bool {
- return c.LocalFlags().HasAvailableFlags()
-}
-
-// Does the command have flags inherited from its parent command which are
-// not hidden or deprecated
-func (c *Command) HasAvailableInheritedFlags() bool {
- return c.InheritedFlags().HasAvailableFlags()
-}
-
-// Flag climbs up the command tree looking for matching flag
-func (c *Command) Flag(name string) (flag *flag.Flag) {
- flag = c.Flags().Lookup(name)
-
- if flag == nil {
- flag = c.persistentFlag(name)
- }
-
- return
-}
-
-// recursively find matching persistent flag
-func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
- if c.HasPersistentFlags() {
- flag = c.PersistentFlags().Lookup(name)
- }
-
- if flag == nil && c.HasParent() {
- flag = c.parent.persistentFlag(name)
- }
- return
-}
-
-// ParseFlags parses persistent flag tree & local flags
-func (c *Command) ParseFlags(args []string) (err error) {
- if c.DisableFlagParsing {
- return nil
- }
- c.mergePersistentFlags()
- err = c.Flags().Parse(args)
- return
-}
-
-// Parent returns a commands parent command
-func (c *Command) Parent() *Command {
- return c.parent
-}
-
-func (c *Command) mergePersistentFlags() {
- var rmerge func(x *Command)
-
- // Save the set of local flags
- if c.lflags == nil {
- c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.lflags.SetOutput(c.flagErrorBuf)
- addtolocal := func(f *flag.Flag) {
- c.lflags.AddFlag(f)
- }
- c.Flags().VisitAll(addtolocal)
- c.PersistentFlags().VisitAll(addtolocal)
- }
- rmerge = func(x *Command) {
- if !x.HasParent() {
- flag.CommandLine.VisitAll(func(f *flag.Flag) {
- if x.PersistentFlags().Lookup(f.Name) == nil {
- x.PersistentFlags().AddFlag(f)
- }
- })
- }
- if x.HasPersistentFlags() {
- x.PersistentFlags().VisitAll(func(f *flag.Flag) {
- if c.Flags().Lookup(f.Name) == nil {
- c.Flags().AddFlag(f)
- }
- })
- }
- if x.HasParent() {
- rmerge(x.parent)
- }
- }
-
- rmerge(c)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/command_notwin.go b/archived/event-adapter/vendor/github.com/spf13/cobra/command_notwin.go
deleted file mode 100644
index 6159c1cc1..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/command_notwin.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !windows
-
-package cobra
-
-var preExecHookFn func(*Command)
diff --git a/archived/event-adapter/vendor/github.com/spf13/cobra/command_win.go b/archived/event-adapter/vendor/github.com/spf13/cobra/command_win.go
deleted file mode 100644
index 4b0eaa1b6..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/cobra/command_win.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build windows
-
-package cobra
-
-import (
- "os"
- "time"
-
- "github.com/inconshreveable/mousetrap"
-)
-
-var preExecHookFn = preExecHook
-
-// enables an information splash screen on Windows if the CLI is started from explorer.exe.
-var MousetrapHelpText string = `This is a command line tool
-
-You need to open cmd.exe and run it from there.
-`
-
-func preExecHook(c *Command) {
- if mousetrap.StartedByExplorer() {
- c.Print(MousetrapHelpText)
- time.Sleep(5 * time.Second)
- os.Exit(1)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/.gitignore b/archived/event-adapter/vendor/github.com/spf13/pflag/.gitignore
deleted file mode 100644
index c3da29013..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.idea/*
-
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/.travis.yml b/archived/event-adapter/vendor/github.com/spf13/pflag/.travis.yml
deleted file mode 100644
index 707bdc39a..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-sudo: false
-
-language: go
-
-go:
- - 1.6.3
- - 1.7.3
- - tip
-
-matrix:
- allow_failures:
- - go: tip
-install:
- - go get github.com/golang/lint/golint
- - export PATH=$GOPATH/bin:$PATH
- - go install ./...
-
-script:
- - verify/all.sh -v
- - go test ./...
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/LICENSE b/archived/event-adapter/vendor/github.com/spf13/pflag/LICENSE
deleted file mode 100644
index 63ed1cfea..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2012 Alex Ogier. All rights reserved.
-Copyright (c) 2012 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/README.md b/archived/event-adapter/vendor/github.com/spf13/pflag/README.md
deleted file mode 100644
index eefb46dec..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/README.md
+++ /dev/null
@@ -1,277 +0,0 @@
-[![Build Status](https://travis-ci.org/spf13/pflag.svg?branch=master)](https://travis-ci.org/spf13/pflag)
-[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/pflag)](https://goreportcard.com/report/github.com/spf13/pflag)
-[![GoDoc](https://godoc.org/github.com/spf13/pflag?status.svg)](https://godoc.org/github.com/spf13/pflag)
-
-## Description
-
-pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the [GNU extensions to the POSIX recommendations
-for command-line options][1]. For a more precise description, see the
-"Command-line flag syntax" section below.
-
-[1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-pflag is available under the same style of BSD license as the Go language,
-which can be found in the LICENSE file.
-
-## Installation
-
-pflag is available using the standard `go get` command.
-
-Install by running:
-
- go get github.com/spf13/pflag
-
-Run tests by running:
-
- go test github.com/spf13/pflag
-
-## Usage
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
-``` go
-import flag "github.com/spf13/pflag"
-```
-
-There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
-
-``` go
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-```
-
-If you like, you can bind the flag to a variable using the Var() functions.
-
-``` go
-var flagvar int
-func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
-}
-```
-
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
-
-``` go
-flag.Var(&flagVal, "name", "help message for flagname")
-```
-
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
-
-``` go
-flag.Parse()
-```
-
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
-
-``` go
-fmt.Println("ip has value ", *ip)
-fmt.Println("flagvar has value ", flagvar)
-```
-
-There are helpers function to get values later if you have the FlagSet but
-it was difficult to keep up with all of the flag pointers in your code.
-If you have a pflag.FlagSet with a flag called 'flagname' of type int you
-can use GetInt() to get the int value. But notice that 'flagname' must exist
-and it must be an int. GetString("flagname") will fail.
-
-``` go
-i, err := flagset.GetInt("flagname")
-```
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-var flagvar bool
-func init() {
- flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
-}
-flag.VarP(&flagVal, "varname", "v", "help message")
-```
-
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-
-## Setting no option default values for flags
-
-After you create a flag it is possible to set the pflag.NoOptDefVal for
-the given flag. Doing this changes the meaning of the flag slightly. If
-a flag has a NoOptDefVal and the flag is set on the command line without
-an option the flag will be set to the NoOptDefVal. For example given:
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-flag.Lookup("flagname").NoOptDefVal = "4321"
-```
-
-Would result in something like
-
-| Parsed Arguments | Resulting Value |
-| ------------- | ------------- |
-| --flagname=1357 | ip=1357 |
-| --flagname | ip=4321 |
-| [nothing] | ip=1234 |
-
-## Command line flag syntax
-
-```
---flag // boolean flags, or flags with no option default values
---flag x // only on flags without a default value
---flag=x
-```
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags
-or a flag with a default value
-
-```
-// boolean or flags where the 'no option default value' is set
--f
--f=true
--abc
-but
--b true is INVALID
-
-// non-boolean and flags without a 'no option default value'
--n 1234
--n=1234
--n1234
-
-// mixed
--abcs "hello"
--absd="hello"
--abcs1234
-```
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-## Mutating or "Normalizing" Flag names
-
-It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow.
-
-**Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag
-
-``` go
-func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- from := []string{"-", "_"}
- to := "."
- for _, sep := range from {
- name = strings.Replace(name, sep, to, -1)
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc)
-```
-
-**Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name
-
-``` go
-func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- switch name {
- case "old-flag-name":
- name = "new-flag-name"
- break
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(aliasNormalizeFunc)
-```
-
-## Deprecating a flag or its shorthand
-It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used.
-
-**Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead.
-```go
-// deprecate a flag by specifying its name and a usage message
-flags.MarkDeprecated("badflag", "please use --good-flag instead")
-```
-This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used.
-
-**Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n".
-```go
-// deprecate a flag shorthand by specifying its flag name and a usage message
-flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only")
-```
-This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used.
-
-Note that usage message is essential here, and it should not be empty.
-
-## Hidden flags
-It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text.
-
-**Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available.
-```go
-// hide a flag by specifying its name
-flags.MarkHidden("secretFlag")
-```
-
-## Supporting Go flags when using pflag
-In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary
-to support flags defined by third-party dependencies (e.g. `golang/glog`).
-
-**Example**: You want to add the Go flags to the `CommandLine` flagset
-```go
-import (
- goflag "flag"
- flag "github.com/spf13/pflag"
-)
-
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-
-func main() {
- flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
- flag.Parse()
-}
-```
-
-## More info
-
-You can see the full reference documentation of the pflag package
-[at godoc.org][3], or through go's standard documentation system by
-running `godoc -http=:6060` and browsing to
-[http://localhost:6060/pkg/github.com/ogier/pflag][2] after
-installation.
-
-[2]: http://localhost:6060/pkg/github.com/ogier/pflag
-[3]: http://godoc.org/github.com/ogier/pflag
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/bool.go b/archived/event-adapter/vendor/github.com/spf13/pflag/bool.go
deleted file mode 100644
index c4c5c0bfd..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/bool.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import "strconv"
-
-// optional interface to indicate boolean flags that can be
-// supplied without "=value" text
-type boolFlag interface {
- Value
- IsBoolFlag() bool
-}
-
-// -- bool Value
-type boolValue bool
-
-func newBoolValue(val bool, p *bool) *boolValue {
- *p = val
- return (*boolValue)(p)
-}
-
-func (b *boolValue) Set(s string) error {
- v, err := strconv.ParseBool(s)
- *b = boolValue(v)
- return err
-}
-
-func (b *boolValue) Type() string {
- return "bool"
-}
-
-func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
-
-func (b *boolValue) IsBoolFlag() bool { return true }
-
-func boolConv(sval string) (interface{}, error) {
- return strconv.ParseBool(sval)
-}
-
-// GetBool return the bool value of a flag with the given name
-func (f *FlagSet) GetBool(name string) (bool, error) {
- val, err := f.getFlagType(name, "bool", boolConv)
- if err != nil {
- return false, err
- }
- return val.(bool), nil
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {
- f.BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func BoolVar(p *bool, name string, value bool, usage string) {
- BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func (f *FlagSet) Bool(name string, value bool, usage string) *bool {
- return f.BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool {
- p := new(bool)
- f.BoolVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func Bool(name string, value bool, usage string) *bool {
- return BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func BoolP(name, shorthand string, value bool, usage string) *bool {
- b := CommandLine.BoolP(name, shorthand, value, usage)
- return b
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/bool_slice.go b/archived/event-adapter/vendor/github.com/spf13/pflag/bool_slice.go
deleted file mode 100644
index 5af02f1a7..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/bool_slice.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package pflag
-
-import (
- "io"
- "strconv"
- "strings"
-)
-
-// -- boolSlice Value
-type boolSliceValue struct {
- value *[]bool
- changed bool
-}
-
-func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue {
- bsv := new(boolSliceValue)
- bsv.value = p
- *bsv.value = val
- return bsv
-}
-
-// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag.
-// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended.
-func (s *boolSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- boolStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse boolean values into slice
- out := make([]bool, 0, len(boolStrSlice))
- for _, boolStr := range boolStrSlice {
- b, err := strconv.ParseBool(strings.TrimSpace(boolStr))
- if err != nil {
- return err
- }
- out = append(out, b)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *boolSliceValue) Type() string {
- return "boolSlice"
-}
-
-// String defines a "native" format for this boolean slice flag value.
-func (s *boolSliceValue) String() string {
-
- boolStrSlice := make([]string, len(*s.value))
- for i, b := range *s.value {
- boolStrSlice[i] = strconv.FormatBool(b)
- }
-
- out, _ := writeAsCSV(boolStrSlice)
-
- return "[" + out + "]"
-}
-
-func boolSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []bool{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]bool, len(ss))
- for i, t := range ss {
- var err error
- out[i], err = strconv.ParseBool(t)
- if err != nil {
- return nil, err
- }
- }
- return out, nil
-}
-
-// GetBoolSlice returns the []bool value of a flag with the given name.
-func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) {
- val, err := f.getFlagType(name, "boolSlice", boolSliceConv)
- if err != nil {
- return []bool{}, err
- }
- return val.([]bool), nil
-}
-
-// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSliceVar defines a []bool flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func BoolSlice(name string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, "", value, usage)
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/count.go b/archived/event-adapter/vendor/github.com/spf13/pflag/count.go
deleted file mode 100644
index d22be41f2..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/count.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- count Value
-type countValue int
-
-func newCountValue(val int, p *int) *countValue {
- *p = val
- return (*countValue)(p)
-}
-
-func (i *countValue) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- // -1 means that no specific value was passed, so increment
- if v == -1 {
- *i = countValue(*i + 1)
- } else {
- *i = countValue(v)
- }
- return err
-}
-
-func (i *countValue) Type() string {
- return "count"
-}
-
-func (i *countValue) String() string { return strconv.Itoa(int(*i)) }
-
-func countConv(sval string) (interface{}, error) {
- i, err := strconv.Atoi(sval)
- if err != nil {
- return nil, err
- }
- return i, nil
-}
-
-// GetCount return the int value of a flag with the given name
-func (f *FlagSet) GetCount(name string) (int, error) {
- val, err := f.getFlagType(name, "count", countConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// CountVar defines a count flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func (f *FlagSet) CountVar(p *int, name string, usage string) {
- f.CountVarP(p, name, "", usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) {
- flag := f.VarPF(newCountValue(0, p), name, shorthand, usage)
- flag.NoOptDefVal = "-1"
-}
-
-// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set
-func CountVar(p *int, name string, usage string) {
- CommandLine.CountVar(p, name, usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func CountVarP(p *int, name, shorthand string, usage string) {
- CommandLine.CountVarP(p, name, shorthand, usage)
-}
-
-// Count defines a count flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func (f *FlagSet) Count(name string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, "", usage)
- return p
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, shorthand, usage)
- return p
-}
-
-// Count like Count only the flag is placed on the CommandLine isntead of a given flag set
-func Count(name string, usage string) *int {
- return CommandLine.CountP(name, "", usage)
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func CountP(name, shorthand string, usage string) *int {
- return CommandLine.CountP(name, shorthand, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/duration.go b/archived/event-adapter/vendor/github.com/spf13/pflag/duration.go
deleted file mode 100644
index e9debef88..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/duration.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package pflag
-
-import (
- "time"
-)
-
-// -- time.Duration Value
-type durationValue time.Duration
-
-func newDurationValue(val time.Duration, p *time.Duration) *durationValue {
- *p = val
- return (*durationValue)(p)
-}
-
-func (d *durationValue) Set(s string) error {
- v, err := time.ParseDuration(s)
- *d = durationValue(v)
- return err
-}
-
-func (d *durationValue) Type() string {
- return "duration"
-}
-
-func (d *durationValue) String() string { return (*time.Duration)(d).String() }
-
-func durationConv(sval string) (interface{}, error) {
- return time.ParseDuration(sval)
-}
-
-// GetDuration return the duration value of a flag with the given name
-func (f *FlagSet) GetDuration(name string) (time.Duration, error) {
- val, err := f.getFlagType(name, "duration", durationConv)
- if err != nil {
- return 0, err
- }
- return val.(time.Duration), nil
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, "", value, usage)
- return p
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func Duration(name string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, "", value, usage)
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/flag.go b/archived/event-adapter/vendor/github.com/spf13/pflag/flag.go
deleted file mode 100644
index 746af6327..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/flag.go
+++ /dev/null
@@ -1,1063 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the GNU extensions to the POSIX recommendations
-for command-line options. See
-http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-Usage:
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
- import flag "github.com/ogier/pflag"
-
- There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
- var ip = flag.Int("flagname", 1234, "help message for flagname")
-If you like, you can bind the flag to a variable using the Var() functions.
- var flagvar int
- func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
- }
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
- flag.Var(&flagVal, "name", "help message for flagname")
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
- flag.Parse()
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
- fmt.Println("ip has value ", *ip)
- fmt.Println("flagvar has value ", flagvar)
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
- var ip = flag.IntP("flagname", "f", 1234, "help message")
- var flagvar bool
- func init() {
- flag.BoolVarP("boolname", "b", true, "help message")
- }
- flag.VarP(&flagVar, "varname", "v", 1234, "help message")
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-Command line flag syntax:
- --flag // boolean flags only
- --flag=x
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags.
- // boolean flags
- -f
- -abc
- // non-boolean flags
- -n 1234
- -Ifile
- // mixed
- -abcs "hello"
- -abcn1234
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-*/
-package pflag
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-)
-
-// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
-var ErrHelp = errors.New("pflag: help requested")
-
-// ErrorHandling defines how to handle flag parsing errors.
-type ErrorHandling int
-
-const (
- // ContinueOnError will return an err from Parse() if an error is found
- ContinueOnError ErrorHandling = iota
- // ExitOnError will call os.Exit(2) if an error is found when parsing
- ExitOnError
- // PanicOnError will panic() if an error is found when parsing flags
- PanicOnError
-)
-
-// NormalizedName is a flag name that has been normalized according to rules
-// for the FlagSet (e.g. making '-' and '_' equivalent).
-type NormalizedName string
-
-// A FlagSet represents a set of defined flags.
-type FlagSet struct {
- // Usage is the function called when an error occurs while parsing flags.
- // The field is a function (not a method) that may be changed to point to
- // a custom error handler.
- Usage func()
-
- name string
- parsed bool
- actual map[NormalizedName]*Flag
- formal map[NormalizedName]*Flag
- shorthands map[byte]*Flag
- args []string // arguments after flags
- argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no --
- exitOnError bool // does the program exit if there's an error?
- errorHandling ErrorHandling
- output io.Writer // nil means stderr; use out() accessor
- interspersed bool // allow interspersed option/non-option args
- normalizeNameFunc func(f *FlagSet, name string) NormalizedName
-}
-
-// A Flag represents the state of a flag.
-type Flag struct {
- Name string // name as it appears on command line
- Shorthand string // one-letter abbreviated flag
- Usage string // help message
- Value Value // value as set
- DefValue string // default value (as text); for usage message
- Changed bool // If the user set the value (or if left to default)
- NoOptDefVal string //default value (as text); if the flag is on the command line without any options
- Deprecated string // If this flag is deprecated, this string is the new or now thing to use
- Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text
- ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use
- Annotations map[string][]string // used by cobra.Command bash autocomple code
-}
-
-// Value is the interface to the dynamic value stored in a flag.
-// (The default value is represented as a string.)
-type Value interface {
- String() string
- Set(string) error
- Type() string
-}
-
-// sortFlags returns the flags as a slice in lexicographical sorted order.
-func sortFlags(flags map[NormalizedName]*Flag) []*Flag {
- list := make(sort.StringSlice, len(flags))
- i := 0
- for k := range flags {
- list[i] = string(k)
- i++
- }
- list.Sort()
- result := make([]*Flag, len(list))
- for i, name := range list {
- result[i] = flags[NormalizedName(name)]
- }
- return result
-}
-
-// SetNormalizeFunc allows you to add a function which can translate flag names.
-// Flags added to the FlagSet will be translated and then when anything tries to
-// look up the flag that will also be translated. So it would be possible to create
-// a flag named "getURL" and have it translated to "geturl". A user could then pass
-// "--getUrl" which may also be translated to "geturl" and everything will work.
-func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) {
- f.normalizeNameFunc = n
- for k, v := range f.formal {
- delete(f.formal, k)
- nname := f.normalizeFlagName(string(k))
- f.formal[nname] = v
- v.Name = string(nname)
- }
-}
-
-// GetNormalizeFunc returns the previously set NormalizeFunc of a function which
-// does no translation, if not set previously.
-func (f *FlagSet) GetNormalizeFunc() func(f *FlagSet, name string) NormalizedName {
- if f.normalizeNameFunc != nil {
- return f.normalizeNameFunc
- }
- return func(f *FlagSet, name string) NormalizedName { return NormalizedName(name) }
-}
-
-func (f *FlagSet) normalizeFlagName(name string) NormalizedName {
- n := f.GetNormalizeFunc()
- return n(f, name)
-}
-
-func (f *FlagSet) out() io.Writer {
- if f.output == nil {
- return os.Stderr
- }
- return f.output
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-func (f *FlagSet) SetOutput(output io.Writer) {
- f.output = output
-}
-
-// VisitAll visits the flags in lexicographical order, calling fn for each.
-// It visits all flags, even those not set.
-func (f *FlagSet) VisitAll(fn func(*Flag)) {
- for _, flag := range sortFlags(f.formal) {
- fn(flag)
- }
-}
-
-// HasFlags returns a bool to indicate if the FlagSet has any flags definied.
-func (f *FlagSet) HasFlags() bool {
- return len(f.formal) > 0
-}
-
-// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags
-// definied that are not hidden or deprecated.
-func (f *FlagSet) HasAvailableFlags() bool {
- for _, flag := range f.formal {
- if !flag.Hidden && len(flag.Deprecated) == 0 {
- return true
- }
- }
- return false
-}
-
-// VisitAll visits the command-line flags in lexicographical order, calling
-// fn for each. It visits all flags, even those not set.
-func VisitAll(fn func(*Flag)) {
- CommandLine.VisitAll(fn)
-}
-
-// Visit visits the flags in lexicographical order, calling fn for each.
-// It visits only those flags that have been set.
-func (f *FlagSet) Visit(fn func(*Flag)) {
- for _, flag := range sortFlags(f.actual) {
- fn(flag)
- }
-}
-
-// Visit visits the command-line flags in lexicographical order, calling fn
-// for each. It visits only those flags that have been set.
-func Visit(fn func(*Flag)) {
- CommandLine.Visit(fn)
-}
-
-// Lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) Lookup(name string) *Flag {
- return f.lookup(f.normalizeFlagName(name))
-}
-
-// lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) lookup(name NormalizedName) *Flag {
- return f.formal[name]
-}
-
-// func to return a given type for a given flag name
-func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) {
- flag := f.Lookup(name)
- if flag == nil {
- err := fmt.Errorf("flag accessed but not defined: %s", name)
- return nil, err
- }
-
- if flag.Value.Type() != ftype {
- err := fmt.Errorf("trying to get %s value of flag of type %s", ftype, flag.Value.Type())
- return nil, err
- }
-
- sval := flag.Value.String()
- result, err := convFunc(sval)
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// ArgsLenAtDash will return the length of f.Args at the moment when a -- was
-// found during arg parsing. This allows your program to know which args were
-// before the -- and which came after.
-func (f *FlagSet) ArgsLenAtDash() int {
- return f.argsLenAtDash
-}
-
-// MarkDeprecated indicated that a flag is deprecated in your program. It will
-// continue to function but will not show up in help or usage messages. Using
-// this flag will also print the given usageMessage.
-func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if len(usageMessage) == 0 {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.Deprecated = usageMessage
- return nil
-}
-
-// MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your
-// program. It will continue to function but will not show up in help or usage
-// messages. Using this flag will also print the given usageMessage.
-func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if len(usageMessage) == 0 {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.ShorthandDeprecated = usageMessage
- return nil
-}
-
-// MarkHidden sets a flag to 'hidden' in your program. It will continue to
-// function but will not show up in help or usage messages.
-func (f *FlagSet) MarkHidden(name string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- flag.Hidden = true
- return nil
-}
-
-// Lookup returns the Flag structure of the named command-line flag,
-// returning nil if none exists.
-func Lookup(name string) *Flag {
- return CommandLine.Lookup(name)
-}
-
-// Set sets the value of the named flag.
-func (f *FlagSet) Set(name, value string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
- err := flag.Value.Set(value)
- if err != nil {
- return err
- }
- if f.actual == nil {
- f.actual = make(map[NormalizedName]*Flag)
- }
- f.actual[normalName] = flag
- flag.Changed = true
- if len(flag.Deprecated) > 0 {
- fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
- }
- return nil
-}
-
-// SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet.
-// This is sometimes used by spf13/cobra programs which want to generate additional
-// bash completion information.
-func (f *FlagSet) SetAnnotation(name, key string, values []string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
- if flag.Annotations == nil {
- flag.Annotations = map[string][]string{}
- }
- flag.Annotations[key] = values
- return nil
-}
-
-// Changed returns true if the flag was explicitly set during Parse() and false
-// otherwise
-func (f *FlagSet) Changed(name string) bool {
- flag := f.Lookup(name)
- // If a flag doesn't exist, it wasn't changed....
- if flag == nil {
- return false
- }
- return flag.Changed
-}
-
-// Set sets the value of the named command-line flag.
-func Set(name, value string) error {
- return CommandLine.Set(name, value)
-}
-
-// PrintDefaults prints, to standard error unless configured
-// otherwise, the default values of all defined flags in the set.
-func (f *FlagSet) PrintDefaults() {
- usages := f.FlagUsages()
- fmt.Fprint(f.out(), usages)
-}
-
-// defaultIsZeroValue returns true if the default value for this flag represents
-// a zero value.
-func (f *Flag) defaultIsZeroValue() bool {
- switch f.Value.(type) {
- case boolFlag:
- return f.DefValue == "false"
- case *durationValue:
- // Beginning in Go 1.7, duration zero values are "0s"
- return f.DefValue == "0" || f.DefValue == "0s"
- case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value:
- return f.DefValue == "0"
- case *stringValue:
- return f.DefValue == ""
- case *ipValue, *ipMaskValue, *ipNetValue:
- return f.DefValue == ""
- case *intSliceValue, *stringSliceValue, *stringArrayValue:
- return f.DefValue == "[]"
- default:
- switch f.Value.String() {
- case "false":
- return true
- case "":
- return true
- case "":
- return true
- case "0":
- return true
- }
- return false
- }
-}
-
-// UnquoteUsage extracts a back-quoted name from the usage
-// string for a flag and returns it and the un-quoted usage.
-// Given "a `name` to show" it returns ("name", "a name to show").
-// If there are no back quotes, the name is an educated guess of the
-// type of the flag's value, or the empty string if the flag is boolean.
-func UnquoteUsage(flag *Flag) (name string, usage string) {
- // Look for a back-quoted name, but avoid the strings package.
- usage = flag.Usage
- for i := 0; i < len(usage); i++ {
- if usage[i] == '`' {
- for j := i + 1; j < len(usage); j++ {
- if usage[j] == '`' {
- name = usage[i+1 : j]
- usage = usage[:i] + name + usage[j+1:]
- return name, usage
- }
- }
- break // Only one back quote; use type name.
- }
- }
-
- name = flag.Value.Type()
- switch name {
- case "bool":
- name = ""
- case "float64":
- name = "float"
- case "int64":
- name = "int"
- case "uint64":
- name = "uint"
- }
-
- return
-}
-
-// Splits the string `s` on whitespace into an initial substring up to
-// `i` runes in length and the remainder. Will go `slop` over `i` if
-// that encompasses the entire string (which allows the caller to
-// avoid short orphan words on the final line).
-func wrapN(i, slop int, s string) (string, string) {
- if i+slop > len(s) {
- return s, ""
- }
-
- w := strings.LastIndexAny(s[:i], " \t")
- if w <= 0 {
- return s, ""
- }
-
- return s[:w], s[w+1:]
-}
-
-// Wraps the string `s` to a maximum width `w` with leading indent
-// `i`. The first line is not indented (this is assumed to be done by
-// caller). Pass `w` == 0 to do no wrapping
-func wrap(i, w int, s string) string {
- if w == 0 {
- return s
- }
-
- // space between indent i and end of line width w into which
- // we should wrap the text.
- wrap := w - i
-
- var r, l string
-
- // Not enough space for sensible wrapping. Wrap as a block on
- // the next line instead.
- if wrap < 24 {
- i = 16
- wrap = w - i
- r += "\n" + strings.Repeat(" ", i)
- }
- // If still not enough space then don't even try to wrap.
- if wrap < 24 {
- return s
- }
-
- // Try to avoid short orphan words on the final line, by
- // allowing wrapN to go a bit over if that would fit in the
- // remainder of the line.
- slop := 5
- wrap = wrap - slop
-
- // Handle first line, which is indented by the caller (or the
- // special case above)
- l, s = wrapN(wrap, slop, s)
- r = r + l
-
- // Now wrap the rest
- for s != "" {
- var t string
-
- t, s = wrapN(wrap, slop, s)
- r = r + "\n" + strings.Repeat(" ", i) + t
- }
-
- return r
-
-}
-
-// FlagUsagesWrapped returns a string containing the usage information
-// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
-// wrapping)
-func (f *FlagSet) FlagUsagesWrapped(cols int) string {
- x := new(bytes.Buffer)
-
- lines := make([]string, 0, len(f.formal))
-
- maxlen := 0
- f.VisitAll(func(flag *Flag) {
- if len(flag.Deprecated) > 0 || flag.Hidden {
- return
- }
-
- line := ""
- if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
- line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name)
- } else {
- line = fmt.Sprintf(" --%s", flag.Name)
- }
-
- varname, usage := UnquoteUsage(flag)
- if len(varname) > 0 {
- line += " " + varname
- }
- if len(flag.NoOptDefVal) > 0 {
- switch flag.Value.Type() {
- case "string":
- line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
- case "bool":
- if flag.NoOptDefVal != "true" {
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- default:
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- }
-
- // This special character will be replaced with spacing once the
- // correct alignment is calculated
- line += "\x00"
- if len(line) > maxlen {
- maxlen = len(line)
- }
-
- line += usage
- if !flag.defaultIsZeroValue() {
- if flag.Value.Type() == "string" {
- line += fmt.Sprintf(" (default \"%s\")", flag.DefValue)
- } else {
- line += fmt.Sprintf(" (default %s)", flag.DefValue)
- }
- }
-
- lines = append(lines, line)
- })
-
- for _, line := range lines {
- sidx := strings.Index(line, "\x00")
- spacing := strings.Repeat(" ", maxlen-sidx)
- // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
- fmt.Fprintln(x, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
- }
-
- return x.String()
-}
-
-// FlagUsages returns a string containing the usage information for all flags in
-// the FlagSet
-func (f *FlagSet) FlagUsages() string {
- return f.FlagUsagesWrapped(0)
-}
-
-// PrintDefaults prints to standard error the default values of all defined command-line flags.
-func PrintDefaults() {
- CommandLine.PrintDefaults()
-}
-
-// defaultUsage is the default function to print a usage message.
-func defaultUsage(f *FlagSet) {
- fmt.Fprintf(f.out(), "Usage of %s:\n", f.name)
- f.PrintDefaults()
-}
-
-// NOTE: Usage is not just defaultUsage(CommandLine)
-// because it serves (via godoc flag Usage) as the example
-// for how to write your own usage function.
-
-// Usage prints to standard error a usage message documenting all defined command-line flags.
-// The function is a variable that may be changed to point to a custom function.
-// By default it prints a simple header and calls PrintDefaults; for details about the
-// format of the output and how to control it, see the documentation for PrintDefaults.
-var Usage = func() {
- fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
- PrintDefaults()
-}
-
-// NFlag returns the number of flags that have been set.
-func (f *FlagSet) NFlag() int { return len(f.actual) }
-
-// NFlag returns the number of command-line flags that have been set.
-func NFlag() int { return len(CommandLine.actual) }
-
-// Arg returns the i'th argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func (f *FlagSet) Arg(i int) string {
- if i < 0 || i >= len(f.args) {
- return ""
- }
- return f.args[i]
-}
-
-// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func Arg(i int) string {
- return CommandLine.Arg(i)
-}
-
-// NArg is the number of arguments remaining after flags have been processed.
-func (f *FlagSet) NArg() int { return len(f.args) }
-
-// NArg is the number of arguments remaining after flags have been processed.
-func NArg() int { return len(CommandLine.args) }
-
-// Args returns the non-flag arguments.
-func (f *FlagSet) Args() []string { return f.args }
-
-// Args returns the non-flag command-line arguments.
-func Args() []string { return CommandLine.args }
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func (f *FlagSet) Var(value Value, name string, usage string) {
- f.VarP(value, name, "", usage)
-}
-
-// VarPF is like VarP, but returns the flag created
-func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: name,
- Shorthand: shorthand,
- Usage: usage,
- Value: value,
- DefValue: value.String(),
- }
- f.AddFlag(flag)
- return flag
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
- f.VarPF(value, name, shorthand, usage)
-}
-
-// AddFlag will add the flag to the FlagSet
-func (f *FlagSet) AddFlag(flag *Flag) {
- // Call normalizeFlagName function only once
- normalizedFlagName := f.normalizeFlagName(flag.Name)
-
- _, alreadythere := f.formal[normalizedFlagName]
- if alreadythere {
- msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
- fmt.Fprintln(f.out(), msg)
- panic(msg) // Happens only if flags are declared with identical names
- }
- if f.formal == nil {
- f.formal = make(map[NormalizedName]*Flag)
- }
-
- flag.Name = string(normalizedFlagName)
- f.formal[normalizedFlagName] = flag
-
- if len(flag.Shorthand) == 0 {
- return
- }
- if len(flag.Shorthand) > 1 {
- fmt.Fprintf(f.out(), "%s shorthand more than ASCII character: %s\n", f.name, flag.Shorthand)
- panic("shorthand is more than one character")
- }
- if f.shorthands == nil {
- f.shorthands = make(map[byte]*Flag)
- }
- c := flag.Shorthand[0]
- old, alreadythere := f.shorthands[c]
- if alreadythere {
- fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name)
- panic("shorthand redefinition")
- }
- f.shorthands[c] = flag
-}
-
-// AddFlagSet adds one FlagSet to another. If a flag is already present in f
-// the flag from newSet will be ignored
-func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(flag *Flag) {
- if f.Lookup(flag.Name) == nil {
- f.AddFlag(flag)
- }
- })
-}
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func Var(value Value, name string, usage string) {
- CommandLine.VarP(value, name, "", usage)
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func VarP(value Value, name, shorthand, usage string) {
- CommandLine.VarP(value, name, shorthand, usage)
-}
-
-// failf prints to standard error a formatted error and usage message and
-// returns the error.
-func (f *FlagSet) failf(format string, a ...interface{}) error {
- err := fmt.Errorf(format, a...)
- fmt.Fprintln(f.out(), err)
- f.usage()
- return err
-}
-
-// usage calls the Usage method for the flag set, or the usage function if
-// the flag set is CommandLine.
-func (f *FlagSet) usage() {
- if f == CommandLine {
- Usage()
- } else if f.Usage == nil {
- defaultUsage(f)
- } else {
- f.Usage()
- }
-}
-
-func (f *FlagSet) setFlag(flag *Flag, value string, origArg string) error {
- if err := flag.Value.Set(value); err != nil {
- return f.failf("invalid argument %q for %s: %v", value, origArg, err)
- }
- // mark as visited for Visit()
- if f.actual == nil {
- f.actual = make(map[NormalizedName]*Flag)
- }
- f.actual[f.normalizeFlagName(flag.Name)] = flag
- flag.Changed = true
- if len(flag.Deprecated) > 0 {
- fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
- }
- if len(flag.ShorthandDeprecated) > 0 && containsShorthand(origArg, flag.Shorthand) {
- fmt.Fprintf(os.Stderr, "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
- }
- return nil
-}
-
-func containsShorthand(arg, shorthand string) bool {
- // filter out flags --
- if strings.HasPrefix(arg, "-") {
- return false
- }
- arg = strings.SplitN(arg, "=", 2)[0]
- return strings.Contains(arg, shorthand)
-}
-
-func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- name := s[2:]
- if len(name) == 0 || name[0] == '-' || name[0] == '=' {
- err = f.failf("bad flag syntax: %s", s)
- return
- }
- split := strings.SplitN(name, "=", 2)
- name = split[0]
- flag, alreadythere := f.formal[f.normalizeFlagName(name)]
- if !alreadythere {
- if name == "help" { // special case for nice help message.
- f.usage()
- return a, ErrHelp
- }
- err = f.failf("unknown flag: --%s", name)
- return
- }
- var value string
- if len(split) == 2 {
- // '--flag=arg'
- value = split[1]
- } else if len(flag.NoOptDefVal) > 0 {
- // '--flag' (arg was optional)
- value = flag.NoOptDefVal
- } else if len(a) > 0 {
- // '--flag arg'
- value = a[0]
- a = a[1:]
- } else {
- // '--flag' (arg was required)
- err = f.failf("flag needs an argument: %s", s)
- return
- }
- err = fn(flag, value, s)
- return
-}
-
-func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
- if strings.HasPrefix(shorthands, "test.") {
- return
- }
- outArgs = args
- outShorts = shorthands[1:]
- c := shorthands[0]
-
- flag, alreadythere := f.shorthands[c]
- if !alreadythere {
- if c == 'h' { // special case for nice help message.
- f.usage()
- err = ErrHelp
- return
- }
- //TODO continue on error
- err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
- return
- }
- var value string
- if len(shorthands) > 2 && shorthands[1] == '=' {
- value = shorthands[2:]
- outShorts = ""
- } else if len(flag.NoOptDefVal) > 0 {
- value = flag.NoOptDefVal
- } else if len(shorthands) > 1 {
- value = shorthands[1:]
- outShorts = ""
- } else if len(args) > 0 {
- value = args[0]
- outArgs = args[1:]
- } else {
- err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
- return
- }
- err = fn(flag, value, shorthands)
- return
-}
-
-func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- shorthands := s[1:]
-
- for len(shorthands) > 0 {
- shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
- if err != nil {
- return
- }
- }
-
- return
-}
-
-func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
- for len(args) > 0 {
- s := args[0]
- args = args[1:]
- if len(s) == 0 || s[0] != '-' || len(s) == 1 {
- if !f.interspersed {
- f.args = append(f.args, s)
- f.args = append(f.args, args...)
- return nil
- }
- f.args = append(f.args, s)
- continue
- }
-
- if s[1] == '-' {
- if len(s) == 2 { // "--" terminates the flags
- f.argsLenAtDash = len(f.args)
- f.args = append(f.args, args...)
- break
- }
- args, err = f.parseLongArg(s, args, fn)
- } else {
- args, err = f.parseShortArg(s, args, fn)
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// Parse parses flag definitions from the argument list, which should not
-// include the command name. Must be called after all flags in the FlagSet
-// are defined and before flags are accessed by the program.
-// The return value will be ErrHelp if -help was set but not defined.
-func (f *FlagSet) Parse(arguments []string) error {
- f.parsed = true
- f.args = make([]string, 0, len(arguments))
-
- assign := func(flag *Flag, value, origArg string) error {
- return f.setFlag(flag, value, origArg)
- }
-
- err := f.parseArgs(arguments, assign)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-type parseFunc func(flag *Flag, value, origArg string) error
-
-// ParseAll parses flag definitions from the argument list, which should not
-// include the command name. The arguments for fn are flag and value. Must be
-// called after all flags in the FlagSet are defined and before flags are
-// accessed by the program. The return value will be ErrHelp if -help was set
-// but not defined.
-func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error {
- f.parsed = true
- f.args = make([]string, 0, len(arguments))
-
- assign := func(flag *Flag, value, origArg string) error {
- return fn(flag, value)
- }
-
- err := f.parseArgs(arguments, assign)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-// Parsed reports whether f.Parse has been called.
-func (f *FlagSet) Parsed() bool {
- return f.parsed
-}
-
-// Parse parses the command-line flags from os.Args[1:]. Must be called
-// after all flags are defined and before flags are accessed by the program.
-func Parse() {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.Parse(os.Args[1:])
-}
-
-// ParseAll parses the command-line flags from os.Args[1:] and called fn for each.
-// The arguments for fn are flag and value. Must be called after all flags are
-// defined and before flags are accessed by the program.
-func ParseAll(fn func(flag *Flag, value string) error) {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.ParseAll(os.Args[1:], fn)
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func SetInterspersed(interspersed bool) {
- CommandLine.SetInterspersed(interspersed)
-}
-
-// Parsed returns true if the command-line flags have been parsed.
-func Parsed() bool {
- return CommandLine.Parsed()
-}
-
-// CommandLine is the default set of command-line flags, parsed from os.Args.
-var CommandLine = NewFlagSet(os.Args[0], ExitOnError)
-
-// NewFlagSet returns a new, empty flag set with the specified name and
-// error handling property.
-func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
- f := &FlagSet{
- name: name,
- errorHandling: errorHandling,
- argsLenAtDash: -1,
- interspersed: true,
- }
- return f
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func (f *FlagSet) SetInterspersed(interspersed bool) {
- f.interspersed = interspersed
-}
-
-// Init sets the name and error handling property for a flag set.
-// By default, the zero FlagSet uses an empty name and the
-// ContinueOnError error handling policy.
-func (f *FlagSet) Init(name string, errorHandling ErrorHandling) {
- f.name = name
- f.errorHandling = errorHandling
- f.argsLenAtDash = -1
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/float32.go b/archived/event-adapter/vendor/github.com/spf13/pflag/float32.go
deleted file mode 100644
index a243f81f7..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/float32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float32 Value
-type float32Value float32
-
-func newFloat32Value(val float32, p *float32) *float32Value {
- *p = val
- return (*float32Value)(p)
-}
-
-func (f *float32Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 32)
- *f = float32Value(v)
- return err
-}
-
-func (f *float32Value) Type() string {
- return "float32"
-}
-
-func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) }
-
-func float32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseFloat(sval, 32)
- if err != nil {
- return 0, err
- }
- return float32(v), nil
-}
-
-// GetFloat32 return the float32 value of a flag with the given name
-func (f *FlagSet) GetFloat32(name string) (float32, error) {
- val, err := f.getFlagType(name, "float32", float32Conv)
- if err != nil {
- return 0, err
- }
- return val.(float32), nil
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func Float32Var(p *float32, name string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func (f *FlagSet) Float32(name string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, "", value, usage)
- return p
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func Float32(name string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, "", value, usage)
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func Float32P(name, shorthand string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/float64.go b/archived/event-adapter/vendor/github.com/spf13/pflag/float64.go
deleted file mode 100644
index 04b5492a7..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/float64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float64 Value
-type float64Value float64
-
-func newFloat64Value(val float64, p *float64) *float64Value {
- *p = val
- return (*float64Value)(p)
-}
-
-func (f *float64Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 64)
- *f = float64Value(v)
- return err
-}
-
-func (f *float64Value) Type() string {
- return "float64"
-}
-
-func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
-
-func float64Conv(sval string) (interface{}, error) {
- return strconv.ParseFloat(sval, 64)
-}
-
-// GetFloat64 return the float64 value of a flag with the given name
-func (f *FlagSet) GetFloat64(name string) (float64, error) {
- val, err := f.getFlagType(name, "float64", float64Conv)
- if err != nil {
- return 0, err
- }
- return val.(float64), nil
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func Float64Var(p *float64, name string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func (f *FlagSet) Float64(name string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, "", value, usage)
- return p
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func Float64(name string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, "", value, usage)
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func Float64P(name, shorthand string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/golangflag.go b/archived/event-adapter/vendor/github.com/spf13/pflag/golangflag.go
deleted file mode 100644
index c4f47ebe5..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/golangflag.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- goflag "flag"
- "reflect"
- "strings"
-)
-
-// flagValueWrapper implements pflag.Value around a flag.Value. The main
-// difference here is the addition of the Type method that returns a string
-// name of the type. As this is generally unknown, we approximate that with
-// reflection.
-type flagValueWrapper struct {
- inner goflag.Value
- flagType string
-}
-
-// We are just copying the boolFlag interface out of goflag as that is what
-// they use to decide if a flag should get "true" when no arg is given.
-type goBoolFlag interface {
- goflag.Value
- IsBoolFlag() bool
-}
-
-func wrapFlagValue(v goflag.Value) Value {
- // If the flag.Value happens to also be a pflag.Value, just use it directly.
- if pv, ok := v.(Value); ok {
- return pv
- }
-
- pv := &flagValueWrapper{
- inner: v,
- }
-
- t := reflect.TypeOf(v)
- if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
-
- pv.flagType = strings.TrimSuffix(t.Name(), "Value")
- return pv
-}
-
-func (v *flagValueWrapper) String() string {
- return v.inner.String()
-}
-
-func (v *flagValueWrapper) Set(s string) error {
- return v.inner.Set(s)
-}
-
-func (v *flagValueWrapper) Type() string {
- return v.flagType
-}
-
-// PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag
-// If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei
-// with both `-v` and `--v` in flags. If the golang flag was more than a single
-// character (ex: `verbose`) it will only be accessible via `--verbose`
-func PFlagFromGoFlag(goflag *goflag.Flag) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: goflag.Name,
- Usage: goflag.Usage,
- Value: wrapFlagValue(goflag.Value),
- // Looks like golang flags don't set DefValue correctly :-(
- //DefValue: goflag.DefValue,
- DefValue: goflag.Value.String(),
- }
- // Ex: if the golang flag was -v, allow both -v and --v to work
- if len(flag.Name) == 1 {
- flag.Shorthand = flag.Name
- }
- if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() {
- flag.NoOptDefVal = "true"
- }
- return flag
-}
-
-// AddGoFlag will add the given *flag.Flag to the pflag.FlagSet
-func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) {
- if f.Lookup(goflag.Name) != nil {
- return
- }
- newflag := PFlagFromGoFlag(goflag)
- f.AddFlag(newflag)
-}
-
-// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet
-func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(goflag *goflag.Flag) {
- f.AddGoFlag(goflag)
- })
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/int.go b/archived/event-adapter/vendor/github.com/spf13/pflag/int.go
deleted file mode 100644
index 1474b89df..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/int.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int Value
-type intValue int
-
-func newIntValue(val int, p *int) *intValue {
- *p = val
- return (*intValue)(p)
-}
-
-func (i *intValue) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = intValue(v)
- return err
-}
-
-func (i *intValue) Type() string {
- return "int"
-}
-
-func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
-
-func intConv(sval string) (interface{}, error) {
- return strconv.Atoi(sval)
-}
-
-// GetInt return the int value of a flag with the given name
-func (f *FlagSet) GetInt(name string) (int, error) {
- val, err := f.getFlagType(name, "int", intConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func (f *FlagSet) IntVar(p *int, name string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func IntVar(p *int, name string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func IntVarP(p *int, name, shorthand string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func (f *FlagSet) Int(name string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, "", value, usage)
- return p
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func Int(name string, value int, usage string) *int {
- return CommandLine.IntP(name, "", value, usage)
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func IntP(name, shorthand string, value int, usage string) *int {
- return CommandLine.IntP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/int32.go b/archived/event-adapter/vendor/github.com/spf13/pflag/int32.go
deleted file mode 100644
index 9b95944f0..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/int32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int32 Value
-type int32Value int32
-
-func newInt32Value(val int32, p *int32) *int32Value {
- *p = val
- return (*int32Value)(p)
-}
-
-func (i *int32Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 32)
- *i = int32Value(v)
- return err
-}
-
-func (i *int32Value) Type() string {
- return "int32"
-}
-
-func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return int32(v), nil
-}
-
-// GetInt32 return the int32 value of a flag with the given name
-func (f *FlagSet) GetInt32(name string) (int32, error) {
- val, err := f.getFlagType(name, "int32", int32Conv)
- if err != nil {
- return 0, err
- }
- return val.(int32), nil
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func Int32Var(p *int32, name string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func (f *FlagSet) Int32(name string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, "", value, usage)
- return p
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func Int32(name string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, "", value, usage)
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func Int32P(name, shorthand string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/int64.go b/archived/event-adapter/vendor/github.com/spf13/pflag/int64.go
deleted file mode 100644
index 0026d781d..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/int64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int64 Value
-type int64Value int64
-
-func newInt64Value(val int64, p *int64) *int64Value {
- *p = val
- return (*int64Value)(p)
-}
-
-func (i *int64Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = int64Value(v)
- return err
-}
-
-func (i *int64Value) Type() string {
- return "int64"
-}
-
-func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int64Conv(sval string) (interface{}, error) {
- return strconv.ParseInt(sval, 0, 64)
-}
-
-// GetInt64 return the int64 value of a flag with the given name
-func (f *FlagSet) GetInt64(name string) (int64, error) {
- val, err := f.getFlagType(name, "int64", int64Conv)
- if err != nil {
- return 0, err
- }
- return val.(int64), nil
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func Int64Var(p *int64, name string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func (f *FlagSet) Int64(name string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, "", value, usage)
- return p
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func Int64(name string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, "", value, usage)
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func Int64P(name, shorthand string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/int8.go b/archived/event-adapter/vendor/github.com/spf13/pflag/int8.go
deleted file mode 100644
index 4da92228e..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/int8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int8 Value
-type int8Value int8
-
-func newInt8Value(val int8, p *int8) *int8Value {
- *p = val
- return (*int8Value)(p)
-}
-
-func (i *int8Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 8)
- *i = int8Value(v)
- return err
-}
-
-func (i *int8Value) Type() string {
- return "int8"
-}
-
-func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return int8(v), nil
-}
-
-// GetInt8 return the int8 value of a flag with the given name
-func (f *FlagSet) GetInt8(name string) (int8, error) {
- val, err := f.getFlagType(name, "int8", int8Conv)
- if err != nil {
- return 0, err
- }
- return val.(int8), nil
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func Int8Var(p *int8, name string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func (f *FlagSet) Int8(name string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, "", value, usage)
- return p
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func Int8(name string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, "", value, usage)
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func Int8P(name, shorthand string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/int_slice.go b/archived/event-adapter/vendor/github.com/spf13/pflag/int_slice.go
deleted file mode 100644
index 1e7c9edde..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/int_slice.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- intSlice Value
-type intSliceValue struct {
- value *[]int
- changed bool
-}
-
-func newIntSliceValue(val []int, p *[]int) *intSliceValue {
- isv := new(intSliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *intSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *intSliceValue) Type() string {
- return "intSlice"
-}
-
-func (s *intSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func intSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []int{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetIntSlice return the []int value of a flag with the given name
-func (f *FlagSet) GetIntSlice(name string) ([]int, error) {
- val, err := f.getFlagType(name, "intSlice", intSliceConv)
- if err != nil {
- return []int{}, err
- }
- return val.([]int), nil
-}
-
-// IntSliceVar defines a intSlice flag with specified name, default value, and usage string.
-// The argument p points to a []int variable in which to store the value of the flag.
-func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSliceVar defines a int[] flag with specified name, default value, and usage string.
-// The argument p points to a int[] variable in which to store the value of the flag.
-func IntSliceVar(p *[]int, name string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func IntSlice(name string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, "", value, usage)
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/ip.go b/archived/event-adapter/vendor/github.com/spf13/pflag/ip.go
deleted file mode 100644
index 3d414ba69..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/ip.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// -- net.IP value
-type ipValue net.IP
-
-func newIPValue(val net.IP, p *net.IP) *ipValue {
- *p = val
- return (*ipValue)(p)
-}
-
-func (i *ipValue) String() string { return net.IP(*i).String() }
-func (i *ipValue) Set(s string) error {
- ip := net.ParseIP(strings.TrimSpace(s))
- if ip == nil {
- return fmt.Errorf("failed to parse IP: %q", s)
- }
- *i = ipValue(ip)
- return nil
-}
-
-func (i *ipValue) Type() string {
- return "ip"
-}
-
-func ipConv(sval string) (interface{}, error) {
- ip := net.ParseIP(sval)
- if ip != nil {
- return ip, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
-}
-
-// GetIP return the net.IP value of a flag with the given name
-func (f *FlagSet) GetIP(name string) (net.IP, error) {
- val, err := f.getFlagType(name, "ip", ipConv)
- if err != nil {
- return nil, err
- }
- return val.(net.IP), nil
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func IPVar(p *net.IP, name string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, "", value, usage)
- return p
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func IP(name string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, "", value, usage)
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/ip_slice.go b/archived/event-adapter/vendor/github.com/spf13/pflag/ip_slice.go
deleted file mode 100644
index 7dd196fe3..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/ip_slice.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// -- ipSlice Value
-type ipSliceValue struct {
- value *[]net.IP
- changed bool
-}
-
-func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue {
- ipsv := new(ipSliceValue)
- ipsv.value = p
- *ipsv.value = val
- return ipsv
-}
-
-// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag.
-// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended.
-func (s *ipSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- ipStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse ip values into slice
- out := make([]net.IP, 0, len(ipStrSlice))
- for _, ipStr := range ipStrSlice {
- ip := net.ParseIP(strings.TrimSpace(ipStr))
- if ip == nil {
- return fmt.Errorf("invalid string being converted to IP address: %s", ipStr)
- }
- out = append(out, ip)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *ipSliceValue) Type() string {
- return "ipSlice"
-}
-
-// String defines a "native" format for this net.IP slice flag value.
-func (s *ipSliceValue) String() string {
-
- ipStrSlice := make([]string, len(*s.value))
- for i, ip := range *s.value {
- ipStrSlice[i] = ip.String()
- }
-
- out, _ := writeAsCSV(ipStrSlice)
-
- return "[" + out + "]"
-}
-
-func ipSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Emtpy string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []net.IP{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]net.IP, len(ss))
- for i, sval := range ss {
- ip := net.ParseIP(strings.TrimSpace(sval))
- if ip == nil {
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
- }
- out[i] = ip
- }
- return out, nil
-}
-
-// GetIPSlice returns the []net.IP value of a flag with the given name
-func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) {
- val, err := f.getFlagType(name, "ipSlice", ipSliceConv)
- if err != nil {
- return []net.IP{}, err
- }
- return val.([]net.IP), nil
-}
-
-// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of that flag.
-func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of the flag.
-func IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, "", value, usage)
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/ipmask.go b/archived/event-adapter/vendor/github.com/spf13/pflag/ipmask.go
deleted file mode 100644
index 5bd44bd21..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/ipmask.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strconv"
-)
-
-// -- net.IPMask value
-type ipMaskValue net.IPMask
-
-func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue {
- *p = val
- return (*ipMaskValue)(p)
-}
-
-func (i *ipMaskValue) String() string { return net.IPMask(*i).String() }
-func (i *ipMaskValue) Set(s string) error {
- ip := ParseIPv4Mask(s)
- if ip == nil {
- return fmt.Errorf("failed to parse IP mask: %q", s)
- }
- *i = ipMaskValue(ip)
- return nil
-}
-
-func (i *ipMaskValue) Type() string {
- return "ipMask"
-}
-
-// ParseIPv4Mask written in IP form (e.g. 255.255.255.0).
-// This function should really belong to the net package.
-func ParseIPv4Mask(s string) net.IPMask {
- mask := net.ParseIP(s)
- if mask == nil {
- if len(s) != 8 {
- return nil
- }
- // net.IPMask.String() actually outputs things like ffffff00
- // so write a horrible parser for that as well :-(
- m := []int{}
- for i := 0; i < 4; i++ {
- b := "0x" + s[2*i:2*i+2]
- d, err := strconv.ParseInt(b, 0, 0)
- if err != nil {
- return nil
- }
- m = append(m, int(d))
- }
- s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3])
- mask = net.ParseIP(s)
- if mask == nil {
- return nil
- }
- }
- return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15])
-}
-
-func parseIPv4Mask(sval string) (interface{}, error) {
- mask := ParseIPv4Mask(sval)
- if mask == nil {
- return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval)
- }
- return mask, nil
-}
-
-// GetIPv4Mask return the net.IPv4Mask value of a flag with the given name
-func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) {
- val, err := f.getFlagType(name, "ipMask", parseIPv4Mask)
- if err != nil {
- return nil, err
- }
- return val.(net.IPMask), nil
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, "", value, usage)
- return p
-}
-
-// IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, "", value, usage)
-}
-
-// IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/ipnet.go b/archived/event-adapter/vendor/github.com/spf13/pflag/ipnet.go
deleted file mode 100644
index e2c1b8bcd..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/ipnet.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// IPNet adapts net.IPNet for use as a flag.
-type ipNetValue net.IPNet
-
-func (ipnet ipNetValue) String() string {
- n := net.IPNet(ipnet)
- return n.String()
-}
-
-func (ipnet *ipNetValue) Set(value string) error {
- _, n, err := net.ParseCIDR(strings.TrimSpace(value))
- if err != nil {
- return err
- }
- *ipnet = ipNetValue(*n)
- return nil
-}
-
-func (*ipNetValue) Type() string {
- return "ipNet"
-}
-
-func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue {
- *p = val
- return (*ipNetValue)(p)
-}
-
-func ipNetConv(sval string) (interface{}, error) {
- _, n, err := net.ParseCIDR(strings.TrimSpace(sval))
- if err == nil {
- return *n, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval)
-}
-
-// GetIPNet return the net.IPNet value of a flag with the given name
-func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) {
- val, err := f.getFlagType(name, "ipNet", ipNetConv)
- if err != nil {
- return net.IPNet{}, err
- }
- return val.(net.IPNet), nil
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, "", value, usage)
- return p
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, "", value, usage)
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/string.go b/archived/event-adapter/vendor/github.com/spf13/pflag/string.go
deleted file mode 100644
index 04e0a26ff..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/string.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package pflag
-
-// -- string Value
-type stringValue string
-
-func newStringValue(val string, p *string) *stringValue {
- *p = val
- return (*stringValue)(p)
-}
-
-func (s *stringValue) Set(val string) error {
- *s = stringValue(val)
- return nil
-}
-func (s *stringValue) Type() string {
- return "string"
-}
-
-func (s *stringValue) String() string { return string(*s) }
-
-func stringConv(sval string) (interface{}, error) {
- return sval, nil
-}
-
-// GetString return the string value of a flag with the given name
-func (f *FlagSet) GetString(name string) (string, error) {
- val, err := f.getFlagType(name, "string", stringConv)
- if err != nil {
- return "", err
- }
- return val.(string), nil
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func (f *FlagSet) StringVar(p *string, name string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func StringVar(p *string, name string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func StringVarP(p *string, name, shorthand string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func (f *FlagSet) String(name string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, "", value, usage)
- return p
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func String(name string, value string, usage string) *string {
- return CommandLine.StringP(name, "", value, usage)
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func StringP(name, shorthand string, value string, usage string) *string {
- return CommandLine.StringP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/string_array.go b/archived/event-adapter/vendor/github.com/spf13/pflag/string_array.go
deleted file mode 100644
index 276b7ed49..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/string_array.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package pflag
-
-// -- stringArray Value
-type stringArrayValue struct {
- value *[]string
- changed bool
-}
-
-func newStringArrayValue(val []string, p *[]string) *stringArrayValue {
- ssv := new(stringArrayValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func (s *stringArrayValue) Set(val string) error {
- if !s.changed {
- *s.value = []string{val}
- s.changed = true
- } else {
- *s.value = append(*s.value, val)
- }
- return nil
-}
-
-func (s *stringArrayValue) Type() string {
- return "stringArray"
-}
-
-func (s *stringArrayValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func stringArrayConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a array with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringArray return the []string value of a flag with the given name
-func (f *FlagSet) GetStringArray(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringArray", stringArrayConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringArrayVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringArray(name string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, "", value, usage)
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/string_slice.go b/archived/event-adapter/vendor/github.com/spf13/pflag/string_slice.go
deleted file mode 100644
index 05eee7543..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/string_slice.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "encoding/csv"
- "strings"
-)
-
-// -- stringSlice Value
-type stringSliceValue struct {
- value *[]string
- changed bool
-}
-
-func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
- ssv := new(stringSliceValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func readAsCSV(val string) ([]string, error) {
- if val == "" {
- return []string{}, nil
- }
- stringReader := strings.NewReader(val)
- csvReader := csv.NewReader(stringReader)
- return csvReader.Read()
-}
-
-func writeAsCSV(vals []string) (string, error) {
- b := &bytes.Buffer{}
- w := csv.NewWriter(b)
- err := w.Write(vals)
- if err != nil {
- return "", err
- }
- w.Flush()
- return strings.TrimSuffix(b.String(), "\n"), nil
-}
-
-func (s *stringSliceValue) Set(val string) error {
- v, err := readAsCSV(val)
- if err != nil {
- return err
- }
- if !s.changed {
- *s.value = v
- } else {
- *s.value = append(*s.value, v...)
- }
- s.changed = true
- return nil
-}
-
-func (s *stringSliceValue) Type() string {
- return "stringSlice"
-}
-
-func (s *stringSliceValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func stringSliceConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a slice with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringSlice return the []string value of a flag with the given name
-func (f *FlagSet) GetStringSlice(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringSlice", stringSliceConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-func StringSliceVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-func StringSlice(name string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, "", value, usage)
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint.go
deleted file mode 100644
index dcbc2b758..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint Value
-type uintValue uint
-
-func newUintValue(val uint, p *uint) *uintValue {
- *p = val
- return (*uintValue)(p)
-}
-
-func (i *uintValue) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uintValue(v)
- return err
-}
-
-func (i *uintValue) Type() string {
- return "uint"
-}
-
-func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uintConv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 0)
- if err != nil {
- return 0, err
- }
- return uint(v), nil
-}
-
-// GetUint return the uint value of a flag with the given name
-func (f *FlagSet) GetUint(name string) (uint, error) {
- val, err := f.getFlagType(name, "uint", uintConv)
- if err != nil {
- return 0, err
- }
- return val.(uint), nil
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func UintVar(p *uint, name string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint(name string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, "", value, usage)
- return p
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint(name string, value uint, usage string) *uint {
- return CommandLine.UintP(name, "", value, usage)
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func UintP(name, shorthand string, value uint, usage string) *uint {
- return CommandLine.UintP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint16.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint16.go
deleted file mode 100644
index 7e9914edd..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint16.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint16 value
-type uint16Value uint16
-
-func newUint16Value(val uint16, p *uint16) *uint16Value {
- *p = val
- return (*uint16Value)(p)
-}
-
-func (i *uint16Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 16)
- *i = uint16Value(v)
- return err
-}
-
-func (i *uint16Value) Type() string {
- return "uint16"
-}
-
-func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint16Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 16)
- if err != nil {
- return 0, err
- }
- return uint16(v), nil
-}
-
-// GetUint16 return the uint16 value of a flag with the given name
-func (f *FlagSet) GetUint16(name string) (uint16, error) {
- val, err := f.getFlagType(name, "uint16", uint16Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint16), nil
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func Uint16Var(p *uint16, name string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint16(name string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, "", value, usage)
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint32.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint32.go
deleted file mode 100644
index d8024539b..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint32 value
-type uint32Value uint32
-
-func newUint32Value(val uint32, p *uint32) *uint32Value {
- *p = val
- return (*uint32Value)(p)
-}
-
-func (i *uint32Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 32)
- *i = uint32Value(v)
- return err
-}
-
-func (i *uint32Value) Type() string {
- return "uint32"
-}
-
-func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return uint32(v), nil
-}
-
-// GetUint32 return the uint32 value of a flag with the given name
-func (f *FlagSet) GetUint32(name string) (uint32, error) {
- val, err := f.getFlagType(name, "uint32", uint32Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint32), nil
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func Uint32Var(p *uint32, name string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func Uint32(name string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, "", value, usage)
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint64.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint64.go
deleted file mode 100644
index f62240f2c..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint64.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint64 Value
-type uint64Value uint64
-
-func newUint64Value(val uint64, p *uint64) *uint64Value {
- *p = val
- return (*uint64Value)(p)
-}
-
-func (i *uint64Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uint64Value(v)
- return err
-}
-
-func (i *uint64Value) Type() string {
- return "uint64"
-}
-
-func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint64Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 64)
- if err != nil {
- return 0, err
- }
- return uint64(v), nil
-}
-
-// GetUint64 return the uint64 value of a flag with the given name
-func (f *FlagSet) GetUint64(name string) (uint64, error) {
- val, err := f.getFlagType(name, "uint64", uint64Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint64), nil
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func Uint64Var(p *uint64, name string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func Uint64(name string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, "", value, usage)
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint8.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint8.go
deleted file mode 100644
index bb0e83c1f..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint8 Value
-type uint8Value uint8
-
-func newUint8Value(val uint8, p *uint8) *uint8Value {
- *p = val
- return (*uint8Value)(p)
-}
-
-func (i *uint8Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 8)
- *i = uint8Value(v)
- return err
-}
-
-func (i *uint8Value) Type() string {
- return "uint8"
-}
-
-func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return uint8(v), nil
-}
-
-// GetUint8 return the uint8 value of a flag with the given name
-func (f *FlagSet) GetUint8(name string) (uint8, error) {
- val, err := f.getFlagType(name, "uint8", uint8Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint8), nil
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func Uint8Var(p *uint8, name string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func Uint8(name string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, "", value, usage)
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/spf13/pflag/uint_slice.go b/archived/event-adapter/vendor/github.com/spf13/pflag/uint_slice.go
deleted file mode 100644
index edd94c600..000000000
--- a/archived/event-adapter/vendor/github.com/spf13/pflag/uint_slice.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- uintSlice Value
-type uintSliceValue struct {
- value *[]uint
- changed bool
-}
-
-func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue {
- uisv := new(uintSliceValue)
- uisv.value = p
- *uisv.value = val
- return uisv
-}
-
-func (s *uintSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return err
- }
- out[i] = uint(u)
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *uintSliceValue) Type() string {
- return "uintSlice"
-}
-
-func (s *uintSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func uintSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []uint{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return nil, err
- }
- out[i] = uint(u)
- }
- return out, nil
-}
-
-// GetUintSlice returns the []uint value of a flag with the given name.
-func (f *FlagSet) GetUintSlice(name string) ([]uint, error) {
- val, err := f.getFlagType(name, "uintSlice", uintSliceConv)
- if err != nil {
- return []uint{}, err
- }
- return val.([]uint), nil
-}
-
-// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string.
-// The argument p points to a []uint variable in which to store the value of the flag.
-func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSliceVar defines a uint[] flag with specified name, default value, and usage string.
-// The argument p points to a uint[] variable in which to store the value of the flag.
-func UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func UintSlice(name string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, "", value, usage)
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, shorthand, value, usage)
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/LICENSE b/archived/event-adapter/vendor/github.com/ugorji/go/LICENSE
deleted file mode 100644
index 95a0f0541..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2012-2015 Ugorji Nwoke.
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/0doc.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/0doc.go
deleted file mode 100644
index 209f9ebad..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/0doc.go
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-/*
-High Performance, Feature-Rich Idiomatic Go codec/encoding library for
-binc, msgpack, cbor, json.
-
-Supported Serialization formats are:
-
- - msgpack: https://github.com/msgpack/msgpack
- - binc: http://github.com/ugorji/binc
- - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049
- - json: http://json.org http://tools.ietf.org/html/rfc7159
- - simple:
-
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package understands the 'unsafe' tag, to allow using unsafe semantics:
-
- - When decoding into a struct, you need to read the field name as a string
- so you can find the struct field it is mapped to.
- Using `unsafe` will bypass the allocation and copying overhead of []byte->string conversion.
-
-To install using unsafe, pass the 'unsafe' tag:
-
- go get -tags=unsafe github.com/ugorji/go/codec
-
-For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer .
-
-The idiomatic Go support is as seen in other encoding packages in
-the standard library (ie json, xml, gob, etc).
-
-Rich Feature Set includes:
-
- - Simple but extremely powerful and feature-rich API
- - Very High Performance.
- Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- - Multiple conversions:
- Package coerces types where appropriate
- e.g. decode an int in the stream into a float, etc.
- - Corner Cases:
- Overflows, nil maps/slices, nil values in streams are handled correctly
- - Standard field renaming via tags
- - Support for omitting empty fields during an encoding
- - Encoding from any value and decoding into pointer to any value
- (struct, slice, map, primitives, pointers, interface{}, etc)
- - Extensions to support efficient encoding/decoding of any named types
- - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- - Decoding without a schema (into a interface{}).
- Includes Options to configure what specific map or slice type to use
- when decoding an encoded list or map into a nil interface{}
- - Encode a struct as an array, and decode struct from an array in the data stream
- - Comprehensive support for anonymous fields
- - Fast (no-reflection) encoding/decoding of common maps and slices
- - Code-generation for faster performance.
- - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats
- - Support indefinite-length formats to enable true streaming
- (for formats which support it e.g. json, cbor)
- - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes.
- This mostly applies to maps, where iteration order is non-deterministic.
- - NIL in data stream decoded as zero value
- - Never silently skip data when decoding.
- User decides whether to return an error or silently skip data when keys or indexes
- in the data stream do not map to fields in the struct.
- - Detect and error when encoding a cyclic reference (instead of stack overflow shutdown)
- - Encode/Decode from/to chan types (for iterative streaming support)
- - Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- - Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosyncrasies of codecs e.g.
- - For messagepack, configure how ambiguities in handling raw bytes are resolved
- - For messagepack, provide rpc server/client codec to support
- msgpack-rpc protocol defined at:
- https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-
-Extension Support
-
-Users can register a function to handle the encoding or decoding of
-their custom types.
-
-There are no restrictions on what the custom type can be. Some examples:
-
- type BisSet []int
- type BitSet64 uint64
- type UUID string
- type MyStructWithUnexportedFields struct { a int; b bool; c []int; }
- type GifImage struct { ... }
-
-As an illustration, MyStructWithUnexportedFields would normally be
-encoded as an empty map because it has no exported fields, while UUID
-would be encoded as a string. However, with extension support, you can
-encode any of these however you like.
-
-RPC
-
-RPC Client and Server Codecs are implemented, so the codecs can be used
-with the standard net/rpc package.
-
-Usage
-
-The Handle is SAFE for concurrent READ, but NOT SAFE for concurrent modification.
-
-The Encoder and Decoder are NOT safe for concurrent use.
-
-Consequently, the usage model is basically:
-
- - Create and initialize the Handle before any use.
- Once created, DO NOT modify it.
- - Multiple Encoders or Decoders can now use the Handle concurrently.
- They only read information off the Handle (never write).
- - However, each Encoder or Decoder MUST not be used concurrently
- - To re-use an Encoder/Decoder, call Reset(...) on it first.
- This allows you use state maintained on the Encoder/Decoder.
-
-Sample usage model:
-
- // create and configure Handle
- var (
- bh codec.BincHandle
- mh codec.MsgpackHandle
- ch codec.CborHandle
- )
-
- mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
-
- // configure extensions
- // e.g. for msgpack, define functions and enable Time support for tag 1
- // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt)
-
- // create and use decoder/encoder
- var (
- r io.Reader
- w io.Writer
- b []byte
- h = &bh // or mh to use msgpack
- )
-
- dec = codec.NewDecoder(r, h)
- dec = codec.NewDecoderBytes(b, h)
- err = dec.Decode(&v)
-
- enc = codec.NewEncoder(w, h)
- enc = codec.NewEncoderBytes(&b, h)
- err = enc.Encode(v)
-
- //RPC Server
- go func() {
- for {
- conn, err := listener.Accept()
- rpcCodec := codec.GoRpc.ServerCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h)
- rpc.ServeCodec(rpcCodec)
- }
- }()
-
- //RPC Communication (client side)
- conn, err = net.Dial("tcp", "localhost:5555")
- rpcCodec := codec.GoRpc.ClientCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
- client := rpc.NewClientWithCodec(rpcCodec)
-
-*/
-package codec
-
-// Benefits of go-codec:
-//
-// - encoding/json always reads whole file into memory first.
-// This makes it unsuitable for parsing very large files.
-// - encoding/xml cannot parse into a map[string]interface{}
-// I found this out on reading https://github.com/clbanning/mxj
-
-// TODO:
-//
-// - optimization for codecgen:
-// if len of entity is <= 3 words, then support a value receiver for encode.
-// - (En|De)coder should store an error when it occurs.
-// Until reset, subsequent calls return that error that was stored.
-// This means that free panics must go away.
-// All errors must be raised through errorf method.
-// - Decoding using a chan is good, but incurs concurrency costs.
-// This is because there's no fast way to use a channel without it
-// having to switch goroutines constantly.
-// Callback pattern is still the best. Maybe consider supporting something like:
-// type X struct {
-// Name string
-// Ys []Y
-// Ys chan <- Y
-// Ys func(Y) -> call this function for each entry
-// }
-// - Consider adding a isZeroer interface { isZero() bool }
-// It is used within isEmpty, for omitEmpty support.
-// - Consider making Handle used AS-IS within the encoding/decoding session.
-// This means that we don't cache Handle information within the (En|De)coder,
-// except we really need it at Reset(...)
-// - Consider adding math/big support
-// - Consider reducing the size of the generated functions:
-// Maybe use one loop, and put the conditionals in the loop.
-// for ... { if cLen > 0 { if j == cLen { break } } else if dd.CheckBreak() { break } }
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/README.md b/archived/event-adapter/vendor/github.com/ugorji/go/codec/README.md
deleted file mode 100644
index 91cb3a27b..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/README.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# Codec
-
-High Performance, Feature-Rich Idiomatic Go codec/encoding library for
-binc, msgpack, cbor, json.
-
-Supported Serialization formats are:
-
- - msgpack: https://github.com/msgpack/msgpack
- - binc: http://github.com/ugorji/binc
- - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049
- - json: http://json.org http://tools.ietf.org/html/rfc7159
- - simple:
-
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package understands the `unsafe` tag, to allow using unsafe semantics:
-
- - When decoding into a struct, you need to read the field name as a string
- so you can find the struct field it is mapped to.
- Using `unsafe` will bypass the allocation and copying overhead of `[]byte->string` conversion.
-
-To use it, you must pass the `unsafe` tag during install:
-
-```
-go install -tags=unsafe github.com/ugorji/go/codec
-```
-
-Online documentation: http://godoc.org/github.com/ugorji/go/codec
-Detailed Usage/How-to Primer: http://ugorji.net/blog/go-codec-primer
-
-The idiomatic Go support is as seen in other encoding packages in
-the standard library (ie json, xml, gob, etc).
-
-Rich Feature Set includes:
-
- - Simple but extremely powerful and feature-rich API
- - Very High Performance.
- Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- - Multiple conversions:
- Package coerces types where appropriate
- e.g. decode an int in the stream into a float, etc.
- - Corner Cases:
- Overflows, nil maps/slices, nil values in streams are handled correctly
- - Standard field renaming via tags
- - Support for omitting empty fields during an encoding
- - Encoding from any value and decoding into pointer to any value
- (struct, slice, map, primitives, pointers, interface{}, etc)
- - Extensions to support efficient encoding/decoding of any named types
- - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- - Decoding without a schema (into a interface{}).
- Includes Options to configure what specific map or slice type to use
- when decoding an encoded list or map into a nil interface{}
- - Encode a struct as an array, and decode struct from an array in the data stream
- - Comprehensive support for anonymous fields
- - Fast (no-reflection) encoding/decoding of common maps and slices
- - Code-generation for faster performance.
- - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats
- - Support indefinite-length formats to enable true streaming
- (for formats which support it e.g. json, cbor)
- - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes.
- This mostly applies to maps, where iteration order is non-deterministic.
- - NIL in data stream decoded as zero value
- - Never silently skip data when decoding.
- User decides whether to return an error or silently skip data when keys or indexes
- in the data stream do not map to fields in the struct.
- - Encode/Decode from/to chan types (for iterative streaming support)
- - Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- - Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosyncrasies of codecs e.g.
- - For messagepack, configure how ambiguities in handling raw bytes are resolved
- - For messagepack, provide rpc server/client codec to support
- msgpack-rpc protocol defined at:
- https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-
-## Extension Support
-
-Users can register a function to handle the encoding or decoding of
-their custom types.
-
-There are no restrictions on what the custom type can be. Some examples:
-
- type BisSet []int
- type BitSet64 uint64
- type UUID string
- type MyStructWithUnexportedFields struct { a int; b bool; c []int; }
- type GifImage struct { ... }
-
-As an illustration, MyStructWithUnexportedFields would normally be
-encoded as an empty map because it has no exported fields, while UUID
-would be encoded as a string. However, with extension support, you can
-encode any of these however you like.
-
-## RPC
-
-RPC Client and Server Codecs are implemented, so the codecs can be used
-with the standard net/rpc package.
-
-## Usage
-
-Typical usage model:
-
- // create and configure Handle
- var (
- bh codec.BincHandle
- mh codec.MsgpackHandle
- ch codec.CborHandle
- )
-
- mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
-
- // configure extensions
- // e.g. for msgpack, define functions and enable Time support for tag 1
- // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt)
-
- // create and use decoder/encoder
- var (
- r io.Reader
- w io.Writer
- b []byte
- h = &bh // or mh to use msgpack
- )
-
- dec = codec.NewDecoder(r, h)
- dec = codec.NewDecoderBytes(b, h)
- err = dec.Decode(&v)
-
- enc = codec.NewEncoder(w, h)
- enc = codec.NewEncoderBytes(&b, h)
- err = enc.Encode(v)
-
- //RPC Server
- go func() {
- for {
- conn, err := listener.Accept()
- rpcCodec := codec.GoRpc.ServerCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h)
- rpc.ServeCodec(rpcCodec)
- }
- }()
-
- //RPC Communication (client side)
- conn, err = net.Dial("tcp", "localhost:5555")
- rpcCodec := codec.GoRpc.ClientCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
- client := rpc.NewClientWithCodec(rpcCodec)
-
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/binc.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/binc.go
deleted file mode 100644
index 33120dcb6..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/binc.go
+++ /dev/null
@@ -1,929 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math"
- "reflect"
- "time"
-)
-
-const bincDoPrune = true // No longer needed. Needed before as C lib did not support pruning.
-
-// vd as low 4 bits (there are 16 slots)
-const (
- bincVdSpecial byte = iota
- bincVdPosInt
- bincVdNegInt
- bincVdFloat
-
- bincVdString
- bincVdByteArray
- bincVdArray
- bincVdMap
-
- bincVdTimestamp
- bincVdSmallInt
- bincVdUnicodeOther
- bincVdSymbol
-
- bincVdDecimal
- _ // open slot
- _ // open slot
- bincVdCustomExt = 0x0f
-)
-
-const (
- bincSpNil byte = iota
- bincSpFalse
- bincSpTrue
- bincSpNan
- bincSpPosInf
- bincSpNegInf
- bincSpZeroFloat
- bincSpZero
- bincSpNegOne
-)
-
-const (
- bincFlBin16 byte = iota
- bincFlBin32
- _ // bincFlBin32e
- bincFlBin64
- _ // bincFlBin64e
- // others not currently supported
-)
-
-type bincEncDriver struct {
- e *Encoder
- w encWriter
- m map[string]uint16 // symbols
- b [scratchByteArrayLen]byte
- s uint16 // symbols sequencer
- encNoSeparator
-}
-
-func (e *bincEncDriver) IsBuiltinType(rt uintptr) bool {
- return rt == timeTypId
-}
-
-func (e *bincEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {
- if rt == timeTypId {
- var bs []byte
- switch x := v.(type) {
- case time.Time:
- bs = encodeTime(x)
- case *time.Time:
- bs = encodeTime(*x)
- default:
- e.e.errorf("binc error encoding builtin: expect time.Time, received %T", v)
- }
- e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs)))
- e.w.writeb(bs)
- }
-}
-
-func (e *bincEncDriver) EncodeNil() {
- e.w.writen1(bincVdSpecial<<4 | bincSpNil)
-}
-
-func (e *bincEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(bincVdSpecial<<4 | bincSpTrue)
- } else {
- e.w.writen1(bincVdSpecial<<4 | bincSpFalse)
- }
-}
-
-func (e *bincEncDriver) EncodeFloat32(f float32) {
- if f == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZeroFloat)
- return
- }
- e.w.writen1(bincVdFloat<<4 | bincFlBin32)
- bigenHelper{e.b[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *bincEncDriver) EncodeFloat64(f float64) {
- if f == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZeroFloat)
- return
- }
- bigen.PutUint64(e.b[:8], math.Float64bits(f))
- if bincDoPrune {
- i := 7
- for ; i >= 0 && (e.b[i] == 0); i-- {
- }
- i++
- if i <= 6 {
- e.w.writen1(bincVdFloat<<4 | 0x8 | bincFlBin64)
- e.w.writen1(byte(i))
- e.w.writeb(e.b[:i])
- return
- }
- }
- e.w.writen1(bincVdFloat<<4 | bincFlBin64)
- e.w.writeb(e.b[:8])
-}
-
-func (e *bincEncDriver) encIntegerPrune(bd byte, pos bool, v uint64, lim uint8) {
- if lim == 4 {
- bigen.PutUint32(e.b[:lim], uint32(v))
- } else {
- bigen.PutUint64(e.b[:lim], v)
- }
- if bincDoPrune {
- i := pruneSignExt(e.b[:lim], pos)
- e.w.writen1(bd | lim - 1 - byte(i))
- e.w.writeb(e.b[i:lim])
- } else {
- e.w.writen1(bd | lim - 1)
- e.w.writeb(e.b[:lim])
- }
-}
-
-func (e *bincEncDriver) EncodeInt(v int64) {
- const nbd byte = bincVdNegInt << 4
- if v >= 0 {
- e.encUint(bincVdPosInt<<4, true, uint64(v))
- } else if v == -1 {
- e.w.writen1(bincVdSpecial<<4 | bincSpNegOne)
- } else {
- e.encUint(bincVdNegInt<<4, false, uint64(-v))
- }
-}
-
-func (e *bincEncDriver) EncodeUint(v uint64) {
- e.encUint(bincVdPosInt<<4, true, v)
-}
-
-func (e *bincEncDriver) encUint(bd byte, pos bool, v uint64) {
- if v == 0 {
- e.w.writen1(bincVdSpecial<<4 | bincSpZero)
- } else if pos && v >= 1 && v <= 16 {
- e.w.writen1(bincVdSmallInt<<4 | byte(v-1))
- } else if v <= math.MaxUint8 {
- e.w.writen2(bd|0x0, byte(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd | 0x01)
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.encIntegerPrune(bd, pos, v, 4)
- } else {
- e.encIntegerPrune(bd, pos, v, 8)
- }
-}
-
-func (e *bincEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, _ *Encoder) {
- bs := ext.WriteExt(rv)
- if bs == nil {
- e.EncodeNil()
- return
- }
- e.encodeExtPreamble(uint8(xtag), len(bs))
- e.w.writeb(bs)
-}
-
-func (e *bincEncDriver) EncodeRawExt(re *RawExt, _ *Encoder) {
- e.encodeExtPreamble(uint8(re.Tag), len(re.Data))
- e.w.writeb(re.Data)
-}
-
-func (e *bincEncDriver) encodeExtPreamble(xtag byte, length int) {
- e.encLen(bincVdCustomExt<<4, uint64(length))
- e.w.writen1(xtag)
-}
-
-func (e *bincEncDriver) EncodeArrayStart(length int) {
- e.encLen(bincVdArray<<4, uint64(length))
-}
-
-func (e *bincEncDriver) EncodeMapStart(length int) {
- e.encLen(bincVdMap<<4, uint64(length))
-}
-
-func (e *bincEncDriver) EncodeString(c charEncoding, v string) {
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writestr(v)
- }
-}
-
-func (e *bincEncDriver) EncodeSymbol(v string) {
- // if WriteSymbolsNoRefs {
- // e.encodeString(c_UTF8, v)
- // return
- // }
-
- //symbols only offer benefit when string length > 1.
- //This is because strings with length 1 take only 2 bytes to store
- //(bd with embedded length, and single byte for string val).
-
- l := len(v)
- if l == 0 {
- e.encBytesLen(c_UTF8, 0)
- return
- } else if l == 1 {
- e.encBytesLen(c_UTF8, 1)
- e.w.writen1(v[0])
- return
- }
- if e.m == nil {
- e.m = make(map[string]uint16, 16)
- }
- ui, ok := e.m[v]
- if ok {
- if ui <= math.MaxUint8 {
- e.w.writen2(bincVdSymbol<<4, byte(ui))
- } else {
- e.w.writen1(bincVdSymbol<<4 | 0x8)
- bigenHelper{e.b[:2], e.w}.writeUint16(ui)
- }
- } else {
- e.s++
- ui = e.s
- //ui = uint16(atomic.AddUint32(&e.s, 1))
- e.m[v] = ui
- var lenprec uint8
- if l <= math.MaxUint8 {
- // lenprec = 0
- } else if l <= math.MaxUint16 {
- lenprec = 1
- } else if int64(l) <= math.MaxUint32 {
- lenprec = 2
- } else {
- lenprec = 3
- }
- if ui <= math.MaxUint8 {
- e.w.writen2(bincVdSymbol<<4|0x0|0x4|lenprec, byte(ui))
- } else {
- e.w.writen1(bincVdSymbol<<4 | 0x8 | 0x4 | lenprec)
- bigenHelper{e.b[:2], e.w}.writeUint16(ui)
- }
- if lenprec == 0 {
- e.w.writen1(byte(l))
- } else if lenprec == 1 {
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(l))
- } else if lenprec == 2 {
- bigenHelper{e.b[:4], e.w}.writeUint32(uint32(l))
- } else {
- bigenHelper{e.b[:8], e.w}.writeUint64(uint64(l))
- }
- e.w.writestr(v)
- }
-}
-
-func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writeb(v)
- }
-}
-
-func (e *bincEncDriver) encBytesLen(c charEncoding, length uint64) {
- //TODO: support bincUnicodeOther (for now, just use string or bytearray)
- if c == c_RAW {
- e.encLen(bincVdByteArray<<4, length)
- } else {
- e.encLen(bincVdString<<4, length)
- }
-}
-
-func (e *bincEncDriver) encLen(bd byte, l uint64) {
- if l < 12 {
- e.w.writen1(bd | uint8(l+4))
- } else {
- e.encLenNumber(bd, l)
- }
-}
-
-func (e *bincEncDriver) encLenNumber(bd byte, v uint64) {
- if v <= math.MaxUint8 {
- e.w.writen2(bd, byte(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd | 0x01)
- bigenHelper{e.b[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.w.writen1(bd | 0x02)
- bigenHelper{e.b[:4], e.w}.writeUint32(uint32(v))
- } else {
- e.w.writen1(bd | 0x03)
- bigenHelper{e.b[:8], e.w}.writeUint64(uint64(v))
- }
-}
-
-//------------------------------------
-
-type bincDecSymbol struct {
- s string
- b []byte
- i uint16
-}
-
-type bincDecDriver struct {
- d *Decoder
- h *BincHandle
- r decReader
- br bool // bytes reader
- bdRead bool
- bd byte
- vd byte
- vs byte
- noStreamingCodec
- decNoSeparator
- b [scratchByteArrayLen]byte
-
- // linear searching on this slice is ok,
- // because we typically expect < 32 symbols in each stream.
- s []bincDecSymbol
-}
-
-func (d *bincDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.vd = d.bd >> 4
- d.vs = d.bd & 0x0f
- d.bdRead = true
-}
-
-func (d *bincDecDriver) uncacheRead() {
- if d.bdRead {
- d.r.unreadn1()
- d.bdRead = false
- }
-}
-
-func (d *bincDecDriver) ContainerType() (vt valueType) {
- if d.vd == bincVdSpecial && d.vs == bincSpNil {
- return valueTypeNil
- } else if d.vd == bincVdByteArray {
- return valueTypeBytes
- } else if d.vd == bincVdString {
- return valueTypeString
- } else if d.vd == bincVdArray {
- return valueTypeArray
- } else if d.vd == bincVdMap {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *bincDecDriver) TryDecodeAsNil() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *bincDecDriver) IsBuiltinType(rt uintptr) bool {
- return rt == timeTypId
-}
-
-func (d *bincDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {
- if !d.bdRead {
- d.readNextBd()
- }
- if rt == timeTypId {
- if d.vd != bincVdTimestamp {
- d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd)
- return
- }
- tt, err := decodeTime(d.r.readx(int(d.vs)))
- if err != nil {
- panic(err)
- }
- var vt *time.Time = v.(*time.Time)
- *vt = tt
- d.bdRead = false
- }
-}
-
-func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) {
- if vs&0x8 == 0 {
- d.r.readb(d.b[0:defaultLen])
- } else {
- l := d.r.readn1()
- if l > 8 {
- d.d.errorf("At most 8 bytes used to represent float. Received: %v bytes", l)
- return
- }
- for i := l; i < 8; i++ {
- d.b[i] = 0
- }
- d.r.readb(d.b[0:l])
- }
-}
-
-func (d *bincDecDriver) decFloat() (f float64) {
- //if true { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))); break; }
- if x := d.vs & 0x7; x == bincFlBin32 {
- d.decFloatPre(d.vs, 4)
- f = float64(math.Float32frombits(bigen.Uint32(d.b[0:4])))
- } else if x == bincFlBin64 {
- d.decFloatPre(d.vs, 8)
- f = math.Float64frombits(bigen.Uint64(d.b[0:8]))
- } else {
- d.d.errorf("only float32 and float64 are supported. d.vd: 0x%x, d.vs: 0x%x", d.vd, d.vs)
- return
- }
- return
-}
-
-func (d *bincDecDriver) decUint() (v uint64) {
- // need to inline the code (interface conversion and type assertion expensive)
- switch d.vs {
- case 0:
- v = uint64(d.r.readn1())
- case 1:
- d.r.readb(d.b[6:8])
- v = uint64(bigen.Uint16(d.b[6:8]))
- case 2:
- d.b[4] = 0
- d.r.readb(d.b[5:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- case 3:
- d.r.readb(d.b[4:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- case 4, 5, 6:
- lim := int(7 - d.vs)
- d.r.readb(d.b[lim:8])
- for i := 0; i < lim; i++ {
- d.b[i] = 0
- }
- v = uint64(bigen.Uint64(d.b[:8]))
- case 7:
- d.r.readb(d.b[:8])
- v = uint64(bigen.Uint64(d.b[:8]))
- default:
- d.d.errorf("unsigned integers with greater than 64 bits of precision not supported")
- return
- }
- return
-}
-
-func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- vd, vs := d.vd, d.vs
- if vd == bincVdPosInt {
- ui = d.decUint()
- } else if vd == bincVdNegInt {
- ui = d.decUint()
- neg = true
- } else if vd == bincVdSmallInt {
- ui = uint64(d.vs) + 1
- } else if vd == bincVdSpecial {
- if vs == bincSpZero {
- //i = 0
- } else if vs == bincSpNegOne {
- neg = true
- ui = 1
- } else {
- d.d.errorf("numeric decode fails for special value: d.vs: 0x%x", d.vs)
- return
- }
- } else {
- d.d.errorf("number can only be decoded from uint or int values. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd)
- return
- }
- return
-}
-
-func (d *bincDecDriver) DecodeInt(bitsize uint8) (i int64) {
- ui, neg := d.decCheckInteger()
- i, overflow := chkOvf.SignedInt(ui)
- if overflow {
- d.d.errorf("simple: overflow converting %v to signed integer", ui)
- return
- }
- if neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("binc: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- ui, neg := d.decCheckInteger()
- if neg {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("binc: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- vd, vs := d.vd, d.vs
- if vd == bincVdSpecial {
- d.bdRead = false
- if vs == bincSpNan {
- return math.NaN()
- } else if vs == bincSpPosInf {
- return math.Inf(1)
- } else if vs == bincSpZeroFloat || vs == bincSpZero {
- return
- } else if vs == bincSpNegInf {
- return math.Inf(-1)
- } else {
- d.d.errorf("Invalid d.vs decoding float where d.vd=bincVdSpecial: %v", d.vs)
- return
- }
- } else if vd == bincVdFloat {
- f = d.decFloat()
- } else {
- f = float64(d.DecodeInt(64))
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("binc: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *bincDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == (bincVdSpecial | bincSpFalse) {
- // b = false
- } else if bd == (bincVdSpecial | bincSpTrue) {
- b = true
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) ReadMapStart() (length int) {
- if d.vd != bincVdMap {
- d.d.errorf("Invalid d.vd for map. Expecting 0x%x. Got: 0x%x", bincVdMap, d.vd)
- return
- }
- length = d.decLen()
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) ReadArrayStart() (length int) {
- if d.vd != bincVdArray {
- d.d.errorf("Invalid d.vd for array. Expecting 0x%x. Got: 0x%x", bincVdArray, d.vd)
- return
- }
- length = d.decLen()
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) decLen() int {
- if d.vs > 3 {
- return int(d.vs - 4)
- }
- return int(d.decLenNumber())
-}
-
-func (d *bincDecDriver) decLenNumber() (v uint64) {
- if x := d.vs; x == 0 {
- v = uint64(d.r.readn1())
- } else if x == 1 {
- d.r.readb(d.b[6:8])
- v = uint64(bigen.Uint16(d.b[6:8]))
- } else if x == 2 {
- d.r.readb(d.b[4:8])
- v = uint64(bigen.Uint32(d.b[4:8]))
- } else {
- d.r.readb(d.b[:8])
- v = bigen.Uint64(d.b[:8])
- }
- return
-}
-
-func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) (bs2 []byte, s string) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return
- }
- var slen int = -1
- // var ok bool
- switch d.vd {
- case bincVdString, bincVdByteArray:
- slen = d.decLen()
- if zerocopy {
- if d.br {
- bs2 = d.r.readx(slen)
- } else if len(bs) == 0 {
- bs2 = decByteSlice(d.r, slen, d.b[:])
- } else {
- bs2 = decByteSlice(d.r, slen, bs)
- }
- } else {
- bs2 = decByteSlice(d.r, slen, bs)
- }
- if withString {
- s = string(bs2)
- }
- case bincVdSymbol:
- // zerocopy doesn't apply for symbols,
- // as the values must be stored in a table for later use.
- //
- //from vs: extract numSymbolBytes, containsStringVal, strLenPrecision,
- //extract symbol
- //if containsStringVal, read it and put in map
- //else look in map for string value
- var symbol uint16
- vs := d.vs
- if vs&0x8 == 0 {
- symbol = uint16(d.r.readn1())
- } else {
- symbol = uint16(bigen.Uint16(d.r.readx(2)))
- }
- if d.s == nil {
- d.s = make([]bincDecSymbol, 0, 16)
- }
-
- if vs&0x4 == 0 {
- for i := range d.s {
- j := &d.s[i]
- if j.i == symbol {
- bs2 = j.b
- if withString {
- if j.s == "" && bs2 != nil {
- j.s = string(bs2)
- }
- s = j.s
- }
- break
- }
- }
- } else {
- switch vs & 0x3 {
- case 0:
- slen = int(d.r.readn1())
- case 1:
- slen = int(bigen.Uint16(d.r.readx(2)))
- case 2:
- slen = int(bigen.Uint32(d.r.readx(4)))
- case 3:
- slen = int(bigen.Uint64(d.r.readx(8)))
- }
- // since using symbols, do not store any part of
- // the parameter bs in the map, as it might be a shared buffer.
- // bs2 = decByteSlice(d.r, slen, bs)
- bs2 = decByteSlice(d.r, slen, nil)
- if withString {
- s = string(bs2)
- }
- d.s = append(d.s, bincDecSymbol{i: symbol, s: s, b: bs2})
- }
- default:
- d.d.errorf("Invalid d.vd. Expecting string:0x%x, bytearray:0x%x or symbol: 0x%x. Got: 0x%x",
- bincVdString, bincVdByteArray, bincVdSymbol, d.vd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeString() (s string) {
- // DecodeBytes does not accommodate symbols, whose impl stores string version in map.
- // Use decStringAndBytes directly.
- // return string(d.DecodeBytes(d.b[:], true, true))
- _, s = d.decStringAndBytes(d.b[:], true, true)
- return
-}
-
-func (d *bincDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if isstring {
- bsOut, _ = d.decStringAndBytes(bs, false, zerocopy)
- return
- }
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == bincVdSpecial<<4|bincSpNil {
- d.bdRead = false
- return nil
- }
- var clen int
- if d.vd == bincVdString || d.vd == bincVdByteArray {
- clen = d.decLen()
- } else {
- d.d.errorf("Invalid d.vd for bytes. Expecting string:0x%x or bytearray:0x%x. Got: 0x%x",
- bincVdString, bincVdByteArray, d.vd)
- return
- }
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.vd == bincVdCustomExt {
- l := d.decLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(l)
- } else if d.vd == bincVdByteArray {
- xbs = d.DecodeBytes(nil, false, true)
- } else {
- d.d.errorf("Invalid d.vd for extensions (Expecting extensions or byte array). Got: 0x%x", d.vd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *bincDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.vd {
- case bincVdSpecial:
- switch d.vs {
- case bincSpNil:
- n.v = valueTypeNil
- case bincSpFalse:
- n.v = valueTypeBool
- n.b = false
- case bincSpTrue:
- n.v = valueTypeBool
- n.b = true
- case bincSpNan:
- n.v = valueTypeFloat
- n.f = math.NaN()
- case bincSpPosInf:
- n.v = valueTypeFloat
- n.f = math.Inf(1)
- case bincSpNegInf:
- n.v = valueTypeFloat
- n.f = math.Inf(-1)
- case bincSpZeroFloat:
- n.v = valueTypeFloat
- n.f = float64(0)
- case bincSpZero:
- n.v = valueTypeUint
- n.u = uint64(0) // int8(0)
- case bincSpNegOne:
- n.v = valueTypeInt
- n.i = int64(-1) // int8(-1)
- default:
- d.d.errorf("decodeNaked: Unrecognized special value 0x%x", d.vs)
- }
- case bincVdSmallInt:
- n.v = valueTypeUint
- n.u = uint64(int8(d.vs)) + 1 // int8(d.vs) + 1
- case bincVdPosInt:
- n.v = valueTypeUint
- n.u = d.decUint()
- case bincVdNegInt:
- n.v = valueTypeInt
- n.i = -(int64(d.decUint()))
- case bincVdFloat:
- n.v = valueTypeFloat
- n.f = d.decFloat()
- case bincVdSymbol:
- n.v = valueTypeSymbol
- n.s = d.DecodeString()
- case bincVdString:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case bincVdByteArray:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case bincVdTimestamp:
- n.v = valueTypeTimestamp
- tt, err := decodeTime(d.r.readx(int(d.vs)))
- if err != nil {
- panic(err)
- }
- n.t = tt
- case bincVdCustomExt:
- n.v = valueTypeExt
- l := d.decLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(l)
- case bincVdArray:
- n.v = valueTypeArray
- decodeFurther = true
- case bincVdMap:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.vd: 0x%x", d.vd)
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- if n.v == valueTypeUint && d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = int64(n.u)
- }
- return
-}
-
-//------------------------------------
-
-//BincHandle is a Handle for the Binc Schema-Free Encoding Format
-//defined at https://github.com/ugorji/binc .
-//
-//BincHandle currently supports all Binc features with the following EXCEPTIONS:
-// - only integers up to 64 bits of precision are supported.
-// big integers are unsupported.
-// - Only IEEE 754 binary32 and binary64 floats are supported (ie Go float32 and float64 types).
-// extended precision and decimal IEEE 754 floats are unsupported.
-// - Only UTF-8 strings supported.
-// Unicode_Other Binc types (UTF16, UTF32) are currently unsupported.
-//
-//Note that these EXCEPTIONS are temporary and full support is possible and may happen soon.
-type BincHandle struct {
- BasicHandle
- binaryEncodingType
-}
-
-func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *BincHandle) newEncDriver(e *Encoder) encDriver {
- return &bincEncDriver{e: e, w: e.w}
-}
-
-func (h *BincHandle) newDecDriver(d *Decoder) decDriver {
- return &bincDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *bincEncDriver) reset() {
- e.w = e.e.w
- e.s = 0
- e.m = nil
-}
-
-func (d *bincDecDriver) reset() {
- d.r = d.d.r
- d.s = nil
- d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0
-}
-
-var _ decDriver = (*bincDecDriver)(nil)
-var _ encDriver = (*bincEncDriver)(nil)
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/cbor.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/cbor.go
deleted file mode 100644
index 4fa349ac8..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/cbor.go
+++ /dev/null
@@ -1,592 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math"
- "reflect"
-)
-
-const (
- cborMajorUint byte = iota
- cborMajorNegInt
- cborMajorBytes
- cborMajorText
- cborMajorArray
- cborMajorMap
- cborMajorTag
- cborMajorOther
-)
-
-const (
- cborBdFalse byte = 0xf4 + iota
- cborBdTrue
- cborBdNil
- cborBdUndefined
- cborBdExt
- cborBdFloat16
- cborBdFloat32
- cborBdFloat64
-)
-
-const (
- cborBdIndefiniteBytes byte = 0x5f
- cborBdIndefiniteString = 0x7f
- cborBdIndefiniteArray = 0x9f
- cborBdIndefiniteMap = 0xbf
- cborBdBreak = 0xff
-)
-
-const (
- CborStreamBytes byte = 0x5f
- CborStreamString = 0x7f
- CborStreamArray = 0x9f
- CborStreamMap = 0xbf
- CborStreamBreak = 0xff
-)
-
-const (
- cborBaseUint byte = 0x00
- cborBaseNegInt = 0x20
- cborBaseBytes = 0x40
- cborBaseString = 0x60
- cborBaseArray = 0x80
- cborBaseMap = 0xa0
- cborBaseTag = 0xc0
- cborBaseSimple = 0xe0
-)
-
-// -------------------
-
-type cborEncDriver struct {
- noBuiltInTypes
- encNoSeparator
- e *Encoder
- w encWriter
- h *CborHandle
- x [8]byte
-}
-
-func (e *cborEncDriver) EncodeNil() {
- e.w.writen1(cborBdNil)
-}
-
-func (e *cborEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(cborBdTrue)
- } else {
- e.w.writen1(cborBdFalse)
- }
-}
-
-func (e *cborEncDriver) EncodeFloat32(f float32) {
- e.w.writen1(cborBdFloat32)
- bigenHelper{e.x[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *cborEncDriver) EncodeFloat64(f float64) {
- e.w.writen1(cborBdFloat64)
- bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f))
-}
-
-func (e *cborEncDriver) encUint(v uint64, bd byte) {
- if v <= 0x17 {
- e.w.writen1(byte(v) + bd)
- } else if v <= math.MaxUint8 {
- e.w.writen2(bd+0x18, uint8(v))
- } else if v <= math.MaxUint16 {
- e.w.writen1(bd + 0x19)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(v))
- } else if v <= math.MaxUint32 {
- e.w.writen1(bd + 0x1a)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(v))
- } else { // if v <= math.MaxUint64 {
- e.w.writen1(bd + 0x1b)
- bigenHelper{e.x[:8], e.w}.writeUint64(v)
- }
-}
-
-func (e *cborEncDriver) EncodeInt(v int64) {
- if v < 0 {
- e.encUint(uint64(-1-v), cborBaseNegInt)
- } else {
- e.encUint(uint64(v), cborBaseUint)
- }
-}
-
-func (e *cborEncDriver) EncodeUint(v uint64) {
- e.encUint(v, cborBaseUint)
-}
-
-func (e *cborEncDriver) encLen(bd byte, length int) {
- e.encUint(uint64(length), bd)
-}
-
-func (e *cborEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) {
- e.encUint(uint64(xtag), cborBaseTag)
- if v := ext.ConvertExt(rv); v == nil {
- e.EncodeNil()
- } else {
- en.encode(v)
- }
-}
-
-func (e *cborEncDriver) EncodeRawExt(re *RawExt, en *Encoder) {
- e.encUint(uint64(re.Tag), cborBaseTag)
- if re.Data != nil {
- en.encode(re.Data)
- } else if re.Value == nil {
- e.EncodeNil()
- } else {
- en.encode(re.Value)
- }
-}
-
-func (e *cborEncDriver) EncodeArrayStart(length int) {
- e.encLen(cborBaseArray, length)
-}
-
-func (e *cborEncDriver) EncodeMapStart(length int) {
- e.encLen(cborBaseMap, length)
-}
-
-func (e *cborEncDriver) EncodeString(c charEncoding, v string) {
- e.encLen(cborBaseString, len(v))
- e.w.writestr(v)
-}
-
-func (e *cborEncDriver) EncodeSymbol(v string) {
- e.EncodeString(c_UTF8, v)
-}
-
-func (e *cborEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- if c == c_RAW {
- e.encLen(cborBaseBytes, len(v))
- } else {
- e.encLen(cborBaseString, len(v))
- }
- e.w.writeb(v)
-}
-
-// ----------------------
-
-type cborDecDriver struct {
- d *Decoder
- h *CborHandle
- r decReader
- b [scratchByteArrayLen]byte
- br bool // bytes reader
- bdRead bool
- bd byte
- noBuiltInTypes
- decNoSeparator
-}
-
-func (d *cborDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.bdRead = true
-}
-
-func (d *cborDecDriver) uncacheRead() {
- if d.bdRead {
- d.r.unreadn1()
- d.bdRead = false
- }
-}
-
-func (d *cborDecDriver) ContainerType() (vt valueType) {
- if d.bd == cborBdNil {
- return valueTypeNil
- } else if d.bd == cborBdIndefiniteBytes || (d.bd >= cborBaseBytes && d.bd < cborBaseString) {
- return valueTypeBytes
- } else if d.bd == cborBdIndefiniteString || (d.bd >= cborBaseString && d.bd < cborBaseArray) {
- return valueTypeString
- } else if d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) {
- return valueTypeArray
- } else if d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *cborDecDriver) TryDecodeAsNil() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- // treat Nil and Undefined as nil values
- if d.bd == cborBdNil || d.bd == cborBdUndefined {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *cborDecDriver) CheckBreak() bool {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == cborBdBreak {
- d.bdRead = false
- return true
- }
- return false
-}
-
-func (d *cborDecDriver) decUint() (ui uint64) {
- v := d.bd & 0x1f
- if v <= 0x17 {
- ui = uint64(v)
- } else {
- if v == 0x18 {
- ui = uint64(d.r.readn1())
- } else if v == 0x19 {
- ui = uint64(bigen.Uint16(d.r.readx(2)))
- } else if v == 0x1a {
- ui = uint64(bigen.Uint32(d.r.readx(4)))
- } else if v == 0x1b {
- ui = uint64(bigen.Uint64(d.r.readx(8)))
- } else {
- d.d.errorf("decUint: Invalid descriptor: %v", d.bd)
- return
- }
- }
- return
-}
-
-func (d *cborDecDriver) decCheckInteger() (neg bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- major := d.bd >> 5
- if major == cborMajorUint {
- } else if major == cborMajorNegInt {
- neg = true
- } else {
- d.d.errorf("invalid major: %v (bd: %v)", major, d.bd)
- return
- }
- return
-}
-
-func (d *cborDecDriver) DecodeInt(bitsize uint8) (i int64) {
- neg := d.decCheckInteger()
- ui := d.decUint()
- // check if this number can be converted to an int without overflow
- var overflow bool
- if neg {
- if i, overflow = chkOvf.SignedInt(ui + 1); overflow {
- d.d.errorf("cbor: overflow converting %v to signed integer", ui+1)
- return
- }
- i = -i
- } else {
- if i, overflow = chkOvf.SignedInt(ui); overflow {
- d.d.errorf("cbor: overflow converting %v to signed integer", ui)
- return
- }
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("cbor: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- if d.decCheckInteger() {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- ui = d.decUint()
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("cbor: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == cborBdFloat16 {
- f = float64(math.Float32frombits(halfFloatToFloatBits(bigen.Uint16(d.r.readx(2)))))
- } else if bd == cborBdFloat32 {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if bd == cborBdFloat64 {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else if bd >= cborBaseUint && bd < cborBaseBytes {
- f = float64(d.DecodeInt(64))
- } else {
- d.d.errorf("Float only valid from float16/32/64: Invalid descriptor: %v", bd)
- return
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("cbor: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *cborDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if bd := d.bd; bd == cborBdTrue {
- b = true
- } else if bd == cborBdFalse {
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) ReadMapStart() (length int) {
- d.bdRead = false
- if d.bd == cborBdIndefiniteMap {
- return -1
- }
- return d.decLen()
-}
-
-func (d *cborDecDriver) ReadArrayStart() (length int) {
- d.bdRead = false
- if d.bd == cborBdIndefiniteArray {
- return -1
- }
- return d.decLen()
-}
-
-func (d *cborDecDriver) decLen() int {
- return int(d.decUint())
-}
-
-func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte {
- d.bdRead = false
- for {
- if d.CheckBreak() {
- break
- }
- if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorText {
- d.d.errorf("cbor: expect bytes or string major type in indefinite string/bytes; got: %v, byte: %v", major, d.bd)
- return nil
- }
- n := d.decLen()
- oldLen := len(bs)
- newLen := oldLen + n
- if newLen > cap(bs) {
- bs2 := make([]byte, newLen, 2*cap(bs)+n)
- copy(bs2, bs)
- bs = bs2
- } else {
- bs = bs[:newLen]
- }
- d.r.readb(bs[oldLen:newLen])
- // bs = append(bs, d.r.readn()...)
- d.bdRead = false
- }
- d.bdRead = false
- return bs
-}
-
-func (d *cborDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == cborBdNil || d.bd == cborBdUndefined {
- d.bdRead = false
- return nil
- }
- if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString {
- if bs == nil {
- return d.decAppendIndefiniteBytes(nil)
- }
- return d.decAppendIndefiniteBytes(bs[:0])
- }
- clen := d.decLen()
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *cborDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if !d.bdRead {
- d.readNextBd()
- }
- u := d.decUint()
- d.bdRead = false
- realxtag = u
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- d.d.decode(&re.Value)
- } else if xtag != realxtag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", realxtag, xtag)
- return
- } else {
- var v interface{}
- d.d.decode(&v)
- ext.UpdateExt(rv, v)
- }
- d.bdRead = false
- return
-}
-
-func (d *cborDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.bd {
- case cborBdNil:
- n.v = valueTypeNil
- case cborBdFalse:
- n.v = valueTypeBool
- n.b = false
- case cborBdTrue:
- n.v = valueTypeBool
- n.b = true
- case cborBdFloat16, cborBdFloat32:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(true)
- case cborBdFloat64:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(false)
- case cborBdIndefiniteBytes:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case cborBdIndefiniteString:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case cborBdIndefiniteArray:
- n.v = valueTypeArray
- decodeFurther = true
- case cborBdIndefiniteMap:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- switch {
- case d.bd >= cborBaseUint && d.bd < cborBaseNegInt:
- if d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- } else {
- n.v = valueTypeUint
- n.u = d.DecodeUint(64)
- }
- case d.bd >= cborBaseNegInt && d.bd < cborBaseBytes:
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- case d.bd >= cborBaseBytes && d.bd < cborBaseString:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case d.bd >= cborBaseString && d.bd < cborBaseArray:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case d.bd >= cborBaseArray && d.bd < cborBaseMap:
- n.v = valueTypeArray
- decodeFurther = true
- case d.bd >= cborBaseMap && d.bd < cborBaseTag:
- n.v = valueTypeMap
- decodeFurther = true
- case d.bd >= cborBaseTag && d.bd < cborBaseSimple:
- n.v = valueTypeExt
- n.u = d.decUint()
- n.l = nil
- // d.bdRead = false
- // d.d.decode(&re.Value) // handled by decode itself.
- // decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd)
- return
- }
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- return
-}
-
-// -------------------------
-
-// CborHandle is a Handle for the CBOR encoding format,
-// defined at http://tools.ietf.org/html/rfc7049 and documented further at http://cbor.io .
-//
-// CBOR is comprehensively supported, including support for:
-// - indefinite-length arrays/maps/bytes/strings
-// - (extension) tags in range 0..0xffff (0 .. 65535)
-// - half, single and double-precision floats
-// - all numbers (1, 2, 4 and 8-byte signed and unsigned integers)
-// - nil, true, false, ...
-// - arrays and maps, bytes and text strings
-//
-// None of the optional extensions (with tags) defined in the spec are supported out-of-the-box.
-// Users can implement them as needed (using SetExt), including spec-documented ones:
-// - timestamp, BigNum, BigFloat, Decimals, Encoded Text (e.g. URL, regexp, base64, MIME Message), etc.
-//
-// To encode with indefinite lengths (streaming), users will use
-// (Must)Encode methods of *Encoder, along with writing CborStreamXXX constants.
-//
-// For example, to encode "one-byte" as an indefinite length string:
-// var buf bytes.Buffer
-// e := NewEncoder(&buf, new(CborHandle))
-// buf.WriteByte(CborStreamString)
-// e.MustEncode("one-")
-// e.MustEncode("byte")
-// buf.WriteByte(CborStreamBreak)
-// encodedBytes := buf.Bytes()
-// var vv interface{}
-// NewDecoderBytes(buf.Bytes(), new(CborHandle)).MustDecode(&vv)
-// // Now, vv contains the same string "one-byte"
-//
-type CborHandle struct {
- binaryEncodingType
- BasicHandle
-}
-
-func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{i: ext})
-}
-
-func (h *CborHandle) newEncDriver(e *Encoder) encDriver {
- return &cborEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *CborHandle) newDecDriver(d *Decoder) decDriver {
- return &cborDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *cborEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *cborDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-var _ decDriver = (*cborDecDriver)(nil)
-var _ encDriver = (*cborEncDriver)(nil)
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode.go
deleted file mode 100644
index 52c1dfe83..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode.go
+++ /dev/null
@@ -1,2053 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "encoding"
- "errors"
- "fmt"
- "io"
- "reflect"
- "time"
-)
-
-// Some tagging information for error messages.
-const (
- msgBadDesc = "Unrecognized descriptor byte"
- msgDecCannotExpandArr = "cannot expand go array from %v to stream length: %v"
-)
-
-var (
- onlyMapOrArrayCanDecodeIntoStructErr = errors.New("only encoded map or array can be decoded into a struct")
- cannotDecodeIntoNilErr = errors.New("cannot decode into nil")
-)
-
-// decReader abstracts the reading source, allowing implementations that can
-// read from an io.Reader or directly off a byte slice with zero-copying.
-type decReader interface {
- unreadn1()
-
- // readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR
- // just return a view of the []byte being decoded from.
- // Ensure you call detachZeroCopyBytes later if this needs to be sent outside codec control.
- readx(n int) []byte
- readb([]byte)
- readn1() uint8
- readn1eof() (v uint8, eof bool)
- numread() int // number of bytes read
- track()
- stopTrack() []byte
-}
-
-type decReaderByteScanner interface {
- io.Reader
- io.ByteScanner
-}
-
-type decDriver interface {
- // this will check if the next token is a break.
- CheckBreak() bool
- TryDecodeAsNil() bool
- // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known.
- ContainerType() (vt valueType)
- IsBuiltinType(rt uintptr) bool
- DecodeBuiltin(rt uintptr, v interface{})
-
- // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt.
- // For maps and arrays, it will not do the decoding in-band, but will signal
- // the decoder, so that is done later, by setting the decNaked.valueType field.
- //
- // Note: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types).
- // for extensions, DecodeNaked must read the tag and the []byte if it exists.
- // if the []byte is not read, then kInterfaceNaked will treat it as a Handle
- // that stores the subsequent value in-band, and complete reading the RawExt.
- //
- // extensions should also use readx to decode them, for efficiency.
- // kInterface will extract the detached byte slice if it has to pass it outside its realm.
- DecodeNaked()
- DecodeInt(bitsize uint8) (i int64)
- DecodeUint(bitsize uint8) (ui uint64)
- DecodeFloat(chkOverflow32 bool) (f float64)
- DecodeBool() (b bool)
- // DecodeString can also decode symbols.
- // It looks redundant as DecodeBytes is available.
- // However, some codecs (e.g. binc) support symbols and can
- // return a pre-stored string value, meaning that it can bypass
- // the cost of []byte->string conversion.
- DecodeString() (s string)
-
- // DecodeBytes may be called directly, without going through reflection.
- // Consequently, it must be designed to handle possible nil.
- DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte)
-
- // decodeExt will decode into a *RawExt or into an extension.
- DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64)
- // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte)
- ReadMapStart() int
- ReadArrayStart() int
-
- reset()
- uncacheRead()
-}
-
-type decNoSeparator struct {
-}
-
-func (_ decNoSeparator) ReadEnd() {}
-
-// func (_ decNoSeparator) uncacheRead() {}
-
-type DecodeOptions struct {
- // MapType specifies type to use during schema-less decoding of a map in the stream.
- // If nil, we use map[interface{}]interface{}
- MapType reflect.Type
-
- // SliceType specifies type to use during schema-less decoding of an array in the stream.
- // If nil, we use []interface{}
- SliceType reflect.Type
-
- // MaxInitLen defines the initial length that we "make" a collection (slice, chan or map) with.
- // If 0 or negative, we default to a sensible value based on the size of an element in the collection.
- //
- // For example, when decoding, a stream may say that it has MAX_UINT elements.
- // We should not auto-matically provision a slice of that length, to prevent Out-Of-Memory crash.
- // Instead, we provision up to MaxInitLen, fill that up, and start appending after that.
- MaxInitLen int
-
- // If ErrorIfNoField, return an error when decoding a map
- // from a codec stream into a struct, and no matching struct field is found.
- ErrorIfNoField bool
-
- // If ErrorIfNoArrayExpand, return an error when decoding a slice/array that cannot be expanded.
- // For example, the stream contains an array of 8 items, but you are decoding into a [4]T array,
- // or you are decoding into a slice of length 4 which is non-addressable (and so cannot be set).
- ErrorIfNoArrayExpand bool
-
- // If SignedInteger, use the int64 during schema-less decoding of unsigned values (not uint64).
- SignedInteger bool
-
- // MapValueReset controls how we decode into a map value.
- //
- // By default, we MAY retrieve the mapping for a key, and then decode into that.
- // However, especially with big maps, that retrieval may be expensive and unnecessary
- // if the stream already contains all that is necessary to recreate the value.
- //
- // If true, we will never retrieve the previous mapping,
- // but rather decode into a new value and set that in the map.
- //
- // If false, we will retrieve the previous mapping if necessary e.g.
- // the previous mapping is a pointer, or is a struct or array with pre-set state,
- // or is an interface.
- MapValueReset bool
-
- // InterfaceReset controls how we decode into an interface.
- //
- // By default, when we see a field that is an interface{...},
- // or a map with interface{...} value, we will attempt decoding into the
- // "contained" value.
- //
- // However, this prevents us from reading a string into an interface{}
- // that formerly contained a number.
- //
- // If true, we will decode into a new "blank" value, and set that in the interface.
- // If false, we will decode into whatever is contained in the interface.
- InterfaceReset bool
-
- // InternString controls interning of strings during decoding.
- //
- // Some handles, e.g. json, typically will read map keys as strings.
- // If the set of keys are finite, it may help reduce allocation to
- // look them up from a map (than to allocate them afresh).
- //
- // Note: Handles will be smart when using the intern functionality.
- // So everything will not be interned.
- InternString bool
-
- // PreferArrayOverSlice controls whether to decode to an array or a slice.
- //
- // This only impacts decoding into a nil interface{}.
- // Consequently, it has no effect on codecgen.
- //
- // *Note*: This only applies if using go1.5 and above,
- // as it requires reflect.ArrayOf support which was absent before go1.5.
- PreferArrayOverSlice bool
-}
-
-// ------------------------------------
-
-// ioDecByteScanner implements Read(), ReadByte(...), UnreadByte(...) methods
-// of io.Reader, io.ByteScanner.
-type ioDecByteScanner struct {
- r io.Reader
- l byte // last byte
- ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread
- b [1]byte // tiny buffer for reading single bytes
-}
-
-func (z *ioDecByteScanner) Read(p []byte) (n int, err error) {
- var firstByte bool
- if z.ls == 1 {
- z.ls = 2
- p[0] = z.l
- if len(p) == 1 {
- n = 1
- return
- }
- firstByte = true
- p = p[1:]
- }
- n, err = z.r.Read(p)
- if n > 0 {
- if err == io.EOF && n == len(p) {
- err = nil // read was successful, so postpone EOF (till next time)
- }
- z.l = p[n-1]
- z.ls = 2
- }
- if firstByte {
- n++
- }
- return
-}
-
-func (z *ioDecByteScanner) ReadByte() (c byte, err error) {
- n, err := z.Read(z.b[:])
- if n == 1 {
- c = z.b[0]
- if err == io.EOF {
- err = nil // read was successful, so postpone EOF (till next time)
- }
- }
- return
-}
-
-func (z *ioDecByteScanner) UnreadByte() (err error) {
- x := z.ls
- if x == 0 {
- err = errors.New("cannot unread - nothing has been read")
- } else if x == 1 {
- err = errors.New("cannot unread - last byte has not been read")
- } else if x == 2 {
- z.ls = 1
- }
- return
-}
-
-// ioDecReader is a decReader that reads off an io.Reader
-type ioDecReader struct {
- br decReaderByteScanner
- // temp byte array re-used internally for efficiency during read.
- // shares buffer with Decoder, so we keep size of struct within 8 words.
- x *[scratchByteArrayLen]byte
- bs ioDecByteScanner
- n int // num read
- tr []byte // tracking bytes read
- trb bool
-}
-
-func (z *ioDecReader) numread() int {
- return z.n
-}
-
-func (z *ioDecReader) readx(n int) (bs []byte) {
- if n <= 0 {
- return
- }
- if n < len(z.x) {
- bs = z.x[:n]
- } else {
- bs = make([]byte, n)
- }
- if _, err := io.ReadAtLeast(z.br, bs, n); err != nil {
- panic(err)
- }
- z.n += len(bs)
- if z.trb {
- z.tr = append(z.tr, bs...)
- }
- return
-}
-
-func (z *ioDecReader) readb(bs []byte) {
- if len(bs) == 0 {
- return
- }
- n, err := io.ReadAtLeast(z.br, bs, len(bs))
- z.n += n
- if err != nil {
- panic(err)
- }
- if z.trb {
- z.tr = append(z.tr, bs...)
- }
-}
-
-func (z *ioDecReader) readn1() (b uint8) {
- b, err := z.br.ReadByte()
- if err != nil {
- panic(err)
- }
- z.n++
- if z.trb {
- z.tr = append(z.tr, b)
- }
- return b
-}
-
-func (z *ioDecReader) readn1eof() (b uint8, eof bool) {
- b, err := z.br.ReadByte()
- if err == nil {
- z.n++
- if z.trb {
- z.tr = append(z.tr, b)
- }
- } else if err == io.EOF {
- eof = true
- } else {
- panic(err)
- }
- return
-}
-
-func (z *ioDecReader) unreadn1() {
- err := z.br.UnreadByte()
- if err != nil {
- panic(err)
- }
- z.n--
- if z.trb {
- if l := len(z.tr) - 1; l >= 0 {
- z.tr = z.tr[:l]
- }
- }
-}
-
-func (z *ioDecReader) track() {
- if z.tr != nil {
- z.tr = z.tr[:0]
- }
- z.trb = true
-}
-
-func (z *ioDecReader) stopTrack() (bs []byte) {
- z.trb = false
- return z.tr
-}
-
-// ------------------------------------
-
-var bytesDecReaderCannotUnreadErr = errors.New("cannot unread last byte read")
-
-// bytesDecReader is a decReader that reads off a byte slice with zero copying
-type bytesDecReader struct {
- b []byte // data
- c int // cursor
- a int // available
- t int // track start
-}
-
-func (z *bytesDecReader) reset(in []byte) {
- z.b = in
- z.a = len(in)
- z.c = 0
- z.t = 0
-}
-
-func (z *bytesDecReader) numread() int {
- return z.c
-}
-
-func (z *bytesDecReader) unreadn1() {
- if z.c == 0 || len(z.b) == 0 {
- panic(bytesDecReaderCannotUnreadErr)
- }
- z.c--
- z.a++
- return
-}
-
-func (z *bytesDecReader) readx(n int) (bs []byte) {
- // slicing from a non-constant start position is more expensive,
- // as more computation is required to decipher the pointer start position.
- // However, we do it only once, and it's better than reslicing both z.b and return value.
-
- if n <= 0 {
- } else if z.a == 0 {
- panic(io.EOF)
- } else if n > z.a {
- panic(io.ErrUnexpectedEOF)
- } else {
- c0 := z.c
- z.c = c0 + n
- z.a = z.a - n
- bs = z.b[c0:z.c]
- }
- return
-}
-
-func (z *bytesDecReader) readn1() (v uint8) {
- if z.a == 0 {
- panic(io.EOF)
- }
- v = z.b[z.c]
- z.c++
- z.a--
- return
-}
-
-func (z *bytesDecReader) readn1eof() (v uint8, eof bool) {
- if z.a == 0 {
- eof = true
- return
- }
- v = z.b[z.c]
- z.c++
- z.a--
- return
-}
-
-func (z *bytesDecReader) readb(bs []byte) {
- copy(bs, z.readx(len(bs)))
-}
-
-func (z *bytesDecReader) track() {
- z.t = z.c
-}
-
-func (z *bytesDecReader) stopTrack() (bs []byte) {
- return z.b[z.t:z.c]
-}
-
-// ------------------------------------
-
-type decFnInfo struct {
- d *Decoder
- ti *typeInfo
- xfFn Ext
- xfTag uint64
- seq seqType
-}
-
-// ----------------------------------------
-
-type decFn struct {
- i decFnInfo
- f func(*decFnInfo, reflect.Value)
-}
-
-func (f *decFnInfo) builtin(rv reflect.Value) {
- f.d.d.DecodeBuiltin(f.ti.rtid, rv.Addr().Interface())
-}
-
-func (f *decFnInfo) rawExt(rv reflect.Value) {
- f.d.d.DecodeExt(rv.Addr().Interface(), 0, nil)
-}
-
-func (f *decFnInfo) raw(rv reflect.Value) {
- rv.SetBytes(f.d.raw())
-}
-
-func (f *decFnInfo) ext(rv reflect.Value) {
- f.d.d.DecodeExt(rv.Addr().Interface(), f.xfTag, f.xfFn)
-}
-
-func (f *decFnInfo) getValueForUnmarshalInterface(rv reflect.Value, indir int8) (v interface{}) {
- if indir == -1 {
- v = rv.Addr().Interface()
- } else if indir == 0 {
- v = rv.Interface()
- } else {
- for j := int8(0); j < indir; j++ {
- if rv.IsNil() {
- rv.Set(reflect.New(rv.Type().Elem()))
- }
- rv = rv.Elem()
- }
- v = rv.Interface()
- }
- return
-}
-
-func (f *decFnInfo) selferUnmarshal(rv reflect.Value) {
- f.getValueForUnmarshalInterface(rv, f.ti.csIndir).(Selfer).CodecDecodeSelf(f.d)
-}
-
-func (f *decFnInfo) binaryUnmarshal(rv reflect.Value) {
- bm := f.getValueForUnmarshalInterface(rv, f.ti.bunmIndir).(encoding.BinaryUnmarshaler)
- xbs := f.d.d.DecodeBytes(nil, false, true)
- if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) textUnmarshal(rv reflect.Value) {
- tm := f.getValueForUnmarshalInterface(rv, f.ti.tunmIndir).(encoding.TextUnmarshaler)
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) jsonUnmarshal(rv reflect.Value) {
- tm := f.getValueForUnmarshalInterface(rv, f.ti.junmIndir).(jsonUnmarshaler)
- // bs := f.d.d.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-func (f *decFnInfo) kErr(rv reflect.Value) {
- f.d.errorf("no decoding function defined for kind %v", rv.Kind())
-}
-
-func (f *decFnInfo) kString(rv reflect.Value) {
- rv.SetString(f.d.d.DecodeString())
-}
-
-func (f *decFnInfo) kBool(rv reflect.Value) {
- rv.SetBool(f.d.d.DecodeBool())
-}
-
-func (f *decFnInfo) kInt(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(intBitsize))
-}
-
-func (f *decFnInfo) kInt64(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(64))
-}
-
-func (f *decFnInfo) kInt32(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(32))
-}
-
-func (f *decFnInfo) kInt8(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(8))
-}
-
-func (f *decFnInfo) kInt16(rv reflect.Value) {
- rv.SetInt(f.d.d.DecodeInt(16))
-}
-
-func (f *decFnInfo) kFloat32(rv reflect.Value) {
- rv.SetFloat(f.d.d.DecodeFloat(true))
-}
-
-func (f *decFnInfo) kFloat64(rv reflect.Value) {
- rv.SetFloat(f.d.d.DecodeFloat(false))
-}
-
-func (f *decFnInfo) kUint8(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(8))
-}
-
-func (f *decFnInfo) kUint64(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(64))
-}
-
-func (f *decFnInfo) kUint(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(uintBitsize))
-}
-
-func (f *decFnInfo) kUintptr(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(uintBitsize))
-}
-
-func (f *decFnInfo) kUint32(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(32))
-}
-
-func (f *decFnInfo) kUint16(rv reflect.Value) {
- rv.SetUint(f.d.d.DecodeUint(16))
-}
-
-// func (f *decFnInfo) kPtr(rv reflect.Value) {
-// debugf(">>>>>>> ??? decode kPtr called - shouldn't get called")
-// if rv.IsNil() {
-// rv.Set(reflect.New(rv.Type().Elem()))
-// }
-// f.d.decodeValue(rv.Elem())
-// }
-
-// var kIntfCtr uint64
-
-func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) {
- // nil interface:
- // use some hieristics to decode it appropriately
- // based on the detected next value in the stream.
- d := f.d
- d.d.DecodeNaked()
- n := &d.n
- if n.v == valueTypeNil {
- return
- }
- // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader).
- // if num := f.ti.rt.NumMethod(); num > 0 {
- if f.ti.numMeth > 0 {
- d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth)
- return
- }
- // var useRvn bool
- switch n.v {
- case valueTypeMap:
- // if d.h.MapType == nil || d.h.MapType == mapIntfIntfTyp {
- // } else if d.h.MapType == mapStrIntfTyp { // for json performance
- // }
- if d.mtid == 0 || d.mtid == mapIntfIntfTypId {
- l := len(n.ms)
- n.ms = append(n.ms, nil)
- var v2 interface{} = &n.ms[l]
- d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
- n.ms = n.ms[:l]
- } else if d.mtid == mapStrIntfTypId { // for json performance
- l := len(n.ns)
- n.ns = append(n.ns, nil)
- var v2 interface{} = &n.ns[l]
- d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
- n.ns = n.ns[:l]
- } else {
- rvn = reflect.New(d.h.MapType).Elem()
- d.decodeValue(rvn, nil)
- }
- case valueTypeArray:
- // if d.h.SliceType == nil || d.h.SliceType == intfSliceTyp {
- if d.stid == 0 || d.stid == intfSliceTypId {
- l := len(n.ss)
- n.ss = append(n.ss, nil)
- var v2 interface{} = &n.ss[l]
- d.decode(v2)
- n.ss = n.ss[:l]
- rvn = reflect.ValueOf(v2).Elem()
- if reflectArrayOfSupported && d.stid == 0 && d.h.PreferArrayOverSlice {
- rvn = reflectArrayOf(rvn)
- }
- } else {
- rvn = reflect.New(d.h.SliceType).Elem()
- d.decodeValue(rvn, nil)
- }
- case valueTypeExt:
- var v interface{}
- tag, bytes := n.u, n.l // calling decode below might taint the values
- if bytes == nil {
- l := len(n.is)
- n.is = append(n.is, nil)
- v2 := &n.is[l]
- d.decode(v2)
- v = *v2
- n.is = n.is[:l]
- }
- bfn := d.h.getExtForTag(tag)
- if bfn == nil {
- var re RawExt
- re.Tag = tag
- re.Data = detachZeroCopyBytes(d.bytes, nil, bytes)
- rvn = reflect.ValueOf(re)
- } else {
- rvnA := reflect.New(bfn.rt)
- rvn = rvnA.Elem()
- if bytes != nil {
- bfn.ext.ReadExt(rvnA.Interface(), bytes)
- } else {
- bfn.ext.UpdateExt(rvnA.Interface(), v)
- }
- }
- case valueTypeNil:
- // no-op
- case valueTypeInt:
- rvn = reflect.ValueOf(&n.i).Elem()
- case valueTypeUint:
- rvn = reflect.ValueOf(&n.u).Elem()
- case valueTypeFloat:
- rvn = reflect.ValueOf(&n.f).Elem()
- case valueTypeBool:
- rvn = reflect.ValueOf(&n.b).Elem()
- case valueTypeString, valueTypeSymbol:
- rvn = reflect.ValueOf(&n.s).Elem()
- case valueTypeBytes:
- rvn = reflect.ValueOf(&n.l).Elem()
- case valueTypeTimestamp:
- rvn = reflect.ValueOf(&n.t).Elem()
- default:
- panic(fmt.Errorf("kInterfaceNaked: unexpected valueType: %d", n.v))
- }
- return
-}
-
-func (f *decFnInfo) kInterface(rv reflect.Value) {
- // debugf("\t===> kInterface")
-
- // Note:
- // A consequence of how kInterface works, is that
- // if an interface already contains something, we try
- // to decode into what was there before.
- // We do not replace with a generic value (as got from decodeNaked).
-
- var rvn reflect.Value
- if rv.IsNil() {
- rvn = f.kInterfaceNaked()
- if rvn.IsValid() {
- rv.Set(rvn)
- }
- } else if f.d.h.InterfaceReset {
- rvn = f.kInterfaceNaked()
- if rvn.IsValid() {
- rv.Set(rvn)
- } else {
- // reset to zero value based on current type in there.
- rv.Set(reflect.Zero(rv.Elem().Type()))
- }
- } else {
- rvn = rv.Elem()
- // Note: interface{} is settable, but underlying type may not be.
- // Consequently, we have to set the reflect.Value directly.
- // if underlying type is settable (e.g. ptr or interface),
- // we just decode into it.
- // Else we create a settable value, decode into it, and set on the interface.
- if rvn.CanSet() {
- f.d.decodeValue(rvn, nil)
- } else {
- rvn2 := reflect.New(rvn.Type()).Elem()
- rvn2.Set(rvn)
- f.d.decodeValue(rvn2, nil)
- rv.Set(rvn2)
- }
- }
-}
-
-func (f *decFnInfo) kStruct(rv reflect.Value) {
- fti := f.ti
- d := f.d
- dd := d.d
- cr := d.cr
- ctyp := dd.ContainerType()
- if ctyp == valueTypeMap {
- containerLen := dd.ReadMapStart()
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
- tisfi := fti.sfi
- hasLen := containerLen >= 0
- if hasLen {
- for j := 0; j < containerLen; j++ {
- // rvkencname := dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true))
- // rvksi := ti.getForEncName(rvkencname)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if k := fti.indexForEncName(rvkencname); k > -1 {
- si := tisfi[k]
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- } else {
- d.structFieldNotFound(-1, rvkencname)
- }
- }
- } else {
- for j := 0; !dd.CheckBreak(); j++ {
- // rvkencname := dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true))
- // rvksi := ti.getForEncName(rvkencname)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if k := fti.indexForEncName(rvkencname); k > -1 {
- si := tisfi[k]
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- } else {
- d.structFieldNotFound(-1, rvkencname)
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- } else if ctyp == valueTypeArray {
- containerLen := dd.ReadArrayStart()
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- return
- }
- // Not much gain from doing it two ways for array.
- // Arrays are not used as much for structs.
- hasLen := containerLen >= 0
- for j, si := range fti.sfip {
- if hasLen {
- if j == containerLen {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- if dd.TryDecodeAsNil() {
- si.setToZeroValue(rv)
- } else {
- d.decodeValue(si.field(rv, true), nil)
- }
- }
- if containerLen > len(fti.sfip) {
- // read remaining values and throw away
- for j := len(fti.sfip); j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- d.structFieldNotFound(j, "")
- }
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- } else {
- f.d.error(onlyMapOrArrayCanDecodeIntoStructErr)
- return
- }
-}
-
-func (f *decFnInfo) kSlice(rv reflect.Value) {
- // A slice can be set from a map or array in stream.
- // This way, the order can be kept (as order is lost with map).
- ti := f.ti
- d := f.d
- dd := d.d
- rtelem0 := ti.rt.Elem()
- ctyp := dd.ContainerType()
- if ctyp == valueTypeBytes || ctyp == valueTypeString {
- // you can only decode bytes or string in the stream into a slice or array of bytes
- if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) {
- f.d.errorf("bytes or string in the stream must be decoded into a slice or array of bytes, not %v", ti.rt)
- }
- if f.seq == seqTypeChan {
- bs2 := dd.DecodeBytes(nil, false, true)
- ch := rv.Interface().(chan<- byte)
- for _, b := range bs2 {
- ch <- b
- }
- } else {
- rvbs := rv.Bytes()
- bs2 := dd.DecodeBytes(rvbs, false, false)
- if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) {
- if rv.CanSet() {
- rv.SetBytes(bs2)
- } else {
- copy(rvbs, bs2)
- }
- }
- }
- return
- }
-
- // array := f.seq == seqTypeChan
-
- slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map)
-
- // // an array can never return a nil slice. so no need to check f.array here.
- if containerLenS == 0 {
- if f.seq == seqTypeSlice {
- if rv.IsNil() {
- rv.Set(reflect.MakeSlice(ti.rt, 0, 0))
- } else {
- rv.SetLen(0)
- }
- } else if f.seq == seqTypeChan {
- if rv.IsNil() {
- rv.Set(reflect.MakeChan(ti.rt, 0))
- }
- }
- slh.End()
- return
- }
-
- rtelem := rtelem0
- for rtelem.Kind() == reflect.Ptr {
- rtelem = rtelem.Elem()
- }
- fn := d.getDecFn(rtelem, true, true)
-
- var rv0, rv9 reflect.Value
- rv0 = rv
- rvChanged := false
-
- // for j := 0; j < containerLenS; j++ {
- var rvlen int
- if containerLenS > 0 { // hasLen
- if f.seq == seqTypeChan {
- if rv.IsNil() {
- rvlen, _ = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size()))
- rv.Set(reflect.MakeChan(ti.rt, rvlen))
- }
- // handle chan specially:
- for j := 0; j < containerLenS; j++ {
- rv9 = reflect.New(rtelem0).Elem()
- slh.ElemContainerState(j)
- d.decodeValue(rv9, fn)
- rv.Send(rv9)
- }
- } else { // slice or array
- var truncated bool // says len of sequence is not same as expected number of elements
- numToRead := containerLenS // if truncated, reset numToRead
-
- rvcap := rv.Cap()
- rvlen = rv.Len()
- if containerLenS > rvcap {
- if f.seq == seqTypeArray {
- d.arrayCannotExpand(rvlen, containerLenS)
- } else {
- oldRvlenGtZero := rvlen > 0
- rvlen, truncated = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size()))
- if truncated {
- if rvlen <= rvcap {
- rv.SetLen(rvlen)
- } else {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
- rvChanged = true
- }
- } else {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
- rvChanged = true
- }
- if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) {
- reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap)
- }
- rvcap = rvlen
- }
- numToRead = rvlen
- } else if containerLenS != rvlen {
- if f.seq == seqTypeSlice {
- rv.SetLen(containerLenS)
- rvlen = containerLenS
- }
- }
- j := 0
- // we read up to the numToRead
- for ; j < numToRead; j++ {
- slh.ElemContainerState(j)
- d.decodeValue(rv.Index(j), fn)
- }
-
- // if slice, expand and read up to containerLenS (or EOF) iff truncated
- // if array, swallow all the rest.
-
- if f.seq == seqTypeArray {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- } else if truncated { // slice was truncated, as chan NOT in this block
- for ; j < containerLenS; j++ {
- rv = expandSliceValue(rv, 1)
- rv9 = rv.Index(j)
- if resetSliceElemToZeroValue {
- rv9.Set(reflect.Zero(rtelem0))
- }
- slh.ElemContainerState(j)
- d.decodeValue(rv9, fn)
- }
- }
- }
- } else {
- rvlen = rv.Len()
- j := 0
- for ; !dd.CheckBreak(); j++ {
- if f.seq == seqTypeChan {
- slh.ElemContainerState(j)
- rv9 = reflect.New(rtelem0).Elem()
- d.decodeValue(rv9, fn)
- rv.Send(rv9)
- } else {
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= rvlen {
- if f.seq == seqTypeArray {
- d.arrayCannotExpand(rvlen, j+1)
- decodeIntoBlank = true
- } else { // if f.seq == seqTypeSlice
- // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs
- rv = expandSliceValue(rv, 1)
- rv9 = rv.Index(j)
- // rv.Index(rv.Len() - 1).Set(reflect.Zero(rtelem0))
- if resetSliceElemToZeroValue {
- rv9.Set(reflect.Zero(rtelem0))
- }
- rvlen++
- rvChanged = true
- }
- } else { // slice or array
- rv9 = rv.Index(j)
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else { // seqTypeSlice
- d.decodeValue(rv9, fn)
- }
- }
- }
- if f.seq == seqTypeSlice {
- if j < rvlen {
- rv.SetLen(j)
- } else if j == 0 && rv.IsNil() {
- rv = reflect.MakeSlice(ti.rt, 0, 0)
- rvChanged = true
- }
- }
- }
- slh.End()
-
- if rvChanged {
- rv0.Set(rv)
- }
-}
-
-func (f *decFnInfo) kArray(rv reflect.Value) {
- // f.d.decodeValue(rv.Slice(0, rv.Len()))
- f.kSlice(rv.Slice(0, rv.Len()))
-}
-
-func (f *decFnInfo) kMap(rv reflect.Value) {
- d := f.d
- dd := d.d
- containerLen := dd.ReadMapStart()
- cr := d.cr
- ti := f.ti
- if rv.IsNil() {
- rv.Set(reflect.MakeMap(ti.rt))
- }
-
- if containerLen == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
-
- ktype, vtype := ti.rt.Key(), ti.rt.Elem()
- ktypeId := reflect.ValueOf(ktype).Pointer()
- vtypeKind := vtype.Kind()
- var keyFn, valFn *decFn
- var xtyp reflect.Type
- for xtyp = ktype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() {
- }
- keyFn = d.getDecFn(xtyp, true, true)
- for xtyp = vtype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() {
- }
- valFn = d.getDecFn(xtyp, true, true)
- var mapGet, mapSet bool
- if !f.d.h.MapValueReset {
- // if pointer, mapGet = true
- // if interface, mapGet = true if !DecodeNakedAlways (else false)
- // if builtin, mapGet = false
- // else mapGet = true
- if vtypeKind == reflect.Ptr {
- mapGet = true
- } else if vtypeKind == reflect.Interface {
- if !f.d.h.InterfaceReset {
- mapGet = true
- }
- } else if !isImmutableKind(vtypeKind) {
- mapGet = true
- }
- }
-
- var rvk, rvv, rvz reflect.Value
-
- // for j := 0; j < containerLen; j++ {
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- rvk = reflect.New(ktype).Elem()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.decodeValue(rvk, keyFn)
-
- // special case if a byte array.
- if ktypeId == intfTypId {
- rvk = rvk.Elem()
- if rvk.Type() == uint8SliceTyp {
- rvk = reflect.ValueOf(d.string(rvk.Bytes()))
- }
- }
- mapSet = true // set to false if u do a get, and its a pointer, and exists
- if mapGet {
- rvv = rv.MapIndex(rvk)
- if rvv.IsValid() {
- if vtypeKind == reflect.Ptr {
- mapSet = false
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.decodeValue(rvv, valFn)
- if mapSet {
- rv.SetMapIndex(rvk, rvv)
- }
- }
- } else {
- for j := 0; !dd.CheckBreak(); j++ {
- rvk = reflect.New(ktype).Elem()
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.decodeValue(rvk, keyFn)
-
- // special case if a byte array.
- if ktypeId == intfTypId {
- rvk = rvk.Elem()
- if rvk.Type() == uint8SliceTyp {
- rvk = reflect.ValueOf(d.string(rvk.Bytes()))
- }
- }
- mapSet = true // set to false if u do a get, and its a pointer, and exists
- if mapGet {
- rvv = rv.MapIndex(rvk)
- if rvv.IsValid() {
- if vtypeKind == reflect.Ptr {
- mapSet = false
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- } else {
- if rvz.IsValid() {
- rvz.Set(reflect.Zero(vtype))
- } else {
- rvz = reflect.New(vtype).Elem()
- }
- rvv = rvz
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.decodeValue(rvv, valFn)
- if mapSet {
- rv.SetMapIndex(rvk, rvv)
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-type decRtidFn struct {
- rtid uintptr
- fn decFn
-}
-
-// decNaked is used to keep track of the primitives decoded.
-// Without it, we would have to decode each primitive and wrap it
-// in an interface{}, causing an allocation.
-// In this model, the primitives are decoded in a "pseudo-atomic" fashion,
-// so we can rest assured that no other decoding happens while these
-// primitives are being decoded.
-//
-// maps and arrays are not handled by this mechanism.
-// However, RawExt is, and we accommodate for extensions that decode
-// RawExt from DecodeNaked, but need to decode the value subsequently.
-// kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat.
-//
-// However, decNaked also keeps some arrays of default maps and slices
-// used in DecodeNaked. This way, we can get a pointer to it
-// without causing a new heap allocation.
-//
-// kInterfaceNaked will ensure that there is no allocation for the common
-// uses.
-type decNaked struct {
- // r RawExt // used for RawExt, uint, []byte.
- u uint64
- i int64
- f float64
- l []byte
- s string
- t time.Time
- b bool
- v valueType
-
- // stacks for reducing allocation
- is []interface{}
- ms []map[interface{}]interface{}
- ns []map[string]interface{}
- ss [][]interface{}
- // rs []RawExt
-
- // keep arrays at the bottom? Chance is that they are not used much.
- ia [4]interface{}
- ma [4]map[interface{}]interface{}
- na [4]map[string]interface{}
- sa [4][]interface{}
- // ra [2]RawExt
-}
-
-func (n *decNaked) reset() {
- if n.ss != nil {
- n.ss = n.ss[:0]
- }
- if n.is != nil {
- n.is = n.is[:0]
- }
- if n.ms != nil {
- n.ms = n.ms[:0]
- }
- if n.ns != nil {
- n.ns = n.ns[:0]
- }
-}
-
-// A Decoder reads and decodes an object from an input stream in the codec format.
-type Decoder struct {
- // hopefully, reduce derefencing cost by laying the decReader inside the Decoder.
- // Try to put things that go together to fit within a cache line (8 words).
-
- d decDriver
- // NOTE: Decoder shouldn't call it's read methods,
- // as the handler MAY need to do some coordination.
- r decReader
- // sa [initCollectionCap]decRtidFn
- h *BasicHandle
- hh Handle
-
- be bool // is binary encoding
- bytes bool // is bytes reader
- js bool // is json handle
-
- rb bytesDecReader
- ri ioDecReader
- cr containerStateRecv
-
- s []decRtidFn
- f map[uintptr]*decFn
-
- // _ uintptr // for alignment purposes, so next one starts from a cache line
-
- // cache the mapTypeId and sliceTypeId for faster comparisons
- mtid uintptr
- stid uintptr
-
- n decNaked
- b [scratchByteArrayLen]byte
- is map[string]string // used for interning strings
-}
-
-// NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader.
-//
-// For efficiency, Users are encouraged to pass in a memory buffered reader
-// (eg bufio.Reader, bytes.Buffer).
-func NewDecoder(r io.Reader, h Handle) *Decoder {
- d := newDecoder(h)
- d.Reset(r)
- return d
-}
-
-// NewDecoderBytes returns a Decoder which efficiently decodes directly
-// from a byte slice with zero copying.
-func NewDecoderBytes(in []byte, h Handle) *Decoder {
- d := newDecoder(h)
- d.ResetBytes(in)
- return d
-}
-
-func newDecoder(h Handle) *Decoder {
- d := &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()}
- n := &d.n
- // n.rs = n.ra[:0]
- n.ms = n.ma[:0]
- n.is = n.ia[:0]
- n.ns = n.na[:0]
- n.ss = n.sa[:0]
- _, d.js = h.(*JsonHandle)
- if d.h.InternString {
- d.is = make(map[string]string, 32)
- }
- d.d = h.newDecDriver(d)
- d.cr, _ = d.d.(containerStateRecv)
- // d.d = h.newDecDriver(decReaderT{true, &d.rb, &d.ri})
- return d
-}
-
-func (d *Decoder) resetCommon() {
- d.n.reset()
- d.d.reset()
- // reset all things which were cached from the Handle,
- // but could be changed.
- d.mtid, d.stid = 0, 0
- if d.h.MapType != nil {
- d.mtid = reflect.ValueOf(d.h.MapType).Pointer()
- }
- if d.h.SliceType != nil {
- d.stid = reflect.ValueOf(d.h.SliceType).Pointer()
- }
-}
-
-func (d *Decoder) Reset(r io.Reader) {
- d.ri.x = &d.b
- // d.s = d.sa[:0]
- d.ri.bs.r = r
- var ok bool
- d.ri.br, ok = r.(decReaderByteScanner)
- if !ok {
- d.ri.br = &d.ri.bs
- }
- d.r = &d.ri
- d.resetCommon()
-}
-
-func (d *Decoder) ResetBytes(in []byte) {
- // d.s = d.sa[:0]
- d.rb.reset(in)
- d.r = &d.rb
- d.resetCommon()
-}
-
-// func (d *Decoder) sendContainerState(c containerState) {
-// if d.cr != nil {
-// d.cr.sendContainerState(c)
-// }
-// }
-
-// Decode decodes the stream from reader and stores the result in the
-// value pointed to by v. v cannot be a nil pointer. v can also be
-// a reflect.Value of a pointer.
-//
-// Note that a pointer to a nil interface is not a nil pointer.
-// If you do not know what type of stream it is, pass in a pointer to a nil interface.
-// We will decode and store a value in that nil interface.
-//
-// Sample usages:
-// // Decoding into a non-nil typed value
-// var f float32
-// err = codec.NewDecoder(r, handle).Decode(&f)
-//
-// // Decoding into nil interface
-// var v interface{}
-// dec := codec.NewDecoder(r, handle)
-// err = dec.Decode(&v)
-//
-// When decoding into a nil interface{}, we will decode into an appropriate value based
-// on the contents of the stream:
-// - Numbers are decoded as float64, int64 or uint64.
-// - Other values are decoded appropriately depending on the type:
-// bool, string, []byte, time.Time, etc
-// - Extensions are decoded as RawExt (if no ext function registered for the tag)
-// Configurations exist on the Handle to override defaults
-// (e.g. for MapType, SliceType and how to decode raw bytes).
-//
-// When decoding into a non-nil interface{} value, the mode of encoding is based on the
-// type of the value. When a value is seen:
-// - If an extension is registered for it, call that extension function
-// - If it implements BinaryUnmarshaler, call its UnmarshalBinary(data []byte) error
-// - Else decode it based on its reflect.Kind
-//
-// There are some special rules when decoding into containers (slice/array/map/struct).
-// Decode will typically use the stream contents to UPDATE the container.
-// - A map can be decoded from a stream map, by updating matching keys.
-// - A slice can be decoded from a stream array,
-// by updating the first n elements, where n is length of the stream.
-// - A slice can be decoded from a stream map, by decoding as if
-// it contains a sequence of key-value pairs.
-// - A struct can be decoded from a stream map, by updating matching fields.
-// - A struct can be decoded from a stream array,
-// by updating fields as they occur in the struct (by index).
-//
-// When decoding a stream map or array with length of 0 into a nil map or slice,
-// we reset the destination map or slice to a zero-length value.
-//
-// However, when decoding a stream nil, we reset the destination container
-// to its "zero" value (e.g. nil for slice/map, etc).
-//
-func (d *Decoder) Decode(v interface{}) (err error) {
- defer panicToErr(&err)
- d.decode(v)
- return
-}
-
-// this is not a smart swallow, as it allocates objects and does unnecessary work.
-func (d *Decoder) swallowViaHammer() {
- var blank interface{}
- d.decodeValue(reflect.ValueOf(&blank).Elem(), nil)
-}
-
-func (d *Decoder) swallow() {
- // smarter decode that just swallows the content
- dd := d.d
- if dd.TryDecodeAsNil() {
- return
- }
- cr := d.cr
- switch dd.ContainerType() {
- case valueTypeMap:
- containerLen := dd.ReadMapStart()
- clenGtEqualZero := containerLen >= 0
- for j := 0; ; j++ {
- if clenGtEqualZero {
- if j >= containerLen {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- d.swallow()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- d.swallow()
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- case valueTypeArray:
- containerLenS := dd.ReadArrayStart()
- clenGtEqualZero := containerLenS >= 0
- for j := 0; ; j++ {
- if clenGtEqualZero {
- if j >= containerLenS {
- break
- }
- } else if dd.CheckBreak() {
- break
- }
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- d.swallow()
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- case valueTypeBytes:
- dd.DecodeBytes(d.b[:], false, true)
- case valueTypeString:
- dd.DecodeBytes(d.b[:], true, true)
- // dd.DecodeStringAsBytes(d.b[:])
- default:
- // these are all primitives, which we can get from decodeNaked
- // if RawExt using Value, complete the processing.
- dd.DecodeNaked()
- if n := &d.n; n.v == valueTypeExt && n.l == nil {
- l := len(n.is)
- n.is = append(n.is, nil)
- v2 := &n.is[l]
- d.decode(v2)
- n.is = n.is[:l]
- }
- }
-}
-
-// MustDecode is like Decode, but panics if unable to Decode.
-// This provides insight to the code location that triggered the error.
-func (d *Decoder) MustDecode(v interface{}) {
- d.decode(v)
-}
-
-func (d *Decoder) decode(iv interface{}) {
- // if ics, ok := iv.(Selfer); ok {
- // ics.CodecDecodeSelf(d)
- // return
- // }
-
- if d.d.TryDecodeAsNil() {
- switch v := iv.(type) {
- case nil:
- case *string:
- *v = ""
- case *bool:
- *v = false
- case *int:
- *v = 0
- case *int8:
- *v = 0
- case *int16:
- *v = 0
- case *int32:
- *v = 0
- case *int64:
- *v = 0
- case *uint:
- *v = 0
- case *uint8:
- *v = 0
- case *uint16:
- *v = 0
- case *uint32:
- *v = 0
- case *uint64:
- *v = 0
- case *float32:
- *v = 0
- case *float64:
- *v = 0
- case *[]uint8:
- *v = nil
- case *Raw:
- *v = nil
- case reflect.Value:
- if v.Kind() != reflect.Ptr || v.IsNil() {
- d.errNotValidPtrValue(v)
- }
- // d.chkPtrValue(v)
- v = v.Elem()
- if v.IsValid() {
- v.Set(reflect.Zero(v.Type()))
- }
- default:
- rv := reflect.ValueOf(iv)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- d.errNotValidPtrValue(rv)
- }
- // d.chkPtrValue(rv)
- rv = rv.Elem()
- if rv.IsValid() {
- rv.Set(reflect.Zero(rv.Type()))
- }
- }
- return
- }
-
- switch v := iv.(type) {
- case nil:
- d.error(cannotDecodeIntoNilErr)
- return
-
- case Selfer:
- v.CodecDecodeSelf(d)
-
- case reflect.Value:
- if v.Kind() != reflect.Ptr || v.IsNil() {
- d.errNotValidPtrValue(v)
- }
- // d.chkPtrValue(v)
- d.decodeValueNotNil(v.Elem(), nil)
-
- case *string:
- *v = d.d.DecodeString()
- case *bool:
- *v = d.d.DecodeBool()
- case *int:
- *v = int(d.d.DecodeInt(intBitsize))
- case *int8:
- *v = int8(d.d.DecodeInt(8))
- case *int16:
- *v = int16(d.d.DecodeInt(16))
- case *int32:
- *v = int32(d.d.DecodeInt(32))
- case *int64:
- *v = d.d.DecodeInt(64)
- case *uint:
- *v = uint(d.d.DecodeUint(uintBitsize))
- case *uint8:
- *v = uint8(d.d.DecodeUint(8))
- case *uint16:
- *v = uint16(d.d.DecodeUint(16))
- case *uint32:
- *v = uint32(d.d.DecodeUint(32))
- case *uint64:
- *v = d.d.DecodeUint(64)
- case *float32:
- *v = float32(d.d.DecodeFloat(true))
- case *float64:
- *v = d.d.DecodeFloat(false)
- case *[]uint8:
- *v = d.d.DecodeBytes(*v, false, false)
-
- case *Raw:
- *v = d.raw()
-
- case *interface{}:
- d.decodeValueNotNil(reflect.ValueOf(iv).Elem(), nil)
-
- default:
- if !fastpathDecodeTypeSwitch(iv, d) {
- d.decodeI(iv, true, false, false, false)
- }
- }
-}
-
-func (d *Decoder) preDecodeValue(rv reflect.Value, tryNil bool) (rv2 reflect.Value, proceed bool) {
- if tryNil && d.d.TryDecodeAsNil() {
- // No need to check if a ptr, recursively, to determine
- // whether to set value to nil.
- // Just always set value to its zero type.
- if rv.IsValid() { // rv.CanSet() // always settable, except it's invalid
- rv.Set(reflect.Zero(rv.Type()))
- }
- return
- }
-
- // If stream is not containing a nil value, then we can deref to the base
- // non-pointer value, and decode into that.
- for rv.Kind() == reflect.Ptr {
- if rv.IsNil() {
- rv.Set(reflect.New(rv.Type().Elem()))
- }
- rv = rv.Elem()
- }
- return rv, true
-}
-
-func (d *Decoder) decodeI(iv interface{}, checkPtr, tryNil, checkFastpath, checkCodecSelfer bool) {
- rv := reflect.ValueOf(iv)
- if checkPtr {
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- d.errNotValidPtrValue(rv)
- }
- // d.chkPtrValue(rv)
- }
- rv, proceed := d.preDecodeValue(rv, tryNil)
- if proceed {
- fn := d.getDecFn(rv.Type(), checkFastpath, checkCodecSelfer)
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) decodeValue(rv reflect.Value, fn *decFn) {
- if rv, proceed := d.preDecodeValue(rv, true); proceed {
- if fn == nil {
- fn = d.getDecFn(rv.Type(), true, true)
- }
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) decodeValueNotNil(rv reflect.Value, fn *decFn) {
- if rv, proceed := d.preDecodeValue(rv, false); proceed {
- if fn == nil {
- fn = d.getDecFn(rv.Type(), true, true)
- }
- fn.f(&fn.i, rv)
- }
-}
-
-func (d *Decoder) getDecFn(rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *decFn) {
- rtid := reflect.ValueOf(rt).Pointer()
-
- // retrieve or register a focus'ed function for this type
- // to eliminate need to do the retrieval multiple times
-
- // if d.f == nil && d.s == nil { debugf("---->Creating new dec f map for type: %v\n", rt) }
- var ok bool
- if useMapForCodecCache {
- fn, ok = d.f[rtid]
- } else {
- for i := range d.s {
- v := &(d.s[i])
- if v.rtid == rtid {
- fn, ok = &(v.fn), true
- break
- }
- }
- }
- if ok {
- return
- }
-
- if useMapForCodecCache {
- if d.f == nil {
- d.f = make(map[uintptr]*decFn, initCollectionCap)
- }
- fn = new(decFn)
- d.f[rtid] = fn
- } else {
- if d.s == nil {
- d.s = make([]decRtidFn, 0, initCollectionCap)
- }
- d.s = append(d.s, decRtidFn{rtid: rtid})
- fn = &(d.s[len(d.s)-1]).fn
- }
-
- // debugf("\tCreating new dec fn for type: %v\n", rt)
- ti := d.h.getTypeInfo(rtid, rt)
- fi := &(fn.i)
- fi.d = d
- fi.ti = ti
-
- // An extension can be registered for any type, regardless of the Kind
- // (e.g. type BitSet int64, type MyStruct { / * unexported fields * / }, type X []int, etc.
- //
- // We can't check if it's an extension byte here first, because the user may have
- // registered a pointer or non-pointer type, meaning we may have to recurse first
- // before matching a mapped type, even though the extension byte is already detected.
- //
- // NOTE: if decoding into a nil interface{}, we return a non-nil
- // value except even if the container registers a length of 0.
- if checkCodecSelfer && ti.cs {
- fn.f = (*decFnInfo).selferUnmarshal
- } else if rtid == rawExtTypId {
- fn.f = (*decFnInfo).rawExt
- } else if rtid == rawTypId {
- fn.f = (*decFnInfo).raw
- } else if d.d.IsBuiltinType(rtid) {
- fn.f = (*decFnInfo).builtin
- } else if xfFn := d.h.getExt(rtid); xfFn != nil {
- fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext
- fn.f = (*decFnInfo).ext
- } else if supportMarshalInterfaces && d.be && ti.bunm {
- fn.f = (*decFnInfo).binaryUnmarshal
- } else if supportMarshalInterfaces && !d.be && d.js && ti.junm {
- //If JSON, we should check JSONUnmarshal before textUnmarshal
- fn.f = (*decFnInfo).jsonUnmarshal
- } else if supportMarshalInterfaces && !d.be && ti.tunm {
- fn.f = (*decFnInfo).textUnmarshal
- } else {
- rk := rt.Kind()
- if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) {
- if rt.PkgPath() == "" {
- if idx := fastpathAV.index(rtid); idx != -1 {
- fn.f = fastpathAV[idx].decfn
- }
- } else {
- // use mapping for underlying type if there
- ok = false
- var rtu reflect.Type
- if rk == reflect.Map {
- rtu = reflect.MapOf(rt.Key(), rt.Elem())
- } else {
- rtu = reflect.SliceOf(rt.Elem())
- }
- rtuid := reflect.ValueOf(rtu).Pointer()
- if idx := fastpathAV.index(rtuid); idx != -1 {
- xfnf := fastpathAV[idx].decfn
- xrt := fastpathAV[idx].rt
- fn.f = func(xf *decFnInfo, xrv reflect.Value) {
- // xfnf(xf, xrv.Convert(xrt))
- xfnf(xf, xrv.Addr().Convert(reflect.PtrTo(xrt)).Elem())
- }
- }
- }
- }
- if fn.f == nil {
- switch rk {
- case reflect.String:
- fn.f = (*decFnInfo).kString
- case reflect.Bool:
- fn.f = (*decFnInfo).kBool
- case reflect.Int:
- fn.f = (*decFnInfo).kInt
- case reflect.Int64:
- fn.f = (*decFnInfo).kInt64
- case reflect.Int32:
- fn.f = (*decFnInfo).kInt32
- case reflect.Int8:
- fn.f = (*decFnInfo).kInt8
- case reflect.Int16:
- fn.f = (*decFnInfo).kInt16
- case reflect.Float32:
- fn.f = (*decFnInfo).kFloat32
- case reflect.Float64:
- fn.f = (*decFnInfo).kFloat64
- case reflect.Uint8:
- fn.f = (*decFnInfo).kUint8
- case reflect.Uint64:
- fn.f = (*decFnInfo).kUint64
- case reflect.Uint:
- fn.f = (*decFnInfo).kUint
- case reflect.Uint32:
- fn.f = (*decFnInfo).kUint32
- case reflect.Uint16:
- fn.f = (*decFnInfo).kUint16
- // case reflect.Ptr:
- // fn.f = (*decFnInfo).kPtr
- case reflect.Uintptr:
- fn.f = (*decFnInfo).kUintptr
- case reflect.Interface:
- fn.f = (*decFnInfo).kInterface
- case reflect.Struct:
- fn.f = (*decFnInfo).kStruct
- case reflect.Chan:
- fi.seq = seqTypeChan
- fn.f = (*decFnInfo).kSlice
- case reflect.Slice:
- fi.seq = seqTypeSlice
- fn.f = (*decFnInfo).kSlice
- case reflect.Array:
- fi.seq = seqTypeArray
- fn.f = (*decFnInfo).kArray
- case reflect.Map:
- fn.f = (*decFnInfo).kMap
- default:
- fn.f = (*decFnInfo).kErr
- }
- }
- }
-
- return
-}
-
-func (d *Decoder) structFieldNotFound(index int, rvkencname string) {
- // NOTE: rvkencname may be a stringView, so don't pass it to another function.
- if d.h.ErrorIfNoField {
- if index >= 0 {
- d.errorf("no matching struct field found when decoding stream array at index %v", index)
- return
- } else if rvkencname != "" {
- d.errorf("no matching struct field found when decoding stream map with key " + rvkencname)
- return
- }
- }
- d.swallow()
-}
-
-func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) {
- if d.h.ErrorIfNoArrayExpand {
- d.errorf("cannot expand array len during decode from %v to %v", sliceLen, streamLen)
- }
-}
-
-func (d *Decoder) chkPtrValue(rv reflect.Value) {
- // We can only decode into a non-nil pointer
- if rv.Kind() == reflect.Ptr && !rv.IsNil() {
- return
- }
- d.errNotValidPtrValue(rv)
-}
-
-func (d *Decoder) errNotValidPtrValue(rv reflect.Value) {
- if !rv.IsValid() {
- d.error(cannotDecodeIntoNilErr)
- return
- }
- if !rv.CanInterface() {
- d.errorf("cannot decode into a value without an interface: %v", rv)
- return
- }
- rvi := rv.Interface()
- d.errorf("cannot decode into non-pointer or nil pointer. Got: %v, %T, %v", rv.Kind(), rvi, rvi)
-}
-
-func (d *Decoder) error(err error) {
- panic(err)
-}
-
-func (d *Decoder) errorf(format string, params ...interface{}) {
- params2 := make([]interface{}, len(params)+1)
- params2[0] = d.r.numread()
- copy(params2[1:], params)
- err := fmt.Errorf("[pos %d]: "+format, params2...)
- panic(err)
-}
-
-func (d *Decoder) string(v []byte) (s string) {
- if d.is != nil {
- s, ok := d.is[string(v)] // no allocation here.
- if !ok {
- s = string(v)
- d.is[s] = s
- }
- return s
- }
- return string(v) // don't return stringView, as we need a real string here.
-}
-
-func (d *Decoder) intern(s string) {
- if d.is != nil {
- d.is[s] = s
- }
-}
-
-// nextValueBytes returns the next value in the stream as a set of bytes.
-func (d *Decoder) nextValueBytes() []byte {
- d.d.uncacheRead()
- d.r.track()
- d.swallow()
- return d.r.stopTrack()
-}
-
-func (d *Decoder) raw() []byte {
- // ensure that this is not a view into the bytes
- // i.e. make new copy always.
- bs := d.nextValueBytes()
- bs2 := make([]byte, len(bs))
- copy(bs2, bs)
- return bs2
-}
-
-// --------------------------------------------------
-
-// decSliceHelper assists when decoding into a slice, from a map or an array in the stream.
-// A slice can be set from a map or array in stream. This supports the MapBySlice interface.
-type decSliceHelper struct {
- d *Decoder
- // ct valueType
- array bool
-}
-
-func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) {
- dd := d.d
- ctyp := dd.ContainerType()
- if ctyp == valueTypeArray {
- x.array = true
- clen = dd.ReadArrayStart()
- } else if ctyp == valueTypeMap {
- clen = dd.ReadMapStart() * 2
- } else {
- d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp)
- }
- // x.ct = ctyp
- x.d = d
- return
-}
-
-func (x decSliceHelper) End() {
- cr := x.d.cr
- if cr == nil {
- return
- }
- if x.array {
- cr.sendContainerState(containerArrayEnd)
- } else {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (x decSliceHelper) ElemContainerState(index int) {
- cr := x.d.cr
- if cr == nil {
- return
- }
- if x.array {
- cr.sendContainerState(containerArrayElem)
- } else {
- if index%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
-}
-
-func decByteSlice(r decReader, clen int, bs []byte) (bsOut []byte) {
- if clen == 0 {
- return zeroByteSlice
- }
- if len(bs) == clen {
- bsOut = bs
- } else if cap(bs) >= clen {
- bsOut = bs[:clen]
- } else {
- bsOut = make([]byte, clen)
- }
- r.readb(bsOut)
- return
-}
-
-func detachZeroCopyBytes(isBytesReader bool, dest []byte, in []byte) (out []byte) {
- if xlen := len(in); xlen > 0 {
- if isBytesReader || xlen <= scratchByteArrayLen {
- if cap(dest) >= xlen {
- out = dest[:xlen]
- } else {
- out = make([]byte, xlen)
- }
- copy(out, in)
- return
- }
- }
- return in
-}
-
-// decInferLen will infer a sensible length, given the following:
-// - clen: length wanted.
-// - maxlen: max length to be returned.
-// if <= 0, it is unset, and we infer it based on the unit size
-// - unit: number of bytes for each element of the collection
-func decInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- // handle when maxlen is not set i.e. <= 0
- if clen <= 0 {
- return
- }
- if maxlen <= 0 {
- // no maxlen defined. Use maximum of 256K memory, with a floor of 4K items.
- // maxlen = 256 * 1024 / unit
- // if maxlen < (4 * 1024) {
- // maxlen = 4 * 1024
- // }
- if unit < (256 / 4) {
- maxlen = 256 * 1024 / unit
- } else {
- maxlen = 4 * 1024
- }
- }
- if clen > maxlen {
- rvlen = maxlen
- truncated = true
- } else {
- rvlen = clen
- }
- return
- // if clen <= 0 {
- // rvlen = 0
- // } else if maxlen > 0 && clen > maxlen {
- // rvlen = maxlen
- // truncated = true
- // } else {
- // rvlen = clen
- // }
- // return
-}
-
-// // implement overall decReader wrapping both, for possible use inline:
-// type decReaderT struct {
-// bytes bool
-// rb *bytesDecReader
-// ri *ioDecReader
-// }
-//
-// // implement *Decoder as a decReader.
-// // Using decReaderT (defined just above) caused performance degradation
-// // possibly because of constant copying the value,
-// // and some value->interface conversion causing allocation.
-// func (d *Decoder) unreadn1() {
-// if d.bytes {
-// d.rb.unreadn1()
-// } else {
-// d.ri.unreadn1()
-// }
-// }
-// ... for other methods of decReader.
-// Testing showed that performance improvement was negligible.
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go.go
deleted file mode 100644
index ba289cef6..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build go1.5
-
-package codec
-
-import "reflect"
-
-const reflectArrayOfSupported = true
-
-func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
- rvn2 = reflect.New(reflect.ArrayOf(rvn.Len(), intfTyp)).Elem()
- reflect.Copy(rvn2, rvn)
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go14.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go14.go
deleted file mode 100644
index 50063bc8f..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/decode_go14.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build !go1.5
-
-package codec
-
-import "reflect"
-
-const reflectArrayOfSupported = false
-
-func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
- panic("reflect.ArrayOf unsupported")
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/encode.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/encode.go
deleted file mode 100644
index c2cef812e..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/encode.go
+++ /dev/null
@@ -1,1461 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "encoding"
- "fmt"
- "io"
- "reflect"
- "sort"
- "sync"
-)
-
-const (
- defEncByteBufSize = 1 << 6 // 4:16, 6:64, 8:256, 10:1024
-)
-
-// AsSymbolFlag defines what should be encoded as symbols.
-type AsSymbolFlag uint8
-
-const (
- // AsSymbolDefault is default.
- // Currently, this means only encode struct field names as symbols.
- // The default is subject to change.
- AsSymbolDefault AsSymbolFlag = iota
-
- // AsSymbolAll means encode anything which could be a symbol as a symbol.
- AsSymbolAll = 0xfe
-
- // AsSymbolNone means do not encode anything as a symbol.
- AsSymbolNone = 1 << iota
-
- // AsSymbolMapStringKeys means encode keys in map[string]XXX as symbols.
- AsSymbolMapStringKeysFlag
-
- // AsSymbolStructFieldName means encode struct field names as symbols.
- AsSymbolStructFieldNameFlag
-)
-
-// encWriter abstracts writing to a byte array or to an io.Writer.
-type encWriter interface {
- writeb([]byte)
- writestr(string)
- writen1(byte)
- writen2(byte, byte)
- atEndOfEncode()
-}
-
-// encDriver abstracts the actual codec (binc vs msgpack, etc)
-type encDriver interface {
- IsBuiltinType(rt uintptr) bool
- EncodeBuiltin(rt uintptr, v interface{})
- EncodeNil()
- EncodeInt(i int64)
- EncodeUint(i uint64)
- EncodeBool(b bool)
- EncodeFloat32(f float32)
- EncodeFloat64(f float64)
- // encodeExtPreamble(xtag byte, length int)
- EncodeRawExt(re *RawExt, e *Encoder)
- EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder)
- EncodeArrayStart(length int)
- EncodeMapStart(length int)
- EncodeString(c charEncoding, v string)
- EncodeSymbol(v string)
- EncodeStringBytes(c charEncoding, v []byte)
- //TODO
- //encBignum(f *big.Int)
- //encStringRunes(c charEncoding, v []rune)
-
- reset()
-}
-
-type encDriverAsis interface {
- EncodeAsis(v []byte)
-}
-
-type encNoSeparator struct{}
-
-func (_ encNoSeparator) EncodeEnd() {}
-
-type ioEncWriterWriter interface {
- WriteByte(c byte) error
- WriteString(s string) (n int, err error)
- Write(p []byte) (n int, err error)
-}
-
-type ioEncStringWriter interface {
- WriteString(s string) (n int, err error)
-}
-
-type EncodeOptions struct {
- // Encode a struct as an array, and not as a map
- StructToArray bool
-
- // Canonical representation means that encoding a value will always result in the same
- // sequence of bytes.
- //
- // This only affects maps, as the iteration order for maps is random.
- //
- // The implementation MAY use the natural sort order for the map keys if possible:
- //
- // - If there is a natural sort order (ie for number, bool, string or []byte keys),
- // then the map keys are first sorted in natural order and then written
- // with corresponding map values to the strema.
- // - If there is no natural sort order, then the map keys will first be
- // encoded into []byte, and then sorted,
- // before writing the sorted keys and the corresponding map values to the stream.
- //
- Canonical bool
-
- // CheckCircularRef controls whether we check for circular references
- // and error fast during an encode.
- //
- // If enabled, an error is received if a pointer to a struct
- // references itself either directly or through one of its fields (iteratively).
- //
- // This is opt-in, as there may be a performance hit to checking circular references.
- CheckCircularRef bool
-
- // RecursiveEmptyCheck controls whether we descend into interfaces, structs and pointers
- // when checking if a value is empty.
- //
- // Note that this may make OmitEmpty more expensive, as it incurs a lot more reflect calls.
- RecursiveEmptyCheck bool
-
- // Raw controls whether we encode Raw values.
- // This is a "dangerous" option and must be explicitly set.
- // If set, we blindly encode Raw values as-is, without checking
- // if they are a correct representation of a value in that format.
- // If unset, we error out.
- Raw bool
-
- // AsSymbols defines what should be encoded as symbols.
- //
- // Encoding as symbols can reduce the encoded size significantly.
- //
- // However, during decoding, each string to be encoded as a symbol must
- // be checked to see if it has been seen before. Consequently, encoding time
- // will increase if using symbols, because string comparisons has a clear cost.
- //
- // Sample values:
- // AsSymbolNone
- // AsSymbolAll
- // AsSymbolMapStringKeys
- // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag
- AsSymbols AsSymbolFlag
-}
-
-// ---------------------------------------------
-
-type simpleIoEncWriterWriter struct {
- w io.Writer
- bw io.ByteWriter
- sw ioEncStringWriter
- bs [1]byte
-}
-
-func (o *simpleIoEncWriterWriter) WriteByte(c byte) (err error) {
- if o.bw != nil {
- return o.bw.WriteByte(c)
- }
- // _, err = o.w.Write([]byte{c})
- o.bs[0] = c
- _, err = o.w.Write(o.bs[:])
- return
-}
-
-func (o *simpleIoEncWriterWriter) WriteString(s string) (n int, err error) {
- if o.sw != nil {
- return o.sw.WriteString(s)
- }
- // return o.w.Write([]byte(s))
- return o.w.Write(bytesView(s))
-}
-
-func (o *simpleIoEncWriterWriter) Write(p []byte) (n int, err error) {
- return o.w.Write(p)
-}
-
-// ----------------------------------------
-
-// ioEncWriter implements encWriter and can write to an io.Writer implementation
-type ioEncWriter struct {
- w ioEncWriterWriter
- s simpleIoEncWriterWriter
- // x [8]byte // temp byte array re-used internally for efficiency
-}
-
-func (z *ioEncWriter) writeb(bs []byte) {
- if len(bs) == 0 {
- return
- }
- n, err := z.w.Write(bs)
- if err != nil {
- panic(err)
- }
- if n != len(bs) {
- panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(bs), n))
- }
-}
-
-func (z *ioEncWriter) writestr(s string) {
- n, err := z.w.WriteString(s)
- if err != nil {
- panic(err)
- }
- if n != len(s) {
- panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(s), n))
- }
-}
-
-func (z *ioEncWriter) writen1(b byte) {
- if err := z.w.WriteByte(b); err != nil {
- panic(err)
- }
-}
-
-func (z *ioEncWriter) writen2(b1 byte, b2 byte) {
- z.writen1(b1)
- z.writen1(b2)
-}
-
-func (z *ioEncWriter) atEndOfEncode() {}
-
-// ----------------------------------------
-
-// bytesEncWriter implements encWriter and can write to an byte slice.
-// It is used by Marshal function.
-type bytesEncWriter struct {
- b []byte
- c int // cursor
- out *[]byte // write out on atEndOfEncode
-}
-
-func (z *bytesEncWriter) writeb(s []byte) {
- if len(s) == 0 {
- return
- }
- oc, a := z.growNoAlloc(len(s))
- if a {
- z.growAlloc(len(s), oc)
- }
- copy(z.b[oc:], s)
-}
-
-func (z *bytesEncWriter) writestr(s string) {
- if len(s) == 0 {
- return
- }
- oc, a := z.growNoAlloc(len(s))
- if a {
- z.growAlloc(len(s), oc)
- }
- copy(z.b[oc:], s)
-}
-
-func (z *bytesEncWriter) writen1(b1 byte) {
- oc, a := z.growNoAlloc(1)
- if a {
- z.growAlloc(1, oc)
- }
- z.b[oc] = b1
-}
-
-func (z *bytesEncWriter) writen2(b1 byte, b2 byte) {
- oc, a := z.growNoAlloc(2)
- if a {
- z.growAlloc(2, oc)
- }
- z.b[oc+1] = b2
- z.b[oc] = b1
-}
-
-func (z *bytesEncWriter) atEndOfEncode() {
- *(z.out) = z.b[:z.c]
-}
-
-// have a growNoalloc(n int), which can be inlined.
-// if allocation is needed, then call growAlloc(n int)
-
-func (z *bytesEncWriter) growNoAlloc(n int) (oldcursor int, allocNeeded bool) {
- oldcursor = z.c
- z.c = z.c + n
- if z.c > len(z.b) {
- if z.c > cap(z.b) {
- allocNeeded = true
- } else {
- z.b = z.b[:cap(z.b)]
- }
- }
- return
-}
-
-func (z *bytesEncWriter) growAlloc(n int, oldcursor int) {
- // appendslice logic (if cap < 1024, *2, else *1.25): more expensive. many copy calls.
- // bytes.Buffer model (2*cap + n): much better
- // bs := make([]byte, 2*cap(z.b)+n)
- bs := make([]byte, growCap(cap(z.b), 1, n))
- copy(bs, z.b[:oldcursor])
- z.b = bs
-}
-
-// ---------------------------------------------
-
-type encFnInfo struct {
- e *Encoder
- ti *typeInfo
- xfFn Ext
- xfTag uint64
- seq seqType
-}
-
-func (f *encFnInfo) builtin(rv reflect.Value) {
- f.e.e.EncodeBuiltin(f.ti.rtid, rv.Interface())
-}
-
-func (f *encFnInfo) raw(rv reflect.Value) {
- f.e.raw(rv.Interface().(Raw))
-}
-
-func (f *encFnInfo) rawExt(rv reflect.Value) {
- // rev := rv.Interface().(RawExt)
- // f.e.e.EncodeRawExt(&rev, f.e)
- var re *RawExt
- if rv.CanAddr() {
- re = rv.Addr().Interface().(*RawExt)
- } else {
- rev := rv.Interface().(RawExt)
- re = &rev
- }
- f.e.e.EncodeRawExt(re, f.e)
-}
-
-func (f *encFnInfo) ext(rv reflect.Value) {
- // if this is a struct|array and it was addressable, then pass the address directly (not the value)
- if k := rv.Kind(); (k == reflect.Struct || k == reflect.Array) && rv.CanAddr() {
- rv = rv.Addr()
- }
- f.e.e.EncodeExt(rv.Interface(), f.xfTag, f.xfFn, f.e)
-}
-
-func (f *encFnInfo) getValueForMarshalInterface(rv reflect.Value, indir int8) (v interface{}, proceed bool) {
- if indir == 0 {
- v = rv.Interface()
- } else if indir == -1 {
- // If a non-pointer was passed to Encode(), then that value is not addressable.
- // Take addr if addressable, else copy value to an addressable value.
- if rv.CanAddr() {
- v = rv.Addr().Interface()
- } else {
- rv2 := reflect.New(rv.Type())
- rv2.Elem().Set(rv)
- v = rv2.Interface()
- // fmt.Printf("rv.Type: %v, rv2.Type: %v, v: %v\n", rv.Type(), rv2.Type(), v)
- }
- } else {
- for j := int8(0); j < indir; j++ {
- if rv.IsNil() {
- f.e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- }
- v = rv.Interface()
- }
- return v, true
-}
-
-func (f *encFnInfo) selferMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.csIndir); proceed {
- v.(Selfer).CodecEncodeSelf(f.e)
- }
-}
-
-func (f *encFnInfo) binaryMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.bmIndir); proceed {
- bs, fnerr := v.(encoding.BinaryMarshaler).MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
- }
-}
-
-func (f *encFnInfo) textMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.tmIndir); proceed {
- // debugf(">>>> encoding.TextMarshaler: %T", rv.Interface())
- bs, fnerr := v.(encoding.TextMarshaler).MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
- }
-}
-
-func (f *encFnInfo) jsonMarshal(rv reflect.Value) {
- if v, proceed := f.getValueForMarshalInterface(rv, f.ti.jmIndir); proceed {
- bs, fnerr := v.(jsonMarshaler).MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
- }
-}
-
-func (f *encFnInfo) kBool(rv reflect.Value) {
- f.e.e.EncodeBool(rv.Bool())
-}
-
-func (f *encFnInfo) kString(rv reflect.Value) {
- f.e.e.EncodeString(c_UTF8, rv.String())
-}
-
-func (f *encFnInfo) kFloat64(rv reflect.Value) {
- f.e.e.EncodeFloat64(rv.Float())
-}
-
-func (f *encFnInfo) kFloat32(rv reflect.Value) {
- f.e.e.EncodeFloat32(float32(rv.Float()))
-}
-
-func (f *encFnInfo) kInt(rv reflect.Value) {
- f.e.e.EncodeInt(rv.Int())
-}
-
-func (f *encFnInfo) kUint(rv reflect.Value) {
- f.e.e.EncodeUint(rv.Uint())
-}
-
-func (f *encFnInfo) kInvalid(rv reflect.Value) {
- f.e.e.EncodeNil()
-}
-
-func (f *encFnInfo) kErr(rv reflect.Value) {
- f.e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv)
-}
-
-func (f *encFnInfo) kSlice(rv reflect.Value) {
- ti := f.ti
- // array may be non-addressable, so we have to manage with care
- // (don't call rv.Bytes, rv.Slice, etc).
- // E.g. type struct S{B [2]byte};
- // Encode(S{}) will bomb on "panic: slice of unaddressable array".
- e := f.e
- if f.seq != seqTypeArray {
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- // If in this method, then there was no extension function defined.
- // So it's okay to treat as []byte.
- if ti.rtid == uint8SliceTypId {
- e.e.EncodeStringBytes(c_RAW, rv.Bytes())
- return
- }
- }
- cr := e.cr
- rtelem := ti.rt.Elem()
- l := rv.Len()
- if ti.rtid == uint8SliceTypId || rtelem.Kind() == reflect.Uint8 {
- switch f.seq {
- case seqTypeArray:
- // if l == 0 { e.e.encodeStringBytes(c_RAW, nil) } else
- if rv.CanAddr() {
- e.e.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes())
- } else {
- var bs []byte
- if l <= cap(e.b) {
- bs = e.b[:l]
- } else {
- bs = make([]byte, l)
- }
- reflect.Copy(reflect.ValueOf(bs), rv)
- // TODO: Test that reflect.Copy works instead of manual one-by-one
- // for i := 0; i < l; i++ {
- // bs[i] = byte(rv.Index(i).Uint())
- // }
- e.e.EncodeStringBytes(c_RAW, bs)
- }
- case seqTypeSlice:
- e.e.EncodeStringBytes(c_RAW, rv.Bytes())
- case seqTypeChan:
- bs := e.b[:0]
- // do not use range, so that the number of elements encoded
- // does not change, and encoding does not hang waiting on someone to close chan.
- // for b := range rv.Interface().(<-chan byte) {
- // bs = append(bs, b)
- // }
- ch := rv.Interface().(<-chan byte)
- for i := 0; i < l; i++ {
- bs = append(bs, <-ch)
- }
- e.e.EncodeStringBytes(c_RAW, bs)
- }
- return
- }
-
- if ti.mbs {
- if l%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", l)
- return
- }
- e.e.EncodeMapStart(l / 2)
- } else {
- e.e.EncodeArrayStart(l)
- }
-
- if l > 0 {
- for rtelem.Kind() == reflect.Ptr {
- rtelem = rtelem.Elem()
- }
- // if kind is reflect.Interface, do not pre-determine the
- // encoding type, because preEncodeValue may break it down to
- // a concrete type and kInterface will bomb.
- var fn *encFn
- if rtelem.Kind() != reflect.Interface {
- rtelemid := reflect.ValueOf(rtelem).Pointer()
- fn = e.getEncFn(rtelemid, rtelem, true, true)
- }
- // TODO: Consider perf implication of encoding odd index values as symbols if type is string
- for j := 0; j < l; j++ {
- if cr != nil {
- if ti.mbs {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- } else {
- cr.sendContainerState(containerArrayElem)
- }
- }
- if f.seq == seqTypeChan {
- if rv2, ok2 := rv.Recv(); ok2 {
- e.encodeValue(rv2, fn)
- } else {
- e.encode(nil) // WE HAVE TO DO SOMETHING, so nil if nothing received.
- }
- } else {
- e.encodeValue(rv.Index(j), fn)
- }
- }
- }
-
- if cr != nil {
- if ti.mbs {
- cr.sendContainerState(containerMapEnd)
- } else {
- cr.sendContainerState(containerArrayEnd)
- }
- }
-}
-
-func (f *encFnInfo) kStruct(rv reflect.Value) {
- fti := f.ti
- e := f.e
- cr := e.cr
- tisfi := fti.sfip
- toMap := !(fti.toArray || e.h.StructToArray)
- newlen := len(fti.sfi)
-
- // Use sync.Pool to reduce allocating slices unnecessarily.
- // The cost of sync.Pool is less than the cost of new allocation.
- pool, poolv, fkvs := encStructPoolGet(newlen)
-
- // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct)
- if toMap {
- tisfi = fti.sfi
- }
- newlen = 0
- var kv stringRv
- recur := e.h.RecursiveEmptyCheck
- for _, si := range tisfi {
- kv.r = si.field(rv, false)
- if toMap {
- if si.omitEmpty && isEmptyValue(kv.r, recur, recur) {
- continue
- }
- kv.v = si.encName
- } else {
- // use the zero value.
- // if a reference or struct, set to nil (so you do not output too much)
- if si.omitEmpty && isEmptyValue(kv.r, recur, recur) {
- switch kv.r.Kind() {
- case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice:
- kv.r = reflect.Value{} //encode as nil
- }
- }
- }
- fkvs[newlen] = kv
- newlen++
- }
-
- // debugf(">>>> kStruct: newlen: %v", newlen)
- // sep := !e.be
- ee := e.e //don't dereference every time
-
- if toMap {
- ee.EncodeMapStart(newlen)
- // asSymbols := e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0
- asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0
- for j := 0; j < newlen; j++ {
- kv = fkvs[j]
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(kv.v)
- } else {
- ee.EncodeString(c_UTF8, kv.v)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(kv.r, nil)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- } else {
- ee.EncodeArrayStart(newlen)
- for j := 0; j < newlen; j++ {
- kv = fkvs[j]
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encodeValue(kv.r, nil)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
- }
-
- // do not use defer. Instead, use explicit pool return at end of function.
- // defer has a cost we are trying to avoid.
- // If there is a panic and these slices are not returned, it is ok.
- if pool != nil {
- pool.Put(poolv)
- }
-}
-
-// func (f *encFnInfo) kPtr(rv reflect.Value) {
-// debugf(">>>>>>> ??? encode kPtr called - shouldn't get called")
-// if rv.IsNil() {
-// f.e.e.encodeNil()
-// return
-// }
-// f.e.encodeValue(rv.Elem())
-// }
-
-// func (f *encFnInfo) kInterface(rv reflect.Value) {
-// println("kInterface called")
-// debug.PrintStack()
-// if rv.IsNil() {
-// f.e.e.EncodeNil()
-// return
-// }
-// f.e.encodeValue(rv.Elem(), nil)
-// }
-
-func (f *encFnInfo) kMap(rv reflect.Value) {
- ee := f.e.e
- if rv.IsNil() {
- ee.EncodeNil()
- return
- }
-
- l := rv.Len()
- ee.EncodeMapStart(l)
- e := f.e
- cr := e.cr
- if l == 0 {
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return
- }
- var asSymbols bool
- // determine the underlying key and val encFn's for the map.
- // This eliminates some work which is done for each loop iteration i.e.
- // rv.Type(), ref.ValueOf(rt).Pointer(), then check map/list for fn.
- //
- // However, if kind is reflect.Interface, do not pre-determine the
- // encoding type, because preEncodeValue may break it down to
- // a concrete type and kInterface will bomb.
- var keyFn, valFn *encFn
- ti := f.ti
- rtkey := ti.rt.Key()
- rtval := ti.rt.Elem()
- rtkeyid := reflect.ValueOf(rtkey).Pointer()
- // keyTypeIsString := f.ti.rt.Key().Kind() == reflect.String
- var keyTypeIsString = rtkeyid == stringTypId
- if keyTypeIsString {
- asSymbols = e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- } else {
- for rtkey.Kind() == reflect.Ptr {
- rtkey = rtkey.Elem()
- }
- if rtkey.Kind() != reflect.Interface {
- rtkeyid = reflect.ValueOf(rtkey).Pointer()
- keyFn = e.getEncFn(rtkeyid, rtkey, true, true)
- }
- }
- for rtval.Kind() == reflect.Ptr {
- rtval = rtval.Elem()
- }
- if rtval.Kind() != reflect.Interface {
- rtvalid := reflect.ValueOf(rtval).Pointer()
- valFn = e.getEncFn(rtvalid, rtval, true, true)
- }
- mks := rv.MapKeys()
- // for j, lmks := 0, len(mks); j < lmks; j++ {
-
- if e.h.Canonical {
- e.kMapCanonical(rtkeyid, rtkey, rv, mks, valFn, asSymbols)
- } else {
- for j := range mks {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if keyTypeIsString {
- if asSymbols {
- ee.EncodeSymbol(mks[j].String())
- } else {
- ee.EncodeString(c_UTF8, mks[j].String())
- }
- } else {
- e.encodeValue(mks[j], keyFn)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mks[j]), valFn)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *encFn, asSymbols bool) {
- ee := e.e
- cr := e.cr
- // we previously did out-of-band if an extension was registered.
- // This is not necessary, as the natural kind is sufficient for ordering.
-
- if rtkeyid == uint8SliceTypId {
- mksv := make([]bytesRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Bytes()
- }
- sort.Sort(bytesRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeStringBytes(c_RAW, mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- } else {
- switch rtkey.Kind() {
- case reflect.Bool:
- mksv := make([]boolRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Bool()
- }
- sort.Sort(boolRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.String:
- mksv := make([]stringRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.String()
- }
- sort.Sort(stringRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(mksv[i].v)
- } else {
- ee.EncodeString(c_UTF8, mksv[i].v)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr:
- mksv := make([]uintRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Uint()
- }
- sort.Sort(uintRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- mksv := make([]intRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Int()
- }
- sort.Sort(intRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Float32:
- mksv := make([]floatRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Float()
- }
- sort.Sort(floatRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(mksv[i].v))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- case reflect.Float64:
- mksv := make([]floatRv, len(mks))
- for i, k := range mks {
- v := &mksv[i]
- v.r = k
- v.v = k.Float()
- }
- sort.Sort(floatRvSlice(mksv))
- for i := range mksv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(mksv[i].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksv[i].r), valFn)
- }
- default:
- // out-of-band
- // first encode each key to a []byte first, then sort them, then record
- var mksv []byte = make([]byte, 0, len(mks)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- mksbv := make([]bytesRv, len(mks))
- for i, k := range mks {
- v := &mksbv[i]
- l := len(mksv)
- e2.MustEncode(k)
- v.r = k
- v.v = mksv[l:]
- // fmt.Printf(">>>>> %s\n", mksv[l:])
- }
- sort.Sort(bytesRvSlice(mksbv))
- for j := range mksbv {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(mksbv[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encodeValue(rv.MapIndex(mksbv[j].r), valFn)
- }
- }
- }
-}
-
-// --------------------------------------------------
-
-// encFn encapsulates the captured variables and the encode function.
-// This way, we only do some calculations one times, and pass to the
-// code block that should be called (encapsulated in a function)
-// instead of executing the checks every time.
-type encFn struct {
- i encFnInfo
- f func(*encFnInfo, reflect.Value)
-}
-
-// --------------------------------------------------
-
-type encRtidFn struct {
- rtid uintptr
- fn encFn
-}
-
-// An Encoder writes an object to an output stream in the codec format.
-type Encoder struct {
- // hopefully, reduce derefencing cost by laying the encWriter inside the Encoder
- e encDriver
- // NOTE: Encoder shouldn't call it's write methods,
- // as the handler MAY need to do some coordination.
- w encWriter
- s []encRtidFn
- ci set
- be bool // is binary encoding
- js bool // is json handle
-
- wi ioEncWriter
- wb bytesEncWriter
-
- h *BasicHandle
- hh Handle
-
- cr containerStateRecv
- as encDriverAsis
-
- f map[uintptr]*encFn
- b [scratchByteArrayLen]byte
-}
-
-// NewEncoder returns an Encoder for encoding into an io.Writer.
-//
-// For efficiency, Users are encouraged to pass in a memory buffered writer
-// (eg bufio.Writer, bytes.Buffer).
-func NewEncoder(w io.Writer, h Handle) *Encoder {
- e := newEncoder(h)
- e.Reset(w)
- return e
-}
-
-// NewEncoderBytes returns an encoder for encoding directly and efficiently
-// into a byte slice, using zero-copying to temporary slices.
-//
-// It will potentially replace the output byte slice pointed to.
-// After encoding, the out parameter contains the encoded contents.
-func NewEncoderBytes(out *[]byte, h Handle) *Encoder {
- e := newEncoder(h)
- e.ResetBytes(out)
- return e
-}
-
-func newEncoder(h Handle) *Encoder {
- e := &Encoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()}
- _, e.js = h.(*JsonHandle)
- e.e = h.newEncDriver(e)
- e.as, _ = e.e.(encDriverAsis)
- e.cr, _ = e.e.(containerStateRecv)
- return e
-}
-
-// Reset the Encoder with a new output stream.
-//
-// This accommodates using the state of the Encoder,
-// where it has "cached" information about sub-engines.
-func (e *Encoder) Reset(w io.Writer) {
- ww, ok := w.(ioEncWriterWriter)
- if ok {
- e.wi.w = ww
- } else {
- sww := &e.wi.s
- sww.w = w
- sww.bw, _ = w.(io.ByteWriter)
- sww.sw, _ = w.(ioEncStringWriter)
- e.wi.w = sww
- //ww = bufio.NewWriterSize(w, defEncByteBufSize)
- }
- e.w = &e.wi
- e.e.reset()
-}
-
-func (e *Encoder) ResetBytes(out *[]byte) {
- in := *out
- if in == nil {
- in = make([]byte, defEncByteBufSize)
- }
- e.wb.b, e.wb.out, e.wb.c = in, out, 0
- e.w = &e.wb
- e.e.reset()
-}
-
-// func (e *Encoder) sendContainerState(c containerState) {
-// if e.cr != nil {
-// e.cr.sendContainerState(c)
-// }
-// }
-
-// Encode writes an object into a stream.
-//
-// Encoding can be configured via the struct tag for the fields.
-// The "codec" key in struct field's tag value is the key name,
-// followed by an optional comma and options.
-// Note that the "json" key is used in the absence of the "codec" key.
-//
-// To set an option on all fields (e.g. omitempty on all fields), you
-// can create a field called _struct, and set flags on it.
-//
-// Struct values "usually" encode as maps. Each exported struct field is encoded unless:
-// - the field's tag is "-", OR
-// - the field is empty (empty or the zero value) and its tag specifies the "omitempty" option.
-//
-// When encoding as a map, the first string in the tag (before the comma)
-// is the map key string to use when encoding.
-//
-// However, struct values may encode as arrays. This happens when:
-// - StructToArray Encode option is set, OR
-// - the tag on the _struct field sets the "toarray" option
-//
-// Values with types that implement MapBySlice are encoded as stream maps.
-//
-// The empty values (for omitempty option) are false, 0, any nil pointer
-// or interface value, and any array, slice, map, or string of length zero.
-//
-// Anonymous fields are encoded inline except:
-// - the struct tag specifies a replacement name (first value)
-// - the field is of an interface type
-//
-// Examples:
-//
-// // NOTE: 'json:' can be used as struct tag key, in place 'codec:' below.
-// type MyStruct struct {
-// _struct bool `codec:",omitempty"` //set omitempty for every field
-// Field1 string `codec:"-"` //skip this field
-// Field2 int `codec:"myName"` //Use key "myName" in encode stream
-// Field3 int32 `codec:",omitempty"` //use key "Field3". Omit if empty.
-// Field4 bool `codec:"f4,omitempty"` //use key "f4". Omit if empty.
-// io.Reader //use key "Reader".
-// MyStruct `codec:"my1" //use key "my1".
-// MyStruct //inline it
-// ...
-// }
-//
-// type MyStruct struct {
-// _struct bool `codec:",omitempty,toarray"` //set omitempty for every field
-// //and encode struct as an array
-// }
-//
-// The mode of encoding is based on the type of the value. When a value is seen:
-// - If a Selfer, call its CodecEncodeSelf method
-// - If an extension is registered for it, call that extension function
-// - If it implements encoding.(Binary|Text|JSON)Marshaler, call its Marshal(Binary|Text|JSON) method
-// - Else encode it based on its reflect.Kind
-//
-// Note that struct field names and keys in map[string]XXX will be treated as symbols.
-// Some formats support symbols (e.g. binc) and will properly encode the string
-// only once in the stream, and use a tag to refer to it thereafter.
-func (e *Encoder) Encode(v interface{}) (err error) {
- defer panicToErr(&err)
- e.encode(v)
- e.w.atEndOfEncode()
- return
-}
-
-// MustEncode is like Encode, but panics if unable to Encode.
-// This provides insight to the code location that triggered the error.
-func (e *Encoder) MustEncode(v interface{}) {
- e.encode(v)
- e.w.atEndOfEncode()
-}
-
-func (e *Encoder) encode(iv interface{}) {
- // if ics, ok := iv.(Selfer); ok {
- // ics.CodecEncodeSelf(e)
- // return
- // }
-
- switch v := iv.(type) {
- case nil:
- e.e.EncodeNil()
- case Selfer:
- v.CodecEncodeSelf(e)
- case Raw:
- e.raw(v)
- case reflect.Value:
- e.encodeValue(v, nil)
-
- case string:
- e.e.EncodeString(c_UTF8, v)
- case bool:
- e.e.EncodeBool(v)
- case int:
- e.e.EncodeInt(int64(v))
- case int8:
- e.e.EncodeInt(int64(v))
- case int16:
- e.e.EncodeInt(int64(v))
- case int32:
- e.e.EncodeInt(int64(v))
- case int64:
- e.e.EncodeInt(v)
- case uint:
- e.e.EncodeUint(uint64(v))
- case uint8:
- e.e.EncodeUint(uint64(v))
- case uint16:
- e.e.EncodeUint(uint64(v))
- case uint32:
- e.e.EncodeUint(uint64(v))
- case uint64:
- e.e.EncodeUint(v)
- case float32:
- e.e.EncodeFloat32(v)
- case float64:
- e.e.EncodeFloat64(v)
-
- case []uint8:
- e.e.EncodeStringBytes(c_RAW, v)
-
- case *string:
- e.e.EncodeString(c_UTF8, *v)
- case *bool:
- e.e.EncodeBool(*v)
- case *int:
- e.e.EncodeInt(int64(*v))
- case *int8:
- e.e.EncodeInt(int64(*v))
- case *int16:
- e.e.EncodeInt(int64(*v))
- case *int32:
- e.e.EncodeInt(int64(*v))
- case *int64:
- e.e.EncodeInt(*v)
- case *uint:
- e.e.EncodeUint(uint64(*v))
- case *uint8:
- e.e.EncodeUint(uint64(*v))
- case *uint16:
- e.e.EncodeUint(uint64(*v))
- case *uint32:
- e.e.EncodeUint(uint64(*v))
- case *uint64:
- e.e.EncodeUint(*v)
- case *float32:
- e.e.EncodeFloat32(*v)
- case *float64:
- e.e.EncodeFloat64(*v)
-
- case *[]uint8:
- e.e.EncodeStringBytes(c_RAW, *v)
-
- default:
- const checkCodecSelfer1 = true // in case T is passed, where *T is a Selfer, still checkCodecSelfer
- if !fastpathEncodeTypeSwitch(iv, e) {
- e.encodeI(iv, false, checkCodecSelfer1)
- }
- }
-}
-
-func (e *Encoder) preEncodeValue(rv reflect.Value) (rv2 reflect.Value, sptr uintptr, proceed bool) {
- // use a goto statement instead of a recursive function for ptr/interface.
-TOP:
- switch rv.Kind() {
- case reflect.Ptr:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- if e.h.CheckCircularRef && rv.Kind() == reflect.Struct {
- // TODO: Movable pointers will be an issue here. Future problem.
- sptr = rv.UnsafeAddr()
- break TOP
- }
- goto TOP
- case reflect.Interface:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- rv = rv.Elem()
- goto TOP
- case reflect.Slice, reflect.Map:
- if rv.IsNil() {
- e.e.EncodeNil()
- return
- }
- case reflect.Invalid, reflect.Func:
- e.e.EncodeNil()
- return
- }
-
- proceed = true
- rv2 = rv
- return
-}
-
-func (e *Encoder) doEncodeValue(rv reflect.Value, fn *encFn, sptr uintptr,
- checkFastpath, checkCodecSelfer bool) {
- if sptr != 0 {
- if (&e.ci).add(sptr) {
- e.errorf("circular reference found: # %d", sptr)
- }
- }
- if fn == nil {
- rt := rv.Type()
- rtid := reflect.ValueOf(rt).Pointer()
- // fn = e.getEncFn(rtid, rt, true, true)
- fn = e.getEncFn(rtid, rt, checkFastpath, checkCodecSelfer)
- }
- fn.f(&fn.i, rv)
- if sptr != 0 {
- (&e.ci).remove(sptr)
- }
-}
-
-func (e *Encoder) encodeI(iv interface{}, checkFastpath, checkCodecSelfer bool) {
- if rv, sptr, proceed := e.preEncodeValue(reflect.ValueOf(iv)); proceed {
- e.doEncodeValue(rv, nil, sptr, checkFastpath, checkCodecSelfer)
- }
-}
-
-func (e *Encoder) encodeValue(rv reflect.Value, fn *encFn) {
- // if a valid fn is passed, it MUST BE for the dereferenced type of rv
- if rv, sptr, proceed := e.preEncodeValue(rv); proceed {
- e.doEncodeValue(rv, fn, sptr, true, true)
- }
-}
-
-func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *encFn) {
- // rtid := reflect.ValueOf(rt).Pointer()
- var ok bool
- if useMapForCodecCache {
- fn, ok = e.f[rtid]
- } else {
- for i := range e.s {
- v := &(e.s[i])
- if v.rtid == rtid {
- fn, ok = &(v.fn), true
- break
- }
- }
- }
- if ok {
- return
- }
-
- if useMapForCodecCache {
- if e.f == nil {
- e.f = make(map[uintptr]*encFn, initCollectionCap)
- }
- fn = new(encFn)
- e.f[rtid] = fn
- } else {
- if e.s == nil {
- e.s = make([]encRtidFn, 0, initCollectionCap)
- }
- e.s = append(e.s, encRtidFn{rtid: rtid})
- fn = &(e.s[len(e.s)-1]).fn
- }
-
- ti := e.h.getTypeInfo(rtid, rt)
- fi := &(fn.i)
- fi.e = e
- fi.ti = ti
-
- if checkCodecSelfer && ti.cs {
- fn.f = (*encFnInfo).selferMarshal
- } else if rtid == rawTypId {
- fn.f = (*encFnInfo).raw
- } else if rtid == rawExtTypId {
- fn.f = (*encFnInfo).rawExt
- } else if e.e.IsBuiltinType(rtid) {
- fn.f = (*encFnInfo).builtin
- } else if xfFn := e.h.getExt(rtid); xfFn != nil {
- fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext
- fn.f = (*encFnInfo).ext
- } else if supportMarshalInterfaces && e.be && ti.bm {
- fn.f = (*encFnInfo).binaryMarshal
- } else if supportMarshalInterfaces && !e.be && e.js && ti.jm {
- //If JSON, we should check JSONMarshal before textMarshal
- fn.f = (*encFnInfo).jsonMarshal
- } else if supportMarshalInterfaces && !e.be && ti.tm {
- fn.f = (*encFnInfo).textMarshal
- } else {
- rk := rt.Kind()
- if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) {
- if rt.PkgPath() == "" { // un-named slice or map
- if idx := fastpathAV.index(rtid); idx != -1 {
- fn.f = fastpathAV[idx].encfn
- }
- } else {
- ok = false
- // use mapping for underlying type if there
- var rtu reflect.Type
- if rk == reflect.Map {
- rtu = reflect.MapOf(rt.Key(), rt.Elem())
- } else {
- rtu = reflect.SliceOf(rt.Elem())
- }
- rtuid := reflect.ValueOf(rtu).Pointer()
- if idx := fastpathAV.index(rtuid); idx != -1 {
- xfnf := fastpathAV[idx].encfn
- xrt := fastpathAV[idx].rt
- fn.f = func(xf *encFnInfo, xrv reflect.Value) {
- xfnf(xf, xrv.Convert(xrt))
- }
- }
- }
- }
- if fn.f == nil {
- switch rk {
- case reflect.Bool:
- fn.f = (*encFnInfo).kBool
- case reflect.String:
- fn.f = (*encFnInfo).kString
- case reflect.Float64:
- fn.f = (*encFnInfo).kFloat64
- case reflect.Float32:
- fn.f = (*encFnInfo).kFloat32
- case reflect.Int, reflect.Int8, reflect.Int64, reflect.Int32, reflect.Int16:
- fn.f = (*encFnInfo).kInt
- case reflect.Uint8, reflect.Uint64, reflect.Uint, reflect.Uint32, reflect.Uint16, reflect.Uintptr:
- fn.f = (*encFnInfo).kUint
- case reflect.Invalid:
- fn.f = (*encFnInfo).kInvalid
- case reflect.Chan:
- fi.seq = seqTypeChan
- fn.f = (*encFnInfo).kSlice
- case reflect.Slice:
- fi.seq = seqTypeSlice
- fn.f = (*encFnInfo).kSlice
- case reflect.Array:
- fi.seq = seqTypeArray
- fn.f = (*encFnInfo).kSlice
- case reflect.Struct:
- fn.f = (*encFnInfo).kStruct
- // reflect.Ptr and reflect.Interface are handled already by preEncodeValue
- // case reflect.Ptr:
- // fn.f = (*encFnInfo).kPtr
- // case reflect.Interface:
- // fn.f = (*encFnInfo).kInterface
- case reflect.Map:
- fn.f = (*encFnInfo).kMap
- default:
- fn.f = (*encFnInfo).kErr
- }
- }
- }
-
- return
-}
-
-func (e *Encoder) marshal(bs []byte, fnerr error, asis bool, c charEncoding) {
- if fnerr != nil {
- panic(fnerr)
- }
- if bs == nil {
- e.e.EncodeNil()
- } else if asis {
- e.asis(bs)
- } else {
- e.e.EncodeStringBytes(c, bs)
- }
-}
-
-func (e *Encoder) asis(v []byte) {
- if e.as == nil {
- e.w.writeb(v)
- } else {
- e.as.EncodeAsis(v)
- }
-}
-
-func (e *Encoder) raw(vv Raw) {
- v := []byte(vv)
- if !e.h.Raw {
- e.errorf("Raw values cannot be encoded: %v", v)
- }
- if e.as == nil {
- e.w.writeb(v)
- } else {
- e.as.EncodeAsis(v)
- }
-}
-
-func (e *Encoder) errorf(format string, params ...interface{}) {
- err := fmt.Errorf(format, params...)
- panic(err)
-}
-
-// ----------------------------------------
-
-const encStructPoolLen = 5
-
-// encStructPool is an array of sync.Pool.
-// Each element of the array pools one of encStructPool(8|16|32|64).
-// It allows the re-use of slices up to 64 in length.
-// A performance cost of encoding structs was collecting
-// which values were empty and should be omitted.
-// We needed slices of reflect.Value and string to collect them.
-// This shared pool reduces the amount of unnecessary creation we do.
-// The cost is that of locking sometimes, but sync.Pool is efficient
-// enough to reduce thread contention.
-var encStructPool [encStructPoolLen]sync.Pool
-
-func init() {
- encStructPool[0].New = func() interface{} { return new([8]stringRv) }
- encStructPool[1].New = func() interface{} { return new([16]stringRv) }
- encStructPool[2].New = func() interface{} { return new([32]stringRv) }
- encStructPool[3].New = func() interface{} { return new([64]stringRv) }
- encStructPool[4].New = func() interface{} { return new([128]stringRv) }
-}
-
-func encStructPoolGet(newlen int) (p *sync.Pool, v interface{}, s []stringRv) {
- // if encStructPoolLen != 5 { // constant chec, so removed at build time.
- // panic(errors.New("encStructPoolLen must be equal to 4")) // defensive, in case it is changed
- // }
- // idxpool := newlen / 8
- if newlen <= 8 {
- p = &encStructPool[0]
- v = p.Get()
- s = v.(*[8]stringRv)[:newlen]
- } else if newlen <= 16 {
- p = &encStructPool[1]
- v = p.Get()
- s = v.(*[16]stringRv)[:newlen]
- } else if newlen <= 32 {
- p = &encStructPool[2]
- v = p.Get()
- s = v.(*[32]stringRv)[:newlen]
- } else if newlen <= 64 {
- p = &encStructPool[3]
- v = p.Get()
- s = v.(*[64]stringRv)[:newlen]
- } else if newlen <= 128 {
- p = &encStructPool[4]
- v = p.Get()
- s = v.(*[128]stringRv)[:newlen]
- } else {
- s = make([]stringRv, newlen)
- }
- return
-}
-
-// ----------------------------------------
-
-// func encErr(format string, params ...interface{}) {
-// doPanic(msgTagEnc, format, params...)
-// }
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.generated.go
deleted file mode 100644
index f2e5d2dcf..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.generated.go
+++ /dev/null
@@ -1,39352 +0,0 @@
-// +build !notfastpath
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl
-// ************************************************************
-
-package codec
-
-// Fast path functions try to create a fast path encode or decode implementation
-// for common maps and slices.
-//
-// We define the functions and register then in this single file
-// so as not to pollute the encode.go and decode.go, and create a dependency in there.
-// This file can be omitted without causing a build failure.
-//
-// The advantage of fast paths is:
-// - Many calls bypass reflection altogether
-//
-// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
-// This should provide adequate "typical" implementations.
-//
-// Note that fast track decode functions must handle values for which an address cannot be obtained.
-// For example:
-// m2 := map[string]int{}
-// p2 := []interface{}{m2}
-// // decoding into p2 will bomb if fast track functions do not treat like unaddressable.
-//
-
-import (
- "reflect"
- "sort"
-)
-
-const fastpathEnabled = true
-
-const fastpathCheckNilFalse = false // for reflect
-const fastpathCheckNilTrue = true // for type switch
-
-type fastpathT struct{}
-
-var fastpathTV fastpathT
-
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-
-type fastpathA [271]fastpathE
-
-func (x *fastpathA) index(rtid uintptr) int {
- // use binary search to grab the index (adapted from sort/search.go)
- h, i, j := 0, 0, 271 // len(x)
- for i < j {
- h = i + (j-i)/2
- if x[h].rtid < rtid {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < 271 && x[i].rtid == rtid {
- return i
- }
- return -1
-}
-
-type fastpathAslice []fastpathE
-
-func (x fastpathAslice) Len() int { return len(x) }
-func (x fastpathAslice) Less(i, j int) bool { return x[i].rtid < x[j].rtid }
-func (x fastpathAslice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-var fastpathAV fastpathA
-
-// due to possible initialization loop error, make fastpath in an init()
-func init() {
- i := 0
- fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
- xrt := reflect.TypeOf(v)
- xptr := reflect.ValueOf(xrt).Pointer()
- fastpathAV[i] = fastpathE{xptr, xrt, fe, fd}
- i++
- return
- }
-
- fn([]interface{}(nil), (*encFnInfo).fastpathEncSliceIntfR, (*decFnInfo).fastpathDecSliceIntfR)
- fn([]string(nil), (*encFnInfo).fastpathEncSliceStringR, (*decFnInfo).fastpathDecSliceStringR)
- fn([]float32(nil), (*encFnInfo).fastpathEncSliceFloat32R, (*decFnInfo).fastpathDecSliceFloat32R)
- fn([]float64(nil), (*encFnInfo).fastpathEncSliceFloat64R, (*decFnInfo).fastpathDecSliceFloat64R)
- fn([]uint(nil), (*encFnInfo).fastpathEncSliceUintR, (*decFnInfo).fastpathDecSliceUintR)
- fn([]uint16(nil), (*encFnInfo).fastpathEncSliceUint16R, (*decFnInfo).fastpathDecSliceUint16R)
- fn([]uint32(nil), (*encFnInfo).fastpathEncSliceUint32R, (*decFnInfo).fastpathDecSliceUint32R)
- fn([]uint64(nil), (*encFnInfo).fastpathEncSliceUint64R, (*decFnInfo).fastpathDecSliceUint64R)
- fn([]uintptr(nil), (*encFnInfo).fastpathEncSliceUintptrR, (*decFnInfo).fastpathDecSliceUintptrR)
- fn([]int(nil), (*encFnInfo).fastpathEncSliceIntR, (*decFnInfo).fastpathDecSliceIntR)
- fn([]int8(nil), (*encFnInfo).fastpathEncSliceInt8R, (*decFnInfo).fastpathDecSliceInt8R)
- fn([]int16(nil), (*encFnInfo).fastpathEncSliceInt16R, (*decFnInfo).fastpathDecSliceInt16R)
- fn([]int32(nil), (*encFnInfo).fastpathEncSliceInt32R, (*decFnInfo).fastpathDecSliceInt32R)
- fn([]int64(nil), (*encFnInfo).fastpathEncSliceInt64R, (*decFnInfo).fastpathDecSliceInt64R)
- fn([]bool(nil), (*encFnInfo).fastpathEncSliceBoolR, (*decFnInfo).fastpathDecSliceBoolR)
-
- fn(map[interface{}]interface{}(nil), (*encFnInfo).fastpathEncMapIntfIntfR, (*decFnInfo).fastpathDecMapIntfIntfR)
- fn(map[interface{}]string(nil), (*encFnInfo).fastpathEncMapIntfStringR, (*decFnInfo).fastpathDecMapIntfStringR)
- fn(map[interface{}]uint(nil), (*encFnInfo).fastpathEncMapIntfUintR, (*decFnInfo).fastpathDecMapIntfUintR)
- fn(map[interface{}]uint8(nil), (*encFnInfo).fastpathEncMapIntfUint8R, (*decFnInfo).fastpathDecMapIntfUint8R)
- fn(map[interface{}]uint16(nil), (*encFnInfo).fastpathEncMapIntfUint16R, (*decFnInfo).fastpathDecMapIntfUint16R)
- fn(map[interface{}]uint32(nil), (*encFnInfo).fastpathEncMapIntfUint32R, (*decFnInfo).fastpathDecMapIntfUint32R)
- fn(map[interface{}]uint64(nil), (*encFnInfo).fastpathEncMapIntfUint64R, (*decFnInfo).fastpathDecMapIntfUint64R)
- fn(map[interface{}]uintptr(nil), (*encFnInfo).fastpathEncMapIntfUintptrR, (*decFnInfo).fastpathDecMapIntfUintptrR)
- fn(map[interface{}]int(nil), (*encFnInfo).fastpathEncMapIntfIntR, (*decFnInfo).fastpathDecMapIntfIntR)
- fn(map[interface{}]int8(nil), (*encFnInfo).fastpathEncMapIntfInt8R, (*decFnInfo).fastpathDecMapIntfInt8R)
- fn(map[interface{}]int16(nil), (*encFnInfo).fastpathEncMapIntfInt16R, (*decFnInfo).fastpathDecMapIntfInt16R)
- fn(map[interface{}]int32(nil), (*encFnInfo).fastpathEncMapIntfInt32R, (*decFnInfo).fastpathDecMapIntfInt32R)
- fn(map[interface{}]int64(nil), (*encFnInfo).fastpathEncMapIntfInt64R, (*decFnInfo).fastpathDecMapIntfInt64R)
- fn(map[interface{}]float32(nil), (*encFnInfo).fastpathEncMapIntfFloat32R, (*decFnInfo).fastpathDecMapIntfFloat32R)
- fn(map[interface{}]float64(nil), (*encFnInfo).fastpathEncMapIntfFloat64R, (*decFnInfo).fastpathDecMapIntfFloat64R)
- fn(map[interface{}]bool(nil), (*encFnInfo).fastpathEncMapIntfBoolR, (*decFnInfo).fastpathDecMapIntfBoolR)
- fn(map[string]interface{}(nil), (*encFnInfo).fastpathEncMapStringIntfR, (*decFnInfo).fastpathDecMapStringIntfR)
- fn(map[string]string(nil), (*encFnInfo).fastpathEncMapStringStringR, (*decFnInfo).fastpathDecMapStringStringR)
- fn(map[string]uint(nil), (*encFnInfo).fastpathEncMapStringUintR, (*decFnInfo).fastpathDecMapStringUintR)
- fn(map[string]uint8(nil), (*encFnInfo).fastpathEncMapStringUint8R, (*decFnInfo).fastpathDecMapStringUint8R)
- fn(map[string]uint16(nil), (*encFnInfo).fastpathEncMapStringUint16R, (*decFnInfo).fastpathDecMapStringUint16R)
- fn(map[string]uint32(nil), (*encFnInfo).fastpathEncMapStringUint32R, (*decFnInfo).fastpathDecMapStringUint32R)
- fn(map[string]uint64(nil), (*encFnInfo).fastpathEncMapStringUint64R, (*decFnInfo).fastpathDecMapStringUint64R)
- fn(map[string]uintptr(nil), (*encFnInfo).fastpathEncMapStringUintptrR, (*decFnInfo).fastpathDecMapStringUintptrR)
- fn(map[string]int(nil), (*encFnInfo).fastpathEncMapStringIntR, (*decFnInfo).fastpathDecMapStringIntR)
- fn(map[string]int8(nil), (*encFnInfo).fastpathEncMapStringInt8R, (*decFnInfo).fastpathDecMapStringInt8R)
- fn(map[string]int16(nil), (*encFnInfo).fastpathEncMapStringInt16R, (*decFnInfo).fastpathDecMapStringInt16R)
- fn(map[string]int32(nil), (*encFnInfo).fastpathEncMapStringInt32R, (*decFnInfo).fastpathDecMapStringInt32R)
- fn(map[string]int64(nil), (*encFnInfo).fastpathEncMapStringInt64R, (*decFnInfo).fastpathDecMapStringInt64R)
- fn(map[string]float32(nil), (*encFnInfo).fastpathEncMapStringFloat32R, (*decFnInfo).fastpathDecMapStringFloat32R)
- fn(map[string]float64(nil), (*encFnInfo).fastpathEncMapStringFloat64R, (*decFnInfo).fastpathDecMapStringFloat64R)
- fn(map[string]bool(nil), (*encFnInfo).fastpathEncMapStringBoolR, (*decFnInfo).fastpathDecMapStringBoolR)
- fn(map[float32]interface{}(nil), (*encFnInfo).fastpathEncMapFloat32IntfR, (*decFnInfo).fastpathDecMapFloat32IntfR)
- fn(map[float32]string(nil), (*encFnInfo).fastpathEncMapFloat32StringR, (*decFnInfo).fastpathDecMapFloat32StringR)
- fn(map[float32]uint(nil), (*encFnInfo).fastpathEncMapFloat32UintR, (*decFnInfo).fastpathDecMapFloat32UintR)
- fn(map[float32]uint8(nil), (*encFnInfo).fastpathEncMapFloat32Uint8R, (*decFnInfo).fastpathDecMapFloat32Uint8R)
- fn(map[float32]uint16(nil), (*encFnInfo).fastpathEncMapFloat32Uint16R, (*decFnInfo).fastpathDecMapFloat32Uint16R)
- fn(map[float32]uint32(nil), (*encFnInfo).fastpathEncMapFloat32Uint32R, (*decFnInfo).fastpathDecMapFloat32Uint32R)
- fn(map[float32]uint64(nil), (*encFnInfo).fastpathEncMapFloat32Uint64R, (*decFnInfo).fastpathDecMapFloat32Uint64R)
- fn(map[float32]uintptr(nil), (*encFnInfo).fastpathEncMapFloat32UintptrR, (*decFnInfo).fastpathDecMapFloat32UintptrR)
- fn(map[float32]int(nil), (*encFnInfo).fastpathEncMapFloat32IntR, (*decFnInfo).fastpathDecMapFloat32IntR)
- fn(map[float32]int8(nil), (*encFnInfo).fastpathEncMapFloat32Int8R, (*decFnInfo).fastpathDecMapFloat32Int8R)
- fn(map[float32]int16(nil), (*encFnInfo).fastpathEncMapFloat32Int16R, (*decFnInfo).fastpathDecMapFloat32Int16R)
- fn(map[float32]int32(nil), (*encFnInfo).fastpathEncMapFloat32Int32R, (*decFnInfo).fastpathDecMapFloat32Int32R)
- fn(map[float32]int64(nil), (*encFnInfo).fastpathEncMapFloat32Int64R, (*decFnInfo).fastpathDecMapFloat32Int64R)
- fn(map[float32]float32(nil), (*encFnInfo).fastpathEncMapFloat32Float32R, (*decFnInfo).fastpathDecMapFloat32Float32R)
- fn(map[float32]float64(nil), (*encFnInfo).fastpathEncMapFloat32Float64R, (*decFnInfo).fastpathDecMapFloat32Float64R)
- fn(map[float32]bool(nil), (*encFnInfo).fastpathEncMapFloat32BoolR, (*decFnInfo).fastpathDecMapFloat32BoolR)
- fn(map[float64]interface{}(nil), (*encFnInfo).fastpathEncMapFloat64IntfR, (*decFnInfo).fastpathDecMapFloat64IntfR)
- fn(map[float64]string(nil), (*encFnInfo).fastpathEncMapFloat64StringR, (*decFnInfo).fastpathDecMapFloat64StringR)
- fn(map[float64]uint(nil), (*encFnInfo).fastpathEncMapFloat64UintR, (*decFnInfo).fastpathDecMapFloat64UintR)
- fn(map[float64]uint8(nil), (*encFnInfo).fastpathEncMapFloat64Uint8R, (*decFnInfo).fastpathDecMapFloat64Uint8R)
- fn(map[float64]uint16(nil), (*encFnInfo).fastpathEncMapFloat64Uint16R, (*decFnInfo).fastpathDecMapFloat64Uint16R)
- fn(map[float64]uint32(nil), (*encFnInfo).fastpathEncMapFloat64Uint32R, (*decFnInfo).fastpathDecMapFloat64Uint32R)
- fn(map[float64]uint64(nil), (*encFnInfo).fastpathEncMapFloat64Uint64R, (*decFnInfo).fastpathDecMapFloat64Uint64R)
- fn(map[float64]uintptr(nil), (*encFnInfo).fastpathEncMapFloat64UintptrR, (*decFnInfo).fastpathDecMapFloat64UintptrR)
- fn(map[float64]int(nil), (*encFnInfo).fastpathEncMapFloat64IntR, (*decFnInfo).fastpathDecMapFloat64IntR)
- fn(map[float64]int8(nil), (*encFnInfo).fastpathEncMapFloat64Int8R, (*decFnInfo).fastpathDecMapFloat64Int8R)
- fn(map[float64]int16(nil), (*encFnInfo).fastpathEncMapFloat64Int16R, (*decFnInfo).fastpathDecMapFloat64Int16R)
- fn(map[float64]int32(nil), (*encFnInfo).fastpathEncMapFloat64Int32R, (*decFnInfo).fastpathDecMapFloat64Int32R)
- fn(map[float64]int64(nil), (*encFnInfo).fastpathEncMapFloat64Int64R, (*decFnInfo).fastpathDecMapFloat64Int64R)
- fn(map[float64]float32(nil), (*encFnInfo).fastpathEncMapFloat64Float32R, (*decFnInfo).fastpathDecMapFloat64Float32R)
- fn(map[float64]float64(nil), (*encFnInfo).fastpathEncMapFloat64Float64R, (*decFnInfo).fastpathDecMapFloat64Float64R)
- fn(map[float64]bool(nil), (*encFnInfo).fastpathEncMapFloat64BoolR, (*decFnInfo).fastpathDecMapFloat64BoolR)
- fn(map[uint]interface{}(nil), (*encFnInfo).fastpathEncMapUintIntfR, (*decFnInfo).fastpathDecMapUintIntfR)
- fn(map[uint]string(nil), (*encFnInfo).fastpathEncMapUintStringR, (*decFnInfo).fastpathDecMapUintStringR)
- fn(map[uint]uint(nil), (*encFnInfo).fastpathEncMapUintUintR, (*decFnInfo).fastpathDecMapUintUintR)
- fn(map[uint]uint8(nil), (*encFnInfo).fastpathEncMapUintUint8R, (*decFnInfo).fastpathDecMapUintUint8R)
- fn(map[uint]uint16(nil), (*encFnInfo).fastpathEncMapUintUint16R, (*decFnInfo).fastpathDecMapUintUint16R)
- fn(map[uint]uint32(nil), (*encFnInfo).fastpathEncMapUintUint32R, (*decFnInfo).fastpathDecMapUintUint32R)
- fn(map[uint]uint64(nil), (*encFnInfo).fastpathEncMapUintUint64R, (*decFnInfo).fastpathDecMapUintUint64R)
- fn(map[uint]uintptr(nil), (*encFnInfo).fastpathEncMapUintUintptrR, (*decFnInfo).fastpathDecMapUintUintptrR)
- fn(map[uint]int(nil), (*encFnInfo).fastpathEncMapUintIntR, (*decFnInfo).fastpathDecMapUintIntR)
- fn(map[uint]int8(nil), (*encFnInfo).fastpathEncMapUintInt8R, (*decFnInfo).fastpathDecMapUintInt8R)
- fn(map[uint]int16(nil), (*encFnInfo).fastpathEncMapUintInt16R, (*decFnInfo).fastpathDecMapUintInt16R)
- fn(map[uint]int32(nil), (*encFnInfo).fastpathEncMapUintInt32R, (*decFnInfo).fastpathDecMapUintInt32R)
- fn(map[uint]int64(nil), (*encFnInfo).fastpathEncMapUintInt64R, (*decFnInfo).fastpathDecMapUintInt64R)
- fn(map[uint]float32(nil), (*encFnInfo).fastpathEncMapUintFloat32R, (*decFnInfo).fastpathDecMapUintFloat32R)
- fn(map[uint]float64(nil), (*encFnInfo).fastpathEncMapUintFloat64R, (*decFnInfo).fastpathDecMapUintFloat64R)
- fn(map[uint]bool(nil), (*encFnInfo).fastpathEncMapUintBoolR, (*decFnInfo).fastpathDecMapUintBoolR)
- fn(map[uint8]interface{}(nil), (*encFnInfo).fastpathEncMapUint8IntfR, (*decFnInfo).fastpathDecMapUint8IntfR)
- fn(map[uint8]string(nil), (*encFnInfo).fastpathEncMapUint8StringR, (*decFnInfo).fastpathDecMapUint8StringR)
- fn(map[uint8]uint(nil), (*encFnInfo).fastpathEncMapUint8UintR, (*decFnInfo).fastpathDecMapUint8UintR)
- fn(map[uint8]uint8(nil), (*encFnInfo).fastpathEncMapUint8Uint8R, (*decFnInfo).fastpathDecMapUint8Uint8R)
- fn(map[uint8]uint16(nil), (*encFnInfo).fastpathEncMapUint8Uint16R, (*decFnInfo).fastpathDecMapUint8Uint16R)
- fn(map[uint8]uint32(nil), (*encFnInfo).fastpathEncMapUint8Uint32R, (*decFnInfo).fastpathDecMapUint8Uint32R)
- fn(map[uint8]uint64(nil), (*encFnInfo).fastpathEncMapUint8Uint64R, (*decFnInfo).fastpathDecMapUint8Uint64R)
- fn(map[uint8]uintptr(nil), (*encFnInfo).fastpathEncMapUint8UintptrR, (*decFnInfo).fastpathDecMapUint8UintptrR)
- fn(map[uint8]int(nil), (*encFnInfo).fastpathEncMapUint8IntR, (*decFnInfo).fastpathDecMapUint8IntR)
- fn(map[uint8]int8(nil), (*encFnInfo).fastpathEncMapUint8Int8R, (*decFnInfo).fastpathDecMapUint8Int8R)
- fn(map[uint8]int16(nil), (*encFnInfo).fastpathEncMapUint8Int16R, (*decFnInfo).fastpathDecMapUint8Int16R)
- fn(map[uint8]int32(nil), (*encFnInfo).fastpathEncMapUint8Int32R, (*decFnInfo).fastpathDecMapUint8Int32R)
- fn(map[uint8]int64(nil), (*encFnInfo).fastpathEncMapUint8Int64R, (*decFnInfo).fastpathDecMapUint8Int64R)
- fn(map[uint8]float32(nil), (*encFnInfo).fastpathEncMapUint8Float32R, (*decFnInfo).fastpathDecMapUint8Float32R)
- fn(map[uint8]float64(nil), (*encFnInfo).fastpathEncMapUint8Float64R, (*decFnInfo).fastpathDecMapUint8Float64R)
- fn(map[uint8]bool(nil), (*encFnInfo).fastpathEncMapUint8BoolR, (*decFnInfo).fastpathDecMapUint8BoolR)
- fn(map[uint16]interface{}(nil), (*encFnInfo).fastpathEncMapUint16IntfR, (*decFnInfo).fastpathDecMapUint16IntfR)
- fn(map[uint16]string(nil), (*encFnInfo).fastpathEncMapUint16StringR, (*decFnInfo).fastpathDecMapUint16StringR)
- fn(map[uint16]uint(nil), (*encFnInfo).fastpathEncMapUint16UintR, (*decFnInfo).fastpathDecMapUint16UintR)
- fn(map[uint16]uint8(nil), (*encFnInfo).fastpathEncMapUint16Uint8R, (*decFnInfo).fastpathDecMapUint16Uint8R)
- fn(map[uint16]uint16(nil), (*encFnInfo).fastpathEncMapUint16Uint16R, (*decFnInfo).fastpathDecMapUint16Uint16R)
- fn(map[uint16]uint32(nil), (*encFnInfo).fastpathEncMapUint16Uint32R, (*decFnInfo).fastpathDecMapUint16Uint32R)
- fn(map[uint16]uint64(nil), (*encFnInfo).fastpathEncMapUint16Uint64R, (*decFnInfo).fastpathDecMapUint16Uint64R)
- fn(map[uint16]uintptr(nil), (*encFnInfo).fastpathEncMapUint16UintptrR, (*decFnInfo).fastpathDecMapUint16UintptrR)
- fn(map[uint16]int(nil), (*encFnInfo).fastpathEncMapUint16IntR, (*decFnInfo).fastpathDecMapUint16IntR)
- fn(map[uint16]int8(nil), (*encFnInfo).fastpathEncMapUint16Int8R, (*decFnInfo).fastpathDecMapUint16Int8R)
- fn(map[uint16]int16(nil), (*encFnInfo).fastpathEncMapUint16Int16R, (*decFnInfo).fastpathDecMapUint16Int16R)
- fn(map[uint16]int32(nil), (*encFnInfo).fastpathEncMapUint16Int32R, (*decFnInfo).fastpathDecMapUint16Int32R)
- fn(map[uint16]int64(nil), (*encFnInfo).fastpathEncMapUint16Int64R, (*decFnInfo).fastpathDecMapUint16Int64R)
- fn(map[uint16]float32(nil), (*encFnInfo).fastpathEncMapUint16Float32R, (*decFnInfo).fastpathDecMapUint16Float32R)
- fn(map[uint16]float64(nil), (*encFnInfo).fastpathEncMapUint16Float64R, (*decFnInfo).fastpathDecMapUint16Float64R)
- fn(map[uint16]bool(nil), (*encFnInfo).fastpathEncMapUint16BoolR, (*decFnInfo).fastpathDecMapUint16BoolR)
- fn(map[uint32]interface{}(nil), (*encFnInfo).fastpathEncMapUint32IntfR, (*decFnInfo).fastpathDecMapUint32IntfR)
- fn(map[uint32]string(nil), (*encFnInfo).fastpathEncMapUint32StringR, (*decFnInfo).fastpathDecMapUint32StringR)
- fn(map[uint32]uint(nil), (*encFnInfo).fastpathEncMapUint32UintR, (*decFnInfo).fastpathDecMapUint32UintR)
- fn(map[uint32]uint8(nil), (*encFnInfo).fastpathEncMapUint32Uint8R, (*decFnInfo).fastpathDecMapUint32Uint8R)
- fn(map[uint32]uint16(nil), (*encFnInfo).fastpathEncMapUint32Uint16R, (*decFnInfo).fastpathDecMapUint32Uint16R)
- fn(map[uint32]uint32(nil), (*encFnInfo).fastpathEncMapUint32Uint32R, (*decFnInfo).fastpathDecMapUint32Uint32R)
- fn(map[uint32]uint64(nil), (*encFnInfo).fastpathEncMapUint32Uint64R, (*decFnInfo).fastpathDecMapUint32Uint64R)
- fn(map[uint32]uintptr(nil), (*encFnInfo).fastpathEncMapUint32UintptrR, (*decFnInfo).fastpathDecMapUint32UintptrR)
- fn(map[uint32]int(nil), (*encFnInfo).fastpathEncMapUint32IntR, (*decFnInfo).fastpathDecMapUint32IntR)
- fn(map[uint32]int8(nil), (*encFnInfo).fastpathEncMapUint32Int8R, (*decFnInfo).fastpathDecMapUint32Int8R)
- fn(map[uint32]int16(nil), (*encFnInfo).fastpathEncMapUint32Int16R, (*decFnInfo).fastpathDecMapUint32Int16R)
- fn(map[uint32]int32(nil), (*encFnInfo).fastpathEncMapUint32Int32R, (*decFnInfo).fastpathDecMapUint32Int32R)
- fn(map[uint32]int64(nil), (*encFnInfo).fastpathEncMapUint32Int64R, (*decFnInfo).fastpathDecMapUint32Int64R)
- fn(map[uint32]float32(nil), (*encFnInfo).fastpathEncMapUint32Float32R, (*decFnInfo).fastpathDecMapUint32Float32R)
- fn(map[uint32]float64(nil), (*encFnInfo).fastpathEncMapUint32Float64R, (*decFnInfo).fastpathDecMapUint32Float64R)
- fn(map[uint32]bool(nil), (*encFnInfo).fastpathEncMapUint32BoolR, (*decFnInfo).fastpathDecMapUint32BoolR)
- fn(map[uint64]interface{}(nil), (*encFnInfo).fastpathEncMapUint64IntfR, (*decFnInfo).fastpathDecMapUint64IntfR)
- fn(map[uint64]string(nil), (*encFnInfo).fastpathEncMapUint64StringR, (*decFnInfo).fastpathDecMapUint64StringR)
- fn(map[uint64]uint(nil), (*encFnInfo).fastpathEncMapUint64UintR, (*decFnInfo).fastpathDecMapUint64UintR)
- fn(map[uint64]uint8(nil), (*encFnInfo).fastpathEncMapUint64Uint8R, (*decFnInfo).fastpathDecMapUint64Uint8R)
- fn(map[uint64]uint16(nil), (*encFnInfo).fastpathEncMapUint64Uint16R, (*decFnInfo).fastpathDecMapUint64Uint16R)
- fn(map[uint64]uint32(nil), (*encFnInfo).fastpathEncMapUint64Uint32R, (*decFnInfo).fastpathDecMapUint64Uint32R)
- fn(map[uint64]uint64(nil), (*encFnInfo).fastpathEncMapUint64Uint64R, (*decFnInfo).fastpathDecMapUint64Uint64R)
- fn(map[uint64]uintptr(nil), (*encFnInfo).fastpathEncMapUint64UintptrR, (*decFnInfo).fastpathDecMapUint64UintptrR)
- fn(map[uint64]int(nil), (*encFnInfo).fastpathEncMapUint64IntR, (*decFnInfo).fastpathDecMapUint64IntR)
- fn(map[uint64]int8(nil), (*encFnInfo).fastpathEncMapUint64Int8R, (*decFnInfo).fastpathDecMapUint64Int8R)
- fn(map[uint64]int16(nil), (*encFnInfo).fastpathEncMapUint64Int16R, (*decFnInfo).fastpathDecMapUint64Int16R)
- fn(map[uint64]int32(nil), (*encFnInfo).fastpathEncMapUint64Int32R, (*decFnInfo).fastpathDecMapUint64Int32R)
- fn(map[uint64]int64(nil), (*encFnInfo).fastpathEncMapUint64Int64R, (*decFnInfo).fastpathDecMapUint64Int64R)
- fn(map[uint64]float32(nil), (*encFnInfo).fastpathEncMapUint64Float32R, (*decFnInfo).fastpathDecMapUint64Float32R)
- fn(map[uint64]float64(nil), (*encFnInfo).fastpathEncMapUint64Float64R, (*decFnInfo).fastpathDecMapUint64Float64R)
- fn(map[uint64]bool(nil), (*encFnInfo).fastpathEncMapUint64BoolR, (*decFnInfo).fastpathDecMapUint64BoolR)
- fn(map[uintptr]interface{}(nil), (*encFnInfo).fastpathEncMapUintptrIntfR, (*decFnInfo).fastpathDecMapUintptrIntfR)
- fn(map[uintptr]string(nil), (*encFnInfo).fastpathEncMapUintptrStringR, (*decFnInfo).fastpathDecMapUintptrStringR)
- fn(map[uintptr]uint(nil), (*encFnInfo).fastpathEncMapUintptrUintR, (*decFnInfo).fastpathDecMapUintptrUintR)
- fn(map[uintptr]uint8(nil), (*encFnInfo).fastpathEncMapUintptrUint8R, (*decFnInfo).fastpathDecMapUintptrUint8R)
- fn(map[uintptr]uint16(nil), (*encFnInfo).fastpathEncMapUintptrUint16R, (*decFnInfo).fastpathDecMapUintptrUint16R)
- fn(map[uintptr]uint32(nil), (*encFnInfo).fastpathEncMapUintptrUint32R, (*decFnInfo).fastpathDecMapUintptrUint32R)
- fn(map[uintptr]uint64(nil), (*encFnInfo).fastpathEncMapUintptrUint64R, (*decFnInfo).fastpathDecMapUintptrUint64R)
- fn(map[uintptr]uintptr(nil), (*encFnInfo).fastpathEncMapUintptrUintptrR, (*decFnInfo).fastpathDecMapUintptrUintptrR)
- fn(map[uintptr]int(nil), (*encFnInfo).fastpathEncMapUintptrIntR, (*decFnInfo).fastpathDecMapUintptrIntR)
- fn(map[uintptr]int8(nil), (*encFnInfo).fastpathEncMapUintptrInt8R, (*decFnInfo).fastpathDecMapUintptrInt8R)
- fn(map[uintptr]int16(nil), (*encFnInfo).fastpathEncMapUintptrInt16R, (*decFnInfo).fastpathDecMapUintptrInt16R)
- fn(map[uintptr]int32(nil), (*encFnInfo).fastpathEncMapUintptrInt32R, (*decFnInfo).fastpathDecMapUintptrInt32R)
- fn(map[uintptr]int64(nil), (*encFnInfo).fastpathEncMapUintptrInt64R, (*decFnInfo).fastpathDecMapUintptrInt64R)
- fn(map[uintptr]float32(nil), (*encFnInfo).fastpathEncMapUintptrFloat32R, (*decFnInfo).fastpathDecMapUintptrFloat32R)
- fn(map[uintptr]float64(nil), (*encFnInfo).fastpathEncMapUintptrFloat64R, (*decFnInfo).fastpathDecMapUintptrFloat64R)
- fn(map[uintptr]bool(nil), (*encFnInfo).fastpathEncMapUintptrBoolR, (*decFnInfo).fastpathDecMapUintptrBoolR)
- fn(map[int]interface{}(nil), (*encFnInfo).fastpathEncMapIntIntfR, (*decFnInfo).fastpathDecMapIntIntfR)
- fn(map[int]string(nil), (*encFnInfo).fastpathEncMapIntStringR, (*decFnInfo).fastpathDecMapIntStringR)
- fn(map[int]uint(nil), (*encFnInfo).fastpathEncMapIntUintR, (*decFnInfo).fastpathDecMapIntUintR)
- fn(map[int]uint8(nil), (*encFnInfo).fastpathEncMapIntUint8R, (*decFnInfo).fastpathDecMapIntUint8R)
- fn(map[int]uint16(nil), (*encFnInfo).fastpathEncMapIntUint16R, (*decFnInfo).fastpathDecMapIntUint16R)
- fn(map[int]uint32(nil), (*encFnInfo).fastpathEncMapIntUint32R, (*decFnInfo).fastpathDecMapIntUint32R)
- fn(map[int]uint64(nil), (*encFnInfo).fastpathEncMapIntUint64R, (*decFnInfo).fastpathDecMapIntUint64R)
- fn(map[int]uintptr(nil), (*encFnInfo).fastpathEncMapIntUintptrR, (*decFnInfo).fastpathDecMapIntUintptrR)
- fn(map[int]int(nil), (*encFnInfo).fastpathEncMapIntIntR, (*decFnInfo).fastpathDecMapIntIntR)
- fn(map[int]int8(nil), (*encFnInfo).fastpathEncMapIntInt8R, (*decFnInfo).fastpathDecMapIntInt8R)
- fn(map[int]int16(nil), (*encFnInfo).fastpathEncMapIntInt16R, (*decFnInfo).fastpathDecMapIntInt16R)
- fn(map[int]int32(nil), (*encFnInfo).fastpathEncMapIntInt32R, (*decFnInfo).fastpathDecMapIntInt32R)
- fn(map[int]int64(nil), (*encFnInfo).fastpathEncMapIntInt64R, (*decFnInfo).fastpathDecMapIntInt64R)
- fn(map[int]float32(nil), (*encFnInfo).fastpathEncMapIntFloat32R, (*decFnInfo).fastpathDecMapIntFloat32R)
- fn(map[int]float64(nil), (*encFnInfo).fastpathEncMapIntFloat64R, (*decFnInfo).fastpathDecMapIntFloat64R)
- fn(map[int]bool(nil), (*encFnInfo).fastpathEncMapIntBoolR, (*decFnInfo).fastpathDecMapIntBoolR)
- fn(map[int8]interface{}(nil), (*encFnInfo).fastpathEncMapInt8IntfR, (*decFnInfo).fastpathDecMapInt8IntfR)
- fn(map[int8]string(nil), (*encFnInfo).fastpathEncMapInt8StringR, (*decFnInfo).fastpathDecMapInt8StringR)
- fn(map[int8]uint(nil), (*encFnInfo).fastpathEncMapInt8UintR, (*decFnInfo).fastpathDecMapInt8UintR)
- fn(map[int8]uint8(nil), (*encFnInfo).fastpathEncMapInt8Uint8R, (*decFnInfo).fastpathDecMapInt8Uint8R)
- fn(map[int8]uint16(nil), (*encFnInfo).fastpathEncMapInt8Uint16R, (*decFnInfo).fastpathDecMapInt8Uint16R)
- fn(map[int8]uint32(nil), (*encFnInfo).fastpathEncMapInt8Uint32R, (*decFnInfo).fastpathDecMapInt8Uint32R)
- fn(map[int8]uint64(nil), (*encFnInfo).fastpathEncMapInt8Uint64R, (*decFnInfo).fastpathDecMapInt8Uint64R)
- fn(map[int8]uintptr(nil), (*encFnInfo).fastpathEncMapInt8UintptrR, (*decFnInfo).fastpathDecMapInt8UintptrR)
- fn(map[int8]int(nil), (*encFnInfo).fastpathEncMapInt8IntR, (*decFnInfo).fastpathDecMapInt8IntR)
- fn(map[int8]int8(nil), (*encFnInfo).fastpathEncMapInt8Int8R, (*decFnInfo).fastpathDecMapInt8Int8R)
- fn(map[int8]int16(nil), (*encFnInfo).fastpathEncMapInt8Int16R, (*decFnInfo).fastpathDecMapInt8Int16R)
- fn(map[int8]int32(nil), (*encFnInfo).fastpathEncMapInt8Int32R, (*decFnInfo).fastpathDecMapInt8Int32R)
- fn(map[int8]int64(nil), (*encFnInfo).fastpathEncMapInt8Int64R, (*decFnInfo).fastpathDecMapInt8Int64R)
- fn(map[int8]float32(nil), (*encFnInfo).fastpathEncMapInt8Float32R, (*decFnInfo).fastpathDecMapInt8Float32R)
- fn(map[int8]float64(nil), (*encFnInfo).fastpathEncMapInt8Float64R, (*decFnInfo).fastpathDecMapInt8Float64R)
- fn(map[int8]bool(nil), (*encFnInfo).fastpathEncMapInt8BoolR, (*decFnInfo).fastpathDecMapInt8BoolR)
- fn(map[int16]interface{}(nil), (*encFnInfo).fastpathEncMapInt16IntfR, (*decFnInfo).fastpathDecMapInt16IntfR)
- fn(map[int16]string(nil), (*encFnInfo).fastpathEncMapInt16StringR, (*decFnInfo).fastpathDecMapInt16StringR)
- fn(map[int16]uint(nil), (*encFnInfo).fastpathEncMapInt16UintR, (*decFnInfo).fastpathDecMapInt16UintR)
- fn(map[int16]uint8(nil), (*encFnInfo).fastpathEncMapInt16Uint8R, (*decFnInfo).fastpathDecMapInt16Uint8R)
- fn(map[int16]uint16(nil), (*encFnInfo).fastpathEncMapInt16Uint16R, (*decFnInfo).fastpathDecMapInt16Uint16R)
- fn(map[int16]uint32(nil), (*encFnInfo).fastpathEncMapInt16Uint32R, (*decFnInfo).fastpathDecMapInt16Uint32R)
- fn(map[int16]uint64(nil), (*encFnInfo).fastpathEncMapInt16Uint64R, (*decFnInfo).fastpathDecMapInt16Uint64R)
- fn(map[int16]uintptr(nil), (*encFnInfo).fastpathEncMapInt16UintptrR, (*decFnInfo).fastpathDecMapInt16UintptrR)
- fn(map[int16]int(nil), (*encFnInfo).fastpathEncMapInt16IntR, (*decFnInfo).fastpathDecMapInt16IntR)
- fn(map[int16]int8(nil), (*encFnInfo).fastpathEncMapInt16Int8R, (*decFnInfo).fastpathDecMapInt16Int8R)
- fn(map[int16]int16(nil), (*encFnInfo).fastpathEncMapInt16Int16R, (*decFnInfo).fastpathDecMapInt16Int16R)
- fn(map[int16]int32(nil), (*encFnInfo).fastpathEncMapInt16Int32R, (*decFnInfo).fastpathDecMapInt16Int32R)
- fn(map[int16]int64(nil), (*encFnInfo).fastpathEncMapInt16Int64R, (*decFnInfo).fastpathDecMapInt16Int64R)
- fn(map[int16]float32(nil), (*encFnInfo).fastpathEncMapInt16Float32R, (*decFnInfo).fastpathDecMapInt16Float32R)
- fn(map[int16]float64(nil), (*encFnInfo).fastpathEncMapInt16Float64R, (*decFnInfo).fastpathDecMapInt16Float64R)
- fn(map[int16]bool(nil), (*encFnInfo).fastpathEncMapInt16BoolR, (*decFnInfo).fastpathDecMapInt16BoolR)
- fn(map[int32]interface{}(nil), (*encFnInfo).fastpathEncMapInt32IntfR, (*decFnInfo).fastpathDecMapInt32IntfR)
- fn(map[int32]string(nil), (*encFnInfo).fastpathEncMapInt32StringR, (*decFnInfo).fastpathDecMapInt32StringR)
- fn(map[int32]uint(nil), (*encFnInfo).fastpathEncMapInt32UintR, (*decFnInfo).fastpathDecMapInt32UintR)
- fn(map[int32]uint8(nil), (*encFnInfo).fastpathEncMapInt32Uint8R, (*decFnInfo).fastpathDecMapInt32Uint8R)
- fn(map[int32]uint16(nil), (*encFnInfo).fastpathEncMapInt32Uint16R, (*decFnInfo).fastpathDecMapInt32Uint16R)
- fn(map[int32]uint32(nil), (*encFnInfo).fastpathEncMapInt32Uint32R, (*decFnInfo).fastpathDecMapInt32Uint32R)
- fn(map[int32]uint64(nil), (*encFnInfo).fastpathEncMapInt32Uint64R, (*decFnInfo).fastpathDecMapInt32Uint64R)
- fn(map[int32]uintptr(nil), (*encFnInfo).fastpathEncMapInt32UintptrR, (*decFnInfo).fastpathDecMapInt32UintptrR)
- fn(map[int32]int(nil), (*encFnInfo).fastpathEncMapInt32IntR, (*decFnInfo).fastpathDecMapInt32IntR)
- fn(map[int32]int8(nil), (*encFnInfo).fastpathEncMapInt32Int8R, (*decFnInfo).fastpathDecMapInt32Int8R)
- fn(map[int32]int16(nil), (*encFnInfo).fastpathEncMapInt32Int16R, (*decFnInfo).fastpathDecMapInt32Int16R)
- fn(map[int32]int32(nil), (*encFnInfo).fastpathEncMapInt32Int32R, (*decFnInfo).fastpathDecMapInt32Int32R)
- fn(map[int32]int64(nil), (*encFnInfo).fastpathEncMapInt32Int64R, (*decFnInfo).fastpathDecMapInt32Int64R)
- fn(map[int32]float32(nil), (*encFnInfo).fastpathEncMapInt32Float32R, (*decFnInfo).fastpathDecMapInt32Float32R)
- fn(map[int32]float64(nil), (*encFnInfo).fastpathEncMapInt32Float64R, (*decFnInfo).fastpathDecMapInt32Float64R)
- fn(map[int32]bool(nil), (*encFnInfo).fastpathEncMapInt32BoolR, (*decFnInfo).fastpathDecMapInt32BoolR)
- fn(map[int64]interface{}(nil), (*encFnInfo).fastpathEncMapInt64IntfR, (*decFnInfo).fastpathDecMapInt64IntfR)
- fn(map[int64]string(nil), (*encFnInfo).fastpathEncMapInt64StringR, (*decFnInfo).fastpathDecMapInt64StringR)
- fn(map[int64]uint(nil), (*encFnInfo).fastpathEncMapInt64UintR, (*decFnInfo).fastpathDecMapInt64UintR)
- fn(map[int64]uint8(nil), (*encFnInfo).fastpathEncMapInt64Uint8R, (*decFnInfo).fastpathDecMapInt64Uint8R)
- fn(map[int64]uint16(nil), (*encFnInfo).fastpathEncMapInt64Uint16R, (*decFnInfo).fastpathDecMapInt64Uint16R)
- fn(map[int64]uint32(nil), (*encFnInfo).fastpathEncMapInt64Uint32R, (*decFnInfo).fastpathDecMapInt64Uint32R)
- fn(map[int64]uint64(nil), (*encFnInfo).fastpathEncMapInt64Uint64R, (*decFnInfo).fastpathDecMapInt64Uint64R)
- fn(map[int64]uintptr(nil), (*encFnInfo).fastpathEncMapInt64UintptrR, (*decFnInfo).fastpathDecMapInt64UintptrR)
- fn(map[int64]int(nil), (*encFnInfo).fastpathEncMapInt64IntR, (*decFnInfo).fastpathDecMapInt64IntR)
- fn(map[int64]int8(nil), (*encFnInfo).fastpathEncMapInt64Int8R, (*decFnInfo).fastpathDecMapInt64Int8R)
- fn(map[int64]int16(nil), (*encFnInfo).fastpathEncMapInt64Int16R, (*decFnInfo).fastpathDecMapInt64Int16R)
- fn(map[int64]int32(nil), (*encFnInfo).fastpathEncMapInt64Int32R, (*decFnInfo).fastpathDecMapInt64Int32R)
- fn(map[int64]int64(nil), (*encFnInfo).fastpathEncMapInt64Int64R, (*decFnInfo).fastpathDecMapInt64Int64R)
- fn(map[int64]float32(nil), (*encFnInfo).fastpathEncMapInt64Float32R, (*decFnInfo).fastpathDecMapInt64Float32R)
- fn(map[int64]float64(nil), (*encFnInfo).fastpathEncMapInt64Float64R, (*decFnInfo).fastpathDecMapInt64Float64R)
- fn(map[int64]bool(nil), (*encFnInfo).fastpathEncMapInt64BoolR, (*decFnInfo).fastpathDecMapInt64BoolR)
- fn(map[bool]interface{}(nil), (*encFnInfo).fastpathEncMapBoolIntfR, (*decFnInfo).fastpathDecMapBoolIntfR)
- fn(map[bool]string(nil), (*encFnInfo).fastpathEncMapBoolStringR, (*decFnInfo).fastpathDecMapBoolStringR)
- fn(map[bool]uint(nil), (*encFnInfo).fastpathEncMapBoolUintR, (*decFnInfo).fastpathDecMapBoolUintR)
- fn(map[bool]uint8(nil), (*encFnInfo).fastpathEncMapBoolUint8R, (*decFnInfo).fastpathDecMapBoolUint8R)
- fn(map[bool]uint16(nil), (*encFnInfo).fastpathEncMapBoolUint16R, (*decFnInfo).fastpathDecMapBoolUint16R)
- fn(map[bool]uint32(nil), (*encFnInfo).fastpathEncMapBoolUint32R, (*decFnInfo).fastpathDecMapBoolUint32R)
- fn(map[bool]uint64(nil), (*encFnInfo).fastpathEncMapBoolUint64R, (*decFnInfo).fastpathDecMapBoolUint64R)
- fn(map[bool]uintptr(nil), (*encFnInfo).fastpathEncMapBoolUintptrR, (*decFnInfo).fastpathDecMapBoolUintptrR)
- fn(map[bool]int(nil), (*encFnInfo).fastpathEncMapBoolIntR, (*decFnInfo).fastpathDecMapBoolIntR)
- fn(map[bool]int8(nil), (*encFnInfo).fastpathEncMapBoolInt8R, (*decFnInfo).fastpathDecMapBoolInt8R)
- fn(map[bool]int16(nil), (*encFnInfo).fastpathEncMapBoolInt16R, (*decFnInfo).fastpathDecMapBoolInt16R)
- fn(map[bool]int32(nil), (*encFnInfo).fastpathEncMapBoolInt32R, (*decFnInfo).fastpathDecMapBoolInt32R)
- fn(map[bool]int64(nil), (*encFnInfo).fastpathEncMapBoolInt64R, (*decFnInfo).fastpathDecMapBoolInt64R)
- fn(map[bool]float32(nil), (*encFnInfo).fastpathEncMapBoolFloat32R, (*decFnInfo).fastpathDecMapBoolFloat32R)
- fn(map[bool]float64(nil), (*encFnInfo).fastpathEncMapBoolFloat64R, (*decFnInfo).fastpathDecMapBoolFloat64R)
- fn(map[bool]bool(nil), (*encFnInfo).fastpathEncMapBoolBoolR, (*decFnInfo).fastpathDecMapBoolBoolR)
-
- sort.Sort(fastpathAslice(fastpathAV[:]))
-}
-
-// -- encode
-
-// -- -- fast path type switch
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e)
- case *[]interface{}:
- fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]string:
- fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]string:
- fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int:
- fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int:
- fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e)
-
- case []string:
- fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e)
- case *[]string:
- fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]interface{}:
- fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e)
- case *map[string]interface{}:
- fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[string]string:
- fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e)
- case *map[string]string:
- fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint:
- fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e)
- case *map[string]uint:
- fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint8:
- fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e)
- case *map[string]uint8:
- fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint16:
- fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e)
- case *map[string]uint16:
- fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint32:
- fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e)
- case *map[string]uint32:
- fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint64:
- fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e)
- case *map[string]uint64:
- fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e)
- case *map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int:
- fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e)
- case *map[string]int:
- fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int8:
- fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e)
- case *map[string]int8:
- fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int16:
- fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e)
- case *map[string]int16:
- fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int32:
- fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e)
- case *map[string]int32:
- fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int64:
- fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e)
- case *map[string]int64:
- fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float32:
- fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e)
- case *map[string]float32:
- fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float64:
- fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e)
- case *map[string]float64:
- fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]bool:
- fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e)
- case *map[string]bool:
- fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e)
-
- case []float32:
- fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e)
- case *[]float32:
- fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e)
- case *map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]string:
- fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e)
- case *map[float32]string:
- fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint:
- fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e)
- case *map[float32]uint:
- fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int:
- fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e)
- case *map[float32]int:
- fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e)
- case *map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e)
- case *map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e)
- case *map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e)
- case *map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e)
- case *map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e)
- case *map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e)
- case *map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []float64:
- fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e)
- case *[]float64:
- fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e)
- case *map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]string:
- fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e)
- case *map[float64]string:
- fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint:
- fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e)
- case *map[float64]uint:
- fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int:
- fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e)
- case *map[float64]int:
- fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e)
- case *map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e)
- case *map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e)
- case *map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e)
- case *map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e)
- case *map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e)
- case *map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e)
- case *map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint:
- fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e)
- case *[]uint:
- fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e)
- case *map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]string:
- fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e)
- case *map[uint]string:
- fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint:
- fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e)
- case *map[uint]uint:
- fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint8:
- fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint8:
- fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint16:
- fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint16:
- fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint32:
- fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint32:
- fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint64:
- fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint64:
- fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int:
- fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e)
- case *map[uint]int:
- fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int8:
- fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e)
- case *map[uint]int8:
- fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int16:
- fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e)
- case *map[uint]int16:
- fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int32:
- fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e)
- case *map[uint]int32:
- fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int64:
- fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e)
- case *map[uint]int64:
- fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float32:
- fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uint]float32:
- fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float64:
- fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uint]float64:
- fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]bool:
- fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e)
- case *map[uint]bool:
- fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]string:
- fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e)
- case *map[uint8]string:
- fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint:
- fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint:
- fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int:
- fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e)
- case *map[uint8]int:
- fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint16:
- fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e)
- case *[]uint16:
- fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]string:
- fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e)
- case *map[uint16]string:
- fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint:
- fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint:
- fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int:
- fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e)
- case *map[uint16]int:
- fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint32:
- fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e)
- case *[]uint32:
- fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]string:
- fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e)
- case *map[uint32]string:
- fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint:
- fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint:
- fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int:
- fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e)
- case *map[uint32]int:
- fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uint64:
- fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e)
- case *[]uint64:
- fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]string:
- fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e)
- case *map[uint64]string:
- fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint:
- fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint:
- fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int:
- fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e)
- case *map[uint64]int:
- fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []uintptr:
- fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e)
- case *[]uintptr:
- fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e)
-
- case []int:
- fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e)
- case *[]int:
- fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]interface{}:
- fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e)
- case *map[int]interface{}:
- fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int]string:
- fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e)
- case *map[int]string:
- fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint:
- fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e)
- case *map[int]uint:
- fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint8:
- fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e)
- case *map[int]uint8:
- fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint16:
- fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e)
- case *map[int]uint16:
- fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint32:
- fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e)
- case *map[int]uint32:
- fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint64:
- fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e)
- case *map[int]uint64:
- fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e)
- case *map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int:
- fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e)
- case *map[int]int:
- fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int8:
- fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e)
- case *map[int]int8:
- fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int16:
- fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e)
- case *map[int]int16:
- fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int32:
- fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e)
- case *map[int]int32:
- fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int64:
- fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e)
- case *map[int]int64:
- fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float32:
- fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e)
- case *map[int]float32:
- fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float64:
- fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e)
- case *map[int]float64:
- fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]bool:
- fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e)
- case *map[int]bool:
- fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e)
-
- case []int8:
- fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e)
- case *[]int8:
- fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e)
- case *map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]string:
- fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e)
- case *map[int8]string:
- fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint:
- fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e)
- case *map[int8]uint:
- fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int:
- fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e)
- case *map[int8]int:
- fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int8:
- fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e)
- case *map[int8]int8:
- fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int16:
- fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e)
- case *map[int8]int16:
- fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int32:
- fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e)
- case *map[int8]int32:
- fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int64:
- fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e)
- case *map[int8]int64:
- fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float32:
- fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e)
- case *map[int8]float32:
- fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float64:
- fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e)
- case *map[int8]float64:
- fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]bool:
- fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e)
- case *map[int8]bool:
- fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int16:
- fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e)
- case *[]int16:
- fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e)
- case *map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]string:
- fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e)
- case *map[int16]string:
- fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint:
- fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e)
- case *map[int16]uint:
- fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int:
- fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e)
- case *map[int16]int:
- fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int8:
- fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e)
- case *map[int16]int8:
- fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int16:
- fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e)
- case *map[int16]int16:
- fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int32:
- fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e)
- case *map[int16]int32:
- fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int64:
- fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e)
- case *map[int16]int64:
- fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float32:
- fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e)
- case *map[int16]float32:
- fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float64:
- fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e)
- case *map[int16]float64:
- fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]bool:
- fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e)
- case *map[int16]bool:
- fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int32:
- fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e)
- case *[]int32:
- fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e)
- case *map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]string:
- fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e)
- case *map[int32]string:
- fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint:
- fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e)
- case *map[int32]uint:
- fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int:
- fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e)
- case *map[int32]int:
- fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int8:
- fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e)
- case *map[int32]int8:
- fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int16:
- fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e)
- case *map[int32]int16:
- fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int32:
- fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e)
- case *map[int32]int32:
- fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int64:
- fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e)
- case *map[int32]int64:
- fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float32:
- fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e)
- case *map[int32]float32:
- fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float64:
- fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e)
- case *map[int32]float64:
- fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]bool:
- fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e)
- case *map[int32]bool:
- fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e)
-
- case []int64:
- fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e)
- case *[]int64:
- fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e)
- case *map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]string:
- fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e)
- case *map[int64]string:
- fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint:
- fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e)
- case *map[int64]uint:
- fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int:
- fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e)
- case *map[int64]int:
- fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int8:
- fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e)
- case *map[int64]int8:
- fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int16:
- fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e)
- case *map[int64]int16:
- fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int32:
- fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e)
- case *map[int64]int32:
- fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int64:
- fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e)
- case *map[int64]int64:
- fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float32:
- fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e)
- case *map[int64]float32:
- fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float64:
- fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e)
- case *map[int64]float64:
- fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]bool:
- fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e)
- case *map[int64]bool:
- fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e)
-
- case []bool:
- fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e)
- case *[]bool:
- fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e)
- case *map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]string:
- fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e)
- case *map[bool]string:
- fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint:
- fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e)
- case *map[bool]uint:
- fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e)
- case *map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int:
- fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e)
- case *map[bool]int:
- fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int8:
- fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e)
- case *map[bool]int8:
- fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int16:
- fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e)
- case *map[bool]int16:
- fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int32:
- fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e)
- case *map[bool]int32:
- fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int64:
- fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e)
- case *map[bool]int64:
- fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e)
- case *map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e)
- case *map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]bool:
- fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e)
- case *map[bool]bool:
- fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e)
- case *[]interface{}:
- fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e)
-
- case []string:
- fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e)
- case *[]string:
- fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e)
-
- case []float32:
- fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e)
- case *[]float32:
- fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e)
-
- case []float64:
- fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e)
- case *[]float64:
- fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e)
-
- case []uint:
- fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e)
- case *[]uint:
- fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e)
-
- case []uint16:
- fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e)
- case *[]uint16:
- fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e)
-
- case []uint32:
- fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e)
- case *[]uint32:
- fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e)
-
- case []uint64:
- fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e)
- case *[]uint64:
- fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e)
-
- case []uintptr:
- fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e)
- case *[]uintptr:
- fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e)
-
- case []int:
- fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e)
- case *[]int:
- fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e)
-
- case []int8:
- fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e)
- case *[]int8:
- fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e)
-
- case []int16:
- fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e)
- case *[]int16:
- fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e)
-
- case []int32:
- fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e)
- case *[]int32:
- fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e)
-
- case []int64:
- fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e)
- case *[]int64:
- fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e)
-
- case []bool:
- fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e)
- case *[]bool:
- fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-
- case map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]string:
- fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]string:
- fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int:
- fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int:
- fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e)
- case *map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e)
- case *map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[string]interface{}:
- fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e)
- case *map[string]interface{}:
- fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[string]string:
- fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e)
- case *map[string]string:
- fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint:
- fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e)
- case *map[string]uint:
- fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint8:
- fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e)
- case *map[string]uint8:
- fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint16:
- fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e)
- case *map[string]uint16:
- fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint32:
- fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e)
- case *map[string]uint32:
- fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uint64:
- fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e)
- case *map[string]uint64:
- fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e)
- case *map[string]uintptr:
- fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int:
- fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e)
- case *map[string]int:
- fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e)
-
- case map[string]int8:
- fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e)
- case *map[string]int8:
- fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int16:
- fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e)
- case *map[string]int16:
- fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int32:
- fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e)
- case *map[string]int32:
- fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]int64:
- fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e)
- case *map[string]int64:
- fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float32:
- fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e)
- case *map[string]float32:
- fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[string]float64:
- fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e)
- case *map[string]float64:
- fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[string]bool:
- fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e)
- case *map[string]bool:
- fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e)
- case *map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]string:
- fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e)
- case *map[float32]string:
- fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint:
- fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e)
- case *map[float32]uint:
- fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int:
- fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e)
- case *map[float32]int:
- fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e)
- case *map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e)
- case *map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e)
- case *map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e)
- case *map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e)
- case *map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e)
- case *map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e)
- case *map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e)
- case *map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]string:
- fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e)
- case *map[float64]string:
- fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint:
- fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e)
- case *map[float64]uint:
- fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int:
- fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e)
- case *map[float64]int:
- fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e)
- case *map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e)
- case *map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e)
- case *map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e)
- case *map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e)
- case *map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e)
- case *map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e)
- case *map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e)
- case *map[uint]interface{}:
- fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]string:
- fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e)
- case *map[uint]string:
- fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint:
- fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e)
- case *map[uint]uint:
- fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint8:
- fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint8:
- fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint16:
- fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint16:
- fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint32:
- fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint32:
- fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uint64:
- fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e)
- case *map[uint]uint64:
- fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint]uintptr:
- fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int:
- fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e)
- case *map[uint]int:
- fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int8:
- fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e)
- case *map[uint]int8:
- fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int16:
- fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e)
- case *map[uint]int16:
- fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int32:
- fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e)
- case *map[uint]int32:
- fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]int64:
- fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e)
- case *map[uint]int64:
- fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float32:
- fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uint]float32:
- fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]float64:
- fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uint]float64:
- fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint]bool:
- fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e)
- case *map[uint]bool:
- fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint8]interface{}:
- fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]string:
- fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e)
- case *map[uint8]string:
- fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint:
- fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint:
- fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint8:
- fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]uint64:
- fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint8]uintptr:
- fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int:
- fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e)
- case *map[uint8]int:
- fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]int64:
- fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float32:
- fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint8]float64:
- fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint8]bool:
- fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]string:
- fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e)
- case *map[uint16]string:
- fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint:
- fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint:
- fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int:
- fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e)
- case *map[uint16]int:
- fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]string:
- fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e)
- case *map[uint32]string:
- fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint:
- fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint:
- fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int:
- fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e)
- case *map[uint32]int:
- fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e)
- case *map[uint64]interface{}:
- fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]string:
- fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e)
- case *map[uint64]string:
- fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint:
- fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint:
- fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint8:
- fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]uint64:
- fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[uint64]uintptr:
- fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int:
- fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e)
- case *map[uint64]int:
- fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]int64:
- fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float32:
- fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e)
- case *map[uint64]float64:
- fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e)
- case *map[uint64]bool:
- fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e)
- case *map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e)
- case *map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int]interface{}:
- fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e)
- case *map[int]interface{}:
- fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int]string:
- fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e)
- case *map[int]string:
- fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint:
- fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e)
- case *map[int]uint:
- fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint8:
- fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e)
- case *map[int]uint8:
- fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint16:
- fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e)
- case *map[int]uint16:
- fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint32:
- fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e)
- case *map[int]uint32:
- fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uint64:
- fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e)
- case *map[int]uint64:
- fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e)
- case *map[int]uintptr:
- fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int:
- fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e)
- case *map[int]int:
- fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e)
-
- case map[int]int8:
- fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e)
- case *map[int]int8:
- fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int16:
- fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e)
- case *map[int]int16:
- fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int32:
- fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e)
- case *map[int]int32:
- fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]int64:
- fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e)
- case *map[int]int64:
- fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float32:
- fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e)
- case *map[int]float32:
- fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[int]float64:
- fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e)
- case *map[int]float64:
- fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[int]bool:
- fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e)
- case *map[int]bool:
- fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e)
- case *map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]string:
- fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e)
- case *map[int8]string:
- fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint:
- fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e)
- case *map[int8]uint:
- fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int:
- fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e)
- case *map[int8]int:
- fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int8:
- fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e)
- case *map[int8]int8:
- fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int16:
- fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e)
- case *map[int8]int16:
- fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int32:
- fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e)
- case *map[int8]int32:
- fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]int64:
- fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e)
- case *map[int8]int64:
- fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float32:
- fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e)
- case *map[int8]float32:
- fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]float64:
- fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e)
- case *map[int8]float64:
- fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int8]bool:
- fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e)
- case *map[int8]bool:
- fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e)
- case *map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]string:
- fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e)
- case *map[int16]string:
- fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint:
- fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e)
- case *map[int16]uint:
- fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int:
- fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e)
- case *map[int16]int:
- fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int8:
- fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e)
- case *map[int16]int8:
- fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int16:
- fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e)
- case *map[int16]int16:
- fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int32:
- fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e)
- case *map[int16]int32:
- fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]int64:
- fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e)
- case *map[int16]int64:
- fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float32:
- fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e)
- case *map[int16]float32:
- fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]float64:
- fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e)
- case *map[int16]float64:
- fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int16]bool:
- fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e)
- case *map[int16]bool:
- fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e)
- case *map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]string:
- fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e)
- case *map[int32]string:
- fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint:
- fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e)
- case *map[int32]uint:
- fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int:
- fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e)
- case *map[int32]int:
- fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int8:
- fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e)
- case *map[int32]int8:
- fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int16:
- fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e)
- case *map[int32]int16:
- fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int32:
- fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e)
- case *map[int32]int32:
- fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]int64:
- fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e)
- case *map[int32]int64:
- fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float32:
- fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e)
- case *map[int32]float32:
- fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]float64:
- fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e)
- case *map[int32]float64:
- fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int32]bool:
- fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e)
- case *map[int32]bool:
- fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e)
- case *map[int64]interface{}:
- fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]string:
- fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e)
- case *map[int64]string:
- fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint:
- fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e)
- case *map[int64]uint:
- fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint8:
- fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e)
- case *map[int64]uint64:
- fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e)
- case *map[int64]uintptr:
- fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int:
- fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e)
- case *map[int64]int:
- fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int8:
- fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e)
- case *map[int64]int8:
- fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int16:
- fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e)
- case *map[int64]int16:
- fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int32:
- fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e)
- case *map[int64]int32:
- fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]int64:
- fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e)
- case *map[int64]int64:
- fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float32:
- fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e)
- case *map[int64]float32:
- fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]float64:
- fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e)
- case *map[int64]float64:
- fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e)
-
- case map[int64]bool:
- fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e)
- case *map[int64]bool:
- fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e)
- case *map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]string:
- fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e)
- case *map[bool]string:
- fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint:
- fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e)
- case *map[bool]uint:
- fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e)
- case *map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e)
- case *map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int:
- fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e)
- case *map[bool]int:
- fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int8:
- fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e)
- case *map[bool]int8:
- fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int16:
- fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e)
- case *map[bool]int16:
- fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int32:
- fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e)
- case *map[bool]int32:
- fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]int64:
- fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e)
- case *map[bool]int64:
- fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e)
- case *map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e)
- case *map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e)
-
- case map[bool]bool:
- fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e)
- case *map[bool]bool:
- fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e)
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-
-func (f *encFnInfo) fastpathEncSliceIntfR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceStringR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceStringV(v []string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeString(c_UTF8, v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceFloat32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeFloat32(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeFloat32(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceFloat64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeFloat64(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeFloat64(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUintR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUintV(v []uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint16R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUint64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeUint(uint64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceUintptrR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- e.encode(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceIntR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceIntV(v []int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt8R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt8V(v []int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt16R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt16V(v []int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt32R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt32V(v []int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceInt64R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceInt64V(v []int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeInt(int64(v2))
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncSliceBoolR(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.EncAsMapSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerArrayElem)
- }
- ee.EncodeBool(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerArrayEnd)
- }
-}
-
-func (_ fastpathT) EncAsMapSliceBoolV(v []bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- ee.EncodeBool(v2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) {
- fastpathTV.EncMapIntfIntfV(rv.Interface().(map[interface{}]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfStringR(rv reflect.Value) {
- fastpathTV.EncMapIntfStringV(rv.Interface().(map[interface{}]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUintR(rv reflect.Value) {
- fastpathTV.EncMapIntfUintV(rv.Interface().(map[interface{}]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint8R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint8V(rv.Interface().(map[interface{}]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint16R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint16V(rv.Interface().(map[interface{}]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint32R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint32V(rv.Interface().(map[interface{}]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUint64R(rv reflect.Value) {
- fastpathTV.EncMapIntfUint64V(rv.Interface().(map[interface{}]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfUintptrR(rv reflect.Value) {
- fastpathTV.EncMapIntfUintptrV(rv.Interface().(map[interface{}]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfIntR(rv reflect.Value) {
- fastpathTV.EncMapIntfIntV(rv.Interface().(map[interface{}]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt8R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt8V(rv.Interface().(map[interface{}]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt16R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt16V(rv.Interface().(map[interface{}]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt32R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt32V(rv.Interface().(map[interface{}]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfInt64R(rv reflect.Value) {
- fastpathTV.EncMapIntfInt64V(rv.Interface().(map[interface{}]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfFloat32R(rv reflect.Value) {
- fastpathTV.EncMapIntfFloat32V(rv.Interface().(map[interface{}]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfFloat64R(rv reflect.Value) {
- fastpathTV.EncMapIntfFloat64V(rv.Interface().(map[interface{}]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntfBoolR(rv reflect.Value) {
- fastpathTV.EncMapIntfBoolV(rv.Interface().(map[interface{}]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.asis(v2[j].v)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[v2[j].i])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringIntfR(rv reflect.Value) {
- fastpathTV.EncMapStringIntfV(rv.Interface().(map[string]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringStringR(rv reflect.Value) {
- fastpathTV.EncMapStringStringV(rv.Interface().(map[string]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUintR(rv reflect.Value) {
- fastpathTV.EncMapStringUintV(rv.Interface().(map[string]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint8R(rv reflect.Value) {
- fastpathTV.EncMapStringUint8V(rv.Interface().(map[string]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint16R(rv reflect.Value) {
- fastpathTV.EncMapStringUint16V(rv.Interface().(map[string]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint32R(rv reflect.Value) {
- fastpathTV.EncMapStringUint32V(rv.Interface().(map[string]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUint64R(rv reflect.Value) {
- fastpathTV.EncMapStringUint64V(rv.Interface().(map[string]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringUintptrR(rv reflect.Value) {
- fastpathTV.EncMapStringUintptrV(rv.Interface().(map[string]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringIntR(rv reflect.Value) {
- fastpathTV.EncMapStringIntV(rv.Interface().(map[string]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt8R(rv reflect.Value) {
- fastpathTV.EncMapStringInt8V(rv.Interface().(map[string]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt16R(rv reflect.Value) {
- fastpathTV.EncMapStringInt16V(rv.Interface().(map[string]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt32R(rv reflect.Value) {
- fastpathTV.EncMapStringInt32V(rv.Interface().(map[string]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringInt64R(rv reflect.Value) {
- fastpathTV.EncMapStringInt64V(rv.Interface().(map[string]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringFloat32R(rv reflect.Value) {
- fastpathTV.EncMapStringFloat32V(rv.Interface().(map[string]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringFloat64R(rv reflect.Value) {
- fastpathTV.EncMapStringFloat64V(rv.Interface().(map[string]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapStringBoolR(rv reflect.Value) {
- fastpathTV.EncMapStringBoolV(rv.Interface().(map[string]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- if e.h.Canonical {
- v2 := make([]string, len(v))
- var i int
- for k, _ := range v {
- v2[i] = string(k)
- i++
- }
- sort.Sort(stringSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[string(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32IntfR(rv reflect.Value) {
- fastpathTV.EncMapFloat32IntfV(rv.Interface().(map[float32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32StringR(rv reflect.Value) {
- fastpathTV.EncMapFloat32StringV(rv.Interface().(map[float32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32UintR(rv reflect.Value) {
- fastpathTV.EncMapFloat32UintV(rv.Interface().(map[float32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint8V(rv.Interface().(map[float32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint16V(rv.Interface().(map[float32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint32V(rv.Interface().(map[float32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint64V(rv.Interface().(map[float32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapFloat32UintptrV(rv.Interface().(map[float32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32IntR(rv reflect.Value) {
- fastpathTV.EncMapFloat32IntV(rv.Interface().(map[float32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int8R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int8V(rv.Interface().(map[float32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int16R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int16V(rv.Interface().(map[float32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int32V(rv.Interface().(map[float32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Int64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Int64V(rv.Interface().(map[float32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Float32R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Float32V(rv.Interface().(map[float32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32Float64R(rv reflect.Value) {
- fastpathTV.EncMapFloat32Float64V(rv.Interface().(map[float32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat32BoolR(rv reflect.Value) {
- fastpathTV.EncMapFloat32BoolV(rv.Interface().(map[float32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(float32(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[float32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat32(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64IntfR(rv reflect.Value) {
- fastpathTV.EncMapFloat64IntfV(rv.Interface().(map[float64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64StringR(rv reflect.Value) {
- fastpathTV.EncMapFloat64StringV(rv.Interface().(map[float64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64UintR(rv reflect.Value) {
- fastpathTV.EncMapFloat64UintV(rv.Interface().(map[float64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint8V(rv.Interface().(map[float64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint16V(rv.Interface().(map[float64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint32V(rv.Interface().(map[float64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint64V(rv.Interface().(map[float64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapFloat64UintptrV(rv.Interface().(map[float64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64IntR(rv reflect.Value) {
- fastpathTV.EncMapFloat64IntV(rv.Interface().(map[float64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int8R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int8V(rv.Interface().(map[float64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int16R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int16V(rv.Interface().(map[float64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int32V(rv.Interface().(map[float64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Int64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Int64V(rv.Interface().(map[float64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Float32R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Float32V(rv.Interface().(map[float64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64Float64R(rv reflect.Value) {
- fastpathTV.EncMapFloat64Float64V(rv.Interface().(map[float64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapFloat64BoolR(rv reflect.Value) {
- fastpathTV.EncMapFloat64BoolV(rv.Interface().(map[float64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]float64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = float64(k)
- i++
- }
- sort.Sort(floatSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(float64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[float64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeFloat64(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintIntfR(rv reflect.Value) {
- fastpathTV.EncMapUintIntfV(rv.Interface().(map[uint]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintStringR(rv reflect.Value) {
- fastpathTV.EncMapUintStringV(rv.Interface().(map[uint]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUintR(rv reflect.Value) {
- fastpathTV.EncMapUintUintV(rv.Interface().(map[uint]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint8R(rv reflect.Value) {
- fastpathTV.EncMapUintUint8V(rv.Interface().(map[uint]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint16R(rv reflect.Value) {
- fastpathTV.EncMapUintUint16V(rv.Interface().(map[uint]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint32R(rv reflect.Value) {
- fastpathTV.EncMapUintUint32V(rv.Interface().(map[uint]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUint64R(rv reflect.Value) {
- fastpathTV.EncMapUintUint64V(rv.Interface().(map[uint]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintUintptrR(rv reflect.Value) {
- fastpathTV.EncMapUintUintptrV(rv.Interface().(map[uint]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintIntR(rv reflect.Value) {
- fastpathTV.EncMapUintIntV(rv.Interface().(map[uint]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt8R(rv reflect.Value) {
- fastpathTV.EncMapUintInt8V(rv.Interface().(map[uint]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt16R(rv reflect.Value) {
- fastpathTV.EncMapUintInt16V(rv.Interface().(map[uint]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt32R(rv reflect.Value) {
- fastpathTV.EncMapUintInt32V(rv.Interface().(map[uint]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintInt64R(rv reflect.Value) {
- fastpathTV.EncMapUintInt64V(rv.Interface().(map[uint]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintFloat32R(rv reflect.Value) {
- fastpathTV.EncMapUintFloat32V(rv.Interface().(map[uint]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintFloat64R(rv reflect.Value) {
- fastpathTV.EncMapUintFloat64V(rv.Interface().(map[uint]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintBoolR(rv reflect.Value) {
- fastpathTV.EncMapUintBoolV(rv.Interface().(map[uint]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint8IntfV(rv.Interface().(map[uint8]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8StringR(rv reflect.Value) {
- fastpathTV.EncMapUint8StringV(rv.Interface().(map[uint8]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8UintR(rv reflect.Value) {
- fastpathTV.EncMapUint8UintV(rv.Interface().(map[uint8]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint8V(rv.Interface().(map[uint8]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint16V(rv.Interface().(map[uint8]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint32V(rv.Interface().(map[uint8]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Uint64V(rv.Interface().(map[uint8]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint8UintptrV(rv.Interface().(map[uint8]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8IntR(rv reflect.Value) {
- fastpathTV.EncMapUint8IntV(rv.Interface().(map[uint8]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int8V(rv.Interface().(map[uint8]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int16V(rv.Interface().(map[uint8]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int32V(rv.Interface().(map[uint8]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Int64V(rv.Interface().(map[uint8]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint8Float32V(rv.Interface().(map[uint8]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint8Float64V(rv.Interface().(map[uint8]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint8BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint8BoolV(rv.Interface().(map[uint8]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint16IntfV(rv.Interface().(map[uint16]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16StringR(rv reflect.Value) {
- fastpathTV.EncMapUint16StringV(rv.Interface().(map[uint16]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16UintR(rv reflect.Value) {
- fastpathTV.EncMapUint16UintV(rv.Interface().(map[uint16]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint8V(rv.Interface().(map[uint16]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint16V(rv.Interface().(map[uint16]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint32V(rv.Interface().(map[uint16]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Uint64V(rv.Interface().(map[uint16]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint16UintptrV(rv.Interface().(map[uint16]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16IntR(rv reflect.Value) {
- fastpathTV.EncMapUint16IntV(rv.Interface().(map[uint16]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int8V(rv.Interface().(map[uint16]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int16V(rv.Interface().(map[uint16]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int32V(rv.Interface().(map[uint16]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Int64V(rv.Interface().(map[uint16]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint16Float32V(rv.Interface().(map[uint16]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint16Float64V(rv.Interface().(map[uint16]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint16BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint16BoolV(rv.Interface().(map[uint16]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint32IntfV(rv.Interface().(map[uint32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32StringR(rv reflect.Value) {
- fastpathTV.EncMapUint32StringV(rv.Interface().(map[uint32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32UintR(rv reflect.Value) {
- fastpathTV.EncMapUint32UintV(rv.Interface().(map[uint32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint8V(rv.Interface().(map[uint32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint16V(rv.Interface().(map[uint32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint32V(rv.Interface().(map[uint32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Uint64V(rv.Interface().(map[uint32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint32UintptrV(rv.Interface().(map[uint32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32IntR(rv reflect.Value) {
- fastpathTV.EncMapUint32IntV(rv.Interface().(map[uint32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int8V(rv.Interface().(map[uint32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int16V(rv.Interface().(map[uint32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int32V(rv.Interface().(map[uint32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Int64V(rv.Interface().(map[uint32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint32Float32V(rv.Interface().(map[uint32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint32Float64V(rv.Interface().(map[uint32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint32BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint32BoolV(rv.Interface().(map[uint32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64IntfR(rv reflect.Value) {
- fastpathTV.EncMapUint64IntfV(rv.Interface().(map[uint64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64StringR(rv reflect.Value) {
- fastpathTV.EncMapUint64StringV(rv.Interface().(map[uint64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64UintR(rv reflect.Value) {
- fastpathTV.EncMapUint64UintV(rv.Interface().(map[uint64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint8V(rv.Interface().(map[uint64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint16V(rv.Interface().(map[uint64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint32V(rv.Interface().(map[uint64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Uint64V(rv.Interface().(map[uint64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapUint64UintptrV(rv.Interface().(map[uint64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64IntR(rv reflect.Value) {
- fastpathTV.EncMapUint64IntV(rv.Interface().(map[uint64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int8R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int8V(rv.Interface().(map[uint64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int16R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int16V(rv.Interface().(map[uint64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int32V(rv.Interface().(map[uint64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Int64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Int64V(rv.Interface().(map[uint64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Float32R(rv reflect.Value) {
- fastpathTV.EncMapUint64Float32V(rv.Interface().(map[uint64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64Float64R(rv reflect.Value) {
- fastpathTV.EncMapUint64Float64V(rv.Interface().(map[uint64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUint64BoolR(rv reflect.Value) {
- fastpathTV.EncMapUint64BoolV(rv.Interface().(map[uint64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(uint64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uint64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeUint(uint64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrIntfR(rv reflect.Value) {
- fastpathTV.EncMapUintptrIntfV(rv.Interface().(map[uintptr]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrStringR(rv reflect.Value) {
- fastpathTV.EncMapUintptrStringV(rv.Interface().(map[uintptr]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUintR(rv reflect.Value) {
- fastpathTV.EncMapUintptrUintV(rv.Interface().(map[uintptr]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint8R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint8V(rv.Interface().(map[uintptr]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint16R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint16V(rv.Interface().(map[uintptr]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint32V(rv.Interface().(map[uintptr]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUint64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrUint64V(rv.Interface().(map[uintptr]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrUintptrR(rv reflect.Value) {
- fastpathTV.EncMapUintptrUintptrV(rv.Interface().(map[uintptr]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrIntR(rv reflect.Value) {
- fastpathTV.EncMapUintptrIntV(rv.Interface().(map[uintptr]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt8R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt8V(rv.Interface().(map[uintptr]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt16R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt16V(rv.Interface().(map[uintptr]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt32V(rv.Interface().(map[uintptr]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrInt64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrInt64V(rv.Interface().(map[uintptr]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrFloat32R(rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat32V(rv.Interface().(map[uintptr]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrFloat64R(rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat64V(rv.Interface().(map[uintptr]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapUintptrBoolR(rv reflect.Value) {
- fastpathTV.EncMapUintptrBoolV(rv.Interface().(map[uintptr]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(uintptr(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[uintptr(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- e.encode(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntIntfR(rv reflect.Value) {
- fastpathTV.EncMapIntIntfV(rv.Interface().(map[int]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntStringR(rv reflect.Value) {
- fastpathTV.EncMapIntStringV(rv.Interface().(map[int]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUintR(rv reflect.Value) {
- fastpathTV.EncMapIntUintV(rv.Interface().(map[int]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint8R(rv reflect.Value) {
- fastpathTV.EncMapIntUint8V(rv.Interface().(map[int]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint16R(rv reflect.Value) {
- fastpathTV.EncMapIntUint16V(rv.Interface().(map[int]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint32R(rv reflect.Value) {
- fastpathTV.EncMapIntUint32V(rv.Interface().(map[int]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUint64R(rv reflect.Value) {
- fastpathTV.EncMapIntUint64V(rv.Interface().(map[int]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntUintptrR(rv reflect.Value) {
- fastpathTV.EncMapIntUintptrV(rv.Interface().(map[int]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntIntR(rv reflect.Value) {
- fastpathTV.EncMapIntIntV(rv.Interface().(map[int]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt8R(rv reflect.Value) {
- fastpathTV.EncMapIntInt8V(rv.Interface().(map[int]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt16R(rv reflect.Value) {
- fastpathTV.EncMapIntInt16V(rv.Interface().(map[int]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt32R(rv reflect.Value) {
- fastpathTV.EncMapIntInt32V(rv.Interface().(map[int]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntInt64R(rv reflect.Value) {
- fastpathTV.EncMapIntInt64V(rv.Interface().(map[int]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntFloat32R(rv reflect.Value) {
- fastpathTV.EncMapIntFloat32V(rv.Interface().(map[int]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntFloat64R(rv reflect.Value) {
- fastpathTV.EncMapIntFloat64V(rv.Interface().(map[int]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapIntBoolR(rv reflect.Value) {
- fastpathTV.EncMapIntBoolV(rv.Interface().(map[int]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt8IntfV(rv.Interface().(map[int8]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8StringR(rv reflect.Value) {
- fastpathTV.EncMapInt8StringV(rv.Interface().(map[int8]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8UintR(rv reflect.Value) {
- fastpathTV.EncMapInt8UintV(rv.Interface().(map[int8]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint8V(rv.Interface().(map[int8]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint16V(rv.Interface().(map[int8]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint32V(rv.Interface().(map[int8]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Uint64V(rv.Interface().(map[int8]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt8UintptrV(rv.Interface().(map[int8]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8IntR(rv reflect.Value) {
- fastpathTV.EncMapInt8IntV(rv.Interface().(map[int8]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int8V(rv.Interface().(map[int8]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int16V(rv.Interface().(map[int8]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int32V(rv.Interface().(map[int8]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Int64V(rv.Interface().(map[int8]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt8Float32V(rv.Interface().(map[int8]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt8Float64V(rv.Interface().(map[int8]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt8BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt8BoolV(rv.Interface().(map[int8]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int8(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int8(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt16IntfV(rv.Interface().(map[int16]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16StringR(rv reflect.Value) {
- fastpathTV.EncMapInt16StringV(rv.Interface().(map[int16]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16UintR(rv reflect.Value) {
- fastpathTV.EncMapInt16UintV(rv.Interface().(map[int16]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint8V(rv.Interface().(map[int16]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint16V(rv.Interface().(map[int16]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint32V(rv.Interface().(map[int16]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Uint64V(rv.Interface().(map[int16]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt16UintptrV(rv.Interface().(map[int16]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16IntR(rv reflect.Value) {
- fastpathTV.EncMapInt16IntV(rv.Interface().(map[int16]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int8V(rv.Interface().(map[int16]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int16V(rv.Interface().(map[int16]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int32V(rv.Interface().(map[int16]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Int64V(rv.Interface().(map[int16]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt16Float32V(rv.Interface().(map[int16]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt16Float64V(rv.Interface().(map[int16]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt16BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt16BoolV(rv.Interface().(map[int16]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int16(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int16(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt32IntfV(rv.Interface().(map[int32]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32StringR(rv reflect.Value) {
- fastpathTV.EncMapInt32StringV(rv.Interface().(map[int32]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32UintR(rv reflect.Value) {
- fastpathTV.EncMapInt32UintV(rv.Interface().(map[int32]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint8V(rv.Interface().(map[int32]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint16V(rv.Interface().(map[int32]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint32V(rv.Interface().(map[int32]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Uint64V(rv.Interface().(map[int32]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt32UintptrV(rv.Interface().(map[int32]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32IntR(rv reflect.Value) {
- fastpathTV.EncMapInt32IntV(rv.Interface().(map[int32]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int8V(rv.Interface().(map[int32]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int16V(rv.Interface().(map[int32]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int32V(rv.Interface().(map[int32]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Int64V(rv.Interface().(map[int32]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt32Float32V(rv.Interface().(map[int32]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt32Float64V(rv.Interface().(map[int32]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt32BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt32BoolV(rv.Interface().(map[int32]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int32(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int32(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64IntfR(rv reflect.Value) {
- fastpathTV.EncMapInt64IntfV(rv.Interface().(map[int64]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64StringR(rv reflect.Value) {
- fastpathTV.EncMapInt64StringV(rv.Interface().(map[int64]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64UintR(rv reflect.Value) {
- fastpathTV.EncMapInt64UintV(rv.Interface().(map[int64]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint8R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint8V(rv.Interface().(map[int64]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint16R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint16V(rv.Interface().(map[int64]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint32V(rv.Interface().(map[int64]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Uint64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Uint64V(rv.Interface().(map[int64]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64UintptrR(rv reflect.Value) {
- fastpathTV.EncMapInt64UintptrV(rv.Interface().(map[int64]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64IntR(rv reflect.Value) {
- fastpathTV.EncMapInt64IntV(rv.Interface().(map[int64]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int8R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int8V(rv.Interface().(map[int64]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int16R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int16V(rv.Interface().(map[int64]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int32V(rv.Interface().(map[int64]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Int64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Int64V(rv.Interface().(map[int64]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Float32R(rv reflect.Value) {
- fastpathTV.EncMapInt64Float32V(rv.Interface().(map[int64]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64Float64R(rv reflect.Value) {
- fastpathTV.EncMapInt64Float64V(rv.Interface().(map[int64]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapInt64BoolR(rv reflect.Value) {
- fastpathTV.EncMapInt64BoolV(rv.Interface().(map[int64]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i int
- for k, _ := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(int64(k2)))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[int64(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeInt(int64(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolIntfR(rv reflect.Value) {
- fastpathTV.EncMapBoolIntfV(rv.Interface().(map[bool]interface{}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolStringR(rv reflect.Value) {
- fastpathTV.EncMapBoolStringV(rv.Interface().(map[bool]string), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeString(c_UTF8, v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUintR(rv reflect.Value) {
- fastpathTV.EncMapBoolUintV(rv.Interface().(map[bool]uint), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint8R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint8V(rv.Interface().(map[bool]uint8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint16R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint16V(rv.Interface().(map[bool]uint16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint32R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint32V(rv.Interface().(map[bool]uint32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUint64R(rv reflect.Value) {
- fastpathTV.EncMapBoolUint64V(rv.Interface().(map[bool]uint64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeUint(uint64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolUintptrR(rv reflect.Value) {
- fastpathTV.EncMapBoolUintptrV(rv.Interface().(map[bool]uintptr), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- e.encode(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolIntR(rv reflect.Value) {
- fastpathTV.EncMapBoolIntV(rv.Interface().(map[bool]int), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt8R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt8V(rv.Interface().(map[bool]int8), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt16R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt16V(rv.Interface().(map[bool]int16), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt32R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt32V(rv.Interface().(map[bool]int32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolInt64R(rv reflect.Value) {
- fastpathTV.EncMapBoolInt64V(rv.Interface().(map[bool]int64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeInt(int64(v2))
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolFloat32R(rv reflect.Value) {
- fastpathTV.EncMapBoolFloat32V(rv.Interface().(map[bool]float32), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat32(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolFloat64R(rv reflect.Value) {
- fastpathTV.EncMapBoolFloat64V(rv.Interface().(map[bool]float64), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeFloat64(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-func (f *encFnInfo) fastpathEncMapBoolBoolR(rv reflect.Value) {
- fastpathTV.EncMapBoolBoolV(rv.Interface().(map[bool]bool), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i int
- for k, _ := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- for _, k2 := range v2 {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(bool(k2))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v[bool(k2)])
- }
- } else {
- for k2, v2 := range v {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- ee.EncodeBool(k2)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- ee.EncodeBool(v2)
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
-}
-
-// -- decode
-
-// -- -- fast path type switch
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- switch v := iv.(type) {
-
- case []interface{}:
- fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, d)
- case *[]interface{}:
- v2, changed2 := fastpathTV.DecSliceIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]interface{}:
- fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]interface{}:
- v2, changed2 := fastpathTV.DecMapIntfIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]string:
- fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]string:
- v2, changed2 := fastpathTV.DecMapIntfStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint:
- fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint:
- v2, changed2 := fastpathTV.DecMapIntfUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint8:
- fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint8:
- v2, changed2 := fastpathTV.DecMapIntfUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint16:
- fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint16:
- v2, changed2 := fastpathTV.DecMapIntfUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint32:
- fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint32:
- v2, changed2 := fastpathTV.DecMapIntfUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uint64:
- fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uint64:
- v2, changed2 := fastpathTV.DecMapIntfUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]uintptr:
- fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]uintptr:
- v2, changed2 := fastpathTV.DecMapIntfUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int:
- fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int:
- v2, changed2 := fastpathTV.DecMapIntfIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int8:
- fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int8:
- v2, changed2 := fastpathTV.DecMapIntfInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int16:
- fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int16:
- v2, changed2 := fastpathTV.DecMapIntfInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int32:
- fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int32:
- v2, changed2 := fastpathTV.DecMapIntfInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]int64:
- fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]int64:
- v2, changed2 := fastpathTV.DecMapIntfInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]float32:
- fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]float32:
- v2, changed2 := fastpathTV.DecMapIntfFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]float64:
- fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]float64:
- v2, changed2 := fastpathTV.DecMapIntfFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[interface{}]bool:
- fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[interface{}]bool:
- v2, changed2 := fastpathTV.DecMapIntfBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []string:
- fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, d)
- case *[]string:
- v2, changed2 := fastpathTV.DecSliceStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]interface{}:
- fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[string]interface{}:
- v2, changed2 := fastpathTV.DecMapStringIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]string:
- fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, d)
- case *map[string]string:
- v2, changed2 := fastpathTV.DecMapStringStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint:
- fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint:
- v2, changed2 := fastpathTV.DecMapStringUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint8:
- fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint8:
- v2, changed2 := fastpathTV.DecMapStringUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint16:
- fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint16:
- v2, changed2 := fastpathTV.DecMapStringUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint32:
- fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint32:
- v2, changed2 := fastpathTV.DecMapStringUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uint64:
- fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]uint64:
- v2, changed2 := fastpathTV.DecMapStringUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]uintptr:
- fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[string]uintptr:
- v2, changed2 := fastpathTV.DecMapStringUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int:
- fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, d)
- case *map[string]int:
- v2, changed2 := fastpathTV.DecMapStringIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int8:
- fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int8:
- v2, changed2 := fastpathTV.DecMapStringInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int16:
- fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int16:
- v2, changed2 := fastpathTV.DecMapStringInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int32:
- fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int32:
- v2, changed2 := fastpathTV.DecMapStringInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]int64:
- fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]int64:
- v2, changed2 := fastpathTV.DecMapStringInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]float32:
- fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[string]float32:
- v2, changed2 := fastpathTV.DecMapStringFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]float64:
- fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[string]float64:
- v2, changed2 := fastpathTV.DecMapStringFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[string]bool:
- fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[string]bool:
- v2, changed2 := fastpathTV.DecMapStringBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []float32:
- fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, d)
- case *[]float32:
- v2, changed2 := fastpathTV.DecSliceFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]interface{}:
- fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]interface{}:
- v2, changed2 := fastpathTV.DecMapFloat32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]string:
- fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]string:
- v2, changed2 := fastpathTV.DecMapFloat32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint:
- fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint:
- v2, changed2 := fastpathTV.DecMapFloat32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint8:
- fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint8:
- v2, changed2 := fastpathTV.DecMapFloat32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint16:
- fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint16:
- v2, changed2 := fastpathTV.DecMapFloat32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint32:
- fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint32:
- v2, changed2 := fastpathTV.DecMapFloat32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uint64:
- fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uint64:
- v2, changed2 := fastpathTV.DecMapFloat32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]uintptr:
- fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]uintptr:
- v2, changed2 := fastpathTV.DecMapFloat32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int:
- fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int:
- v2, changed2 := fastpathTV.DecMapFloat32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int8:
- fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int8:
- v2, changed2 := fastpathTV.DecMapFloat32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int16:
- fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int16:
- v2, changed2 := fastpathTV.DecMapFloat32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int32:
- fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int32:
- v2, changed2 := fastpathTV.DecMapFloat32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]int64:
- fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]int64:
- v2, changed2 := fastpathTV.DecMapFloat32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]float32:
- fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]float32:
- v2, changed2 := fastpathTV.DecMapFloat32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]float64:
- fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[float32]float64:
- v2, changed2 := fastpathTV.DecMapFloat32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float32]bool:
- fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[float32]bool:
- v2, changed2 := fastpathTV.DecMapFloat32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []float64:
- fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, d)
- case *[]float64:
- v2, changed2 := fastpathTV.DecSliceFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]interface{}:
- fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]interface{}:
- v2, changed2 := fastpathTV.DecMapFloat64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]string:
- fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]string:
- v2, changed2 := fastpathTV.DecMapFloat64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint:
- fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint:
- v2, changed2 := fastpathTV.DecMapFloat64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint8:
- fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint8:
- v2, changed2 := fastpathTV.DecMapFloat64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint16:
- fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint16:
- v2, changed2 := fastpathTV.DecMapFloat64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint32:
- fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint32:
- v2, changed2 := fastpathTV.DecMapFloat64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uint64:
- fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uint64:
- v2, changed2 := fastpathTV.DecMapFloat64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]uintptr:
- fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]uintptr:
- v2, changed2 := fastpathTV.DecMapFloat64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int:
- fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int:
- v2, changed2 := fastpathTV.DecMapFloat64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int8:
- fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int8:
- v2, changed2 := fastpathTV.DecMapFloat64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int16:
- fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int16:
- v2, changed2 := fastpathTV.DecMapFloat64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int32:
- fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int32:
- v2, changed2 := fastpathTV.DecMapFloat64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]int64:
- fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]int64:
- v2, changed2 := fastpathTV.DecMapFloat64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]float32:
- fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]float32:
- v2, changed2 := fastpathTV.DecMapFloat64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]float64:
- fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[float64]float64:
- v2, changed2 := fastpathTV.DecMapFloat64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[float64]bool:
- fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[float64]bool:
- v2, changed2 := fastpathTV.DecMapFloat64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint:
- fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, d)
- case *[]uint:
- v2, changed2 := fastpathTV.DecSliceUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]interface{}:
- fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]interface{}:
- v2, changed2 := fastpathTV.DecMapUintIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]string:
- fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]string:
- v2, changed2 := fastpathTV.DecMapUintStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint:
- fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint:
- v2, changed2 := fastpathTV.DecMapUintUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint8:
- fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint8:
- v2, changed2 := fastpathTV.DecMapUintUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint16:
- fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint16:
- v2, changed2 := fastpathTV.DecMapUintUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint32:
- fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint32:
- v2, changed2 := fastpathTV.DecMapUintUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uint64:
- fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uint64:
- v2, changed2 := fastpathTV.DecMapUintUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]uintptr:
- fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]uintptr:
- v2, changed2 := fastpathTV.DecMapUintUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int:
- fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int:
- v2, changed2 := fastpathTV.DecMapUintIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int8:
- fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int8:
- v2, changed2 := fastpathTV.DecMapUintInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int16:
- fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int16:
- v2, changed2 := fastpathTV.DecMapUintInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int32:
- fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int32:
- v2, changed2 := fastpathTV.DecMapUintInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]int64:
- fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]int64:
- v2, changed2 := fastpathTV.DecMapUintInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]float32:
- fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]float32:
- v2, changed2 := fastpathTV.DecMapUintFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]float64:
- fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint]float64:
- v2, changed2 := fastpathTV.DecMapUintFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint]bool:
- fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint]bool:
- v2, changed2 := fastpathTV.DecMapUintBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]interface{}:
- fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]interface{}:
- v2, changed2 := fastpathTV.DecMapUint8IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]string:
- fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]string:
- v2, changed2 := fastpathTV.DecMapUint8StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint:
- fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint:
- v2, changed2 := fastpathTV.DecMapUint8UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint8:
- fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint8:
- v2, changed2 := fastpathTV.DecMapUint8Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint16:
- fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint16:
- v2, changed2 := fastpathTV.DecMapUint8Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint32:
- fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint32:
- v2, changed2 := fastpathTV.DecMapUint8Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uint64:
- fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uint64:
- v2, changed2 := fastpathTV.DecMapUint8Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]uintptr:
- fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]uintptr:
- v2, changed2 := fastpathTV.DecMapUint8UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int:
- fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int:
- v2, changed2 := fastpathTV.DecMapUint8IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int8:
- fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int8:
- v2, changed2 := fastpathTV.DecMapUint8Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int16:
- fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int16:
- v2, changed2 := fastpathTV.DecMapUint8Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int32:
- fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int32:
- v2, changed2 := fastpathTV.DecMapUint8Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]int64:
- fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]int64:
- v2, changed2 := fastpathTV.DecMapUint8Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]float32:
- fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]float32:
- v2, changed2 := fastpathTV.DecMapUint8Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]float64:
- fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]float64:
- v2, changed2 := fastpathTV.DecMapUint8Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint8]bool:
- fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint8]bool:
- v2, changed2 := fastpathTV.DecMapUint8BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint16:
- fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, d)
- case *[]uint16:
- v2, changed2 := fastpathTV.DecSliceUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]interface{}:
- fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]interface{}:
- v2, changed2 := fastpathTV.DecMapUint16IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]string:
- fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]string:
- v2, changed2 := fastpathTV.DecMapUint16StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint:
- fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint:
- v2, changed2 := fastpathTV.DecMapUint16UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint8:
- fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint8:
- v2, changed2 := fastpathTV.DecMapUint16Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint16:
- fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint16:
- v2, changed2 := fastpathTV.DecMapUint16Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint32:
- fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint32:
- v2, changed2 := fastpathTV.DecMapUint16Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uint64:
- fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uint64:
- v2, changed2 := fastpathTV.DecMapUint16Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]uintptr:
- fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]uintptr:
- v2, changed2 := fastpathTV.DecMapUint16UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int:
- fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int:
- v2, changed2 := fastpathTV.DecMapUint16IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int8:
- fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int8:
- v2, changed2 := fastpathTV.DecMapUint16Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int16:
- fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int16:
- v2, changed2 := fastpathTV.DecMapUint16Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int32:
- fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int32:
- v2, changed2 := fastpathTV.DecMapUint16Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]int64:
- fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]int64:
- v2, changed2 := fastpathTV.DecMapUint16Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]float32:
- fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]float32:
- v2, changed2 := fastpathTV.DecMapUint16Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]float64:
- fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]float64:
- v2, changed2 := fastpathTV.DecMapUint16Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint16]bool:
- fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint16]bool:
- v2, changed2 := fastpathTV.DecMapUint16BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint32:
- fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, d)
- case *[]uint32:
- v2, changed2 := fastpathTV.DecSliceUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]interface{}:
- fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]interface{}:
- v2, changed2 := fastpathTV.DecMapUint32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]string:
- fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]string:
- v2, changed2 := fastpathTV.DecMapUint32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint:
- fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint:
- v2, changed2 := fastpathTV.DecMapUint32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint8:
- fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint8:
- v2, changed2 := fastpathTV.DecMapUint32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint16:
- fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint16:
- v2, changed2 := fastpathTV.DecMapUint32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint32:
- fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint32:
- v2, changed2 := fastpathTV.DecMapUint32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uint64:
- fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uint64:
- v2, changed2 := fastpathTV.DecMapUint32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]uintptr:
- fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]uintptr:
- v2, changed2 := fastpathTV.DecMapUint32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int:
- fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int:
- v2, changed2 := fastpathTV.DecMapUint32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int8:
- fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int8:
- v2, changed2 := fastpathTV.DecMapUint32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int16:
- fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int16:
- v2, changed2 := fastpathTV.DecMapUint32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int32:
- fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int32:
- v2, changed2 := fastpathTV.DecMapUint32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]int64:
- fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]int64:
- v2, changed2 := fastpathTV.DecMapUint32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]float32:
- fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]float32:
- v2, changed2 := fastpathTV.DecMapUint32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]float64:
- fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]float64:
- v2, changed2 := fastpathTV.DecMapUint32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint32]bool:
- fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint32]bool:
- v2, changed2 := fastpathTV.DecMapUint32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uint64:
- fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, d)
- case *[]uint64:
- v2, changed2 := fastpathTV.DecSliceUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]interface{}:
- fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]interface{}:
- v2, changed2 := fastpathTV.DecMapUint64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]string:
- fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]string:
- v2, changed2 := fastpathTV.DecMapUint64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint:
- fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint:
- v2, changed2 := fastpathTV.DecMapUint64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint8:
- fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint8:
- v2, changed2 := fastpathTV.DecMapUint64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint16:
- fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint16:
- v2, changed2 := fastpathTV.DecMapUint64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint32:
- fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint32:
- v2, changed2 := fastpathTV.DecMapUint64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uint64:
- fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uint64:
- v2, changed2 := fastpathTV.DecMapUint64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]uintptr:
- fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]uintptr:
- v2, changed2 := fastpathTV.DecMapUint64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int:
- fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int:
- v2, changed2 := fastpathTV.DecMapUint64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int8:
- fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int8:
- v2, changed2 := fastpathTV.DecMapUint64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int16:
- fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int16:
- v2, changed2 := fastpathTV.DecMapUint64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int32:
- fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int32:
- v2, changed2 := fastpathTV.DecMapUint64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]int64:
- fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]int64:
- v2, changed2 := fastpathTV.DecMapUint64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]float32:
- fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]float32:
- v2, changed2 := fastpathTV.DecMapUint64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]float64:
- fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]float64:
- v2, changed2 := fastpathTV.DecMapUint64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uint64]bool:
- fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uint64]bool:
- v2, changed2 := fastpathTV.DecMapUint64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []uintptr:
- fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, d)
- case *[]uintptr:
- v2, changed2 := fastpathTV.DecSliceUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]interface{}:
- fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]interface{}:
- v2, changed2 := fastpathTV.DecMapUintptrIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]string:
- fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]string:
- v2, changed2 := fastpathTV.DecMapUintptrStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint:
- fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint:
- v2, changed2 := fastpathTV.DecMapUintptrUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint8:
- fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint8:
- v2, changed2 := fastpathTV.DecMapUintptrUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint16:
- fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint16:
- v2, changed2 := fastpathTV.DecMapUintptrUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint32:
- fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint32:
- v2, changed2 := fastpathTV.DecMapUintptrUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uint64:
- fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uint64:
- v2, changed2 := fastpathTV.DecMapUintptrUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]uintptr:
- fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]uintptr:
- v2, changed2 := fastpathTV.DecMapUintptrUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int:
- fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int:
- v2, changed2 := fastpathTV.DecMapUintptrIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int8:
- fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int8:
- v2, changed2 := fastpathTV.DecMapUintptrInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int16:
- fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int16:
- v2, changed2 := fastpathTV.DecMapUintptrInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int32:
- fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int32:
- v2, changed2 := fastpathTV.DecMapUintptrInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]int64:
- fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]int64:
- v2, changed2 := fastpathTV.DecMapUintptrInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]float32:
- fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]float32:
- v2, changed2 := fastpathTV.DecMapUintptrFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]float64:
- fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]float64:
- v2, changed2 := fastpathTV.DecMapUintptrFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[uintptr]bool:
- fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[uintptr]bool:
- v2, changed2 := fastpathTV.DecMapUintptrBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int:
- fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, d)
- case *[]int:
- v2, changed2 := fastpathTV.DecSliceIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]interface{}:
- fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int]interface{}:
- v2, changed2 := fastpathTV.DecMapIntIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]string:
- fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, d)
- case *map[int]string:
- v2, changed2 := fastpathTV.DecMapIntStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint:
- fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint:
- v2, changed2 := fastpathTV.DecMapIntUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint8:
- fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint8:
- v2, changed2 := fastpathTV.DecMapIntUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint16:
- fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint16:
- v2, changed2 := fastpathTV.DecMapIntUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint32:
- fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint32:
- v2, changed2 := fastpathTV.DecMapIntUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uint64:
- fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]uint64:
- v2, changed2 := fastpathTV.DecMapIntUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]uintptr:
- fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int]uintptr:
- v2, changed2 := fastpathTV.DecMapIntUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int:
- fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, d)
- case *map[int]int:
- v2, changed2 := fastpathTV.DecMapIntIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int8:
- fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int8:
- v2, changed2 := fastpathTV.DecMapIntInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int16:
- fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int16:
- v2, changed2 := fastpathTV.DecMapIntInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int32:
- fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int32:
- v2, changed2 := fastpathTV.DecMapIntInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]int64:
- fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]int64:
- v2, changed2 := fastpathTV.DecMapIntInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]float32:
- fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[int]float32:
- v2, changed2 := fastpathTV.DecMapIntFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]float64:
- fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[int]float64:
- v2, changed2 := fastpathTV.DecMapIntFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int]bool:
- fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int]bool:
- v2, changed2 := fastpathTV.DecMapIntBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int8:
- fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, d)
- case *[]int8:
- v2, changed2 := fastpathTV.DecSliceInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]interface{}:
- fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]interface{}:
- v2, changed2 := fastpathTV.DecMapInt8IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]string:
- fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]string:
- v2, changed2 := fastpathTV.DecMapInt8StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint:
- fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint:
- v2, changed2 := fastpathTV.DecMapInt8UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint8:
- fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint8:
- v2, changed2 := fastpathTV.DecMapInt8Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint16:
- fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint16:
- v2, changed2 := fastpathTV.DecMapInt8Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint32:
- fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint32:
- v2, changed2 := fastpathTV.DecMapInt8Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uint64:
- fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uint64:
- v2, changed2 := fastpathTV.DecMapInt8Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]uintptr:
- fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]uintptr:
- v2, changed2 := fastpathTV.DecMapInt8UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int:
- fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int:
- v2, changed2 := fastpathTV.DecMapInt8IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int8:
- fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int8:
- v2, changed2 := fastpathTV.DecMapInt8Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int16:
- fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int16:
- v2, changed2 := fastpathTV.DecMapInt8Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int32:
- fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int32:
- v2, changed2 := fastpathTV.DecMapInt8Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]int64:
- fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]int64:
- v2, changed2 := fastpathTV.DecMapInt8Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]float32:
- fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]float32:
- v2, changed2 := fastpathTV.DecMapInt8Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]float64:
- fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int8]float64:
- v2, changed2 := fastpathTV.DecMapInt8Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int8]bool:
- fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int8]bool:
- v2, changed2 := fastpathTV.DecMapInt8BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int16:
- fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, d)
- case *[]int16:
- v2, changed2 := fastpathTV.DecSliceInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]interface{}:
- fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]interface{}:
- v2, changed2 := fastpathTV.DecMapInt16IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]string:
- fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]string:
- v2, changed2 := fastpathTV.DecMapInt16StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint:
- fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint:
- v2, changed2 := fastpathTV.DecMapInt16UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint8:
- fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint8:
- v2, changed2 := fastpathTV.DecMapInt16Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint16:
- fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint16:
- v2, changed2 := fastpathTV.DecMapInt16Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint32:
- fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint32:
- v2, changed2 := fastpathTV.DecMapInt16Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uint64:
- fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uint64:
- v2, changed2 := fastpathTV.DecMapInt16Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]uintptr:
- fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]uintptr:
- v2, changed2 := fastpathTV.DecMapInt16UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int:
- fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int:
- v2, changed2 := fastpathTV.DecMapInt16IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int8:
- fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int8:
- v2, changed2 := fastpathTV.DecMapInt16Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int16:
- fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int16:
- v2, changed2 := fastpathTV.DecMapInt16Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int32:
- fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int32:
- v2, changed2 := fastpathTV.DecMapInt16Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]int64:
- fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]int64:
- v2, changed2 := fastpathTV.DecMapInt16Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]float32:
- fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]float32:
- v2, changed2 := fastpathTV.DecMapInt16Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]float64:
- fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int16]float64:
- v2, changed2 := fastpathTV.DecMapInt16Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int16]bool:
- fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int16]bool:
- v2, changed2 := fastpathTV.DecMapInt16BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int32:
- fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, d)
- case *[]int32:
- v2, changed2 := fastpathTV.DecSliceInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]interface{}:
- fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]interface{}:
- v2, changed2 := fastpathTV.DecMapInt32IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]string:
- fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]string:
- v2, changed2 := fastpathTV.DecMapInt32StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint:
- fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint:
- v2, changed2 := fastpathTV.DecMapInt32UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint8:
- fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint8:
- v2, changed2 := fastpathTV.DecMapInt32Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint16:
- fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint16:
- v2, changed2 := fastpathTV.DecMapInt32Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint32:
- fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint32:
- v2, changed2 := fastpathTV.DecMapInt32Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uint64:
- fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uint64:
- v2, changed2 := fastpathTV.DecMapInt32Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]uintptr:
- fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]uintptr:
- v2, changed2 := fastpathTV.DecMapInt32UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int:
- fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int:
- v2, changed2 := fastpathTV.DecMapInt32IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int8:
- fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int8:
- v2, changed2 := fastpathTV.DecMapInt32Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int16:
- fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int16:
- v2, changed2 := fastpathTV.DecMapInt32Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int32:
- fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int32:
- v2, changed2 := fastpathTV.DecMapInt32Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]int64:
- fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]int64:
- v2, changed2 := fastpathTV.DecMapInt32Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]float32:
- fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]float32:
- v2, changed2 := fastpathTV.DecMapInt32Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]float64:
- fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int32]float64:
- v2, changed2 := fastpathTV.DecMapInt32Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int32]bool:
- fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int32]bool:
- v2, changed2 := fastpathTV.DecMapInt32BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []int64:
- fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, d)
- case *[]int64:
- v2, changed2 := fastpathTV.DecSliceInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]interface{}:
- fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]interface{}:
- v2, changed2 := fastpathTV.DecMapInt64IntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]string:
- fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]string:
- v2, changed2 := fastpathTV.DecMapInt64StringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint:
- fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint:
- v2, changed2 := fastpathTV.DecMapInt64UintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint8:
- fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint8:
- v2, changed2 := fastpathTV.DecMapInt64Uint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint16:
- fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint16:
- v2, changed2 := fastpathTV.DecMapInt64Uint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint32:
- fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint32:
- v2, changed2 := fastpathTV.DecMapInt64Uint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uint64:
- fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uint64:
- v2, changed2 := fastpathTV.DecMapInt64Uint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]uintptr:
- fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]uintptr:
- v2, changed2 := fastpathTV.DecMapInt64UintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int:
- fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int:
- v2, changed2 := fastpathTV.DecMapInt64IntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int8:
- fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int8:
- v2, changed2 := fastpathTV.DecMapInt64Int8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int16:
- fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int16:
- v2, changed2 := fastpathTV.DecMapInt64Int16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int32:
- fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int32:
- v2, changed2 := fastpathTV.DecMapInt64Int32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]int64:
- fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]int64:
- v2, changed2 := fastpathTV.DecMapInt64Int64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]float32:
- fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]float32:
- v2, changed2 := fastpathTV.DecMapInt64Float32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]float64:
- fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, d)
- case *map[int64]float64:
- v2, changed2 := fastpathTV.DecMapInt64Float64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[int64]bool:
- fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, d)
- case *map[int64]bool:
- v2, changed2 := fastpathTV.DecMapInt64BoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case []bool:
- fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, d)
- case *[]bool:
- v2, changed2 := fastpathTV.DecSliceBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]interface{}:
- fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]interface{}:
- v2, changed2 := fastpathTV.DecMapBoolIntfV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]string:
- fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]string:
- v2, changed2 := fastpathTV.DecMapBoolStringV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint:
- fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint:
- v2, changed2 := fastpathTV.DecMapBoolUintV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint8:
- fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint8:
- v2, changed2 := fastpathTV.DecMapBoolUint8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint16:
- fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint16:
- v2, changed2 := fastpathTV.DecMapBoolUint16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint32:
- fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint32:
- v2, changed2 := fastpathTV.DecMapBoolUint32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uint64:
- fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uint64:
- v2, changed2 := fastpathTV.DecMapBoolUint64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]uintptr:
- fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]uintptr:
- v2, changed2 := fastpathTV.DecMapBoolUintptrV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int:
- fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int:
- v2, changed2 := fastpathTV.DecMapBoolIntV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int8:
- fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int8:
- v2, changed2 := fastpathTV.DecMapBoolInt8V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int16:
- fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int16:
- v2, changed2 := fastpathTV.DecMapBoolInt16V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int32:
- fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int32:
- v2, changed2 := fastpathTV.DecMapBoolInt32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]int64:
- fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]int64:
- v2, changed2 := fastpathTV.DecMapBoolInt64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]float32:
- fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]float32:
- v2, changed2 := fastpathTV.DecMapBoolFloat32V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]float64:
- fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, d)
- case *map[bool]float64:
- v2, changed2 := fastpathTV.DecMapBoolFloat64V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- case map[bool]bool:
- fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, d)
- case *map[bool]bool:
- v2, changed2 := fastpathTV.DecMapBoolBoolV(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-
-func (f *decFnInfo) fastpathDecSliceIntfR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]interface{})
- v, changed := fastpathTV.DecSliceIntfV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]interface{})
- fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceIntfX(vp *[]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, d *Decoder) (_ []interface{}, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []interface{}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]interface{}, xlen)
- }
- } else {
- v = make([]interface{}, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- d.decode(&v[j])
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, nil)
- slh.ElemContainerState(j)
- d.decode(&v[j])
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []interface{}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]interface{}, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, nil)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- d.decode(&v[j])
-
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceStringR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]string)
- v, changed := fastpathTV.DecSliceStringV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]string)
- fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceStringX(vp *[]string, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d *Decoder) (_ []string, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []string{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]string, xlen)
- }
- } else {
- v = make([]string, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeString()
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, "")
- slh.ElemContainerState(j)
- v[j] = dd.DecodeString()
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []string{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]string, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, "")
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeString()
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceFloat32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]float32)
- v, changed := fastpathTV.DecSliceFloat32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]float32)
- fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceFloat32X(vp *[]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, d *Decoder) (_ []float32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]float32, xlen)
- }
- } else {
- v = make([]float32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = float32(dd.DecodeFloat(true))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = float32(dd.DecodeFloat(true))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []float32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]float32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = float32(dd.DecodeFloat(true))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceFloat64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]float64)
- v, changed := fastpathTV.DecSliceFloat64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]float64)
- fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceFloat64X(vp *[]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, d *Decoder) (_ []float64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]float64, xlen)
- }
- } else {
- v = make([]float64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeFloat(false)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeFloat(false)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []float64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]float64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeFloat(false)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUintR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint)
- v, changed := fastpathTV.DecSliceUintV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint)
- fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUintX(vp *[]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d *Decoder) (_ []uint, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint, xlen)
- }
- } else {
- v = make([]uint, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint(dd.DecodeUint(uintBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint(dd.DecodeUint(uintBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint(dd.DecodeUint(uintBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint16R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint16)
- v, changed := fastpathTV.DecSliceUint16V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint16)
- fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint16X(vp *[]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d *Decoder) (_ []uint16, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint16, xlen)
- }
- } else {
- v = make([]uint16, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint16(dd.DecodeUint(16))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint16(dd.DecodeUint(16))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint16, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint16(dd.DecodeUint(16))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint32)
- v, changed := fastpathTV.DecSliceUint32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint32)
- fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint32X(vp *[]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d *Decoder) (_ []uint32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint32, xlen)
- }
- } else {
- v = make([]uint32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uint32(dd.DecodeUint(32))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uint32(dd.DecodeUint(32))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uint32(dd.DecodeUint(32))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUint64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uint64)
- v, changed := fastpathTV.DecSliceUint64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uint64)
- fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUint64X(vp *[]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d *Decoder) (_ []uint64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uint64, xlen)
- }
- } else {
- v = make([]uint64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeUint(64)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeUint(64)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uint64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uint64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeUint(64)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceUintptrR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]uintptr)
- v, changed := fastpathTV.DecSliceUintptrV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]uintptr)
- fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, d *Decoder) (_ []uintptr, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uintptr{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]uintptr, xlen)
- }
- } else {
- v = make([]uintptr, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []uintptr{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]uintptr, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = uintptr(dd.DecodeUint(uintBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceIntR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int)
- v, changed := fastpathTV.DecSliceIntV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int)
- fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceIntX(vp *[]int, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d *Decoder) (_ []int, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int, xlen)
- }
- } else {
- v = make([]int, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int(dd.DecodeInt(intBitsize))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int(dd.DecodeInt(intBitsize))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int(dd.DecodeInt(intBitsize))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt8R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int8)
- v, changed := fastpathTV.DecSliceInt8V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int8)
- fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt8X(vp *[]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d *Decoder) (_ []int8, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int8, xlen)
- }
- } else {
- v = make([]int8, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int8(dd.DecodeInt(8))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int8(dd.DecodeInt(8))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int8, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int8(dd.DecodeInt(8))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt16R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int16)
- v, changed := fastpathTV.DecSliceInt16V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int16)
- fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt16X(vp *[]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d *Decoder) (_ []int16, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int16, xlen)
- }
- } else {
- v = make([]int16, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int16(dd.DecodeInt(16))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int16(dd.DecodeInt(16))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int16, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int16(dd.DecodeInt(16))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt32R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int32)
- v, changed := fastpathTV.DecSliceInt32V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int32)
- fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt32X(vp *[]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d *Decoder) (_ []int32, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int32, xlen)
- }
- } else {
- v = make([]int32, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = int32(dd.DecodeInt(32))
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = int32(dd.DecodeInt(32))
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int32, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = int32(dd.DecodeInt(32))
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceInt64R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]int64)
- v, changed := fastpathTV.DecSliceInt64V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]int64)
- fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceInt64X(vp *[]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d *Decoder) (_ []int64, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]int64, xlen)
- }
- } else {
- v = make([]int64, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeInt(64)
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, 0)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeInt(64)
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []int64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]int64, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeInt(64)
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecSliceBoolR(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() {
- vp := rv.Addr().Interface().(*[]bool)
- v, changed := fastpathTV.DecSliceBoolV(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]bool)
- fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) DecSliceBoolX(vp *[]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecSliceBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d *Decoder) (_ []bool, changed bool) {
- dd := d.d
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []bool{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange {
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]bool, xlen)
- }
- } else {
- v = make([]bool, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- }
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- v[j] = dd.DecodeBool()
- }
- if xtrunc {
- for ; j < containerLenS; j++ {
- v = append(v, false)
- slh.ElemContainerState(j)
- v[j] = dd.DecodeBool()
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak()
- if breakFound {
- if canChange {
- if v == nil {
- v = []bool{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]bool, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, false)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) {
- v[j] = dd.DecodeBool()
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]interface{})
- v, changed := fastpathTV.DecMapIntfIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]interface{})
- fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk interface{}
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]string)
- v, changed := fastpathTV.DecMapIntfStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]string)
- fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]string, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint)
- v, changed := fastpathTV.DecMapIntfUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint)
- fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint8)
- v, changed := fastpathTV.DecMapIntfUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint8)
- fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]uint8, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint16)
- v, changed := fastpathTV.DecMapIntfUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint16)
- fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]uint16, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint32)
- v, changed := fastpathTV.DecMapIntfUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint32)
- fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]uint32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uint64)
- v, changed := fastpathTV.DecMapIntfUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uint64)
- fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]uintptr)
- v, changed := fastpathTV.DecMapIntfUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]uintptr)
- fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uintptr, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int)
- v, changed := fastpathTV.DecMapIntfIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int)
- fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int8)
- v, changed := fastpathTV.DecMapIntfInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int8)
- fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]int8, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int16)
- v, changed := fastpathTV.DecMapIntfInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int16)
- fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]int16, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int32)
- v, changed := fastpathTV.DecMapIntfInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int32)
- fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]int32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]int64)
- v, changed := fastpathTV.DecMapIntfInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]int64)
- fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]float32)
- v, changed := fastpathTV.DecMapIntfFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]float32)
- fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]float32, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]float64)
- v, changed := fastpathTV.DecMapIntfFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]float64)
- fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]float64, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntfBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[interface{}]bool)
- v, changed := fastpathTV.DecMapIntfBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[interface{}]bool)
- fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntfBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[interface{}]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]bool, xlen)
- changed = true
- }
-
- var mk interface{}
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]interface{})
- v, changed := fastpathTV.DecMapStringIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]interface{})
- fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk string
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]string)
- v, changed := fastpathTV.DecMapStringStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]string)
- fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringStringX(vp *map[string]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]string, xlen)
- changed = true
- }
-
- var mk string
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint)
- v, changed := fastpathTV.DecMapStringUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint)
- fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUintX(vp *map[string]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint, xlen)
- changed = true
- }
-
- var mk string
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint8)
- v, changed := fastpathTV.DecMapStringUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint8)
- fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]uint8, xlen)
- changed = true
- }
-
- var mk string
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint16)
- v, changed := fastpathTV.DecMapStringUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint16)
- fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]uint16, xlen)
- changed = true
- }
-
- var mk string
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint32)
- v, changed := fastpathTV.DecMapStringUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint32)
- fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]uint32, xlen)
- changed = true
- }
-
- var mk string
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uint64)
- v, changed := fastpathTV.DecMapStringUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uint64)
- fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint64, xlen)
- changed = true
- }
-
- var mk string
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]uintptr)
- v, changed := fastpathTV.DecMapStringUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]uintptr)
- fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uintptr, xlen)
- changed = true
- }
-
- var mk string
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int)
- v, changed := fastpathTV.DecMapStringIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int)
- fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringIntX(vp *map[string]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int, xlen)
- changed = true
- }
-
- var mk string
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int8)
- v, changed := fastpathTV.DecMapStringInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int8)
- fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]int8, xlen)
- changed = true
- }
-
- var mk string
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int16)
- v, changed := fastpathTV.DecMapStringInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int16)
- fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]int16, xlen)
- changed = true
- }
-
- var mk string
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int32)
- v, changed := fastpathTV.DecMapStringInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int32)
- fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]int32, xlen)
- changed = true
- }
-
- var mk string
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]int64)
- v, changed := fastpathTV.DecMapStringInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]int64)
- fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int64, xlen)
- changed = true
- }
-
- var mk string
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]float32)
- v, changed := fastpathTV.DecMapStringFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]float32)
- fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]float32, xlen)
- changed = true
- }
-
- var mk string
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]float64)
- v, changed := fastpathTV.DecMapStringFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]float64)
- fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]float64, xlen)
- changed = true
- }
-
- var mk string
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapStringBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[string]bool)
- v, changed := fastpathTV.DecMapStringBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[string]bool)
- fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapStringBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[string]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]bool, xlen)
- changed = true
- }
-
- var mk string
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeString()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]interface{})
- v, changed := fastpathTV.DecMapFloat32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]interface{})
- fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]string)
- v, changed := fastpathTV.DecMapFloat32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]string)
- fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]string, xlen)
- changed = true
- }
-
- var mk float32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint)
- v, changed := fastpathTV.DecMapFloat32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint)
- fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint8)
- v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint8)
- fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]uint8, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint16)
- v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint16)
- fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]uint16, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint32)
- v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint32)
- fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]uint32, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uint64)
- v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uint64)
- fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint64, xlen)
- changed = true
- }
-
- var mk float32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]uintptr)
- v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]uintptr)
- fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uintptr, xlen)
- changed = true
- }
-
- var mk float32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int)
- v, changed := fastpathTV.DecMapFloat32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int)
- fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int, xlen)
- changed = true
- }
-
- var mk float32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int8)
- v, changed := fastpathTV.DecMapFloat32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int8)
- fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]int8, xlen)
- changed = true
- }
-
- var mk float32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int16)
- v, changed := fastpathTV.DecMapFloat32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int16)
- fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]int16, xlen)
- changed = true
- }
-
- var mk float32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int32)
- v, changed := fastpathTV.DecMapFloat32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int32)
- fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]int32, xlen)
- changed = true
- }
-
- var mk float32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]int64)
- v, changed := fastpathTV.DecMapFloat32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]int64)
- fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int64, xlen)
- changed = true
- }
-
- var mk float32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]float32)
- v, changed := fastpathTV.DecMapFloat32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]float32)
- fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]float32, xlen)
- changed = true
- }
-
- var mk float32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]float64)
- v, changed := fastpathTV.DecMapFloat32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]float64)
- fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]float64, xlen)
- changed = true
- }
-
- var mk float32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float32]bool)
- v, changed := fastpathTV.DecMapFloat32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float32]bool)
- fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[float32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]bool, xlen)
- changed = true
- }
-
- var mk float32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = float32(dd.DecodeFloat(true))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]interface{})
- v, changed := fastpathTV.DecMapFloat64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]interface{})
- fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]string)
- v, changed := fastpathTV.DecMapFloat64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]string)
- fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]string, xlen)
- changed = true
- }
-
- var mk float64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint)
- v, changed := fastpathTV.DecMapFloat64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint)
- fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint8)
- v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint8)
- fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]uint8, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint16)
- v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint16)
- fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]uint16, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint32)
- v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint32)
- fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]uint32, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uint64)
- v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uint64)
- fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint64, xlen)
- changed = true
- }
-
- var mk float64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]uintptr)
- v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]uintptr)
- fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uintptr, xlen)
- changed = true
- }
-
- var mk float64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int)
- v, changed := fastpathTV.DecMapFloat64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int)
- fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int, xlen)
- changed = true
- }
-
- var mk float64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int8)
- v, changed := fastpathTV.DecMapFloat64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int8)
- fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]int8, xlen)
- changed = true
- }
-
- var mk float64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int16)
- v, changed := fastpathTV.DecMapFloat64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int16)
- fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]int16, xlen)
- changed = true
- }
-
- var mk float64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int32)
- v, changed := fastpathTV.DecMapFloat64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int32)
- fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]int32, xlen)
- changed = true
- }
-
- var mk float64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]int64)
- v, changed := fastpathTV.DecMapFloat64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]int64)
- fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int64, xlen)
- changed = true
- }
-
- var mk float64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]float32)
- v, changed := fastpathTV.DecMapFloat64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]float32)
- fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]float32, xlen)
- changed = true
- }
-
- var mk float64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]float64)
- v, changed := fastpathTV.DecMapFloat64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]float64)
- fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]float64, xlen)
- changed = true
- }
-
- var mk float64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapFloat64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[float64]bool)
- v, changed := fastpathTV.DecMapFloat64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[float64]bool)
- fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapFloat64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[float64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]bool, xlen)
- changed = true
- }
-
- var mk float64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeFloat(false)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]interface{})
- v, changed := fastpathTV.DecMapUintIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]interface{})
- fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]string)
- v, changed := fastpathTV.DecMapUintStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]string)
- fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintStringX(vp *map[uint]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]string, xlen)
- changed = true
- }
-
- var mk uint
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint)
- v, changed := fastpathTV.DecMapUintUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint)
- fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint8)
- v, changed := fastpathTV.DecMapUintUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint8)
- fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]uint8, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint16)
- v, changed := fastpathTV.DecMapUintUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint16)
- fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]uint16, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint32)
- v, changed := fastpathTV.DecMapUintUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint32)
- fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]uint32, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uint64)
- v, changed := fastpathTV.DecMapUintUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uint64)
- fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint64, xlen)
- changed = true
- }
-
- var mk uint
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]uintptr)
- v, changed := fastpathTV.DecMapUintUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]uintptr)
- fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uintptr, xlen)
- changed = true
- }
-
- var mk uint
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int)
- v, changed := fastpathTV.DecMapUintIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int)
- fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintIntX(vp *map[uint]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int, xlen)
- changed = true
- }
-
- var mk uint
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int8)
- v, changed := fastpathTV.DecMapUintInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int8)
- fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]int8, xlen)
- changed = true
- }
-
- var mk uint
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int16)
- v, changed := fastpathTV.DecMapUintInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int16)
- fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]int16, xlen)
- changed = true
- }
-
- var mk uint
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int32)
- v, changed := fastpathTV.DecMapUintInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int32)
- fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]int32, xlen)
- changed = true
- }
-
- var mk uint
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]int64)
- v, changed := fastpathTV.DecMapUintInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]int64)
- fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int64, xlen)
- changed = true
- }
-
- var mk uint
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]float32)
- v, changed := fastpathTV.DecMapUintFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]float32)
- fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]float32, xlen)
- changed = true
- }
-
- var mk uint
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]float64)
- v, changed := fastpathTV.DecMapUintFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]float64)
- fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]float64, xlen)
- changed = true
- }
-
- var mk uint
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint]bool)
- v, changed := fastpathTV.DecMapUintBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint]bool)
- fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]bool, xlen)
- changed = true
- }
-
- var mk uint
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]interface{})
- v, changed := fastpathTV.DecMapUint8IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]interface{})
- fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint8
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]string)
- v, changed := fastpathTV.DecMapUint8StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]string)
- fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]string, xlen)
- changed = true
- }
-
- var mk uint8
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint)
- v, changed := fastpathTV.DecMapUint8UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint)
- fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint8)
- v, changed := fastpathTV.DecMapUint8Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint8)
- fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]uint8, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint16)
- v, changed := fastpathTV.DecMapUint8Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint16)
- fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]uint16, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint32)
- v, changed := fastpathTV.DecMapUint8Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint32)
- fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]uint32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uint64)
- v, changed := fastpathTV.DecMapUint8Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uint64)
- fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]uintptr)
- v, changed := fastpathTV.DecMapUint8UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]uintptr)
- fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uintptr, xlen)
- changed = true
- }
-
- var mk uint8
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int)
- v, changed := fastpathTV.DecMapUint8IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int)
- fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int8)
- v, changed := fastpathTV.DecMapUint8Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int8)
- fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]int8, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int16)
- v, changed := fastpathTV.DecMapUint8Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int16)
- fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]int16, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int32)
- v, changed := fastpathTV.DecMapUint8Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int32)
- fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]int32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]int64)
- v, changed := fastpathTV.DecMapUint8Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]int64)
- fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]float32)
- v, changed := fastpathTV.DecMapUint8Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]float32)
- fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]float32, xlen)
- changed = true
- }
-
- var mk uint8
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]float64)
- v, changed := fastpathTV.DecMapUint8Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]float64)
- fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]float64, xlen)
- changed = true
- }
-
- var mk uint8
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint8BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint8]bool)
- v, changed := fastpathTV.DecMapUint8BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint8]bool)
- fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint8BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint8]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]bool, xlen)
- changed = true
- }
-
- var mk uint8
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint8(dd.DecodeUint(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]interface{})
- v, changed := fastpathTV.DecMapUint16IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]interface{})
- fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint16
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]string)
- v, changed := fastpathTV.DecMapUint16StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]string)
- fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]string, xlen)
- changed = true
- }
-
- var mk uint16
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint)
- v, changed := fastpathTV.DecMapUint16UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint)
- fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint8)
- v, changed := fastpathTV.DecMapUint16Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint8)
- fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]uint8, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint16)
- v, changed := fastpathTV.DecMapUint16Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint16)
- fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]uint16, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint32)
- v, changed := fastpathTV.DecMapUint16Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint32)
- fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]uint32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uint64)
- v, changed := fastpathTV.DecMapUint16Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uint64)
- fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]uintptr)
- v, changed := fastpathTV.DecMapUint16UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]uintptr)
- fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uintptr, xlen)
- changed = true
- }
-
- var mk uint16
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int)
- v, changed := fastpathTV.DecMapUint16IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int)
- fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int8)
- v, changed := fastpathTV.DecMapUint16Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int8)
- fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]int8, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int16)
- v, changed := fastpathTV.DecMapUint16Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int16)
- fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]int16, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int32)
- v, changed := fastpathTV.DecMapUint16Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int32)
- fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]int32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]int64)
- v, changed := fastpathTV.DecMapUint16Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]int64)
- fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]float32)
- v, changed := fastpathTV.DecMapUint16Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]float32)
- fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]float32, xlen)
- changed = true
- }
-
- var mk uint16
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]float64)
- v, changed := fastpathTV.DecMapUint16Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]float64)
- fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]float64, xlen)
- changed = true
- }
-
- var mk uint16
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint16BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint16]bool)
- v, changed := fastpathTV.DecMapUint16BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint16]bool)
- fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint16BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint16]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]bool, xlen)
- changed = true
- }
-
- var mk uint16
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint16(dd.DecodeUint(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]interface{})
- v, changed := fastpathTV.DecMapUint32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]interface{})
- fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]string)
- v, changed := fastpathTV.DecMapUint32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]string)
- fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]string, xlen)
- changed = true
- }
-
- var mk uint32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint)
- v, changed := fastpathTV.DecMapUint32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint)
- fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint8)
- v, changed := fastpathTV.DecMapUint32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint8)
- fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]uint8, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint16)
- v, changed := fastpathTV.DecMapUint32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint16)
- fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]uint16, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint32)
- v, changed := fastpathTV.DecMapUint32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint32)
- fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]uint32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uint64)
- v, changed := fastpathTV.DecMapUint32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uint64)
- fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]uintptr)
- v, changed := fastpathTV.DecMapUint32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]uintptr)
- fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uintptr, xlen)
- changed = true
- }
-
- var mk uint32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int)
- v, changed := fastpathTV.DecMapUint32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int)
- fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int8)
- v, changed := fastpathTV.DecMapUint32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int8)
- fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]int8, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int16)
- v, changed := fastpathTV.DecMapUint32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int16)
- fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]int16, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int32)
- v, changed := fastpathTV.DecMapUint32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int32)
- fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]int32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]int64)
- v, changed := fastpathTV.DecMapUint32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]int64)
- fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]float32)
- v, changed := fastpathTV.DecMapUint32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]float32)
- fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]float32, xlen)
- changed = true
- }
-
- var mk uint32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]float64)
- v, changed := fastpathTV.DecMapUint32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]float64)
- fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]float64, xlen)
- changed = true
- }
-
- var mk uint32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint32]bool)
- v, changed := fastpathTV.DecMapUint32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint32]bool)
- fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]bool, xlen)
- changed = true
- }
-
- var mk uint32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uint32(dd.DecodeUint(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]interface{})
- v, changed := fastpathTV.DecMapUint64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]interface{})
- fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]string)
- v, changed := fastpathTV.DecMapUint64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]string)
- fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]string, xlen)
- changed = true
- }
-
- var mk uint64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint)
- v, changed := fastpathTV.DecMapUint64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint)
- fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint8)
- v, changed := fastpathTV.DecMapUint64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint8)
- fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]uint8, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint16)
- v, changed := fastpathTV.DecMapUint64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint16)
- fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]uint16, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint32)
- v, changed := fastpathTV.DecMapUint64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint32)
- fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]uint32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uint64)
- v, changed := fastpathTV.DecMapUint64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uint64)
- fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]uintptr)
- v, changed := fastpathTV.DecMapUint64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]uintptr)
- fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uintptr, xlen)
- changed = true
- }
-
- var mk uint64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int)
- v, changed := fastpathTV.DecMapUint64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int)
- fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int8)
- v, changed := fastpathTV.DecMapUint64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int8)
- fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]int8, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int16)
- v, changed := fastpathTV.DecMapUint64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int16)
- fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]int16, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int32)
- v, changed := fastpathTV.DecMapUint64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int32)
- fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]int32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]int64)
- v, changed := fastpathTV.DecMapUint64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]int64)
- fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]float32)
- v, changed := fastpathTV.DecMapUint64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]float32)
- fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]float32, xlen)
- changed = true
- }
-
- var mk uint64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]float64)
- v, changed := fastpathTV.DecMapUint64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]float64)
- fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]float64, xlen)
- changed = true
- }
-
- var mk uint64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUint64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uint64]bool)
- v, changed := fastpathTV.DecMapUint64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uint64]bool)
- fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUint64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uint64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]bool, xlen)
- changed = true
- }
-
- var mk uint64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeUint(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]interface{})
- v, changed := fastpathTV.DecMapUintptrIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]interface{})
- fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uintptr
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]string)
- v, changed := fastpathTV.DecMapUintptrStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]string)
- fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]string, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint)
- v, changed := fastpathTV.DecMapUintptrUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint)
- fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint8)
- v, changed := fastpathTV.DecMapUintptrUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint8)
- fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]uint8, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint16)
- v, changed := fastpathTV.DecMapUintptrUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint16)
- fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]uint16, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint32)
- v, changed := fastpathTV.DecMapUintptrUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint32)
- fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]uint32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uint64)
- v, changed := fastpathTV.DecMapUintptrUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uint64)
- fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]uintptr)
- v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]uintptr)
- fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uintptr, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int)
- v, changed := fastpathTV.DecMapUintptrIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int)
- fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int8)
- v, changed := fastpathTV.DecMapUintptrInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int8)
- fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]int8, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int16)
- v, changed := fastpathTV.DecMapUintptrInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int16)
- fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]int16, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int32)
- v, changed := fastpathTV.DecMapUintptrInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int32)
- fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]int32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]int64)
- v, changed := fastpathTV.DecMapUintptrInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]int64)
- fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]float32)
- v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]float32)
- fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]float32, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]float64)
- v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]float64)
- fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]float64, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapUintptrBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[uintptr]bool)
- v, changed := fastpathTV.DecMapUintptrBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[uintptr]bool)
- fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapUintptrBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[uintptr]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]bool, xlen)
- changed = true
- }
-
- var mk uintptr
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = uintptr(dd.DecodeUint(uintBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]interface{})
- v, changed := fastpathTV.DecMapIntIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]interface{})
- fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]string)
- v, changed := fastpathTV.DecMapIntStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]string)
- fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntStringX(vp *map[int]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]string, xlen)
- changed = true
- }
-
- var mk int
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint)
- v, changed := fastpathTV.DecMapIntUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint)
- fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUintX(vp *map[int]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint, xlen)
- changed = true
- }
-
- var mk int
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint8)
- v, changed := fastpathTV.DecMapIntUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint8)
- fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]uint8, xlen)
- changed = true
- }
-
- var mk int
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint16)
- v, changed := fastpathTV.DecMapIntUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint16)
- fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]uint16, xlen)
- changed = true
- }
-
- var mk int
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint32)
- v, changed := fastpathTV.DecMapIntUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint32)
- fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]uint32, xlen)
- changed = true
- }
-
- var mk int
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uint64)
- v, changed := fastpathTV.DecMapIntUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uint64)
- fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint64, xlen)
- changed = true
- }
-
- var mk int
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]uintptr)
- v, changed := fastpathTV.DecMapIntUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]uintptr)
- fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uintptr, xlen)
- changed = true
- }
-
- var mk int
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int)
- v, changed := fastpathTV.DecMapIntIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int)
- fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntIntX(vp *map[int]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int, xlen)
- changed = true
- }
-
- var mk int
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int8)
- v, changed := fastpathTV.DecMapIntInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int8)
- fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]int8, xlen)
- changed = true
- }
-
- var mk int
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int16)
- v, changed := fastpathTV.DecMapIntInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int16)
- fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]int16, xlen)
- changed = true
- }
-
- var mk int
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int32)
- v, changed := fastpathTV.DecMapIntInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int32)
- fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]int32, xlen)
- changed = true
- }
-
- var mk int
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]int64)
- v, changed := fastpathTV.DecMapIntInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]int64)
- fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int64, xlen)
- changed = true
- }
-
- var mk int
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]float32)
- v, changed := fastpathTV.DecMapIntFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]float32)
- fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]float32, xlen)
- changed = true
- }
-
- var mk int
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]float64)
- v, changed := fastpathTV.DecMapIntFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]float64)
- fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]float64, xlen)
- changed = true
- }
-
- var mk int
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapIntBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int]bool)
- v, changed := fastpathTV.DecMapIntBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int]bool)
- fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapIntBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]bool, xlen)
- changed = true
- }
-
- var mk int
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int(dd.DecodeInt(intBitsize))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]interface{})
- v, changed := fastpathTV.DecMapInt8IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]interface{})
- fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int8
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]string)
- v, changed := fastpathTV.DecMapInt8StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]string)
- fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]string, xlen)
- changed = true
- }
-
- var mk int8
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint)
- v, changed := fastpathTV.DecMapInt8UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint)
- fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint8)
- v, changed := fastpathTV.DecMapInt8Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint8)
- fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]uint8, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint16)
- v, changed := fastpathTV.DecMapInt8Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint16)
- fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]uint16, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint32)
- v, changed := fastpathTV.DecMapInt8Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint32)
- fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]uint32, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uint64)
- v, changed := fastpathTV.DecMapInt8Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uint64)
- fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint64, xlen)
- changed = true
- }
-
- var mk int8
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]uintptr)
- v, changed := fastpathTV.DecMapInt8UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]uintptr)
- fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uintptr, xlen)
- changed = true
- }
-
- var mk int8
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int)
- v, changed := fastpathTV.DecMapInt8IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int)
- fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int, xlen)
- changed = true
- }
-
- var mk int8
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int8)
- v, changed := fastpathTV.DecMapInt8Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int8)
- fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]int8, xlen)
- changed = true
- }
-
- var mk int8
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int16)
- v, changed := fastpathTV.DecMapInt8Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int16)
- fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]int16, xlen)
- changed = true
- }
-
- var mk int8
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int32)
- v, changed := fastpathTV.DecMapInt8Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int32)
- fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]int32, xlen)
- changed = true
- }
-
- var mk int8
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]int64)
- v, changed := fastpathTV.DecMapInt8Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]int64)
- fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int64, xlen)
- changed = true
- }
-
- var mk int8
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]float32)
- v, changed := fastpathTV.DecMapInt8Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]float32)
- fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]float32, xlen)
- changed = true
- }
-
- var mk int8
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]float64)
- v, changed := fastpathTV.DecMapInt8Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]float64)
- fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]float64, xlen)
- changed = true
- }
-
- var mk int8
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt8BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int8]bool)
- v, changed := fastpathTV.DecMapInt8BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int8]bool)
- fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt8BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int8]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]bool, xlen)
- changed = true
- }
-
- var mk int8
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int8(dd.DecodeInt(8))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]interface{})
- v, changed := fastpathTV.DecMapInt16IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]interface{})
- fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int16
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]string)
- v, changed := fastpathTV.DecMapInt16StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]string)
- fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]string, xlen)
- changed = true
- }
-
- var mk int16
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint)
- v, changed := fastpathTV.DecMapInt16UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint)
- fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint8)
- v, changed := fastpathTV.DecMapInt16Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint8)
- fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]uint8, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint16)
- v, changed := fastpathTV.DecMapInt16Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint16)
- fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]uint16, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint32)
- v, changed := fastpathTV.DecMapInt16Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint32)
- fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]uint32, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uint64)
- v, changed := fastpathTV.DecMapInt16Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uint64)
- fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint64, xlen)
- changed = true
- }
-
- var mk int16
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]uintptr)
- v, changed := fastpathTV.DecMapInt16UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]uintptr)
- fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uintptr, xlen)
- changed = true
- }
-
- var mk int16
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int)
- v, changed := fastpathTV.DecMapInt16IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int)
- fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int, xlen)
- changed = true
- }
-
- var mk int16
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int8)
- v, changed := fastpathTV.DecMapInt16Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int8)
- fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]int8, xlen)
- changed = true
- }
-
- var mk int16
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int16)
- v, changed := fastpathTV.DecMapInt16Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int16)
- fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]int16, xlen)
- changed = true
- }
-
- var mk int16
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int32)
- v, changed := fastpathTV.DecMapInt16Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int32)
- fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]int32, xlen)
- changed = true
- }
-
- var mk int16
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]int64)
- v, changed := fastpathTV.DecMapInt16Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]int64)
- fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int64, xlen)
- changed = true
- }
-
- var mk int16
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]float32)
- v, changed := fastpathTV.DecMapInt16Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]float32)
- fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]float32, xlen)
- changed = true
- }
-
- var mk int16
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]float64)
- v, changed := fastpathTV.DecMapInt16Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]float64)
- fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]float64, xlen)
- changed = true
- }
-
- var mk int16
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt16BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int16]bool)
- v, changed := fastpathTV.DecMapInt16BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int16]bool)
- fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt16BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int16]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]bool, xlen)
- changed = true
- }
-
- var mk int16
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int16(dd.DecodeInt(16))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]interface{})
- v, changed := fastpathTV.DecMapInt32IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]interface{})
- fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int32
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]string)
- v, changed := fastpathTV.DecMapInt32StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]string)
- fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]string, xlen)
- changed = true
- }
-
- var mk int32
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint)
- v, changed := fastpathTV.DecMapInt32UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint)
- fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint8)
- v, changed := fastpathTV.DecMapInt32Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint8)
- fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]uint8, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint16)
- v, changed := fastpathTV.DecMapInt32Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint16)
- fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]uint16, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint32)
- v, changed := fastpathTV.DecMapInt32Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint32)
- fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]uint32, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uint64)
- v, changed := fastpathTV.DecMapInt32Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uint64)
- fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint64, xlen)
- changed = true
- }
-
- var mk int32
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]uintptr)
- v, changed := fastpathTV.DecMapInt32UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]uintptr)
- fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uintptr, xlen)
- changed = true
- }
-
- var mk int32
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int)
- v, changed := fastpathTV.DecMapInt32IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int)
- fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int, xlen)
- changed = true
- }
-
- var mk int32
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int8)
- v, changed := fastpathTV.DecMapInt32Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int8)
- fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]int8, xlen)
- changed = true
- }
-
- var mk int32
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int16)
- v, changed := fastpathTV.DecMapInt32Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int16)
- fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]int16, xlen)
- changed = true
- }
-
- var mk int32
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int32)
- v, changed := fastpathTV.DecMapInt32Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int32)
- fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]int32, xlen)
- changed = true
- }
-
- var mk int32
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]int64)
- v, changed := fastpathTV.DecMapInt32Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]int64)
- fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int64, xlen)
- changed = true
- }
-
- var mk int32
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]float32)
- v, changed := fastpathTV.DecMapInt32Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]float32)
- fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]float32, xlen)
- changed = true
- }
-
- var mk int32
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]float64)
- v, changed := fastpathTV.DecMapInt32Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]float64)
- fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]float64, xlen)
- changed = true
- }
-
- var mk int32
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt32BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int32]bool)
- v, changed := fastpathTV.DecMapInt32BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int32]bool)
- fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt32BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int32]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]bool, xlen)
- changed = true
- }
-
- var mk int32
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = int32(dd.DecodeInt(32))
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64IntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]interface{})
- v, changed := fastpathTV.DecMapInt64IntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]interface{})
- fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64IntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int64
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64StringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]string)
- v, changed := fastpathTV.DecMapInt64StringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]string)
- fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64StringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]string, xlen)
- changed = true
- }
-
- var mk int64
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64UintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint)
- v, changed := fastpathTV.DecMapInt64UintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint)
- fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64UintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint8)
- v, changed := fastpathTV.DecMapInt64Uint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint8)
- fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]uint8, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint16)
- v, changed := fastpathTV.DecMapInt64Uint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint16)
- fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]uint16, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint32)
- v, changed := fastpathTV.DecMapInt64Uint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint32)
- fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]uint32, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Uint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uint64)
- v, changed := fastpathTV.DecMapInt64Uint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uint64)
- fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Uint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint64, xlen)
- changed = true
- }
-
- var mk int64
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64UintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]uintptr)
- v, changed := fastpathTV.DecMapInt64UintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]uintptr)
- fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64UintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uintptr, xlen)
- changed = true
- }
-
- var mk int64
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64IntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int)
- v, changed := fastpathTV.DecMapInt64IntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int)
- fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64IntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int, xlen)
- changed = true
- }
-
- var mk int64
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int8)
- v, changed := fastpathTV.DecMapInt64Int8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int8)
- fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]int8, xlen)
- changed = true
- }
-
- var mk int64
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int16)
- v, changed := fastpathTV.DecMapInt64Int16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int16)
- fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]int16, xlen)
- changed = true
- }
-
- var mk int64
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int32)
- v, changed := fastpathTV.DecMapInt64Int32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int32)
- fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]int32, xlen)
- changed = true
- }
-
- var mk int64
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Int64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]int64)
- v, changed := fastpathTV.DecMapInt64Int64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]int64)
- fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Int64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int64, xlen)
- changed = true
- }
-
- var mk int64
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Float32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]float32)
- v, changed := fastpathTV.DecMapInt64Float32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]float32)
- fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Float32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]float32, xlen)
- changed = true
- }
-
- var mk int64
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64Float64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]float64)
- v, changed := fastpathTV.DecMapInt64Float64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]float64)
- fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64Float64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]float64, xlen)
- changed = true
- }
-
- var mk int64
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapInt64BoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[int64]bool)
- v, changed := fastpathTV.DecMapInt64BoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[int64]bool)
- fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapInt64BoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[int64]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]bool, xlen)
- changed = true
- }
-
- var mk int64
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeInt(64)
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolIntfR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]interface{})
- v, changed := fastpathTV.DecMapBoolIntfV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]interface{})
- fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolIntfV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]interface{}, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]interface{}, xlen)
- changed = true
- }
- mapGet := !d.h.MapValueReset && !d.h.InterfaceReset
- var mk bool
- var mv interface{}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolStringR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]string)
- v, changed := fastpathTV.DecMapBoolStringV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]string)
- fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolStringV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]string, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]string, xlen)
- changed = true
- }
-
- var mk bool
- var mv string
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUintR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint)
- v, changed := fastpathTV.DecMapBoolUintV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint)
- fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUintV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint8)
- v, changed := fastpathTV.DecMapBoolUint8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint8)
- fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]uint8, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint8(dd.DecodeUint(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint16)
- v, changed := fastpathTV.DecMapBoolUint16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint16)
- fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]uint16, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint16(dd.DecodeUint(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint32)
- v, changed := fastpathTV.DecMapBoolUint32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint32)
- fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]uint32, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uint32(dd.DecodeUint(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUint64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uint64)
- v, changed := fastpathTV.DecMapBoolUint64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uint64)
- fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUint64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uint64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint64, xlen)
- changed = true
- }
-
- var mk bool
- var mv uint64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeUint(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolUintptrR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]uintptr)
- v, changed := fastpathTV.DecMapBoolUintptrV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]uintptr)
- fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolUintptrV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]uintptr, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uintptr, xlen)
- changed = true
- }
-
- var mk bool
- var mv uintptr
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = uintptr(dd.DecodeUint(uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolIntR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int)
- v, changed := fastpathTV.DecMapBoolIntV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int)
- fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolIntV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int, xlen)
- changed = true
- }
-
- var mk bool
- var mv int
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int(dd.DecodeInt(intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt8R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int8)
- v, changed := fastpathTV.DecMapBoolInt8V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int8)
- fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt8V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int8, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]int8, xlen)
- changed = true
- }
-
- var mk bool
- var mv int8
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int8(dd.DecodeInt(8))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt16R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int16)
- v, changed := fastpathTV.DecMapBoolInt16V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int16)
- fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt16V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int16, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]int16, xlen)
- changed = true
- }
-
- var mk bool
- var mv int16
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int16(dd.DecodeInt(16))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int32)
- v, changed := fastpathTV.DecMapBoolInt32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int32)
- fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]int32, xlen)
- changed = true
- }
-
- var mk bool
- var mv int32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = int32(dd.DecodeInt(32))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolInt64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]int64)
- v, changed := fastpathTV.DecMapBoolInt64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]int64)
- fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolInt64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]int64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int64, xlen)
- changed = true
- }
-
- var mk bool
- var mv int64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeInt(64)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolFloat32R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]float32)
- v, changed := fastpathTV.DecMapBoolFloat32V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]float32)
- fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolFloat32V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]float32, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]float32, xlen)
- changed = true
- }
-
- var mk bool
- var mv float32
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = float32(dd.DecodeFloat(true))
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolFloat64R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]float64)
- v, changed := fastpathTV.DecMapBoolFloat64V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]float64)
- fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolFloat64V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]float64, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]float64, xlen)
- changed = true
- }
-
- var mk bool
- var mv float64
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeFloat(false)
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
-
-func (f *decFnInfo) fastpathDecMapBoolBoolR(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[bool]bool)
- v, changed := fastpathTV.DecMapBoolBoolV(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[bool]bool)
- fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, checkNil bool, d *Decoder) {
- v, changed := f.DecMapBoolBoolV(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange bool,
- d *Decoder) (_ map[bool]bool, changed bool) {
- dd := d.d
- cr := d.cr
-
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]bool, xlen)
- changed = true
- }
-
- var mk bool
- var mv bool
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil {
- cr.sendContainerState(containerMapKey)
- }
- mk = dd.DecodeBool()
- if cr != nil {
- cr.sendContainerState(containerMapValue)
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil {
- cr.sendContainerState(containerMapEnd)
- }
- return v, changed
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
deleted file mode 100644
index c3ffdf93d..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
+++ /dev/null
@@ -1,527 +0,0 @@
-// +build !notfastpath
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl
-// ************************************************************
-
-package codec
-
-// Fast path functions try to create a fast path encode or decode implementation
-// for common maps and slices.
-//
-// We define the functions and register then in this single file
-// so as not to pollute the encode.go and decode.go, and create a dependency in there.
-// This file can be omitted without causing a build failure.
-//
-// The advantage of fast paths is:
-// - Many calls bypass reflection altogether
-//
-// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
-// This should provide adequate "typical" implementations.
-//
-// Note that fast track decode functions must handle values for which an address cannot be obtained.
-// For example:
-// m2 := map[string]int{}
-// p2 := []interface{}{m2}
-// // decoding into p2 will bomb if fast track functions do not treat like unaddressable.
-//
-
-import (
- "reflect"
- "sort"
-)
-
-const fastpathEnabled = true
-
-const fastpathCheckNilFalse = false // for reflect
-const fastpathCheckNilTrue = true // for type switch
-
-type fastpathT struct {}
-
-var fastpathTV fastpathT
-
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-
-type fastpathA [{{ .FastpathLen }}]fastpathE
-
-func (x *fastpathA) index(rtid uintptr) int {
- // use binary search to grab the index (adapted from sort/search.go)
- h, i, j := 0, 0, {{ .FastpathLen }} // len(x)
- for i < j {
- h = i + (j-i)/2
- if x[h].rtid < rtid {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < {{ .FastpathLen }} && x[i].rtid == rtid {
- return i
- }
- return -1
-}
-
-type fastpathAslice []fastpathE
-
-func (x fastpathAslice) Len() int { return len(x) }
-func (x fastpathAslice) Less(i, j int) bool { return x[i].rtid < x[j].rtid }
-func (x fastpathAslice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-var fastpathAV fastpathA
-
-// due to possible initialization loop error, make fastpath in an init()
-func init() {
- i := 0
- fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
- xrt := reflect.TypeOf(v)
- xptr := reflect.ValueOf(xrt).Pointer()
- fastpathAV[i] = fastpathE{xptr, xrt, fe, fd}
- i++
- return
- }
-
- {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- fn([]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}
-
- {{range .Values}}{{if not .Primitive}}{{if .MapKey }}
- fn(map[{{ .MapKey }}]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}
-
- sort.Sort(fastpathAslice(fastpathAV[:]))
-}
-
-// -- encode
-
-// -- -- fast path type switch
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:{{else}}
- case map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e){{if not .MapKey }}
- case *[]{{ .Elem }}:{{else}}
- case *map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e)
- case *[]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
- case map[{{ .MapKey }}]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e)
- case *map[{{ .MapKey }}]{{ .Elem }}:
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e)
-{{end}}{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
-
-func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) {
- if f.ti.mbs {
- fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e)
- } else {
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e)
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeArrayStart(len(v))
- for _, v2 := range v {
- if cr != nil { cr.sendContainerState(containerArrayElem) }
- {{ encmd .Elem "v2"}}
- }
- if cr != nil { cr.sendContainerState(containerArrayEnd) }{{/* ee.EncodeEnd() */}}
-}
-
-func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- if len(v)%2 == 1 {
- e.errorf("mapBySlice requires even slice length, but got %v", len(v))
- return
- }
- ee.EncodeMapStart(len(v) / 2)
- for j, v2 := range v {
- if cr != nil {
- if j%2 == 0 {
- cr.sendContainerState(containerMapKey)
- } else {
- cr.sendContainerState(containerMapValue)
- }
- }
- {{ encmd .Elem "v2"}}
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }
-}
-
-{{end}}{{end}}{{end}}
-
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
-
-func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) {
- fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().(map[{{ .MapKey }}]{{ .Elem }}), fastpathCheckNilFalse, f.e)
-}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, e *Encoder) {
- ee := e.e
- cr := e.cr
- if checkNil && v == nil {
- ee.EncodeNil()
- return
- }
- ee.EncodeMapStart(len(v))
- {{if eq .MapKey "string"}}asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0
- {{end}}if e.h.Canonical {
- {{if eq .MapKey "interface{}"}}{{/* out of band
- */}}var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l int
- var vp *bytesI {{/* put loop variables outside. seems currently needed for better perf */}}
- for k2, _ := range v {
- l = len(mksv)
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
- i++
- }
- sort.Sort(bytesISlice(v2))
- for j := range v2 {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- e.asis(v2[j].v)
- if cr != nil { cr.sendContainerState(containerMapValue) }
- e.encode(v[v2[j].i])
- } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v))
- var i int
- for k, _ := range v {
- v2[i] = {{ $x }}(k)
- i++
- }
- sort.Sort({{ sorttype .MapKey false}}(v2))
- for _, k2 := range v2 {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{if eq .MapKey "string"}}if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }{{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }}
- } {{end}}
- } else {
- for k2, v2 := range v {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{if eq .MapKey "string"}}if asSymbols {
- ee.EncodeSymbol(k2)
- } else {
- ee.EncodeString(c_UTF8, k2)
- }{{else}}{{ encmd .MapKey "k2"}}{{end}}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ encmd .Elem "v2"}}
- }
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }{{/* ee.EncodeEnd() */}}
-}
-
-{{end}}{{end}}{{end}}
-
-// -- decode
-
-// -- -- fast path type switch
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- switch v := iv.(type) {
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
- case []{{ .Elem }}:{{else}}
- case map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, d){{if not .MapKey }}
- case *[]{{ .Elem }}:{{else}}
- case *map[{{ .MapKey }}]{{ .Elem }}:{{end}}
- v2, changed2 := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, fastpathCheckNilFalse, true, d)
- if changed2 {
- *v = v2
- }
-{{end}}{{end}}
- default:
- _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release)
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
-{{/*
-Slices can change if they
-- did not come from an array
-- are addressable (from a ptr)
-- are settable (e.g. contained in an interface{})
-*/}}
-func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) {
- array := f.seq == seqTypeArray
- if !array && rv.CanAddr() { {{/* // CanSet => CanAddr + Exported */}}
- vp := rv.Addr().Interface().(*[]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, !array, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().([]{{ .Elem }})
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-
-func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, checkNil bool, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil bool, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) {
- dd := d.d
- {{/* // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() */}}
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []{{ .Elem }}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
-
- if containerLenS > 0 {
- x2read := containerLenS
- var xtrunc bool
- if containerLenS > cap(v) {
- if canChange { {{/*
- // fast-path is for "basic" immutable types, so no need to copy them over
- // s := make([]{{ .Elem }}, decInferLen(containerLenS, d.h.MaxInitLen))
- // copy(s, v[:cap(v)])
- // v = s */}}
- var xlen int
- xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }})
- if xtrunc {
- if xlen <= cap(v) {
- v = v[:xlen]
- } else {
- v = make([]{{ .Elem }}, xlen)
- }
- } else {
- v = make([]{{ .Elem }}, xlen)
- }
- changed = true
- } else {
- d.arrayCannotExpand(len(v), containerLenS)
- }
- x2read = len(v)
- } else if containerLenS != len(v) {
- if canChange {
- v = v[:containerLenS]
- changed = true
- }
- } {{/* // all checks done. cannot go past len. */}}
- j := 0
- for ; j < x2read; j++ {
- slh.ElemContainerState(j)
- {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- }
- if xtrunc { {{/* // means canChange=true, changed=true already. */}}
- for ; j < containerLenS; j++ {
- v = append(v, {{ zerocmd .Elem }})
- slh.ElemContainerState(j)
- {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- }
- } else if !canChange {
- for ; j < containerLenS; j++ {
- slh.ElemContainerState(j)
- d.swallow()
- }
- }
- } else {
- breakFound := dd.CheckBreak() {{/* check break first, so we can initialize v with a capacity of 4 if necessary */}}
- if breakFound {
- if canChange {
- if v == nil {
- v = []{{ .Elem }}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- if cap(v) == 0 {
- v = make([]{{ .Elem }}, 1, 4)
- changed = true
- }
- j := 0
- for ; !breakFound; j++ {
- if j >= len(v) {
- if canChange {
- v = append(v, {{ zerocmd .Elem }})
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- }
- }
- slh.ElemContainerState(j)
- if j < len(v) { {{/* // all checks done. cannot go past len. */}}
- {{ if eq .Elem "interface{}" }}d.decode(&v[j])
- {{ else }}v[j] = {{ decmd .Elem }}{{ end }}
- } else {
- d.swallow()
- }
- breakFound = dd.CheckBreak()
- }
- if canChange && j < len(v) {
- v = v[:j]
- changed = true
- }
- }
- slh.End()
- return v, changed
-}
-
-{{end}}{{end}}{{end}}
-
-
-{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
-{{/*
-Maps can change if they are
-- addressable (from a ptr)
-- settable (e.g. contained in an interface{})
-*/}}
-func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) {
- if rv.CanAddr() {
- vp := rv.Addr().Interface().(*map[{{ .MapKey }}]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, true, f.d)
- if changed {
- *vp = v
- }
- } else {
- v := rv.Interface().(map[{{ .MapKey }}]{{ .Elem }})
- fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d)
- }
-}
-func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, canChange bool,
- d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) {
- dd := d.d
- cr := d.cr
- {{/* // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() */}}
- if checkNil && dd.TryDecodeAsNil() {
- if v != nil {
- changed = true
- }
- return nil, changed
- }
-
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})
- v = make(map[{{ .MapKey }}]{{ .Elem }}, xlen)
- changed = true
- }
- {{ if eq .Elem "interface{}" }}mapGet := !d.h.MapValueReset && !d.h.InterfaceReset{{end}}
- var mk {{ .MapKey }}
- var mv {{ .Elem }}
- if containerLen > 0 {
- for j := 0; j < containerLen; j++ {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{ if eq .MapKey "interface{}" }}mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}}
- }{{ else }}mk = {{ decmd .MapKey }}{{ end }}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil }
- d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }}
- if v != nil {
- v[mk] = mv
- }
- }
- } else if containerLen < 0 {
- for j := 0; !dd.CheckBreak(); j++ {
- if cr != nil { cr.sendContainerState(containerMapKey) }
- {{ if eq .MapKey "interface{}" }}mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}}
- }{{ else }}mk = {{ decmd .MapKey }}{{ end }}
- if cr != nil { cr.sendContainerState(containerMapValue) }
- {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil }
- d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }}
- if v != nil {
- v[mk] = mv
- }
- }
- }
- if cr != nil { cr.sendContainerState(containerMapEnd) }
- return v, changed
-}
-
-{{end}}{{end}}{{end}}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.not.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.not.go
deleted file mode 100644
index 63e591145..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/fast-path.not.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// +build notfastpath
-
-package codec
-
-import "reflect"
-
-const fastpathEnabled = false
-
-// The generated fast-path code is very large, and adds a few seconds to the build time.
-// This causes test execution, execution of small tools which use codec, etc
-// to take a long time.
-//
-// To mitigate, we now support the notfastpath tag.
-// This tag disables fastpath during build, allowing for faster build, test execution,
-// short-program runs, etc.
-
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false }
-func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
-func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
-func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
-
-type fastpathT struct{}
-type fastpathE struct {
- rtid uintptr
- rt reflect.Type
- encfn func(*encFnInfo, reflect.Value)
- decfn func(*decFnInfo, reflect.Value)
-}
-type fastpathA [0]fastpathE
-
-func (x fastpathA) index(rtid uintptr) int { return -1 }
-
-var fastpathAV fastpathA
-var fastpathTV fastpathT
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
deleted file mode 100644
index 32df54144..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
+++ /dev/null
@@ -1,104 +0,0 @@
-{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }}
-{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}}
-var {{var "c"}} bool {{/* // changed */}}
-_ = {{var "c"}}{{end}}
-if {{var "l"}} == 0 {
- {{if isSlice }}if {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- } else if len({{var "v"}}) != 0 {
- {{var "v"}} = {{var "v"}}[:0]
- {{var "c"}} = true
- } {{end}} {{if isChan }}if {{var "v"}} == nil {
- {{var "v"}} = make({{ .CTyp }}, 0)
- {{var "c"}} = true
- } {{end}}
-} else if {{var "l"}} > 0 {
- {{if isChan }}if {{var "v"}} == nil {
- {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- {{var "v"}} = make({{ .CTyp }}, {{var "rl"}})
- {{var "c"}} = true
- }
- for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ {
- {{var "h"}}.ElemContainerState({{var "r"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- }
- {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}}
- var {{var "rt"}} bool {{/* truncated */}}
- _, _ = {{var "rl"}}, {{var "rt"}}
- {{var "rr"}} = {{var "l"}} // len({{var "v"}})
- if {{var "l"}} > cap({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}})
- {{ else }}{{if not .Immutable }}
- {{var "rg"}} := len({{var "v"}}) > 0
- {{var "v2"}} := {{var "v"}} {{end}}
- {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- if {{var "rt"}} {
- if {{var "rl"}} <= cap({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "rl"}}]
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- {{var "c"}} = true
- {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }}
- if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}}
- } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "l"}}]
- {{var "c"}} = true
- } {{end}} {{/* end isSlice:47 */}}
- {{var "j"}} := 0
- for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- z.DecSwallow()
- }
- {{ else }}if {{var "rt"}} {
- for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "v"}} = append({{var "v"}}, {{ zero}})
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- } {{end}} {{/* end isArray:56 */}}
- {{end}} {{/* end isChan:16 */}}
-} else { {{/* len < 0 */}}
- {{var "j"}} := 0
- for ; !r.CheckBreak(); {{var "j"}}++ {
- {{if isChan }}
- {{var "h"}}.ElemContainerState({{var "j"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- {{ else }}
- if {{var "j"}} >= len({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1)
- {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }}
- {{var "c"}} = true {{end}}
- }
- {{var "h"}}.ElemContainerState({{var "j"}})
- if {{var "j"}} < len({{var "v"}}) {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- } else {
- z.DecSwallow()
- }
- {{end}}
- }
- {{if isSlice }}if {{var "j"}} < len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "j"}}]
- {{var "c"}} = true
- } else if {{var "j"}} == 0 && {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- }{{end}}
-}
-{{var "h"}}.End()
-{{if not isArray }}if {{var "c"}} {
- *{{ .Varname }} = {{var "v"}}
-}{{end}}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
deleted file mode 100644
index 77400e0a1..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
+++ /dev/null
@@ -1,58 +0,0 @@
-{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
-{{var "bh"}} := z.DecBasicHandle()
-if {{var "v"}} == nil {
- {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
- {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}})
- *{{ .Varname }} = {{var "v"}}
-}
-var {{var "mk"}} {{ .KTyp }}
-var {{var "mv"}} {{ .Typ }}
-var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool
-if {{var "bh"}}.MapValueReset {
- {{if decElemKindPtr}}{{var "mg"}} = true
- {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true }
- {{else if not decElemKindImmutable}}{{var "mg"}} = true
- {{end}} }
-if {{var "l"}} > 0 {
-for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} else if {{var "l"}} < 0 {
-for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true {{ end }}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} // else len==0: TODO: Should we clear map entries?
-z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }})
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
deleted file mode 100644
index eb0bdad35..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
+++ /dev/null
@@ -1,243 +0,0 @@
-/* // +build ignore */
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl
-// ************************************************************
-
-package codec
-
-import (
- "encoding"
- "reflect"
-)
-
-// This file is used to generate helper code for codecgen.
-// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continuously and without notice.
-//
-// To help enforce this, we create an unexported type with exported members.
-// The only way to get the type is via the one exported type that we control (somewhat).
-//
-// When static codecs are created for types, they will use this value
-// to perform encoding or decoding of primitives or known slice or map types.
-
-// GenHelperEncoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) {
- return genHelperEncoder{e: e}, e.e
-}
-
-// GenHelperDecoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) {
- return genHelperDecoder{d: d}, d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperEncoder struct {
- e *Encoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperDecoder struct {
- d *Decoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBasicHandle() *BasicHandle {
- return f.e.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinary() bool {
- return f.e.be // f.e.hh.isBinaryEncoding()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
- f.e.encodeI(iv, false, false)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) {
- bs, fnerr := iv.MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) {
- bs, fnerr := iv.MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
- bs, fnerr := iv.MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncRaw(iv Raw) {
- f.e.raw(iv)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.e.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) IsJSONHandle() bool {
- return f.e.js
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v)
- if rt.Kind() == reflect.Ptr {
- rt = rt.Elem()
- }
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.e.h.getExt(rtid); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncSendContainerState(c containerState) {
- if f.e.cr != nil {
- f.e.cr.sendContainerState(c)
- }
-}
-
-// ---------------- DECODER FOLLOWS -----------------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBasicHandle() *BasicHandle {
- return f.d.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinary() bool {
- return f.d.be // f.d.hh.isBinaryEncoding()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSwallow() {
- f.d.swallow()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecScratchBuffer() []byte {
- return f.d.b[:]
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
- f.d.decodeI(iv, chkPtr, false, false, false)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
- return f.d.decSliceHelperStart()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecStructFieldNotFound(index int, name string) {
- f.d.structFieldNotFound(index, name)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
- f.d.arrayCannotExpand(sliceLen, streamLen)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
- // bs := f.dd.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecRaw() []byte {
- return f.d.raw()
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.d.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) IsJSONHandle() bool {
- return f.d.js
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v).Elem()
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.d.h.getExt(rtid); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- return decInferLen(clen, maxlen, unit)
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSendContainerState(c containerState) {
- if f.d.cr != nil {
- f.d.cr.sendContainerState(c)
- }
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
deleted file mode 100644
index ad99f6671..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
+++ /dev/null
@@ -1,372 +0,0 @@
-/* // +build ignore */
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl
-// ************************************************************
-
-package codec
-
-import (
- "encoding"
- "reflect"
-)
-
-// This file is used to generate helper code for codecgen.
-// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continuously and without notice.
-//
-// To help enforce this, we create an unexported type with exported members.
-// The only way to get the type is via the one exported type that we control (somewhat).
-//
-// When static codecs are created for types, they will use this value
-// to perform encoding or decoding of primitives or known slice or map types.
-
-// GenHelperEncoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) {
- return genHelperEncoder{e:e}, e.e
-}
-
-// GenHelperDecoder is exported so that it can be used externally by codecgen.
-// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.
-func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) {
- return genHelperDecoder{d:d}, d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperEncoder struct {
- e *Encoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-type genHelperDecoder struct {
- d *Decoder
- F fastpathT
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBasicHandle() *BasicHandle {
- return f.e.h
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinary() bool {
- return f.e.be // f.e.hh.isBinaryEncoding()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
- f.e.encodeI(iv, false, false)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) {
- bs, fnerr := iv.MarshalText()
- f.e.marshal(bs, fnerr, false, c_UTF8)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) {
- bs, fnerr := iv.MarshalJSON()
- f.e.marshal(bs, fnerr, true, c_UTF8)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
- bs, fnerr := iv.MarshalBinary()
- f.e.marshal(bs, fnerr, false, c_RAW)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncRaw(iv Raw) {
- f.e.raw(iv)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.e.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) IsJSONHandle() bool {
- return f.e.js
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v)
- if rt.Kind() == reflect.Ptr {
- rt = rt.Elem()
- }
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.e.h.getExt(rtid); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncSendContainerState(c containerState) {
- if f.e.cr != nil {
- f.e.cr.sendContainerState(c)
- }
-}
-
-// ---------------- DECODER FOLLOWS -----------------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBasicHandle() *BasicHandle {
- return f.d.h
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinary() bool {
- return f.d.be // f.d.hh.isBinaryEncoding()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSwallow() {
- f.d.swallow()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecScratchBuffer() []byte {
- return f.d.b[:]
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
- f.d.decodeI(iv, chkPtr, false, false, false)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
- return f.d.decSliceHelperStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecStructFieldNotFound(index int, name string) {
- f.d.structFieldNotFound(index, name)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
- f.d.arrayCannotExpand(sliceLen, streamLen)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
- // bs := f.dd.DecodeBytes(f.d.b[:], true, true)
- // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true))
- if fnerr != nil {
- panic(fnerr)
- }
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecRaw() []byte {
- return f.d.raw()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
- if _, ok := f.d.hh.(*BincHandle); ok {
- return timeTypId
- }
- return 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) IsJSONHandle() bool {
- return f.d.js
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- rt := reflect.TypeOf(v).Elem()
- rtid := reflect.ValueOf(rt).Pointer()
- if xfFn := f.d.h.getExt(rtid); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) {
- return decInferLen(clen, maxlen, unit)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecSendContainerState(c containerState) {
- if f.d.cr != nil {
- f.d.cr.sendContainerState(c)
- }
-}
-
-{{/*
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncDriver() encDriver {
- return f.e.e
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecDriver() decDriver {
- return f.d.d
-}
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncNil() {
- f.e.e.EncodeNil()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncBytes(v []byte) {
- f.e.e.EncodeStringBytes(c_RAW, v)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayStart(length int) {
- f.e.e.EncodeArrayStart(length)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayEnd() {
- f.e.e.EncodeArrayEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncArrayEntrySeparator() {
- f.e.e.EncodeArrayEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapStart(length int) {
- f.e.e.EncodeMapStart(length)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapEnd() {
- f.e.e.EncodeMapEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapEntrySeparator() {
- f.e.e.EncodeMapEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) EncMapKVSeparator() {
- f.e.e.EncodeMapKVSeparator()
-}
-
-// ---------
-
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecBytes(v *[]byte) {
- *v = f.d.d.DecodeBytes(*v)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecTryNil() bool {
- return f.d.d.TryDecodeAsNil()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsNil() (b bool) {
- return f.d.d.IsContainerType(valueTypeNil)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsMap() (b bool) {
- return f.d.d.IsContainerType(valueTypeMap)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecContainerIsArray() (b bool) {
- return f.d.d.IsContainerType(valueTypeArray)
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecCheckBreak() bool {
- return f.d.d.CheckBreak()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapStart() int {
- return f.d.d.ReadMapStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayStart() int {
- return f.d.d.ReadArrayStart()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapEnd() {
- f.d.d.ReadMapEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayEnd() {
- f.d.d.ReadArrayEnd()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecArrayEntrySeparator() {
- f.d.d.ReadArrayEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapEntrySeparator() {
- f.d.d.ReadMapEntrySeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecMapKVSeparator() {
- f.d.d.ReadMapKVSeparator()
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) ReadStringAsBytes(bs []byte) []byte {
- return f.d.d.DecodeStringAsBytes(bs)
-}
-
-
-// -- encode calls (primitives)
-{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" true }}(v {{ .Primitive }}) {
- ee := f.e.e
- {{ encmd .Primitive "v" }}
-}
-{{ end }}{{ end }}{{ end }}
-
-// -- decode calls (primitives)
-{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) {{ .MethodNamePfx "Dec" true }}(vp *{{ .Primitive }}) {
- dd := f.d.d
- *vp = {{ decmd .Primitive }}
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) {{ .MethodNamePfx "Read" true }}() (v {{ .Primitive }}) {
- dd := f.d.d
- v = {{ decmd .Primitive }}
- return
-}
-{{ end }}{{ end }}{{ end }}
-
-
-// -- encode calls (slices/maps)
-{{range .Values}}{{if not .Primitive }}{{if .Slice }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v []{{ .Elem }}) { {{ else }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v map[{{ .MapKey }}]{{ .Elem }}) { {{end}}
- f.F.{{ .MethodNamePfx "Enc" false }}V(v, false, f.e)
-}
-{{ end }}{{ end }}
-
-// -- decode calls (slices/maps)
-{{range .Values}}{{if not .Primitive }}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-{{if .Slice }}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *[]{{ .Elem }}) {
-{{else}}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *map[{{ .MapKey }}]{{ .Elem }}) { {{end}}
- v, changed := f.F.{{ .MethodNamePfx "Dec" false }}V(*vp, false, true, f.d)
- if changed {
- *vp = v
- }
-}
-{{ end }}{{ end }}
-*/}}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.generated.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.generated.go
deleted file mode 100644
index 2ace97b78..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.generated.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// DO NOT EDIT. THIS FILE IS AUTO-GENERATED FROM gen-dec-(map|array).go.tmpl
-
-const genDecMapTmpl = `
-{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
-{{var "bh"}} := z.DecBasicHandle()
-if {{var "v"}} == nil {
- {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
- {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}})
- *{{ .Varname }} = {{var "v"}}
-}
-var {{var "mk"}} {{ .KTyp }}
-var {{var "mv"}} {{ .Typ }}
-var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool
-if {{var "bh"}}.MapValueReset {
- {{if decElemKindPtr}}{{var "mg"}} = true
- {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true }
- {{else if not decElemKindImmutable}}{{var "mg"}} = true
- {{end}} }
-if {{var "l"}} > 0 {
-for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} else if {{var "l"}} < 0 {
-for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ {
- z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }})
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
- {{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true {{ end }}
- if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
- if {{var "mok"}} {
- {{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
- } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }})
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }}
- if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
- {{var "v"}}[{{var "mk"}}] = {{var "mv"}}
- }
-}
-} // else len==0: TODO: Should we clear map entries?
-z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }})
-`
-
-const genDecListTmpl = `
-{{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }}
-{{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}}
-var {{var "c"}} bool {{/* // changed */}}
-_ = {{var "c"}}{{end}}
-if {{var "l"}} == 0 {
- {{if isSlice }}if {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- } else if len({{var "v"}}) != 0 {
- {{var "v"}} = {{var "v"}}[:0]
- {{var "c"}} = true
- } {{end}} {{if isChan }}if {{var "v"}} == nil {
- {{var "v"}} = make({{ .CTyp }}, 0)
- {{var "c"}} = true
- } {{end}}
-} else if {{var "l"}} > 0 {
- {{if isChan }}if {{var "v"}} == nil {
- {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- {{var "v"}} = make({{ .CTyp }}, {{var "rl"}})
- {{var "c"}} = true
- }
- for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ {
- {{var "h"}}.ElemContainerState({{var "r"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- }
- {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}}
- var {{var "rt"}} bool {{/* truncated */}}
- _, _ = {{var "rl"}}, {{var "rt"}}
- {{var "rr"}} = {{var "l"}} // len({{var "v"}})
- if {{var "l"}} > cap({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}})
- {{ else }}{{if not .Immutable }}
- {{var "rg"}} := len({{var "v"}}) > 0
- {{var "v2"}} := {{var "v"}} {{end}}
- {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }})
- if {{var "rt"}} {
- if {{var "rl"}} <= cap({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "rl"}}]
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- } else {
- {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}})
- }
- {{var "c"}} = true
- {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }}
- if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}}
- } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "l"}}]
- {{var "c"}} = true
- } {{end}} {{/* end isSlice:47 */}}
- {{var "j"}} := 0
- for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "h"}}.ElemContainerState({{var "j"}})
- z.DecSwallow()
- }
- {{ else }}if {{var "rt"}} {
- for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ {
- {{var "v"}} = append({{var "v"}}, {{ zero}})
- {{var "h"}}.ElemContainerState({{var "j"}})
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- }
- } {{end}} {{/* end isArray:56 */}}
- {{end}} {{/* end isChan:16 */}}
-} else { {{/* len < 0 */}}
- {{var "j"}} := 0
- for ; !r.CheckBreak(); {{var "j"}}++ {
- {{if isChan }}
- {{var "h"}}.ElemContainerState({{var "j"}})
- var {{var "t"}} {{ .Typ }}
- {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }}
- {{var "v"}} <- {{var "t"}}
- {{ else }}
- if {{var "j"}} >= len({{var "v"}}) {
- {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1)
- {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }}
- {{var "c"}} = true {{end}}
- }
- {{var "h"}}.ElemContainerState({{var "j"}})
- if {{var "j"}} < len({{var "v"}}) {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
- } else {
- z.DecSwallow()
- }
- {{end}}
- }
- {{if isSlice }}if {{var "j"}} < len({{var "v"}}) {
- {{var "v"}} = {{var "v"}}[:{{var "j"}}]
- {{var "c"}} = true
- } else if {{var "j"}} == 0 && {{var "v"}} == nil {
- {{var "v"}} = []{{ .Typ }}{}
- {{var "c"}} = true
- }{{end}}
-}
-{{var "h"}}.End()
-{{if not isArray }}if {{var "c"}} {
- *{{ .Varname }} = {{var "v"}}
-}{{end}}
-`
-
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.go
deleted file mode 100644
index c4944dbff..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen.go
+++ /dev/null
@@ -1,2014 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "bytes"
- "encoding/base64"
- "errors"
- "fmt"
- "go/format"
- "io"
- "io/ioutil"
- "math/rand"
- "reflect"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "sync"
- "text/template"
- "time"
- "unicode"
- "unicode/utf8"
-)
-
-// ---------------------------------------------------
-// codecgen supports the full cycle of reflection-based codec:
-// - RawExt
-// - Raw
-// - Builtins
-// - Extensions
-// - (Binary|Text|JSON)(Unm|M)arshal
-// - generic by-kind
-//
-// This means that, for dynamic things, we MUST use reflection to at least get the reflect.Type.
-// In those areas, we try to only do reflection or interface-conversion when NECESSARY:
-// - Extensions, only if Extensions are configured.
-//
-// However, codecgen doesn't support the following:
-// - Canonical option. (codecgen IGNORES it currently)
-// This is just because it has not been implemented.
-//
-// During encode/decode, Selfer takes precedence.
-// A type implementing Selfer will know how to encode/decode itself statically.
-//
-// The following field types are supported:
-// array: [n]T
-// slice: []T
-// map: map[K]V
-// primitive: [u]int[n], float(32|64), bool, string
-// struct
-//
-// ---------------------------------------------------
-// Note that a Selfer cannot call (e|d).(En|De)code on itself,
-// as this will cause a circular reference, as (En|De)code will call Selfer methods.
-// Any type that implements Selfer must implement completely and not fallback to (En|De)code.
-//
-// In addition, code in this file manages the generation of fast-path implementations of
-// encode/decode of slices/maps of primitive keys/values.
-//
-// Users MUST re-generate their implementations whenever the code shape changes.
-// The generated code will panic if it was generated with a version older than the supporting library.
-// ---------------------------------------------------
-//
-// codec framework is very feature rich.
-// When encoding or decoding into an interface, it depends on the runtime type of the interface.
-// The type of the interface may be a named type, an extension, etc.
-// Consequently, we fallback to runtime codec for encoding/decoding interfaces.
-// In addition, we fallback for any value which cannot be guaranteed at runtime.
-// This allows us support ANY value, including any named types, specifically those which
-// do not implement our interfaces (e.g. Selfer).
-//
-// This explains some slowness compared to other code generation codecs (e.g. msgp).
-// This reduction in speed is only seen when your refers to interfaces,
-// e.g. type T struct { A interface{}; B []interface{}; C map[string]interface{} }
-//
-// codecgen will panic if the file was generated with an old version of the library in use.
-//
-// Note:
-// It was a conscious decision to have gen.go always explicitly call EncodeNil or TryDecodeAsNil.
-// This way, there isn't a function call overhead just to see that we should not enter a block of code.
-
-// GenVersion is the current version of codecgen.
-//
-// NOTE: Increment this value each time codecgen changes fundamentally.
-// Fundamental changes are:
-// - helper methods change (signature change, new ones added, some removed, etc)
-// - codecgen command line changes
-//
-// v1: Initial Version
-// v2:
-// v3: Changes for Kubernetes:
-// changes in signature of some unpublished helper methods and codecgen cmdline arguments.
-// v4: Removed separator support from (en|de)cDriver, and refactored codec(gen)
-// v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections.
-const GenVersion = 5
-
-const (
- genCodecPkg = "codec1978"
- genTempVarPfx = "yy"
- genTopLevelVarName = "x"
-
- // ignore canBeNil parameter, and always set to true.
- // This is because nil can appear anywhere, so we should always check.
- genAnythingCanBeNil = true
-
- // if genUseOneFunctionForDecStructMap, make a single codecDecodeSelferFromMap function;
- // else make codecDecodeSelferFromMap{LenPrefix,CheckBreak} so that conditionals
- // are not executed a lot.
- //
- // From testing, it didn't make much difference in runtime, so keep as true (one function only)
- genUseOneFunctionForDecStructMap = true
-)
-
-type genStructMapStyle uint8
-
-const (
- genStructMapStyleConsolidated genStructMapStyle = iota
- genStructMapStyleLenPrefix
- genStructMapStyleCheckBreak
-)
-
-var (
- genAllTypesSamePkgErr = errors.New("All types must be in the same package")
- genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice")
- genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__")
- genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`)
- genCheckVendor bool
-)
-
-// genRunner holds some state used during a Gen run.
-type genRunner struct {
- w io.Writer // output
- c uint64 // counter used for generating varsfx
- t []reflect.Type // list of types to run selfer on
-
- tc reflect.Type // currently running selfer on this type
- te map[uintptr]bool // types for which the encoder has been created
- td map[uintptr]bool // types for which the decoder has been created
- cp string // codec import path
-
- im map[string]reflect.Type // imports to add
- imn map[string]string // package names of imports to add
- imc uint64 // counter for import numbers
-
- is map[reflect.Type]struct{} // types seen during import search
- bp string // base PkgPath, for which we are generating for
-
- cpfx string // codec package prefix
- unsafe bool // is unsafe to be used in generated code?
-
- tm map[reflect.Type]struct{} // types for which enc/dec must be generated
- ts []reflect.Type // types for which enc/dec must be generated
-
- xs string // top level variable/constant suffix
- hn string // fn helper type name
-
- ti *TypeInfos
- // rr *rand.Rand // random generator for file-specific types
-}
-
-// Gen will write a complete go file containing Selfer implementations for each
-// type passed. All the types must be in the same package.
-//
-// Library users: *DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.*
-func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeInfos, typ ...reflect.Type) {
- // All types passed to this method do not have a codec.Selfer method implemented directly.
- // codecgen already checks the AST and skips any types that define the codec.Selfer methods.
- // Consequently, there's no need to check and trim them if they implement codec.Selfer
-
- if len(typ) == 0 {
- return
- }
- x := genRunner{
- unsafe: useUnsafe,
- w: w,
- t: typ,
- te: make(map[uintptr]bool),
- td: make(map[uintptr]bool),
- im: make(map[string]reflect.Type),
- imn: make(map[string]string),
- is: make(map[reflect.Type]struct{}),
- tm: make(map[reflect.Type]struct{}),
- ts: []reflect.Type{},
- bp: genImportPath(typ[0]),
- xs: uid,
- ti: ti,
- }
- if x.ti == nil {
- x.ti = defTypeInfos
- }
- if x.xs == "" {
- rr := rand.New(rand.NewSource(time.Now().UnixNano()))
- x.xs = strconv.FormatInt(rr.Int63n(9999), 10)
- }
-
- // gather imports first:
- x.cp = genImportPath(reflect.TypeOf(x))
- x.imn[x.cp] = genCodecPkg
- for _, t := range typ {
- // fmt.Printf("###########: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name())
- if genImportPath(t) != x.bp {
- panic(genAllTypesSamePkgErr)
- }
- x.genRefPkgs(t)
- }
- if buildTags != "" {
- x.line("// +build " + buildTags)
- x.line("")
- }
- x.line(`
-
-// ************************************************************
-// DO NOT EDIT.
-// THIS FILE IS AUTO-GENERATED BY codecgen.
-// ************************************************************
-
-`)
- x.line("package " + pkgName)
- x.line("")
- x.line("import (")
- if x.cp != x.bp {
- x.cpfx = genCodecPkg + "."
- x.linef("%s \"%s\"", genCodecPkg, x.cp)
- }
- // use a sorted set of im keys, so that we can get consistent output
- imKeys := make([]string, 0, len(x.im))
- for k, _ := range x.im {
- imKeys = append(imKeys, k)
- }
- sort.Strings(imKeys)
- for _, k := range imKeys { // for k, _ := range x.im {
- x.linef("%s \"%s\"", x.imn[k], k)
- }
- // add required packages
- for _, k := range [...]string{"reflect", "unsafe", "runtime", "fmt", "errors"} {
- if _, ok := x.im[k]; !ok {
- if k == "unsafe" && !x.unsafe {
- continue
- }
- x.line("\"" + k + "\"")
- }
- }
- x.line(")")
- x.line("")
-
- x.line("const (")
- x.linef("// ----- content types ----")
- x.linef("codecSelferC_UTF8%s = %v", x.xs, int64(c_UTF8))
- x.linef("codecSelferC_RAW%s = %v", x.xs, int64(c_RAW))
- x.linef("// ----- value types used ----")
- x.linef("codecSelferValueTypeArray%s = %v", x.xs, int64(valueTypeArray))
- x.linef("codecSelferValueTypeMap%s = %v", x.xs, int64(valueTypeMap))
- x.linef("// ----- containerStateValues ----")
- x.linef("codecSelfer_containerMapKey%s = %v", x.xs, int64(containerMapKey))
- x.linef("codecSelfer_containerMapValue%s = %v", x.xs, int64(containerMapValue))
- x.linef("codecSelfer_containerMapEnd%s = %v", x.xs, int64(containerMapEnd))
- x.linef("codecSelfer_containerArrayElem%s = %v", x.xs, int64(containerArrayElem))
- x.linef("codecSelfer_containerArrayEnd%s = %v", x.xs, int64(containerArrayEnd))
- x.line(")")
- x.line("var (")
- x.line("codecSelferBitsize" + x.xs + " = uint8(reflect.TypeOf(uint(0)).Bits())")
- x.line("codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)")
- x.line(")")
- x.line("")
-
- if x.unsafe {
- x.line("type codecSelferUnsafeString" + x.xs + " struct { Data uintptr; Len int}")
- x.line("")
- }
- x.hn = "codecSelfer" + x.xs
- x.line("type " + x.hn + " struct{}")
- x.line("")
-
- x.varsfxreset()
- x.line("func init() {")
- x.linef("if %sGenVersion != %v {", x.cpfx, GenVersion)
- x.line("_, file, _, _ := runtime.Caller(0)")
- x.line(`err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `)
- x.linef(`%v, %sGenVersion, file)`, GenVersion, x.cpfx)
- x.line("panic(err)")
- x.linef("}")
- x.line("if false { // reference the types, but skip this branch at build/run time")
- var n int
- // for k, t := range x.im {
- for _, k := range imKeys {
- t := x.im[k]
- x.linef("var v%v %s.%s", n, x.imn[k], t.Name())
- n++
- }
- if x.unsafe {
- x.linef("var v%v unsafe.Pointer", n)
- n++
- }
- if n > 0 {
- x.out("_")
- for i := 1; i < n; i++ {
- x.out(", _")
- }
- x.out(" = v0")
- for i := 1; i < n; i++ {
- x.outf(", v%v", i)
- }
- }
- x.line("} ") // close if false
- x.line("}") // close init
- x.line("")
-
- // generate rest of type info
- for _, t := range typ {
- x.tc = t
- x.selfer(true)
- x.selfer(false)
- }
-
- for _, t := range x.ts {
- rtid := reflect.ValueOf(t).Pointer()
- // generate enc functions for all these slice/map types.
- x.varsfxreset()
- x.linef("func (x %s) enc%s(v %s%s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), x.cpfx)
- x.genRequiredMethodVars(true)
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- x.encListFallback("v", t)
- case reflect.Map:
- x.encMapFallback("v", t)
- default:
- panic(genExpectArrayOrMapErr)
- }
- x.line("}")
- x.line("")
-
- // generate dec functions for all these slice/map types.
- x.varsfxreset()
- x.linef("func (x %s) dec%s(v *%s, d *%sDecoder) {", x.hn, x.genMethodNameT(t), x.genTypeName(t), x.cpfx)
- x.genRequiredMethodVars(false)
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- x.decListFallback("v", rtid, t)
- case reflect.Map:
- x.decMapFallback("v", rtid, t)
- default:
- panic(genExpectArrayOrMapErr)
- }
- x.line("}")
- x.line("")
- }
-
- x.line("")
-}
-
-func (x *genRunner) checkForSelfer(t reflect.Type, varname string) bool {
- // return varname != genTopLevelVarName && t != x.tc
- // the only time we checkForSelfer is if we are not at the TOP of the generated code.
- return varname != genTopLevelVarName
-}
-
-func (x *genRunner) arr2str(t reflect.Type, s string) string {
- if t.Kind() == reflect.Array {
- return s
- }
- return ""
-}
-
-func (x *genRunner) genRequiredMethodVars(encode bool) {
- x.line("var h " + x.hn)
- if encode {
- x.line("z, r := " + x.cpfx + "GenHelperEncoder(e)")
- } else {
- x.line("z, r := " + x.cpfx + "GenHelperDecoder(d)")
- }
- x.line("_, _, _ = h, z, r")
-}
-
-func (x *genRunner) genRefPkgs(t reflect.Type) {
- if _, ok := x.is[t]; ok {
- return
- }
- // fmt.Printf(">>>>>>: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name())
- x.is[t] = struct{}{}
- tpkg, tname := genImportPath(t), t.Name()
- if tpkg != "" && tpkg != x.bp && tpkg != x.cp && tname != "" && tname[0] >= 'A' && tname[0] <= 'Z' {
- if _, ok := x.im[tpkg]; !ok {
- x.im[tpkg] = t
- if idx := strings.LastIndex(tpkg, "/"); idx < 0 {
- x.imn[tpkg] = tpkg
- } else {
- x.imc++
- x.imn[tpkg] = "pkg" + strconv.FormatUint(x.imc, 10) + "_" + genGoIdentifier(tpkg[idx+1:], false)
- }
- }
- }
- switch t.Kind() {
- case reflect.Array, reflect.Slice, reflect.Ptr, reflect.Chan:
- x.genRefPkgs(t.Elem())
- case reflect.Map:
- x.genRefPkgs(t.Elem())
- x.genRefPkgs(t.Key())
- case reflect.Struct:
- for i := 0; i < t.NumField(); i++ {
- if fname := t.Field(i).Name; fname != "" && fname[0] >= 'A' && fname[0] <= 'Z' {
- x.genRefPkgs(t.Field(i).Type)
- }
- }
- }
-}
-
-func (x *genRunner) line(s string) {
- x.out(s)
- if len(s) == 0 || s[len(s)-1] != '\n' {
- x.out("\n")
- }
-}
-
-func (x *genRunner) varsfx() string {
- x.c++
- return strconv.FormatUint(x.c, 10)
-}
-
-func (x *genRunner) varsfxreset() {
- x.c = 0
-}
-
-func (x *genRunner) out(s string) {
- if _, err := io.WriteString(x.w, s); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) linef(s string, params ...interface{}) {
- x.line(fmt.Sprintf(s, params...))
-}
-
-func (x *genRunner) outf(s string, params ...interface{}) {
- x.out(fmt.Sprintf(s, params...))
-}
-
-func (x *genRunner) genTypeName(t reflect.Type) (n string) {
- // defer func() { fmt.Printf(">>>> ####: genTypeName: t: %v, name: '%s'\n", t, n) }()
-
- // if the type has a PkgPath, which doesn't match the current package,
- // then include it.
- // We cannot depend on t.String() because it includes current package,
- // or t.PkgPath because it includes full import path,
- //
- var ptrPfx string
- for t.Kind() == reflect.Ptr {
- ptrPfx += "*"
- t = t.Elem()
- }
- if tn := t.Name(); tn != "" {
- return ptrPfx + x.genTypeNamePrim(t)
- }
- switch t.Kind() {
- case reflect.Map:
- return ptrPfx + "map[" + x.genTypeName(t.Key()) + "]" + x.genTypeName(t.Elem())
- case reflect.Slice:
- return ptrPfx + "[]" + x.genTypeName(t.Elem())
- case reflect.Array:
- return ptrPfx + "[" + strconv.FormatInt(int64(t.Len()), 10) + "]" + x.genTypeName(t.Elem())
- case reflect.Chan:
- return ptrPfx + t.ChanDir().String() + " " + x.genTypeName(t.Elem())
- default:
- if t == intfTyp {
- return ptrPfx + "interface{}"
- } else {
- return ptrPfx + x.genTypeNamePrim(t)
- }
- }
-}
-
-func (x *genRunner) genTypeNamePrim(t reflect.Type) (n string) {
- if t.Name() == "" {
- return t.String()
- } else if genImportPath(t) == "" || genImportPath(t) == genImportPath(x.tc) {
- return t.Name()
- } else {
- return x.imn[genImportPath(t)] + "." + t.Name()
- // return t.String() // best way to get the package name inclusive
- }
-}
-
-func (x *genRunner) genZeroValueR(t reflect.Type) string {
- // if t is a named type, w
- switch t.Kind() {
- case reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func,
- reflect.Slice, reflect.Map, reflect.Invalid:
- return "nil"
- case reflect.Bool:
- return "false"
- case reflect.String:
- return `""`
- case reflect.Struct, reflect.Array:
- return x.genTypeName(t) + "{}"
- default: // all numbers
- return "0"
- }
-}
-
-func (x *genRunner) genMethodNameT(t reflect.Type) (s string) {
- return genMethodNameT(t, x.tc)
-}
-
-func (x *genRunner) selfer(encode bool) {
- t := x.tc
- t0 := t
- // always make decode use a pointer receiver,
- // and structs always use a ptr receiver (encode|decode)
- isptr := !encode || t.Kind() == reflect.Struct
- x.varsfxreset()
- fnSigPfx := "func (x "
- if isptr {
- fnSigPfx += "*"
- }
- fnSigPfx += x.genTypeName(t)
-
- x.out(fnSigPfx)
- if isptr {
- t = reflect.PtrTo(t)
- }
- if encode {
- x.line(") CodecEncodeSelf(e *" + x.cpfx + "Encoder) {")
- x.genRequiredMethodVars(true)
- // x.enc(genTopLevelVarName, t)
- x.encVar(genTopLevelVarName, t)
- } else {
- x.line(") CodecDecodeSelf(d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- // do not use decVar, as there is no need to check TryDecodeAsNil
- // or way to elegantly handle that, and also setting it to a
- // non-nil value doesn't affect the pointer passed.
- // x.decVar(genTopLevelVarName, t, false)
- x.dec(genTopLevelVarName, t0)
- }
- x.line("}")
- x.line("")
-
- if encode || t0.Kind() != reflect.Struct {
- return
- }
-
- // write is containerMap
- if genUseOneFunctionForDecStructMap {
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMap(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleConsolidated)
- x.line("}")
- x.line("")
- } else {
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMapLenPrefix(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleLenPrefix)
- x.line("}")
- x.line("")
-
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromMapCheckBreak(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleCheckBreak)
- x.line("}")
- x.line("")
- }
-
- // write containerArray
- x.out(fnSigPfx)
- x.line(") codecDecodeSelfFromArray(l int, d *" + x.cpfx + "Decoder) {")
- x.genRequiredMethodVars(false)
- x.decStructArray(genTopLevelVarName, "l", "return", reflect.ValueOf(t0).Pointer(), t0)
- x.line("}")
- x.line("")
-
-}
-
-// used for chan, array, slice, map
-func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) {
- if encode {
- x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname)
- } else {
- x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname)
- }
- x.registerXtraT(t)
-}
-
-func (x *genRunner) registerXtraT(t reflect.Type) {
- // recursively register the types
- if _, ok := x.tm[t]; ok {
- return
- }
- var tkey reflect.Type
- switch t.Kind() {
- case reflect.Chan, reflect.Slice, reflect.Array:
- case reflect.Map:
- tkey = t.Key()
- default:
- return
- }
- x.tm[t] = struct{}{}
- x.ts = append(x.ts, t)
- // check if this refers to any xtra types eg. a slice of array: add the array
- x.registerXtraT(t.Elem())
- if tkey != nil {
- x.registerXtraT(tkey)
- }
-}
-
-// encVar will encode a variable.
-// The parameter, t, is the reflect.Type of the variable itself
-func (x *genRunner) encVar(varname string, t reflect.Type) {
- // fmt.Printf(">>>>>> varname: %s, t: %v\n", varname, t)
- var checkNil bool
- switch t.Kind() {
- case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan:
- checkNil = true
- }
- if checkNil {
- x.linef("if %s == nil { r.EncodeNil() } else { ", varname)
- }
- switch t.Kind() {
- case reflect.Ptr:
- switch t.Elem().Kind() {
- case reflect.Struct, reflect.Array:
- x.enc(varname, genNonPtr(t))
- default:
- i := x.varsfx()
- x.line(genTempVarPfx + i + " := *" + varname)
- x.enc(genTempVarPfx+i, genNonPtr(t))
- }
- case reflect.Struct, reflect.Array:
- i := x.varsfx()
- x.line(genTempVarPfx + i + " := &" + varname)
- x.enc(genTempVarPfx+i, t)
- default:
- x.enc(varname, t)
- }
-
- if checkNil {
- x.line("}")
- }
-
-}
-
-// enc will encode a variable (varname) of type t,
-// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type ptrTo(T) (to prevent copying)
-func (x *genRunner) enc(varname string, t reflect.Type) {
- rtid := reflect.ValueOf(t).Pointer()
- // We call CodecEncodeSelf if one of the following are honored:
- // - the type already implements Selfer, call that
- // - the type has a Selfer implementation just created, use that
- // - the type is in the list of the ones we will generate for, but it is not currently being generated
-
- mi := x.varsfx()
- tptr := reflect.PtrTo(t)
- tk := t.Kind()
- if x.checkForSelfer(t, varname) {
- if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T
- if tptr.Implements(selferTyp) || t.Implements(selferTyp) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- } else { // varname is of type T
- if t.Implements(selferTyp) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- } else if tptr.Implements(selferTyp) {
- x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname)
- x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi)
- return
- }
- }
-
- if _, ok := x.te[rtid]; ok {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- }
-
- inlist := false
- for _, t0 := range x.t {
- if t == t0 {
- inlist = true
- if x.checkForSelfer(t, varname) {
- x.line(varname + ".CodecEncodeSelf(e)")
- return
- }
- break
- }
- }
-
- var rtidAdded bool
- if t == x.tc {
- x.te[rtid] = true
- rtidAdded = true
- }
-
- // check if
- // - type is RawExt, Raw
- // - the type implements (Text|JSON|Binary)(Unm|M)arshal
- x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi)
- x.linef("_ = %sm%s", genTempVarPfx, mi)
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
-
- if t == rawTyp {
- x.linef("} else { z.EncRaw(%v)", varname)
- return
- }
- if t == rawExtTyp {
- x.linef("} else { r.EncodeRawExt(%v, e)", varname)
- return
- }
- // HACK: Support for Builtins.
- // Currently, only Binc supports builtins, and the only builtin type is time.Time.
- // Have a method that returns the rtid for time.Time if Handle is Binc.
- if t == timeTyp {
- vrtid := genTempVarPfx + "m" + x.varsfx()
- x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid)
- x.linef("r.EncodeBuiltin(%s, %s)", vrtid, varname)
- }
- // only check for extensions if the type is named, and has a packagePath.
- if genImportPath(t) != "" && t.Name() != "" {
- // first check if extensions are configued, before doing the interface conversion
- x.linef("} else if z.HasExtensions() && z.EncExt(%s) {", varname)
- }
- if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T
- if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname)
- }
- } else { // varname is of type T
- if t.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if %sm%s { z.EncBinaryMarshal(&%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", genTempVarPfx, mi, varname)
- } else if t.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname)
- } else if tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !%sm%s { z.EncTextMarshal(&%v) ", genTempVarPfx, mi, varname)
- }
- }
- x.line("} else {")
-
- switch t.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x.line("r.EncodeInt(int64(" + varname + "))")
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x.line("r.EncodeUint(uint64(" + varname + "))")
- case reflect.Float32:
- x.line("r.EncodeFloat32(float32(" + varname + "))")
- case reflect.Float64:
- x.line("r.EncodeFloat64(float64(" + varname + "))")
- case reflect.Bool:
- x.line("r.EncodeBool(bool(" + varname + "))")
- case reflect.String:
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(" + varname + "))")
- case reflect.Chan:
- x.xtraSM(varname, true, t)
- // x.encListFallback(varname, rtid, t)
- case reflect.Array:
- x.xtraSM(varname, true, t)
- case reflect.Slice:
- // if nil, call dedicated function
- // if a []uint8, call dedicated function
- // if a known fastpath slice, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if rtid == uint8SliceTypId {
- x.line("r.EncodeStringBytes(codecSelferC_RAW" + x.xs + ", []byte(" + varname + "))")
- } else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)")
- } else {
- x.xtraSM(varname, true, t)
- // x.encListFallback(varname, rtid, t)
- }
- case reflect.Map:
- // if nil, call dedicated function
- // if a known fastpath map, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- // x.line("if " + varname + " == nil { \nr.EncodeNil()\n } else { ")
- if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)")
- } else {
- x.xtraSM(varname, true, t)
- // x.encMapFallback(varname, rtid, t)
- }
- case reflect.Struct:
- if !inlist {
- delete(x.te, rtid)
- x.line("z.EncFallback(" + varname + ")")
- break
- }
- x.encStruct(varname, rtid, t)
- default:
- if rtidAdded {
- delete(x.te, rtid)
- }
- x.line("z.EncFallback(" + varname + ")")
- }
-}
-
-func (x *genRunner) encZero(t reflect.Type) {
- switch t.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x.line("r.EncodeInt(0)")
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x.line("r.EncodeUint(0)")
- case reflect.Float32:
- x.line("r.EncodeFloat32(0)")
- case reflect.Float64:
- x.line("r.EncodeFloat64(0)")
- case reflect.Bool:
- x.line("r.EncodeBool(false)")
- case reflect.String:
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + `, "")`)
- default:
- x.line("r.EncodeNil()")
- }
-}
-
-func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
- // Use knowledge from structfieldinfo (mbs, encodable fields. Ignore omitempty. )
- // replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it
-
- // if t === type currently running selfer on, do for all
- ti := x.ti.get(rtid, t)
- i := x.varsfx()
- sepVarname := genTempVarPfx + "sep" + i
- numfieldsvar := genTempVarPfx + "q" + i
- ti2arrayvar := genTempVarPfx + "r" + i
- struct2arrvar := genTempVarPfx + "2arr" + i
-
- x.line(sepVarname + " := !z.EncBinary()")
- x.linef("%s := z.EncBasicHandle().StructToArray", struct2arrvar)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- // due to omitEmpty, we need to calculate the
- // number of non-empty things we write out first.
- // This is required as we need to pre-determine the size of the container,
- // to support length-prefixing.
- x.linef("var %s [%v]bool", numfieldsvar, len(tisfi))
- x.linef("_, _, _ = %s, %s, %s", sepVarname, numfieldsvar, struct2arrvar)
- x.linef("const %s bool = %v", ti2arrayvar, ti.toArray)
- nn := 0
- for j, si := range tisfi {
- if !si.omitEmpty {
- nn++
- continue
- }
- var t2 reflect.StructField
- var omitline string
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- omitline += varname3 + " != nil && "
- }
- }
- }
- // never check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc.
- // also, for maps/slices/arrays, check if len ! 0 (not if == zero value)
- switch t2.Type.Kind() {
- case reflect.Struct:
- omitline += " true"
- case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan:
- omitline += "len(" + varname + "." + t2.Name + ") != 0"
- default:
- omitline += varname + "." + t2.Name + " != " + x.genZeroValueR(t2.Type)
- }
- x.linef("%s[%v] = %s", numfieldsvar, j, omitline)
- }
- x.linef("var %snn%s int", genTempVarPfx, i)
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.line("r.EncodeArrayStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")")
- x.linef("} else {") // if not ti.toArray
- x.linef("%snn%s = %v", genTempVarPfx, i, nn)
- x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i)
- x.linef("r.EncodeMapStart(%snn%s)", genTempVarPfx, i)
- x.linef("%snn%s = %v", genTempVarPfx, i, 0)
- // x.line("r.EncodeMapStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")")
- x.line("}") // close if not StructToArray
-
- for j, si := range tisfi {
- i := x.varsfx()
- isNilVarName := genTempVarPfx + "n" + i
- var labelUsed bool
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- // fmt.Printf("%%%% %v, ix: %v\n", t2typ, ix)
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- if !labelUsed {
- x.line("var " + isNilVarName + " bool")
- }
- x.line("if " + varname3 + " == nil { " + isNilVarName + " = true ")
- x.line("goto LABEL" + i)
- x.line("}")
- labelUsed = true
- // "varname3 = new(" + x.genTypeName(t3.Elem()) + ") }")
- }
- }
- // t2 = t.FieldByIndex(si.is)
- }
- if labelUsed {
- x.line("LABEL" + i + ":")
- }
- // if the type of the field is a Selfer, or one of the ones
-
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray
- if labelUsed {
- x.line("if " + isNilVarName + " { r.EncodeNil() } else { ")
- }
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- if si.omitEmpty {
- x.linef("if %s[%v] {", numfieldsvar, j)
- }
- x.encVar(varname+"."+t2.Name, t2.Type)
- if si.omitEmpty {
- x.linef("} else {")
- x.encZero(t2.Type)
- x.linef("}")
- }
- if labelUsed {
- x.line("}")
- }
-
- x.linef("} else {") // if not ti.toArray
-
- if si.omitEmpty {
- x.linef("if %s[%v] {", numfieldsvar, j)
- }
- x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + si.encName + "\"))")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- if labelUsed {
- x.line("if " + isNilVarName + " { r.EncodeNil() } else { ")
- x.encVar(varname+"."+t2.Name, t2.Type)
- x.line("}")
- } else {
- x.encVar(varname+"."+t2.Name, t2.Type)
- }
- if si.omitEmpty {
- x.line("}")
- }
- x.linef("} ") // end if/else ti.toArray
- }
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
- x.line("} else {")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
- x.line("}")
-
-}
-
-func (x *genRunner) encListFallback(varname string, t reflect.Type) {
- if t.AssignableTo(uint8SliceTyp) {
- x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, []byte(%s))", x.xs, varname)
- return
- }
- if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 {
- x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, ([%v]byte(%s))[:])", x.xs, t.Len(), varname)
- return
- }
- i := x.varsfx()
- g := genTempVarPfx
- x.line("r.EncodeArrayStart(len(" + varname + "))")
- if t.Kind() == reflect.Chan {
- x.linef("for %si%s, %si2%s := 0, len(%s); %si%s < %si2%s; %si%s++ {", g, i, g, i, varname, g, i, g, i, g, i)
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.linef("%sv%s := <-%s", g, i, varname)
- } else {
- // x.linef("for %si%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname)
- x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname)
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- }
- x.encVar(genTempVarPfx+"v"+i, t.Elem())
- x.line("}")
- x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
-}
-
-func (x *genRunner) encMapFallback(varname string, t reflect.Type) {
- // TODO: expand this to handle canonical.
- i := x.varsfx()
- x.line("r.EncodeMapStart(len(" + varname + "))")
- x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname)
- // x.line("for " + genTempVarPfx + "k" + i + ", " + genTempVarPfx + "v" + i + " := range " + varname + " {")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.encVar(genTempVarPfx+"k"+i, t.Key())
- x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- x.encVar(genTempVarPfx+"v"+i, t.Elem())
- x.line("}")
- x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
-}
-
-func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) {
- // We only encode as nil if a nillable value.
- // This removes some of the wasted checks for TryDecodeAsNil.
- // We need to think about this more, to see what happens if omitempty, etc
- // cause a nil value to be stored when something is expected.
- // This could happen when decoding from a struct encoded as an array.
- // For that, decVar should be called with canNil=true, to force true as its value.
- i := x.varsfx()
- if !canBeNil {
- canBeNil = genAnythingCanBeNil || !genIsImmutable(t)
- }
- if canBeNil {
- x.line("if r.TryDecodeAsNil() {")
- if t.Kind() == reflect.Ptr {
- x.line("if " + varname + " != nil { ")
-
- // if varname is a field of a struct (has a dot in it),
- // then just set it to nil
- if strings.IndexByte(varname, '.') != -1 {
- x.line(varname + " = nil")
- } else {
- x.line("*" + varname + " = " + x.genZeroValueR(t.Elem()))
- }
- x.line("}")
- } else {
- x.line(varname + " = " + x.genZeroValueR(t))
- }
- x.line("} else {")
- } else {
- x.line("// cannot be nil")
- }
- if t.Kind() != reflect.Ptr {
- if x.decTryAssignPrimitive(varname, t) {
- x.line(genTempVarPfx + "v" + i + " := &" + varname)
- x.dec(genTempVarPfx+"v"+i, t)
- }
- } else {
- x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem()))
- // Ensure we set underlying ptr to a non-nil value (so we can deref to it later).
- // There's a chance of a **T in here which is nil.
- var ptrPfx string
- for t = t.Elem(); t.Kind() == reflect.Ptr; t = t.Elem() {
- ptrPfx += "*"
- x.linef("if %s%s == nil { %s%s = new(%s)}",
- ptrPfx, varname, ptrPfx, varname, x.genTypeName(t))
- }
- // if varname has [ in it, then create temp variable for this ptr thingie
- if strings.Index(varname, "[") >= 0 {
- varname2 := genTempVarPfx + "w" + i
- x.line(varname2 + " := " + varname)
- varname = varname2
- }
-
- if ptrPfx == "" {
- x.dec(varname, t)
- } else {
- x.line(genTempVarPfx + "z" + i + " := " + ptrPfx + varname)
- x.dec(genTempVarPfx+"z"+i, t)
- }
-
- }
-
- if canBeNil {
- x.line("} ")
- }
-}
-
-// dec will decode a variable (varname) of type ptrTo(t).
-// t is always a basetype (i.e. not of kind reflect.Ptr).
-func (x *genRunner) dec(varname string, t reflect.Type) {
- // assumptions:
- // - the varname is to a pointer already. No need to take address of it
- // - t is always a baseType T (not a *T, etc).
- rtid := reflect.ValueOf(t).Pointer()
- tptr := reflect.PtrTo(t)
- if x.checkForSelfer(t, varname) {
- if t.Implements(selferTyp) || tptr.Implements(selferTyp) {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- if _, ok := x.td[rtid]; ok {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- }
-
- inlist := false
- for _, t0 := range x.t {
- if t == t0 {
- inlist = true
- if x.checkForSelfer(t, varname) {
- x.line(varname + ".CodecDecodeSelf(d)")
- return
- }
- break
- }
- }
-
- var rtidAdded bool
- if t == x.tc {
- x.td[rtid] = true
- rtidAdded = true
- }
-
- // check if
- // - type is Raw, RawExt
- // - the type implements (Text|JSON|Binary)(Unm|M)arshal
- mi := x.varsfx()
- x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi)
- x.linef("_ = %sm%s", genTempVarPfx, mi)
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
-
- if t == rawTyp {
- x.linef("} else { *%v = z.DecRaw()", varname)
- return
- }
- if t == rawExtTyp {
- x.linef("} else { r.DecodeExt(%v, 0, nil)", varname)
- return
- }
-
- // HACK: Support for Builtins.
- // Currently, only Binc supports builtins, and the only builtin type is time.Time.
- // Have a method that returns the rtid for time.Time if Handle is Binc.
- if t == timeTyp {
- vrtid := genTempVarPfx + "m" + x.varsfx()
- x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid)
- x.linef("r.DecodeBuiltin(%s, %s)", vrtid, varname)
- }
- // only check for extensions if the type is named, and has a packagePath.
- if genImportPath(t) != "" && t.Name() != "" {
- // first check if extensions are configued, before doing the interface conversion
- x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname)
- }
-
- if t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) {
- x.linef("} else if %sm%s { z.DecBinaryUnmarshal(%v) ", genTempVarPfx, mi, varname)
- }
- if t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) {
- x.linef("} else if !%sm%s && z.IsJSONHandle() { z.DecJSONUnmarshal(%v)", genTempVarPfx, mi, varname)
- } else if t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) {
- x.linef("} else if !%sm%s { z.DecTextUnmarshal(%v)", genTempVarPfx, mi, varname)
- }
-
- x.line("} else {")
-
- // Since these are pointers, we cannot share, and have to use them one by one
- switch t.Kind() {
- case reflect.Int:
- x.line("*((*int)(" + varname + ")) = int(r.DecodeInt(codecSelferBitsize" + x.xs + "))")
- // x.line("z.DecInt((*int)(" + varname + "))")
- case reflect.Int8:
- x.line("*((*int8)(" + varname + ")) = int8(r.DecodeInt(8))")
- // x.line("z.DecInt8((*int8)(" + varname + "))")
- case reflect.Int16:
- x.line("*((*int16)(" + varname + ")) = int16(r.DecodeInt(16))")
- // x.line("z.DecInt16((*int16)(" + varname + "))")
- case reflect.Int32:
- x.line("*((*int32)(" + varname + ")) = int32(r.DecodeInt(32))")
- // x.line("z.DecInt32((*int32)(" + varname + "))")
- case reflect.Int64:
- x.line("*((*int64)(" + varname + ")) = int64(r.DecodeInt(64))")
- // x.line("z.DecInt64((*int64)(" + varname + "))")
-
- case reflect.Uint:
- x.line("*((*uint)(" + varname + ")) = uint(r.DecodeUint(codecSelferBitsize" + x.xs + "))")
- // x.line("z.DecUint((*uint)(" + varname + "))")
- case reflect.Uint8:
- x.line("*((*uint8)(" + varname + ")) = uint8(r.DecodeUint(8))")
- // x.line("z.DecUint8((*uint8)(" + varname + "))")
- case reflect.Uint16:
- x.line("*((*uint16)(" + varname + ")) = uint16(r.DecodeUint(16))")
- //x.line("z.DecUint16((*uint16)(" + varname + "))")
- case reflect.Uint32:
- x.line("*((*uint32)(" + varname + ")) = uint32(r.DecodeUint(32))")
- //x.line("z.DecUint32((*uint32)(" + varname + "))")
- case reflect.Uint64:
- x.line("*((*uint64)(" + varname + ")) = uint64(r.DecodeUint(64))")
- //x.line("z.DecUint64((*uint64)(" + varname + "))")
- case reflect.Uintptr:
- x.line("*((*uintptr)(" + varname + ")) = uintptr(r.DecodeUint(codecSelferBitsize" + x.xs + "))")
-
- case reflect.Float32:
- x.line("*((*float32)(" + varname + ")) = float32(r.DecodeFloat(true))")
- //x.line("z.DecFloat32((*float32)(" + varname + "))")
- case reflect.Float64:
- x.line("*((*float64)(" + varname + ")) = float64(r.DecodeFloat(false))")
- // x.line("z.DecFloat64((*float64)(" + varname + "))")
-
- case reflect.Bool:
- x.line("*((*bool)(" + varname + ")) = r.DecodeBool()")
- // x.line("z.DecBool((*bool)(" + varname + "))")
- case reflect.String:
- x.line("*((*string)(" + varname + ")) = r.DecodeString()")
- // x.line("z.DecString((*string)(" + varname + "))")
- case reflect.Array, reflect.Chan:
- x.xtraSM(varname, false, t)
- // x.decListFallback(varname, rtid, true, t)
- case reflect.Slice:
- // if a []uint8, call dedicated function
- // if a known fastpath slice, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if rtid == uint8SliceTypId {
- x.line("*" + varname + " = r.DecodeBytes(*(*[]byte)(" + varname + "), false, false)")
- } else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)")
- } else {
- x.xtraSM(varname, false, t)
- // x.decListFallback(varname, rtid, false, t)
- }
- case reflect.Map:
- // if a known fastpath map, call dedicated function
- // else write encode function in-line.
- // - if elements are primitives or Selfers, call dedicated function on each member.
- // - else call Encoder.encode(XXX) on it.
- if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
- x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)")
- } else {
- x.xtraSM(varname, false, t)
- // x.decMapFallback(varname, rtid, t)
- }
- case reflect.Struct:
- if inlist {
- x.decStruct(varname, rtid, t)
- } else {
- // delete(x.td, rtid)
- x.line("z.DecFallback(" + varname + ", false)")
- }
- default:
- if rtidAdded {
- delete(x.te, rtid)
- }
- x.line("z.DecFallback(" + varname + ", true)")
- }
-}
-
-func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type) (tryAsPtr bool) {
- // This should only be used for exact primitives (ie un-named types).
- // Named types may be implementations of Selfer, Unmarshaler, etc.
- // They should be handled by dec(...)
-
- if t.Name() != "" {
- tryAsPtr = true
- return
- }
-
- switch t.Kind() {
- case reflect.Int:
- x.linef("%s = r.DecodeInt(codecSelferBitsize%s)", varname, x.xs)
- case reflect.Int8:
- x.linef("%s = r.DecodeInt(8)", varname)
- case reflect.Int16:
- x.linef("%s = r.DecodeInt(16)", varname)
- case reflect.Int32:
- x.linef("%s = r.DecodeInt(32)", varname)
- case reflect.Int64:
- x.linef("%s = r.DecodeInt(64)", varname)
-
- case reflect.Uint:
- x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs)
- case reflect.Uint8:
- x.linef("%s = r.DecodeUint(8)", varname)
- case reflect.Uint16:
- x.linef("%s = r.DecodeUint(16)", varname)
- case reflect.Uint32:
- x.linef("%s = r.DecodeUint(32)", varname)
- case reflect.Uint64:
- x.linef("%s = r.DecodeUint(64)", varname)
- case reflect.Uintptr:
- x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs)
-
- case reflect.Float32:
- x.linef("%s = r.DecodeFloat(true)", varname)
- case reflect.Float64:
- x.linef("%s = r.DecodeFloat(false)", varname)
-
- case reflect.Bool:
- x.linef("%s = r.DecodeBool()", varname)
- case reflect.String:
- x.linef("%s = r.DecodeString()", varname)
- default:
- tryAsPtr = true
- }
- return
-}
-
-func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type) {
- if t.AssignableTo(uint8SliceTyp) {
- x.line("*" + varname + " = r.DecodeBytes(*((*[]byte)(" + varname + ")), false, false)")
- return
- }
- if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 {
- x.linef("r.DecodeBytes( ((*[%s]byte)(%s))[:], false, true)", t.Len(), varname)
- return
- }
- type tstruc struct {
- TempVar string
- Rand string
- Varname string
- CTyp string
- Typ string
- Immutable bool
- Size int
- }
- telem := t.Elem()
- ts := tstruc{genTempVarPfx, x.varsfx(), varname, x.genTypeName(t), x.genTypeName(telem), genIsImmutable(telem), int(telem.Size())}
-
- funcs := make(template.FuncMap)
-
- funcs["decLineVar"] = func(varname string) string {
- x.decVar(varname, telem, false)
- return ""
- }
- funcs["decLine"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false)
- return ""
- }
- funcs["var"] = func(s string) string {
- return ts.TempVar + s + ts.Rand
- }
- funcs["zero"] = func() string {
- return x.genZeroValueR(telem)
- }
- funcs["isArray"] = func() bool {
- return t.Kind() == reflect.Array
- }
- funcs["isSlice"] = func() bool {
- return t.Kind() == reflect.Slice
- }
- funcs["isChan"] = func() bool {
- return t.Kind() == reflect.Chan
- }
- tm, err := template.New("").Funcs(funcs).Parse(genDecListTmpl)
- if err != nil {
- panic(err)
- }
- if err = tm.Execute(x.w, &ts); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) {
- type tstruc struct {
- TempVar string
- Sfx string
- Rand string
- Varname string
- KTyp string
- Typ string
- Size int
- }
- telem := t.Elem()
- tkey := t.Key()
- ts := tstruc{
- genTempVarPfx, x.xs, x.varsfx(), varname, x.genTypeName(tkey),
- x.genTypeName(telem), int(telem.Size() + tkey.Size()),
- }
-
- funcs := make(template.FuncMap)
- funcs["decElemZero"] = func() string {
- return x.genZeroValueR(telem)
- }
- funcs["decElemKindImmutable"] = func() bool {
- return genIsImmutable(telem)
- }
- funcs["decElemKindPtr"] = func() bool {
- return telem.Kind() == reflect.Ptr
- }
- funcs["decElemKindIntf"] = func() bool {
- return telem.Kind() == reflect.Interface
- }
- funcs["decLineVarK"] = func(varname string) string {
- x.decVar(varname, tkey, false)
- return ""
- }
- funcs["decLineVar"] = func(varname string) string {
- x.decVar(varname, telem, false)
- return ""
- }
- funcs["decLineK"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(tkey), false)
- return ""
- }
- funcs["decLine"] = func(pfx string) string {
- x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false)
- return ""
- }
- funcs["var"] = func(s string) string {
- return ts.TempVar + s + ts.Rand
- }
-
- tm, err := template.New("").Funcs(funcs).Parse(genDecMapTmpl)
- if err != nil {
- panic(err)
- }
- if err = tm.Execute(x.w, &ts); err != nil {
- panic(err)
- }
-}
-
-func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) {
- ti := x.ti.get(rtid, t)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- x.line("switch (" + kName + ") {")
- for _, si := range tisfi {
- x.line("case \"" + si.encName + "\":")
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value.
- // t2 = t.FieldByIndex(si.is)
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem()))
- }
- }
- }
- x.decVar(varname+"."+t2.Name, t2.Type, false)
- }
- x.line("default:")
- // pass the slice here, so that the string will not escape, and maybe save allocation
- x.line("z.DecStructFieldNotFound(-1, " + kName + ")")
- x.line("} // end switch " + kName)
-}
-
-func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style genStructMapStyle) {
- tpfx := genTempVarPfx
- i := x.varsfx()
- kName := tpfx + "s" + i
-
- // We thought to use ReadStringAsBytes, as go compiler might optimize the copy out.
- // However, using that was more expensive, as it seems that the switch expression
- // is evaluated each time.
- //
- // We could depend on decodeString using a temporary/shared buffer internally.
- // However, this model of creating a byte array, and using explicitly is faster,
- // and allows optional use of unsafe []byte->string conversion without alloc.
-
- // Also, ensure that the slice array doesn't escape.
- // That will help escape analysis prevent allocation when it gets better.
-
- // x.line("var " + kName + "Arr = [32]byte{} // default string to decode into")
- // x.line("var " + kName + "Slc = " + kName + "Arr[:] // default slice to decode into")
- // use the scratch buffer to avoid allocation (most field names are < 32).
-
- x.line("var " + kName + "Slc = z.DecScratchBuffer() // default slice to decode into")
-
- x.line("_ = " + kName + "Slc")
- switch style {
- case genStructMapStyleLenPrefix:
- x.linef("for %sj%s := 0; %sj%s < %s; %sj%s++ {", tpfx, i, tpfx, i, lenvarname, tpfx, i)
- case genStructMapStyleCheckBreak:
- x.linef("for %sj%s := 0; !r.CheckBreak(); %sj%s++ {", tpfx, i, tpfx, i)
- default: // 0, otherwise.
- x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length
- x.linef("for %sj%s := 0; ; %sj%s++ {", tpfx, i, tpfx, i)
- x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname)
- x.line("} else { if r.CheckBreak() { break }; }")
- }
- x.linef("z.DecSendContainerState(codecSelfer_containerMapKey%s)", x.xs)
- x.line(kName + "Slc = r.DecodeBytes(" + kName + "Slc, true, true)")
- // let string be scoped to this loop alone, so it doesn't escape.
- if x.unsafe {
- x.line(kName + "SlcHdr := codecSelferUnsafeString" + x.xs + "{uintptr(unsafe.Pointer(&" +
- kName + "Slc[0])), len(" + kName + "Slc)}")
- x.line(kName + " := *(*string)(unsafe.Pointer(&" + kName + "SlcHdr))")
- } else {
- x.line(kName + " := string(" + kName + "Slc)")
- }
- x.linef("z.DecSendContainerState(codecSelfer_containerMapValue%s)", x.xs)
- x.decStructMapSwitch(kName, varname, rtid, t)
-
- x.line("} // end for " + tpfx + "j" + i)
- x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
-}
-
-func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) {
- tpfx := genTempVarPfx
- i := x.varsfx()
- ti := x.ti.get(rtid, t)
- tisfi := ti.sfip // always use sequence from file. decStruct expects same thing.
- x.linef("var %sj%s int", tpfx, i)
- x.linef("var %sb%s bool", tpfx, i) // break
- x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length
- for _, si := range tisfi {
- var t2 reflect.StructField
- if si.i != -1 {
- t2 = t.Field(int(si.i))
- } else {
- //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value.
- // t2 = t.FieldByIndex(si.is)
- t2typ := t
- varname3 := varname
- for _, ix := range si.is {
- for t2typ.Kind() == reflect.Ptr {
- t2typ = t2typ.Elem()
- }
- t2 = t2typ.Field(ix)
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
- if t2typ.Kind() == reflect.Ptr {
- x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem()))
- }
- }
- }
-
- x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }",
- tpfx, i, tpfx, i, tpfx, i,
- tpfx, i, lenvarname, tpfx, i)
- x.linef("if %sb%s { z.DecSendContainerState(codecSelfer_containerArrayEnd%s); %s }",
- tpfx, i, x.xs, breakString)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.decVar(varname+"."+t2.Name, t2.Type, true)
- }
- // read remaining values and throw away.
- x.line("for {")
- x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }",
- tpfx, i, tpfx, i, tpfx, i,
- tpfx, i, lenvarname, tpfx, i)
- x.linef("if %sb%s { break }", tpfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs)
- x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i)
- x.line("}")
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
-}
-
-func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
- // if container is map
- i := x.varsfx()
- x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i)
- x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()")
- x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs)
- if genUseOneFunctionForDecStructMap {
- x.line("} else { ")
- x.linef("x.codecDecodeSelfFromMap(%sl%s, d)", genTempVarPfx, i)
- } else {
- x.line("} else if " + genTempVarPfx + "l" + i + " > 0 { ")
- x.line("x.codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)")
- x.line("} else {")
- x.line("x.codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)")
- }
- x.line("}")
-
- // else if container is array
- x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()")
- x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs)
- x.line("} else { ")
- x.linef("x.codecDecodeSelfFromArray(%sl%s, d)", genTempVarPfx, i)
- x.line("}")
- // else panic
- x.line("} else { ")
- x.line("panic(codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + ")")
- x.line("} ")
-}
-
-// --------
-
-type genV struct {
- // genV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice
- MapKey string
- Elem string
- Primitive string
- Size int
-}
-
-func (x *genRunner) newGenV(t reflect.Type) (v genV) {
- switch t.Kind() {
- case reflect.Slice, reflect.Array:
- te := t.Elem()
- v.Elem = x.genTypeName(te)
- v.Size = int(te.Size())
- case reflect.Map:
- te, tk := t.Elem(), t.Key()
- v.Elem = x.genTypeName(te)
- v.MapKey = x.genTypeName(tk)
- v.Size = int(te.Size() + tk.Size())
- default:
- panic("unexpected type for newGenV. Requires map or slice type")
- }
- return
-}
-
-func (x *genV) MethodNamePfx(prefix string, prim bool) string {
- var name []byte
- if prefix != "" {
- name = append(name, prefix...)
- }
- if prim {
- name = append(name, genTitleCaseName(x.Primitive)...)
- } else {
- if x.MapKey == "" {
- name = append(name, "Slice"...)
- } else {
- name = append(name, "Map"...)
- name = append(name, genTitleCaseName(x.MapKey)...)
- }
- name = append(name, genTitleCaseName(x.Elem)...)
- }
- return string(name)
-
-}
-
-// genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise.
-//
-// This handles the misbehaviour that occurs when 1.5-style vendoring is enabled,
-// where PkgPath returns the full path, including the vendoring pre-fix that should have been stripped.
-// We strip it here.
-func genImportPath(t reflect.Type) (s string) {
- s = t.PkgPath()
- if genCheckVendor {
- // HACK: Misbehaviour occurs in go 1.5. May have to re-visit this later.
- // if s contains /vendor/ OR startsWith vendor/, then return everything after it.
- const vendorStart = "vendor/"
- const vendorInline = "/vendor/"
- if i := strings.LastIndex(s, vendorInline); i >= 0 {
- s = s[i+len(vendorInline):]
- } else if strings.HasPrefix(s, vendorStart) {
- s = s[len(vendorStart):]
- }
- }
- return
-}
-
-// A go identifier is (letter|_)[letter|number|_]*
-func genGoIdentifier(s string, checkFirstChar bool) string {
- b := make([]byte, 0, len(s))
- t := make([]byte, 4)
- var n int
- for i, r := range s {
- if checkFirstChar && i == 0 && !unicode.IsLetter(r) {
- b = append(b, '_')
- }
- // r must be unicode_letter, unicode_digit or _
- if unicode.IsLetter(r) || unicode.IsDigit(r) {
- n = utf8.EncodeRune(t, r)
- b = append(b, t[:n]...)
- } else {
- b = append(b, '_')
- }
- }
- return string(b)
-}
-
-func genNonPtr(t reflect.Type) reflect.Type {
- for t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- return t
-}
-
-func genTitleCaseName(s string) string {
- switch s {
- case "interface{}", "interface {}":
- return "Intf"
- default:
- return strings.ToUpper(s[0:1]) + s[1:]
- }
-}
-
-func genMethodNameT(t reflect.Type, tRef reflect.Type) (n string) {
- var ptrPfx string
- for t.Kind() == reflect.Ptr {
- ptrPfx += "Ptrto"
- t = t.Elem()
- }
- tstr := t.String()
- if tn := t.Name(); tn != "" {
- if tRef != nil && genImportPath(t) == genImportPath(tRef) {
- return ptrPfx + tn
- } else {
- if genQNameRegex.MatchString(tstr) {
- return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- }
- }
- switch t.Kind() {
- case reflect.Map:
- return ptrPfx + "Map" + genMethodNameT(t.Key(), tRef) + genMethodNameT(t.Elem(), tRef)
- case reflect.Slice:
- return ptrPfx + "Slice" + genMethodNameT(t.Elem(), tRef)
- case reflect.Array:
- return ptrPfx + "Array" + strconv.FormatInt(int64(t.Len()), 10) + genMethodNameT(t.Elem(), tRef)
- case reflect.Chan:
- var cx string
- switch t.ChanDir() {
- case reflect.SendDir:
- cx = "ChanSend"
- case reflect.RecvDir:
- cx = "ChanRecv"
- default:
- cx = "Chan"
- }
- return ptrPfx + cx + genMethodNameT(t.Elem(), tRef)
- default:
- if t == intfTyp {
- return ptrPfx + "Interface"
- } else {
- if tRef != nil && genImportPath(t) == genImportPath(tRef) {
- if t.Name() != "" {
- return ptrPfx + t.Name()
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- } else {
- // best way to get the package name inclusive
- // return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- // return ptrPfx + genBase64enc.EncodeToString([]byte(tstr))
- if t.Name() != "" && genQNameRegex.MatchString(tstr) {
- return ptrPfx + strings.Replace(tstr, ".", "_", 1000)
- } else {
- return ptrPfx + genCustomTypeName(tstr)
- }
- }
- }
- }
-}
-
-// genCustomNameForType base64encodes the t.String() value in such a way
-// that it can be used within a function name.
-func genCustomTypeName(tstr string) string {
- len2 := genBase64enc.EncodedLen(len(tstr))
- bufx := make([]byte, len2)
- genBase64enc.Encode(bufx, []byte(tstr))
- for i := len2 - 1; i >= 0; i-- {
- if bufx[i] == '=' {
- len2--
- } else {
- break
- }
- }
- return string(bufx[:len2])
-}
-
-func genIsImmutable(t reflect.Type) (v bool) {
- return isImmutableKind(t.Kind())
-}
-
-type genInternal struct {
- Values []genV
- Unsafe bool
-}
-
-func (x genInternal) FastpathLen() (l int) {
- for _, v := range x.Values {
- if v.Primitive == "" {
- l++
- }
- }
- return
-}
-
-func genInternalZeroValue(s string) string {
- switch s {
- case "interface{}", "interface {}":
- return "nil"
- case "bool":
- return "false"
- case "string":
- return `""`
- default:
- return "0"
- }
-}
-
-func genInternalEncCommandAsString(s string, vname string) string {
- switch s {
- case "uint", "uint8", "uint16", "uint32", "uint64":
- return "ee.EncodeUint(uint64(" + vname + "))"
- case "int", "int8", "int16", "int32", "int64":
- return "ee.EncodeInt(int64(" + vname + "))"
- case "string":
- return "ee.EncodeString(c_UTF8, " + vname + ")"
- case "float32":
- return "ee.EncodeFloat32(" + vname + ")"
- case "float64":
- return "ee.EncodeFloat64(" + vname + ")"
- case "bool":
- return "ee.EncodeBool(" + vname + ")"
- case "symbol":
- return "ee.EncodeSymbol(" + vname + ")"
- default:
- return "e.encode(" + vname + ")"
- }
-}
-
-func genInternalDecCommandAsString(s string) string {
- switch s {
- case "uint":
- return "uint(dd.DecodeUint(uintBitsize))"
- case "uint8":
- return "uint8(dd.DecodeUint(8))"
- case "uint16":
- return "uint16(dd.DecodeUint(16))"
- case "uint32":
- return "uint32(dd.DecodeUint(32))"
- case "uint64":
- return "dd.DecodeUint(64)"
- case "uintptr":
- return "uintptr(dd.DecodeUint(uintBitsize))"
- case "int":
- return "int(dd.DecodeInt(intBitsize))"
- case "int8":
- return "int8(dd.DecodeInt(8))"
- case "int16":
- return "int16(dd.DecodeInt(16))"
- case "int32":
- return "int32(dd.DecodeInt(32))"
- case "int64":
- return "dd.DecodeInt(64)"
-
- case "string":
- return "dd.DecodeString()"
- case "float32":
- return "float32(dd.DecodeFloat(true))"
- case "float64":
- return "dd.DecodeFloat(false)"
- case "bool":
- return "dd.DecodeBool()"
- default:
- panic(errors.New("gen internal: unknown type for decode: " + s))
- }
-}
-
-func genInternalSortType(s string, elem bool) string {
- for _, v := range [...]string{"int", "uint", "float", "bool", "string"} {
- if strings.HasPrefix(s, v) {
- if elem {
- if v == "int" || v == "uint" || v == "float" {
- return v + "64"
- } else {
- return v
- }
- }
- return v + "Slice"
- }
- }
- panic("sorttype: unexpected type: " + s)
-}
-
-// var genInternalMu sync.Mutex
-var genInternalV genInternal
-var genInternalTmplFuncs template.FuncMap
-var genInternalOnce sync.Once
-
-func genInternalInit() {
- types := [...]string{
- "interface{}",
- "string",
- "float32",
- "float64",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "bool",
- }
- // keep as slice, so it is in specific iteration order.
- // Initial order was uint64, string, interface{}, int, int64
- mapvaltypes := [...]string{
- "interface{}",
- "string",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "float32",
- "float64",
- "bool",
- }
- wordSizeBytes := int(intBitsize) / 8
-
- mapvaltypes2 := map[string]int{
- "interface{}": 2 * wordSizeBytes,
- "string": 2 * wordSizeBytes,
- "uint": 1 * wordSizeBytes,
- "uint8": 1,
- "uint16": 2,
- "uint32": 4,
- "uint64": 8,
- "uintptr": 1 * wordSizeBytes,
- "int": 1 * wordSizeBytes,
- "int8": 1,
- "int16": 2,
- "int32": 4,
- "int64": 8,
- "float32": 4,
- "float64": 8,
- "bool": 1,
- }
- var gt genInternal
-
- // For each slice or map type, there must be a (symmetrical) Encode and Decode fast-path function
- for _, s := range types {
- gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]})
- if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already.
- gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]})
- }
- if _, ok := mapvaltypes2[s]; !ok {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]})
- }
- for _, ms := range mapvaltypes {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: ms, Size: mapvaltypes2[s] + mapvaltypes2[ms]})
- }
- }
-
- funcs := make(template.FuncMap)
- // funcs["haspfx"] = strings.HasPrefix
- funcs["encmd"] = genInternalEncCommandAsString
- funcs["decmd"] = genInternalDecCommandAsString
- funcs["zerocmd"] = genInternalZeroValue
- funcs["hasprefix"] = strings.HasPrefix
- funcs["sorttype"] = genInternalSortType
-
- genInternalV = gt
- genInternalTmplFuncs = funcs
-}
-
-// genInternalGoFile is used to generate source files from templates.
-// It is run by the program author alone.
-// Unfortunately, it has to be exported so that it can be called from a command line tool.
-// *** DO NOT USE ***
-func genInternalGoFile(r io.Reader, w io.Writer, safe bool) (err error) {
- genInternalOnce.Do(genInternalInit)
-
- gt := genInternalV
- gt.Unsafe = !safe
-
- t := template.New("").Funcs(genInternalTmplFuncs)
-
- tmplstr, err := ioutil.ReadAll(r)
- if err != nil {
- return
- }
-
- if t, err = t.Parse(string(tmplstr)); err != nil {
- return
- }
-
- var out bytes.Buffer
- err = t.Execute(&out, gt)
- if err != nil {
- return
- }
-
- bout, err := format.Source(out.Bytes())
- if err != nil {
- w.Write(out.Bytes()) // write out if error, so we can still see.
- // w.Write(bout) // write out if error, as much as possible, so we can still see.
- return
- }
- w.Write(bout)
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_15.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_15.go
deleted file mode 100644
index ab76c3102..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_15.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build go1.5,!go1.6
-
-package codec
-
-import "os"
-
-func init() {
- genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_16.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_16.go
deleted file mode 100644
index 87c04e2e1..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_16.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build go1.6
-
-package codec
-
-import "os"
-
-func init() {
- genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0"
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_17.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_17.go
deleted file mode 100644
index 3881a43ce..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/gen_17.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-// +build go1.7
-
-package codec
-
-func init() {
- genCheckVendor = true
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper.go
deleted file mode 100644
index 8b94fc1e4..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper.go
+++ /dev/null
@@ -1,1314 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// Contains code shared by both encode and decode.
-
-// Some shared ideas around encoding/decoding
-// ------------------------------------------
-//
-// If an interface{} is passed, we first do a type assertion to see if it is
-// a primitive type or a map/slice of primitive types, and use a fastpath to handle it.
-//
-// If we start with a reflect.Value, we are already in reflect.Value land and
-// will try to grab the function for the underlying Type and directly call that function.
-// This is more performant than calling reflect.Value.Interface().
-//
-// This still helps us bypass many layers of reflection, and give best performance.
-//
-// Containers
-// ------------
-// Containers in the stream are either associative arrays (key-value pairs) or
-// regular arrays (indexed by incrementing integers).
-//
-// Some streams support indefinite-length containers, and use a breaking
-// byte-sequence to denote that the container has come to an end.
-//
-// Some streams also are text-based, and use explicit separators to denote the
-// end/beginning of different values.
-//
-// During encode, we use a high-level condition to determine how to iterate through
-// the container. That decision is based on whether the container is text-based (with
-// separators) or binary (without separators). If binary, we do not even call the
-// encoding of separators.
-//
-// During decode, we use a different high-level condition to determine how to iterate
-// through the containers. That decision is based on whether the stream contained
-// a length prefix, or if it used explicit breaks. If length-prefixed, we assume that
-// it has to be binary, and we do not even try to read separators.
-//
-// Philosophy
-// ------------
-// On decode, this codec will update containers appropriately:
-// - If struct, update fields from stream into fields of struct.
-// If field in stream not found in struct, handle appropriately (based on option).
-// If a struct field has no corresponding value in the stream, leave it AS IS.
-// If nil in stream, set value to nil/zero value.
-// - If map, update map from stream.
-// If the stream value is NIL, set the map to nil.
-// - if slice, try to update up to length of array in stream.
-// if container len is less than stream array length,
-// and container cannot be expanded, handled (based on option).
-// This means you can decode 4-element stream array into 1-element array.
-//
-// ------------------------------------
-// On encode, user can specify omitEmpty. This means that the value will be omitted
-// if the zero value. The problem may occur during decode, where omitted values do not affect
-// the value being decoded into. This means that if decoding into a struct with an
-// int field with current value=5, and the field is omitted in the stream, then after
-// decoding, the value will still be 5 (not 0).
-// omitEmpty only works if you guarantee that you always decode into zero-values.
-//
-// ------------------------------------
-// We could have truncated a map to remove keys not available in the stream,
-// or set values in the struct which are not in the stream to their zero values.
-// We decided against it because there is no efficient way to do it.
-// We may introduce it as an option later.
-// However, that will require enabling it for both runtime and code generation modes.
-//
-// To support truncate, we need to do 2 passes over the container:
-// map
-// - first collect all keys (e.g. in k1)
-// - for each key in stream, mark k1 that the key should not be removed
-// - after updating map, do second pass and call delete for all keys in k1 which are not marked
-// struct:
-// - for each field, track the *typeInfo s1
-// - iterate through all s1, and for each one not marked, set value to zero
-// - this involves checking the possible anonymous fields which are nil ptrs.
-// too much work.
-//
-// ------------------------------------------
-// Error Handling is done within the library using panic.
-//
-// This way, the code doesn't have to keep checking if an error has happened,
-// and we don't have to keep sending the error value along with each call
-// or storing it in the En|Decoder and checking it constantly along the way.
-//
-// The disadvantage is that small functions which use panics cannot be inlined.
-// The code accounts for that by only using panics behind an interface;
-// since interface calls cannot be inlined, this is irrelevant.
-//
-// We considered storing the error is En|Decoder.
-// - once it has its err field set, it cannot be used again.
-// - panicing will be optional, controlled by const flag.
-// - code should always check error first and return early.
-// We eventually decided against it as it makes the code clumsier to always
-// check for these error conditions.
-
-import (
- "bytes"
- "encoding"
- "encoding/binary"
- "errors"
- "fmt"
- "math"
- "reflect"
- "sort"
- "strings"
- "sync"
- "time"
-)
-
-const (
- scratchByteArrayLen = 32
- initCollectionCap = 32 // 32 is defensive. 16 is preferred.
-
- // Support encoding.(Binary|Text)(Unm|M)arshaler.
- // This constant flag will enable or disable it.
- supportMarshalInterfaces = true
-
- // Each Encoder or Decoder uses a cache of functions based on conditionals,
- // so that the conditionals are not run every time.
- //
- // Either a map or a slice is used to keep track of the functions.
- // The map is more natural, but has a higher cost than a slice/array.
- // This flag (useMapForCodecCache) controls which is used.
- //
- // From benchmarks, slices with linear search perform better with < 32 entries.
- // We have typically seen a high threshold of about 24 entries.
- useMapForCodecCache = false
-
- // for debugging, set this to false, to catch panic traces.
- // Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
- recoverPanicToErr = true
-
- // if resetSliceElemToZeroValue, then on decoding a slice, reset the element to a zero value first.
- // Only concern is that, if the slice already contained some garbage, we will decode into that garbage.
- // The chances of this are slim, so leave this "optimization".
- // TODO: should this be true, to ensure that we always decode into a "zero" "empty" value?
- resetSliceElemToZeroValue bool = false
-)
-
-var (
- oneByteArr = [1]byte{0}
- zeroByteSlice = oneByteArr[:0:0]
-)
-
-type charEncoding uint8
-
-const (
- c_RAW charEncoding = iota
- c_UTF8
- c_UTF16LE
- c_UTF16BE
- c_UTF32LE
- c_UTF32BE
-)
-
-// valueType is the stream type
-type valueType uint8
-
-const (
- valueTypeUnset valueType = iota
- valueTypeNil
- valueTypeInt
- valueTypeUint
- valueTypeFloat
- valueTypeBool
- valueTypeString
- valueTypeSymbol
- valueTypeBytes
- valueTypeMap
- valueTypeArray
- valueTypeTimestamp
- valueTypeExt
-
- // valueTypeInvalid = 0xff
-)
-
-type seqType uint8
-
-const (
- _ seqType = iota
- seqTypeArray
- seqTypeSlice
- seqTypeChan
-)
-
-// note that containerMapStart and containerArraySend are not sent.
-// This is because the ReadXXXStart and EncodeXXXStart already does these.
-type containerState uint8
-
-const (
- _ containerState = iota
-
- containerMapStart // slot left open, since Driver method already covers it
- containerMapKey
- containerMapValue
- containerMapEnd
- containerArrayStart // slot left open, since Driver methods already cover it
- containerArrayElem
- containerArrayEnd
-)
-
-// sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo
-type sfiIdx struct {
- name string
- index int
-}
-
-// do not recurse if a containing type refers to an embedded type
-// which refers back to its containing type (via a pointer).
-// The second time this back-reference happens, break out,
-// so as not to cause an infinite loop.
-const rgetMaxRecursion = 2
-
-// Anecdotally, we believe most types have <= 12 fields.
-// Java's PMD rules set TooManyFields threshold to 15.
-const rgetPoolTArrayLen = 12
-
-type rgetT struct {
- fNames []string
- encNames []string
- etypes []uintptr
- sfis []*structFieldInfo
-}
-
-type rgetPoolT struct {
- fNames [rgetPoolTArrayLen]string
- encNames [rgetPoolTArrayLen]string
- etypes [rgetPoolTArrayLen]uintptr
- sfis [rgetPoolTArrayLen]*structFieldInfo
- sfiidx [rgetPoolTArrayLen]sfiIdx
-}
-
-var rgetPool = sync.Pool{
- New: func() interface{} { return new(rgetPoolT) },
-}
-
-type containerStateRecv interface {
- sendContainerState(containerState)
-}
-
-// mirror json.Marshaler and json.Unmarshaler here,
-// so we don't import the encoding/json package
-type jsonMarshaler interface {
- MarshalJSON() ([]byte, error)
-}
-type jsonUnmarshaler interface {
- UnmarshalJSON([]byte) error
-}
-
-var (
- bigen = binary.BigEndian
- structInfoFieldName = "_struct"
-
- mapStrIntfTyp = reflect.TypeOf(map[string]interface{}(nil))
- mapIntfIntfTyp = reflect.TypeOf(map[interface{}]interface{}(nil))
- intfSliceTyp = reflect.TypeOf([]interface{}(nil))
- intfTyp = intfSliceTyp.Elem()
-
- stringTyp = reflect.TypeOf("")
- timeTyp = reflect.TypeOf(time.Time{})
- rawExtTyp = reflect.TypeOf(RawExt{})
- rawTyp = reflect.TypeOf(Raw{})
- uint8SliceTyp = reflect.TypeOf([]uint8(nil))
-
- mapBySliceTyp = reflect.TypeOf((*MapBySlice)(nil)).Elem()
-
- binaryMarshalerTyp = reflect.TypeOf((*encoding.BinaryMarshaler)(nil)).Elem()
- binaryUnmarshalerTyp = reflect.TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem()
-
- textMarshalerTyp = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
- textUnmarshalerTyp = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
-
- jsonMarshalerTyp = reflect.TypeOf((*jsonMarshaler)(nil)).Elem()
- jsonUnmarshalerTyp = reflect.TypeOf((*jsonUnmarshaler)(nil)).Elem()
-
- selferTyp = reflect.TypeOf((*Selfer)(nil)).Elem()
-
- uint8SliceTypId = reflect.ValueOf(uint8SliceTyp).Pointer()
- rawExtTypId = reflect.ValueOf(rawExtTyp).Pointer()
- rawTypId = reflect.ValueOf(rawTyp).Pointer()
- intfTypId = reflect.ValueOf(intfTyp).Pointer()
- timeTypId = reflect.ValueOf(timeTyp).Pointer()
- stringTypId = reflect.ValueOf(stringTyp).Pointer()
-
- mapStrIntfTypId = reflect.ValueOf(mapStrIntfTyp).Pointer()
- mapIntfIntfTypId = reflect.ValueOf(mapIntfIntfTyp).Pointer()
- intfSliceTypId = reflect.ValueOf(intfSliceTyp).Pointer()
- // mapBySliceTypId = reflect.ValueOf(mapBySliceTyp).Pointer()
-
- intBitsize uint8 = uint8(reflect.TypeOf(int(0)).Bits())
- uintBitsize uint8 = uint8(reflect.TypeOf(uint(0)).Bits())
-
- bsAll0x00 = []byte{0, 0, 0, 0, 0, 0, 0, 0}
- bsAll0xff = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
-
- chkOvf checkOverflow
-
- noFieldNameToStructFieldInfoErr = errors.New("no field name passed to parseStructFieldInfo")
-)
-
-var defTypeInfos = NewTypeInfos([]string{"codec", "json"})
-
-// Selfer defines methods by which a value can encode or decode itself.
-//
-// Any type which implements Selfer will be able to encode or decode itself.
-// Consequently, during (en|de)code, this takes precedence over
-// (text|binary)(M|Unm)arshal or extension support.
-type Selfer interface {
- CodecEncodeSelf(*Encoder)
- CodecDecodeSelf(*Decoder)
-}
-
-// MapBySlice represents a slice which should be encoded as a map in the stream.
-// The slice contains a sequence of key-value pairs.
-// This affords storing a map in a specific sequence in the stream.
-//
-// The support of MapBySlice affords the following:
-// - A slice type which implements MapBySlice will be encoded as a map
-// - A slice can be decoded from a map in the stream
-type MapBySlice interface {
- MapBySlice()
-}
-
-// WARNING: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED.
-//
-// BasicHandle encapsulates the common options and extension functions.
-type BasicHandle struct {
- // TypeInfos is used to get the type info for any type.
- //
- // If not configured, the default TypeInfos is used, which uses struct tag keys: codec, json
- TypeInfos *TypeInfos
-
- extHandle
- EncodeOptions
- DecodeOptions
-}
-
-func (x *BasicHandle) getBasicHandle() *BasicHandle {
- return x
-}
-
-func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
- if x.TypeInfos != nil {
- return x.TypeInfos.get(rtid, rt)
- }
- return defTypeInfos.get(rtid, rt)
-}
-
-// Handle is the interface for a specific encoding format.
-//
-// Typically, a Handle is pre-configured before first time use,
-// and not modified while in use. Such a pre-configured Handle
-// is safe for concurrent access.
-type Handle interface {
- getBasicHandle() *BasicHandle
- newEncDriver(w *Encoder) encDriver
- newDecDriver(r *Decoder) decDriver
- isBinary() bool
-}
-
-// Raw represents raw formatted bytes.
-// We "blindly" store it during encode and store the raw bytes during decode.
-// Note: it is dangerous during encode, so we may gate the behaviour behind an Encode flag which must be explicitly set.
-type Raw []byte
-
-// RawExt represents raw unprocessed extension data.
-// Some codecs will decode extension data as a *RawExt if there is no registered extension for the tag.
-//
-// Only one of Data or Value is nil. If Data is nil, then the content of the RawExt is in the Value.
-type RawExt struct {
- Tag uint64
- // Data is the []byte which represents the raw ext. If Data is nil, ext is exposed in Value.
- // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types
- Data []byte
- // Value represents the extension, if Data is nil.
- // Value is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types.
- Value interface{}
-}
-
-// BytesExt handles custom (de)serialization of types to/from []byte.
-// It is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types.
-type BytesExt interface {
- // WriteExt converts a value to a []byte.
- //
- // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array.
- WriteExt(v interface{}) []byte
-
- // ReadExt updates a value from a []byte.
- ReadExt(dst interface{}, src []byte)
-}
-
-// InterfaceExt handles custom (de)serialization of types to/from another interface{} value.
-// The Encoder or Decoder will then handle the further (de)serialization of that known type.
-//
-// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types.
-type InterfaceExt interface {
- // ConvertExt converts a value into a simpler interface for easy encoding e.g. convert time.Time to int64.
- //
- // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array.
- ConvertExt(v interface{}) interface{}
-
- // UpdateExt updates a value from a simpler interface for easy decoding e.g. convert int64 to time.Time.
- UpdateExt(dst interface{}, src interface{})
-}
-
-// Ext handles custom (de)serialization of custom types / extensions.
-type Ext interface {
- BytesExt
- InterfaceExt
-}
-
-// addExtWrapper is a wrapper implementation to support former AddExt exported method.
-type addExtWrapper struct {
- encFn func(reflect.Value) ([]byte, error)
- decFn func(reflect.Value, []byte) error
-}
-
-func (x addExtWrapper) WriteExt(v interface{}) []byte {
- bs, err := x.encFn(reflect.ValueOf(v))
- if err != nil {
- panic(err)
- }
- return bs
-}
-
-func (x addExtWrapper) ReadExt(v interface{}, bs []byte) {
- if err := x.decFn(reflect.ValueOf(v), bs); err != nil {
- panic(err)
- }
-}
-
-func (x addExtWrapper) ConvertExt(v interface{}) interface{} {
- return x.WriteExt(v)
-}
-
-func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) {
- x.ReadExt(dest, v.([]byte))
-}
-
-type setExtWrapper struct {
- b BytesExt
- i InterfaceExt
-}
-
-func (x *setExtWrapper) WriteExt(v interface{}) []byte {
- if x.b == nil {
- panic("BytesExt.WriteExt is not supported")
- }
- return x.b.WriteExt(v)
-}
-
-func (x *setExtWrapper) ReadExt(v interface{}, bs []byte) {
- if x.b == nil {
- panic("BytesExt.WriteExt is not supported")
-
- }
- x.b.ReadExt(v, bs)
-}
-
-func (x *setExtWrapper) ConvertExt(v interface{}) interface{} {
- if x.i == nil {
- panic("InterfaceExt.ConvertExt is not supported")
-
- }
- return x.i.ConvertExt(v)
-}
-
-func (x *setExtWrapper) UpdateExt(dest interface{}, v interface{}) {
- if x.i == nil {
- panic("InterfaceExxt.UpdateExt is not supported")
-
- }
- x.i.UpdateExt(dest, v)
-}
-
-// type errorString string
-// func (x errorString) Error() string { return string(x) }
-
-type binaryEncodingType struct{}
-
-func (_ binaryEncodingType) isBinary() bool { return true }
-
-type textEncodingType struct{}
-
-func (_ textEncodingType) isBinary() bool { return false }
-
-// noBuiltInTypes is embedded into many types which do not support builtins
-// e.g. msgpack, simple, cbor.
-type noBuiltInTypes struct{}
-
-func (_ noBuiltInTypes) IsBuiltinType(rt uintptr) bool { return false }
-func (_ noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (_ noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {}
-
-type noStreamingCodec struct{}
-
-func (_ noStreamingCodec) CheckBreak() bool { return false }
-
-// bigenHelper.
-// Users must already slice the x completely, because we will not reslice.
-type bigenHelper struct {
- x []byte // must be correctly sliced to appropriate len. slicing is a cost.
- w encWriter
-}
-
-func (z bigenHelper) writeUint16(v uint16) {
- bigen.PutUint16(z.x, v)
- z.w.writeb(z.x)
-}
-
-func (z bigenHelper) writeUint32(v uint32) {
- bigen.PutUint32(z.x, v)
- z.w.writeb(z.x)
-}
-
-func (z bigenHelper) writeUint64(v uint64) {
- bigen.PutUint64(z.x, v)
- z.w.writeb(z.x)
-}
-
-type extTypeTagFn struct {
- rtid uintptr
- rt reflect.Type
- tag uint64
- ext Ext
-}
-
-type extHandle []extTypeTagFn
-
-// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead.
-//
-// AddExt registes an encode and decode function for a reflect.Type.
-// AddExt internally calls SetExt.
-// To deregister an Ext, call AddExt with nil encfn and/or nil decfn.
-func (o *extHandle) AddExt(
- rt reflect.Type, tag byte,
- encfn func(reflect.Value) ([]byte, error), decfn func(reflect.Value, []byte) error,
-) (err error) {
- if encfn == nil || decfn == nil {
- return o.SetExt(rt, uint64(tag), nil)
- }
- return o.SetExt(rt, uint64(tag), addExtWrapper{encfn, decfn})
-}
-
-// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead.
-//
-// Note that the type must be a named type, and specifically not
-// a pointer or Interface. An error is returned if that is not honored.
-//
-// To Deregister an ext, call SetExt with nil Ext
-func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) {
- // o is a pointer, because we may need to initialize it
- if rt.PkgPath() == "" || rt.Kind() == reflect.Interface {
- err = fmt.Errorf("codec.Handle.AddExt: Takes named type, not a pointer or interface: %T",
- reflect.Zero(rt).Interface())
- return
- }
-
- rtid := reflect.ValueOf(rt).Pointer()
- for _, v := range *o {
- if v.rtid == rtid {
- v.tag, v.ext = tag, ext
- return
- }
- }
-
- if *o == nil {
- *o = make([]extTypeTagFn, 0, 4)
- }
- *o = append(*o, extTypeTagFn{rtid, rt, tag, ext})
- return
-}
-
-func (o extHandle) getExt(rtid uintptr) *extTypeTagFn {
- var v *extTypeTagFn
- for i := range o {
- v = &o[i]
- if v.rtid == rtid {
- return v
- }
- }
- return nil
-}
-
-func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn {
- var v *extTypeTagFn
- for i := range o {
- v = &o[i]
- if v.tag == tag {
- return v
- }
- }
- return nil
-}
-
-type structFieldInfo struct {
- encName string // encode name
- fieldName string // field name
-
- // only one of 'i' or 'is' can be set. If 'i' is -1, then 'is' has been set.
-
- is []int // (recursive/embedded) field index in struct
- i int16 // field index in struct
- omitEmpty bool
- toArray bool // if field is _struct, is the toArray set?
-}
-
-// func (si *structFieldInfo) isZero() bool {
-// return si.encName == "" && len(si.is) == 0 && si.i == 0 && !si.omitEmpty && !si.toArray
-// }
-
-// rv returns the field of the struct.
-// If anonymous, it returns an Invalid
-func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Value) {
- if si.i != -1 {
- v = v.Field(int(si.i))
- return v
- }
- // replicate FieldByIndex
- for _, x := range si.is {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- if !update {
- return
- }
- v.Set(reflect.New(v.Type().Elem()))
- }
- v = v.Elem()
- }
- v = v.Field(x)
- }
- return v
-}
-
-func (si *structFieldInfo) setToZeroValue(v reflect.Value) {
- if si.i != -1 {
- v = v.Field(int(si.i))
- v.Set(reflect.Zero(v.Type()))
- // v.Set(reflect.New(v.Type()).Elem())
- // v.Set(reflect.New(v.Type()))
- } else {
- // replicate FieldByIndex
- for _, x := range si.is {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return
- }
- v = v.Elem()
- }
- v = v.Field(x)
- }
- v.Set(reflect.Zero(v.Type()))
- }
-}
-
-func parseStructFieldInfo(fname string, stag string) *structFieldInfo {
- // if fname == "" {
- // panic(noFieldNameToStructFieldInfoErr)
- // }
- si := structFieldInfo{
- encName: fname,
- }
-
- if stag != "" {
- for i, s := range strings.Split(stag, ",") {
- if i == 0 {
- if s != "" {
- si.encName = s
- }
- } else {
- if s == "omitempty" {
- si.omitEmpty = true
- } else if s == "toarray" {
- si.toArray = true
- }
- }
- }
- }
- // si.encNameBs = []byte(si.encName)
- return &si
-}
-
-type sfiSortedByEncName []*structFieldInfo
-
-func (p sfiSortedByEncName) Len() int {
- return len(p)
-}
-
-func (p sfiSortedByEncName) Less(i, j int) bool {
- return p[i].encName < p[j].encName
-}
-
-func (p sfiSortedByEncName) Swap(i, j int) {
- p[i], p[j] = p[j], p[i]
-}
-
-// typeInfo keeps information about each type referenced in the encode/decode sequence.
-//
-// During an encode/decode sequence, we work as below:
-// - If base is a built in type, en/decode base value
-// - If base is registered as an extension, en/decode base value
-// - If type is binary(M/Unm)arshaler, call Binary(M/Unm)arshal method
-// - If type is text(M/Unm)arshaler, call Text(M/Unm)arshal method
-// - Else decode appropriately based on the reflect.Kind
-type typeInfo struct {
- sfi []*structFieldInfo // sorted. Used when enc/dec struct to map.
- sfip []*structFieldInfo // unsorted. Used when enc/dec struct to array.
-
- rt reflect.Type
- rtid uintptr
-
- numMeth uint16 // number of methods
-
- // baseId gives pointer to the base reflect.Type, after deferencing
- // the pointers. E.g. base type of ***time.Time is time.Time.
- base reflect.Type
- baseId uintptr
- baseIndir int8 // number of indirections to get to base
-
- mbs bool // base type (T or *T) is a MapBySlice
-
- bm bool // base type (T or *T) is a binaryMarshaler
- bunm bool // base type (T or *T) is a binaryUnmarshaler
- bmIndir int8 // number of indirections to get to binaryMarshaler type
- bunmIndir int8 // number of indirections to get to binaryUnmarshaler type
-
- tm bool // base type (T or *T) is a textMarshaler
- tunm bool // base type (T or *T) is a textUnmarshaler
- tmIndir int8 // number of indirections to get to textMarshaler type
- tunmIndir int8 // number of indirections to get to textUnmarshaler type
-
- jm bool // base type (T or *T) is a jsonMarshaler
- junm bool // base type (T or *T) is a jsonUnmarshaler
- jmIndir int8 // number of indirections to get to jsonMarshaler type
- junmIndir int8 // number of indirections to get to jsonUnmarshaler type
-
- cs bool // base type (T or *T) is a Selfer
- csIndir int8 // number of indirections to get to Selfer type
-
- toArray bool // whether this (struct) type should be encoded as an array
-}
-
-func (ti *typeInfo) indexForEncName(name string) int {
- // NOTE: name may be a stringView, so don't pass it to another function.
- //tisfi := ti.sfi
- const binarySearchThreshold = 16
- if sfilen := len(ti.sfi); sfilen < binarySearchThreshold {
- // linear search. faster than binary search in my testing up to 16-field structs.
- for i, si := range ti.sfi {
- if si.encName == name {
- return i
- }
- }
- } else {
- // binary search. adapted from sort/search.go.
- h, i, j := 0, 0, sfilen
- for i < j {
- h = i + (j-i)/2
- if ti.sfi[h].encName < name {
- i = h + 1
- } else {
- j = h
- }
- }
- if i < sfilen && ti.sfi[i].encName == name {
- return i
- }
- }
- return -1
-}
-
-// TypeInfos caches typeInfo for each type on first inspection.
-//
-// It is configured with a set of tag keys, which are used to get
-// configuration for the type.
-type TypeInfos struct {
- infos map[uintptr]*typeInfo
- mu sync.RWMutex
- tags []string
-}
-
-// NewTypeInfos creates a TypeInfos given a set of struct tags keys.
-//
-// This allows users customize the struct tag keys which contain configuration
-// of their types.
-func NewTypeInfos(tags []string) *TypeInfos {
- return &TypeInfos{tags: tags, infos: make(map[uintptr]*typeInfo, 64)}
-}
-
-func (x *TypeInfos) structTag(t reflect.StructTag) (s string) {
- // check for tags: codec, json, in that order.
- // this allows seamless support for many configured structs.
- for _, x := range x.tags {
- s = t.Get(x)
- if s != "" {
- return s
- }
- }
- return
-}
-
-func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
- var ok bool
- x.mu.RLock()
- pti, ok = x.infos[rtid]
- x.mu.RUnlock()
- if ok {
- return
- }
-
- // do not hold lock while computing this.
- // it may lead to duplication, but that's ok.
- ti := typeInfo{rt: rt, rtid: rtid}
- ti.numMeth = uint16(rt.NumMethod())
-
- var indir int8
- if ok, indir = implementsIntf(rt, binaryMarshalerTyp); ok {
- ti.bm, ti.bmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, binaryUnmarshalerTyp); ok {
- ti.bunm, ti.bunmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, textMarshalerTyp); ok {
- ti.tm, ti.tmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, textUnmarshalerTyp); ok {
- ti.tunm, ti.tunmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, jsonMarshalerTyp); ok {
- ti.jm, ti.jmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, jsonUnmarshalerTyp); ok {
- ti.junm, ti.junmIndir = true, indir
- }
- if ok, indir = implementsIntf(rt, selferTyp); ok {
- ti.cs, ti.csIndir = true, indir
- }
- if ok, _ = implementsIntf(rt, mapBySliceTyp); ok {
- ti.mbs = true
- }
-
- pt := rt
- var ptIndir int8
- // for ; pt.Kind() == reflect.Ptr; pt, ptIndir = pt.Elem(), ptIndir+1 { }
- for pt.Kind() == reflect.Ptr {
- pt = pt.Elem()
- ptIndir++
- }
- if ptIndir == 0 {
- ti.base = rt
- ti.baseId = rtid
- } else {
- ti.base = pt
- ti.baseId = reflect.ValueOf(pt).Pointer()
- ti.baseIndir = ptIndir
- }
-
- if rt.Kind() == reflect.Struct {
- var omitEmpty bool
- if f, ok := rt.FieldByName(structInfoFieldName); ok {
- siInfo := parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag))
- ti.toArray = siInfo.toArray
- omitEmpty = siInfo.omitEmpty
- }
- pi := rgetPool.Get()
- pv := pi.(*rgetPoolT)
- pv.etypes[0] = ti.baseId
- vv := rgetT{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]}
- x.rget(rt, rtid, omitEmpty, nil, &vv)
- ti.sfip, ti.sfi = rgetResolveSFI(vv.sfis, pv.sfiidx[:0])
- rgetPool.Put(pi)
- }
- // sfi = sfip
-
- x.mu.Lock()
- if pti, ok = x.infos[rtid]; !ok {
- pti = &ti
- x.infos[rtid] = pti
- }
- x.mu.Unlock()
- return
-}
-
-func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool,
- indexstack []int, pv *rgetT,
-) {
- // Read up fields and store how to access the value.
- //
- // It uses go's rules for message selectors,
- // which say that the field with the shallowest depth is selected.
- //
- // Note: we consciously use slices, not a map, to simulate a set.
- // Typically, types have < 16 fields,
- // and iteration using equals is faster than maps there
-
-LOOP:
- for j, jlen := 0, rt.NumField(); j < jlen; j++ {
- f := rt.Field(j)
- fkind := f.Type.Kind()
- // skip if a func type, or is unexported, or structTag value == "-"
- switch fkind {
- case reflect.Func, reflect.Complex64, reflect.Complex128, reflect.UnsafePointer:
- continue LOOP
- }
-
- // if r1, _ := utf8.DecodeRuneInString(f.Name);
- // r1 == utf8.RuneError || !unicode.IsUpper(r1) {
- if f.PkgPath != "" && !f.Anonymous { // unexported, not embedded
- continue
- }
- stag := x.structTag(f.Tag)
- if stag == "-" {
- continue
- }
- var si *structFieldInfo
- // if anonymous and no struct tag (or it's blank),
- // and a struct (or pointer to struct), inline it.
- if f.Anonymous && fkind != reflect.Interface {
- doInline := stag == ""
- if !doInline {
- si = parseStructFieldInfo("", stag)
- doInline = si.encName == ""
- // doInline = si.isZero()
- }
- if doInline {
- ft := f.Type
- for ft.Kind() == reflect.Ptr {
- ft = ft.Elem()
- }
- if ft.Kind() == reflect.Struct {
- // if etypes contains this, don't call rget again (as fields are already seen here)
- ftid := reflect.ValueOf(ft).Pointer()
- // We cannot recurse forever, but we need to track other field depths.
- // So - we break if we see a type twice (not the first time).
- // This should be sufficient to handle an embedded type that refers to its
- // owning type, which then refers to its embedded type.
- processIt := true
- numk := 0
- for _, k := range pv.etypes {
- if k == ftid {
- numk++
- if numk == rgetMaxRecursion {
- processIt = false
- break
- }
- }
- }
- if processIt {
- pv.etypes = append(pv.etypes, ftid)
- indexstack2 := make([]int, len(indexstack)+1)
- copy(indexstack2, indexstack)
- indexstack2[len(indexstack)] = j
- // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
- x.rget(ft, ftid, omitEmpty, indexstack2, pv)
- }
- continue
- }
- }
- }
-
- // after the anonymous dance: if an unexported field, skip
- if f.PkgPath != "" { // unexported
- continue
- }
-
- if f.Name == "" {
- panic(noFieldNameToStructFieldInfoErr)
- }
-
- pv.fNames = append(pv.fNames, f.Name)
-
- if si == nil {
- si = parseStructFieldInfo(f.Name, stag)
- } else if si.encName == "" {
- si.encName = f.Name
- }
- si.fieldName = f.Name
-
- pv.encNames = append(pv.encNames, si.encName)
-
- // si.ikind = int(f.Type.Kind())
- if len(indexstack) == 0 {
- si.i = int16(j)
- } else {
- si.i = -1
- si.is = make([]int, len(indexstack)+1)
- copy(si.is, indexstack)
- si.is[len(indexstack)] = j
- // si.is = append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
- }
-
- if omitEmpty {
- si.omitEmpty = true
- }
- pv.sfis = append(pv.sfis, si)
- }
-}
-
-// resolves the struct field info got from a call to rget.
-// Returns a trimmed, unsorted and sorted []*structFieldInfo.
-func rgetResolveSFI(x []*structFieldInfo, pv []sfiIdx) (y, z []*structFieldInfo) {
- var n int
- for i, v := range x {
- xn := v.encName //TODO: fieldName or encName? use encName for now.
- var found bool
- for j, k := range pv {
- if k.name == xn {
- // one of them must be reset to nil, and the index updated appropriately to the other one
- if len(v.is) == len(x[k.index].is) {
- } else if len(v.is) < len(x[k.index].is) {
- pv[j].index = i
- if x[k.index] != nil {
- x[k.index] = nil
- n++
- }
- } else {
- if x[i] != nil {
- x[i] = nil
- n++
- }
- }
- found = true
- break
- }
- }
- if !found {
- pv = append(pv, sfiIdx{xn, i})
- }
- }
-
- // remove all the nils
- y = make([]*structFieldInfo, len(x)-n)
- n = 0
- for _, v := range x {
- if v == nil {
- continue
- }
- y[n] = v
- n++
- }
-
- z = make([]*structFieldInfo, len(y))
- copy(z, y)
- sort.Sort(sfiSortedByEncName(z))
- return
-}
-
-func panicToErr(err *error) {
- if recoverPanicToErr {
- if x := recover(); x != nil {
- //debug.PrintStack()
- panicValToErr(x, err)
- }
- }
-}
-
-// func doPanic(tag string, format string, params ...interface{}) {
-// params2 := make([]interface{}, len(params)+1)
-// params2[0] = tag
-// copy(params2[1:], params)
-// panic(fmt.Errorf("%s: "+format, params2...))
-// }
-
-func isImmutableKind(k reflect.Kind) (v bool) {
- return false ||
- k == reflect.Int ||
- k == reflect.Int8 ||
- k == reflect.Int16 ||
- k == reflect.Int32 ||
- k == reflect.Int64 ||
- k == reflect.Uint ||
- k == reflect.Uint8 ||
- k == reflect.Uint16 ||
- k == reflect.Uint32 ||
- k == reflect.Uint64 ||
- k == reflect.Uintptr ||
- k == reflect.Float32 ||
- k == reflect.Float64 ||
- k == reflect.Bool ||
- k == reflect.String
-}
-
-// these functions must be inlinable, and not call anybody
-type checkOverflow struct{}
-
-func (_ checkOverflow) Float32(f float64) (overflow bool) {
- if f < 0 {
- f = -f
- }
- return math.MaxFloat32 < f && f <= math.MaxFloat64
-}
-
-func (_ checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) {
- if bitsize == 0 || bitsize >= 64 || v == 0 {
- return
- }
- if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc {
- overflow = true
- }
- return
-}
-
-func (_ checkOverflow) Int(v int64, bitsize uint8) (overflow bool) {
- if bitsize == 0 || bitsize >= 64 || v == 0 {
- return
- }
- if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc {
- overflow = true
- }
- return
-}
-
-func (_ checkOverflow) SignedInt(v uint64) (i int64, overflow bool) {
- //e.g. -127 to 128 for int8
- pos := (v >> 63) == 0
- ui2 := v & 0x7fffffffffffffff
- if pos {
- if ui2 > math.MaxInt64 {
- overflow = true
- return
- }
- } else {
- if ui2 > math.MaxInt64-1 {
- overflow = true
- return
- }
- }
- i = int64(v)
- return
-}
-
-// ------------------ SORT -----------------
-
-func isNaN(f float64) bool { return f != f }
-
-// -----------------------
-
-type intSlice []int64
-type uintSlice []uint64
-type floatSlice []float64
-type boolSlice []bool
-type stringSlice []string
-type bytesSlice [][]byte
-
-func (p intSlice) Len() int { return len(p) }
-func (p intSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p intSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p uintSlice) Len() int { return len(p) }
-func (p uintSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p uintSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p floatSlice) Len() int { return len(p) }
-func (p floatSlice) Less(i, j int) bool {
- return p[i] < p[j] || isNaN(p[i]) && !isNaN(p[j])
-}
-func (p floatSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p stringSlice) Len() int { return len(p) }
-func (p stringSlice) Less(i, j int) bool { return p[i] < p[j] }
-func (p stringSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p bytesSlice) Len() int { return len(p) }
-func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 }
-func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p boolSlice) Len() int { return len(p) }
-func (p boolSlice) Less(i, j int) bool { return !p[i] && p[j] }
-func (p boolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// ---------------------
-
-type intRv struct {
- v int64
- r reflect.Value
-}
-type intRvSlice []intRv
-type uintRv struct {
- v uint64
- r reflect.Value
-}
-type uintRvSlice []uintRv
-type floatRv struct {
- v float64
- r reflect.Value
-}
-type floatRvSlice []floatRv
-type boolRv struct {
- v bool
- r reflect.Value
-}
-type boolRvSlice []boolRv
-type stringRv struct {
- v string
- r reflect.Value
-}
-type stringRvSlice []stringRv
-type bytesRv struct {
- v []byte
- r reflect.Value
-}
-type bytesRvSlice []bytesRv
-
-func (p intRvSlice) Len() int { return len(p) }
-func (p intRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p intRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p uintRvSlice) Len() int { return len(p) }
-func (p uintRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p uintRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p floatRvSlice) Len() int { return len(p) }
-func (p floatRvSlice) Less(i, j int) bool {
- return p[i].v < p[j].v || isNaN(p[i].v) && !isNaN(p[j].v)
-}
-func (p floatRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p stringRvSlice) Len() int { return len(p) }
-func (p stringRvSlice) Less(i, j int) bool { return p[i].v < p[j].v }
-func (p stringRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p bytesRvSlice) Len() int { return len(p) }
-func (p bytesRvSlice) Less(i, j int) bool { return bytes.Compare(p[i].v, p[j].v) == -1 }
-func (p bytesRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-func (p boolRvSlice) Len() int { return len(p) }
-func (p boolRvSlice) Less(i, j int) bool { return !p[i].v && p[j].v }
-func (p boolRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// -----------------
-
-type bytesI struct {
- v []byte
- i interface{}
-}
-
-type bytesISlice []bytesI
-
-func (p bytesISlice) Len() int { return len(p) }
-func (p bytesISlice) Less(i, j int) bool { return bytes.Compare(p[i].v, p[j].v) == -1 }
-func (p bytesISlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-
-// -----------------
-
-type set []uintptr
-
-func (s *set) add(v uintptr) (exists bool) {
- // e.ci is always nil, or len >= 1
- // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Add: %v, exists: %v\n", v, exists) }()
- x := *s
- if x == nil {
- x = make([]uintptr, 1, 8)
- x[0] = v
- *s = x
- return
- }
- // typically, length will be 1. make this perform.
- if len(x) == 1 {
- if j := x[0]; j == 0 {
- x[0] = v
- } else if j == v {
- exists = true
- } else {
- x = append(x, v)
- *s = x
- }
- return
- }
- // check if it exists
- for _, j := range x {
- if j == v {
- exists = true
- return
- }
- }
- // try to replace a "deleted" slot
- for i, j := range x {
- if j == 0 {
- x[i] = v
- return
- }
- }
- // if unable to replace deleted slot, just append it.
- x = append(x, v)
- *s = x
- return
-}
-
-func (s *set) remove(v uintptr) (exists bool) {
- // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Rm: %v, exists: %v\n", v, exists) }()
- x := *s
- if len(x) == 0 {
- return
- }
- if len(x) == 1 {
- if x[0] == v {
- x[0] = 0
- }
- return
- }
- for i, j := range x {
- if j == v {
- exists = true
- x[i] = 0 // set it to 0, as way to delete it.
- // copy(x[i:], x[i+1:])
- // x = x[:len(x)-1]
- return
- }
- }
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_internal.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_internal.go
deleted file mode 100644
index 5d0727f77..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_internal.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// All non-std package dependencies live in this file,
-// so porting to different environment is easy (just update functions).
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-func panicValToErr(panicVal interface{}, err *error) {
- if panicVal == nil {
- return
- }
- // case nil
- switch xerr := panicVal.(type) {
- case error:
- *err = xerr
- case string:
- *err = errors.New(xerr)
- default:
- *err = fmt.Errorf("%v", panicVal)
- }
- return
-}
-
-func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
- switch v.Kind() {
- case reflect.Invalid:
- return true
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- if deref {
- if v.IsNil() {
- return true
- }
- return hIsEmptyValue(v.Elem(), deref, checkStruct)
- } else {
- return v.IsNil()
- }
- case reflect.Struct:
- if !checkStruct {
- return false
- }
- // return true if all fields are empty. else return false.
- // we cannot use equality check, because some fields may be maps/slices/etc
- // and consequently the structs are not comparable.
- // return v.Interface() == reflect.Zero(v.Type()).Interface()
- for i, n := 0, v.NumField(); i < n; i++ {
- if !hIsEmptyValue(v.Field(i), deref, checkStruct) {
- return false
- }
- }
- return true
- }
- return false
-}
-
-func isEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
- return hIsEmptyValue(v, deref, checkStruct)
-}
-
-func pruneSignExt(v []byte, pos bool) (n int) {
- if len(v) < 2 {
- } else if pos && v[0] == 0 {
- for ; v[n] == 0 && n+1 < len(v) && (v[n+1]&(1<<7) == 0); n++ {
- }
- } else if !pos && v[0] == 0xff {
- for ; v[n] == 0xff && n+1 < len(v) && (v[n+1]&(1<<7) != 0); n++ {
- }
- }
- return
-}
-
-func implementsIntf(typ, iTyp reflect.Type) (success bool, indir int8) {
- if typ == nil {
- return
- }
- rt := typ
- // The type might be a pointer and we need to keep
- // dereferencing to the base type until we find an implementation.
- for {
- if rt.Implements(iTyp) {
- return true, indir
- }
- if p := rt; p.Kind() == reflect.Ptr {
- indir++
- if indir >= math.MaxInt8 { // insane number of indirections
- return false, 0
- }
- rt = p.Elem()
- continue
- }
- break
- }
- // No luck yet, but if this is a base type (non-pointer), the pointer might satisfy.
- if typ.Kind() != reflect.Ptr {
- // Not a pointer, but does the pointer work?
- if reflect.PtrTo(typ).Implements(iTyp) {
- return true, -1
- }
- }
- return false, 0
-}
-
-// validate that this function is correct ...
-// culled from OGRE (Object-Oriented Graphics Rendering Engine)
-// function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html)
-func halfFloatToFloatBits(yy uint16) (d uint32) {
- y := uint32(yy)
- s := (y >> 15) & 0x01
- e := (y >> 10) & 0x1f
- m := y & 0x03ff
-
- if e == 0 {
- if m == 0 { // plu or minus 0
- return s << 31
- } else { // Denormalized number -- renormalize it
- for (m & 0x00000400) == 0 {
- m <<= 1
- e -= 1
- }
- e += 1
- const zz uint32 = 0x0400
- m &= ^zz
- }
- } else if e == 31 {
- if m == 0 { // Inf
- return (s << 31) | 0x7f800000
- } else { // NaN
- return (s << 31) | 0x7f800000 | (m << 13)
- }
- }
- e = e + (127 - 15)
- m = m << 13
- return (s << 31) | (e << 23) | m
-}
-
-// GrowCap will return a new capacity for a slice, given the following:
-// - oldCap: current capacity
-// - unit: in-memory size of an element
-// - num: number of elements to add
-func growCap(oldCap, unit, num int) (newCap int) {
- // appendslice logic (if cap < 1024, *2, else *1.25):
- // leads to many copy calls, especially when copying bytes.
- // bytes.Buffer model (2*cap + n): much better for bytes.
- // smarter way is to take the byte-size of the appended element(type) into account
-
- // maintain 3 thresholds:
- // t1: if cap <= t1, newcap = 2x
- // t2: if cap <= t2, newcap = 1.75x
- // t3: if cap <= t3, newcap = 1.5x
- // else newcap = 1.25x
- //
- // t1, t2, t3 >= 1024 always.
- // i.e. if unit size >= 16, then always do 2x or 1.25x (ie t1, t2, t3 are all same)
- //
- // With this, appending for bytes increase by:
- // 100% up to 4K
- // 75% up to 8K
- // 50% up to 16K
- // 25% beyond that
-
- // unit can be 0 e.g. for struct{}{}; handle that appropriately
- var t1, t2, t3 int // thresholds
- if unit <= 1 {
- t1, t2, t3 = 4*1024, 8*1024, 16*1024
- } else if unit < 16 {
- t3 = 16 / unit * 1024
- t1 = t3 * 1 / 4
- t2 = t3 * 2 / 4
- } else {
- t1, t2, t3 = 1024, 1024, 1024
- }
-
- var x int // temporary variable
-
- // x is multiplier here: one of 5, 6, 7 or 8; incr of 25%, 50%, 75% or 100% respectively
- if oldCap <= t1 { // [0,t1]
- x = 8
- } else if oldCap > t3 { // (t3,infinity]
- x = 5
- } else if oldCap <= t2 { // (t1,t2]
- x = 7
- } else { // (t2,t3]
- x = 6
- }
- newCap = x * oldCap / 4
-
- if num > 0 {
- newCap += num
- }
-
- // ensure newCap is a multiple of 64 (if it is > 64) or 16.
- if newCap > 64 {
- if x = newCap % 64; x != 0 {
- x = newCap / 64
- newCap = 64 * (x + 1)
- }
- } else {
- if x = newCap % 16; x != 0 {
- x = newCap / 16
- newCap = 16 * (x + 1)
- }
- }
- return
-}
-
-func expandSliceValue(s reflect.Value, num int) reflect.Value {
- if num <= 0 {
- return s
- }
- l0 := s.Len()
- l1 := l0 + num // new slice length
- if l1 < l0 {
- panic("ExpandSlice: slice overflow")
- }
- c0 := s.Cap()
- if l1 <= c0 {
- return s.Slice(0, l1)
- }
- st := s.Type()
- c1 := growCap(c0, int(st.Elem().Size()), num)
- s2 := reflect.MakeSlice(st, l1, c1)
- // println("expandslicevalue: cap-old: ", c0, ", cap-new: ", c1, ", len-new: ", l1)
- reflect.Copy(s2, s)
- return s2
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
deleted file mode 100644
index 8b06a0045..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build !unsafe
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// stringView returns a view of the []byte as a string.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func stringView(v []byte) string {
- return string(v)
-}
-
-// bytesView returns a view of the string as a []byte.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func bytesView(v string) []byte {
- return []byte(v)
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_unsafe.go
deleted file mode 100644
index 0f596c71a..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/helper_unsafe.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// +build unsafe
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "unsafe"
-)
-
-// This file has unsafe variants of some helper methods.
-
-type unsafeString struct {
- Data uintptr
- Len int
-}
-
-type unsafeSlice struct {
- Data uintptr
- Len int
- Cap int
-}
-
-// stringView returns a view of the []byte as a string.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func stringView(v []byte) string {
- if len(v) == 0 {
- return ""
- }
-
- bx := (*unsafeSlice)(unsafe.Pointer(&v))
- sx := unsafeString{bx.Data, bx.Len}
- return *(*string)(unsafe.Pointer(&sx))
-}
-
-// bytesView returns a view of the string as a []byte.
-// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
-// In regular safe mode, it is an allocation and copy.
-func bytesView(v string) []byte {
- if len(v) == 0 {
- return zeroByteSlice
- }
-
- sx := (*unsafeString)(unsafe.Pointer(&v))
- bx := unsafeSlice{sx.Data, sx.Len, sx.Len}
- return *(*[]byte)(unsafe.Pointer(&bx))
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/json.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/json.go
deleted file mode 100644
index 5bb389628..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/json.go
+++ /dev/null
@@ -1,1234 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-// By default, this json support uses base64 encoding for bytes, because you cannot
-// store and read any arbitrary string in json (only unicode).
-// However, the user can configre how to encode/decode bytes.
-//
-// This library specifically supports UTF-8 for encoding and decoding only.
-//
-// Note that the library will happily encode/decode things which are not valid
-// json e.g. a map[int64]string. We do it for consistency. With valid json,
-// we will encode and decode appropriately.
-// Users can specify their map type if necessary to force it.
-//
-// Note:
-// - we cannot use strconv.Quote and strconv.Unquote because json quotes/unquotes differently.
-// We implement it here.
-// - Also, strconv.ParseXXX for floats and integers
-// - only works on strings resulting in unnecessary allocation and []byte-string conversion.
-// - it does a lot of redundant checks, because json numbers are simpler that what it supports.
-// - We parse numbers (floats and integers) directly here.
-// We only delegate parsing floats if it is a hairy float which could cause a loss of precision.
-// In that case, we delegate to strconv.ParseFloat.
-//
-// Note:
-// - encode does not beautify. There is no whitespace when encoding.
-// - rpc calls which take single integer arguments or write single numeric arguments will need care.
-
-// Top-level methods of json(End|Dec)Driver (which are implementations of (en|de)cDriver
-// MUST not call one-another.
-
-import (
- "bytes"
- "encoding/base64"
- "fmt"
- "reflect"
- "strconv"
- "unicode/utf16"
- "unicode/utf8"
-)
-
-//--------------------------------
-
-var (
- jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'}
-
- jsonFloat64Pow10 = [...]float64{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- 1e20, 1e21, 1e22,
- }
-
- jsonUint64Pow10 = [...]uint64{
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- }
-
- // jsonTabs and jsonSpaces are used as caches for indents
- jsonTabs, jsonSpaces string
-)
-
-const (
- // jsonUnreadAfterDecNum controls whether we unread after decoding a number.
- //
- // instead of unreading, just update d.tok (iff it's not a whitespace char)
- // However, doing this means that we may HOLD onto some data which belongs to another stream.
- // Thus, it is safest to unread the data when done.
- // keep behind a constant flag for now.
- jsonUnreadAfterDecNum = true
-
- // If !jsonValidateSymbols, decoding will be faster, by skipping some checks:
- // - If we see first character of null, false or true,
- // do not validate subsequent characters.
- // - e.g. if we see a n, assume null and skip next 3 characters,
- // and do not validate they are ull.
- // P.S. Do not expect a significant decoding boost from this.
- jsonValidateSymbols = true
-
- // if jsonTruncateMantissa, truncate mantissa if trailing 0's.
- // This is important because it could allow some floats to be decoded without
- // deferring to strconv.ParseFloat.
- jsonTruncateMantissa = true
-
- // if mantissa >= jsonNumUintCutoff before multiplying by 10, this is an overflow
- jsonNumUintCutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base)
-
- // if mantissa >= jsonNumUintMaxVal, this is an overflow
- jsonNumUintMaxVal = 1< 1<<53 || v < -(1<<53)) {
- e.w.writen1('"')
- e.w.writeb(strconv.AppendInt(e.b[:0], v, 10))
- e.w.writen1('"')
- return
- }
- e.w.writeb(strconv.AppendInt(e.b[:0], v, 10))
-}
-
-func (e *jsonEncDriver) EncodeUint(v uint64) {
- if x := e.h.IntegerAsString; x == 'A' || x == 'L' && v > 1<<53 {
- e.w.writen1('"')
- e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
- e.w.writen1('"')
- return
- }
- e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
-}
-
-func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) {
- if v := ext.ConvertExt(rv); v == nil {
- e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil()
- } else {
- en.encode(v)
- }
-}
-
-func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) {
- // only encodes re.Value (never re.Data)
- if re.Value == nil {
- e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil()
- } else {
- en.encode(re.Value)
- }
-}
-
-func (e *jsonEncDriver) EncodeArrayStart(length int) {
- if e.d {
- e.dl++
- }
- e.w.writen1('[')
- e.c = containerArrayStart
-}
-
-func (e *jsonEncDriver) EncodeMapStart(length int) {
- if e.d {
- e.dl++
- }
- e.w.writen1('{')
- e.c = containerMapStart
-}
-
-func (e *jsonEncDriver) EncodeString(c charEncoding, v string) {
- // e.w.writestr(strconv.Quote(v))
- e.quoteStr(v)
-}
-
-func (e *jsonEncDriver) EncodeSymbol(v string) {
- // e.EncodeString(c_UTF8, v)
- e.quoteStr(v)
-}
-
-func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- // if encoding raw bytes and RawBytesExt is configured, use it to encode
- if c == c_RAW && e.se.i != nil {
- e.EncodeExt(v, 0, &e.se, e.e)
- return
- }
- if c == c_RAW {
- slen := base64.StdEncoding.EncodedLen(len(v))
- if cap(e.bs) >= slen {
- e.bs = e.bs[:slen]
- } else {
- e.bs = make([]byte, slen)
- }
- base64.StdEncoding.Encode(e.bs, v)
- e.w.writen1('"')
- e.w.writeb(e.bs)
- e.w.writen1('"')
- } else {
- // e.EncodeString(c, string(v))
- e.quoteStr(stringView(v))
- }
-}
-
-func (e *jsonEncDriver) EncodeAsis(v []byte) {
- e.w.writeb(v)
-}
-
-func (e *jsonEncDriver) quoteStr(s string) {
- // adapted from std pkg encoding/json
- const hex = "0123456789abcdef"
- w := e.w
- w.writen1('"')
- start := 0
- for i := 0; i < len(s); {
- if b := s[i]; b < utf8.RuneSelf {
- if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' {
- i++
- continue
- }
- if start < i {
- w.writestr(s[start:i])
- }
- switch b {
- case '\\', '"':
- w.writen2('\\', b)
- case '\n':
- w.writen2('\\', 'n')
- case '\r':
- w.writen2('\\', 'r')
- case '\b':
- w.writen2('\\', 'b')
- case '\f':
- w.writen2('\\', 'f')
- case '\t':
- w.writen2('\\', 't')
- default:
- // encode all bytes < 0x20 (except \r, \n).
- // also encode < > & to prevent security holes when served to some browsers.
- w.writestr(`\u00`)
- w.writen2(hex[b>>4], hex[b&0xF])
- }
- i++
- start = i
- continue
- }
- c, size := utf8.DecodeRuneInString(s[i:])
- if c == utf8.RuneError && size == 1 {
- if start < i {
- w.writestr(s[start:i])
- }
- w.writestr(`\ufffd`)
- i += size
- start = i
- continue
- }
- // U+2028 is LINE SEPARATOR. U+2029 is PARAGRAPH SEPARATOR.
- // Both technically valid JSON, but bomb on JSONP, so fix here.
- if c == '\u2028' || c == '\u2029' {
- if start < i {
- w.writestr(s[start:i])
- }
- w.writestr(`\u202`)
- w.writen1(hex[c&0xF])
- i += size
- start = i
- continue
- }
- i += size
- }
- if start < len(s) {
- w.writestr(s[start:])
- }
- w.writen1('"')
-}
-
-//--------------------------------
-
-type jsonNum struct {
- // bytes []byte // may have [+-.eE0-9]
- mantissa uint64 // where mantissa ends, and maybe dot begins.
- exponent int16 // exponent value.
- manOverflow bool
- neg bool // started with -. No initial sign in the bytes above.
- dot bool // has dot
- explicitExponent bool // explicit exponent
-}
-
-func (x *jsonNum) reset() {
- x.manOverflow = false
- x.neg = false
- x.dot = false
- x.explicitExponent = false
- x.mantissa = 0
- x.exponent = 0
-}
-
-// uintExp is called only if exponent > 0.
-func (x *jsonNum) uintExp() (n uint64, overflow bool) {
- n = x.mantissa
- e := x.exponent
- if e >= int16(len(jsonUint64Pow10)) {
- overflow = true
- return
- }
- n *= jsonUint64Pow10[e]
- if n < x.mantissa || n > jsonNumUintMaxVal {
- overflow = true
- return
- }
- return
- // for i := int16(0); i < e; i++ {
- // if n >= jsonNumUintCutoff {
- // overflow = true
- // return
- // }
- // n *= 10
- // }
- // return
-}
-
-// these constants are only used withn floatVal.
-// They are brought out, so that floatVal can be inlined.
-const (
- jsonUint64MantissaBits = 52
- jsonMaxExponent = int16(len(jsonFloat64Pow10)) - 1
-)
-
-func (x *jsonNum) floatVal() (f float64, parseUsingStrConv bool) {
- // We do not want to lose precision.
- // Consequently, we will delegate to strconv.ParseFloat if any of the following happen:
- // - There are more digits than in math.MaxUint64: 18446744073709551615 (20 digits)
- // We expect up to 99.... (19 digits)
- // - The mantissa cannot fit into a 52 bits of uint64
- // - The exponent is beyond our scope ie beyong 22.
- parseUsingStrConv = x.manOverflow ||
- x.exponent > jsonMaxExponent ||
- (x.exponent < 0 && -(x.exponent) > jsonMaxExponent) ||
- x.mantissa>>jsonUint64MantissaBits != 0
-
- if parseUsingStrConv {
- return
- }
-
- // all good. so handle parse here.
- f = float64(x.mantissa)
- // fmt.Printf(".Float: uint64 value: %v, float: %v\n", m, f)
- if x.neg {
- f = -f
- }
- if x.exponent > 0 {
- f *= jsonFloat64Pow10[x.exponent]
- } else if x.exponent < 0 {
- f /= jsonFloat64Pow10[-x.exponent]
- }
- return
-}
-
-type jsonDecDriver struct {
- noBuiltInTypes
- d *Decoder
- h *JsonHandle
- r decReader
-
- c containerState
- // tok is used to store the token read right after skipWhiteSpace.
- tok uint8
-
- bstr [8]byte // scratch used for string \UXXX parsing
- b [64]byte // scratch, used for parsing strings or numbers
- b2 [64]byte // scratch, used only for decodeBytes (after base64)
- bs []byte // scratch. Initialized from b. Used for parsing strings or numbers.
-
- se setExtWrapper
-
- n jsonNum
-}
-
-func jsonIsWS(b byte) bool {
- return b == ' ' || b == '\t' || b == '\r' || b == '\n'
-}
-
-// // This will skip whitespace characters and return the next byte to read.
-// // The next byte determines what the value will be one of.
-// func (d *jsonDecDriver) skipWhitespace() {
-// // fast-path: do not enter loop. Just check first (in case no whitespace).
-// b := d.r.readn1()
-// if jsonIsWS(b) {
-// r := d.r
-// for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
-// }
-// }
-// d.tok = b
-// }
-
-func (d *jsonDecDriver) uncacheRead() {
- if d.tok != 0 {
- d.r.unreadn1()
- d.tok = 0
- }
-}
-
-func (d *jsonDecDriver) sendContainerState(c containerState) {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- var xc uint8 // char expected
- if c == containerMapKey {
- if d.c != containerMapStart {
- xc = ','
- }
- } else if c == containerMapValue {
- xc = ':'
- } else if c == containerMapEnd {
- xc = '}'
- } else if c == containerArrayElem {
- if d.c != containerArrayStart {
- xc = ','
- }
- } else if c == containerArrayEnd {
- xc = ']'
- }
- if xc != 0 {
- if d.tok != xc {
- d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok)
- }
- d.tok = 0
- }
- d.c = c
-}
-
-func (d *jsonDecDriver) CheckBreak() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == '}' || d.tok == ']' {
- // d.tok = 0 // only checking, not consuming
- return true
- }
- return false
-}
-
-func (d *jsonDecDriver) readStrIdx(fromIdx, toIdx uint8) {
- bs := d.r.readx(int(toIdx - fromIdx))
- d.tok = 0
- if jsonValidateSymbols {
- if !bytes.Equal(bs, jsonLiterals[fromIdx:toIdx]) {
- d.d.errorf("json: expecting %s: got %s", jsonLiterals[fromIdx:toIdx], bs)
- return
- }
- }
-}
-
-func (d *jsonDecDriver) TryDecodeAsNil() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == 'n' {
- d.readStrIdx(10, 13) // ull
- return true
- }
- return false
-}
-
-func (d *jsonDecDriver) DecodeBool() bool {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok == 'f' {
- d.readStrIdx(5, 9) // alse
- return false
- }
- if d.tok == 't' {
- d.readStrIdx(1, 4) // rue
- return true
- }
- d.d.errorf("json: decode bool: got first char %c", d.tok)
- return false // "unreachable"
-}
-
-func (d *jsonDecDriver) ReadMapStart() int {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok != '{' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '{', d.tok)
- }
- d.tok = 0
- d.c = containerMapStart
- return -1
-}
-
-func (d *jsonDecDriver) ReadArrayStart() int {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if d.tok != '[' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '[', d.tok)
- }
- d.tok = 0
- d.c = containerArrayStart
- return -1
-}
-
-func (d *jsonDecDriver) ContainerType() (vt valueType) {
- // check container type by checking the first char
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- if b := d.tok; b == '{' {
- return valueTypeMap
- } else if b == '[' {
- return valueTypeArray
- } else if b == 'n' {
- return valueTypeNil
- } else if b == '"' {
- return valueTypeString
- }
- return valueTypeUnset
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- // return false // "unreachable"
-}
-
-func (d *jsonDecDriver) decNum(storeBytes bool) {
- // If it is has a . or an e|E, decode as a float; else decode as an int.
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- b := d.tok
- var str bool
- if b == '"' {
- str = true
- b = d.r.readn1()
- }
- if !(b == '+' || b == '-' || b == '.' || (b >= '0' && b <= '9')) {
- d.d.errorf("json: decNum: got first char '%c'", b)
- return
- }
- d.tok = 0
-
- const cutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base)
- const jsonNumUintMaxVal = 1<= jsonNumUintCutoff {
- n.manOverflow = true
- break
- }
- v := uint64(b - '0')
- n.mantissa *= 10
- if v != 0 {
- n1 := n.mantissa + v
- if n1 < n.mantissa || n1 > jsonNumUintMaxVal {
- n.manOverflow = true // n+v overflows
- break
- }
- n.mantissa = n1
- }
- case 6:
- state = 7
- fallthrough
- case 7:
- if !(b == '0' && e == 0) {
- e = e*10 + int16(b-'0')
- }
- default:
- break LOOP
- }
- case '"':
- if str {
- if storeBytes {
- d.bs = append(d.bs, '"')
- }
- b, eof = r.readn1eof()
- }
- break LOOP
- default:
- break LOOP
- }
- if storeBytes {
- d.bs = append(d.bs, b)
- }
- b, eof = r.readn1eof()
- }
-
- if jsonTruncateMantissa && n.mantissa != 0 {
- for n.mantissa%10 == 0 {
- n.mantissa /= 10
- n.exponent++
- }
- }
-
- if e != 0 {
- if eNeg {
- n.exponent -= e
- } else {
- n.exponent += e
- }
- }
-
- // d.n = n
-
- if !eof {
- if jsonUnreadAfterDecNum {
- r.unreadn1()
- } else {
- if !jsonIsWS(b) {
- d.tok = b
- }
- }
- }
- // fmt.Printf("1: n: bytes: %s, neg: %v, dot: %v, exponent: %v, mantissaEndIndex: %v\n",
- // n.bytes, n.neg, n.dot, n.exponent, n.mantissaEndIndex)
- return
-}
-
-func (d *jsonDecDriver) DecodeInt(bitsize uint8) (i int64) {
- d.decNum(false)
- n := &d.n
- if n.manOverflow {
- d.d.errorf("json: overflow integer after: %v", n.mantissa)
- return
- }
- var u uint64
- if n.exponent == 0 {
- u = n.mantissa
- } else if n.exponent < 0 {
- d.d.errorf("json: fractional integer")
- return
- } else if n.exponent > 0 {
- var overflow bool
- if u, overflow = n.uintExp(); overflow {
- d.d.errorf("json: overflow integer")
- return
- }
- }
- i = int64(u)
- if n.neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs)
- return
- }
- // fmt.Printf("DecodeInt: %v\n", i)
- return
-}
-
-// floatVal MUST only be called after a decNum, as d.bs now contains the bytes of the number
-func (d *jsonDecDriver) floatVal() (f float64) {
- f, useStrConv := d.n.floatVal()
- if useStrConv {
- var err error
- if f, err = strconv.ParseFloat(stringView(d.bs), 64); err != nil {
- panic(fmt.Errorf("parse float: %s, %v", d.bs, err))
- }
- if d.n.neg {
- f = -f
- }
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeUint(bitsize uint8) (u uint64) {
- d.decNum(false)
- n := &d.n
- if n.neg {
- d.d.errorf("json: unsigned integer cannot be negative")
- return
- }
- if n.manOverflow {
- d.d.errorf("json: overflow integer after: %v", n.mantissa)
- return
- }
- if n.exponent == 0 {
- u = n.mantissa
- } else if n.exponent < 0 {
- d.d.errorf("json: fractional integer")
- return
- } else if n.exponent > 0 {
- var overflow bool
- if u, overflow = n.uintExp(); overflow {
- d.d.errorf("json: overflow integer")
- return
- }
- }
- if chkOvf.Uint(u, bitsize) {
- d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs)
- return
- }
- // fmt.Printf("DecodeUint: %v\n", u)
- return
-}
-
-func (d *jsonDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- d.decNum(true)
- f = d.floatVal()
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("json: overflow float32: %v, %s", f, d.bs)
- return
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = xtag
- d.d.decode(&re.Value)
- } else {
- var v interface{}
- d.d.decode(&v)
- ext.UpdateExt(rv, v)
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- // if decoding into raw bytes, and the RawBytesExt is configured, use it to decode.
- if !isstring && d.se.i != nil {
- bsOut = bs
- d.DecodeExt(&bsOut, 0, &d.se)
- return
- }
- d.appendStringAsBytes()
- // if isstring, then just return the bytes, even if it is using the scratch buffer.
- // the bytes will be converted to a string as needed.
- if isstring {
- return d.bs
- }
- // if appendStringAsBytes returned a zero-len slice, then treat as nil.
- // This should only happen for null, and "".
- if len(d.bs) == 0 {
- return nil
- }
- bs0 := d.bs
- slen := base64.StdEncoding.DecodedLen(len(bs0))
- if slen <= cap(bs) {
- bsOut = bs[:slen]
- } else if zerocopy && slen <= cap(d.b2) {
- bsOut = d.b2[:slen]
- } else {
- bsOut = make([]byte, slen)
- }
- slen2, err := base64.StdEncoding.Decode(bsOut, bs0)
- if err != nil {
- d.d.errorf("json: error decoding base64 binary '%s': %v", bs0, err)
- return nil
- }
- if slen != slen2 {
- bsOut = bsOut[:slen2]
- }
- return
-}
-
-func (d *jsonDecDriver) DecodeString() (s string) {
- d.appendStringAsBytes()
- // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key
- if d.c == containerMapKey {
- return d.d.string(d.bs)
- }
- return string(d.bs)
-}
-
-func (d *jsonDecDriver) appendStringAsBytes() {
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
-
- // handle null as a string
- if d.tok == 'n' {
- d.readStrIdx(10, 13) // ull
- d.bs = d.bs[:0]
- return
- }
-
- if d.tok != '"' {
- d.d.errorf("json: expect char '%c' but got char '%c'", '"', d.tok)
- }
- d.tok = 0
-
- v := d.bs[:0]
- var c uint8
- r := d.r
- for {
- c = r.readn1()
- if c == '"' {
- break
- } else if c == '\\' {
- c = r.readn1()
- switch c {
- case '"', '\\', '/', '\'':
- v = append(v, c)
- case 'b':
- v = append(v, '\b')
- case 'f':
- v = append(v, '\f')
- case 'n':
- v = append(v, '\n')
- case 'r':
- v = append(v, '\r')
- case 't':
- v = append(v, '\t')
- case 'u':
- rr := d.jsonU4(false)
- // fmt.Printf("$$$$$$$$$: is surrogate: %v\n", utf16.IsSurrogate(rr))
- if utf16.IsSurrogate(rr) {
- rr = utf16.DecodeRune(rr, d.jsonU4(true))
- }
- w2 := utf8.EncodeRune(d.bstr[:], rr)
- v = append(v, d.bstr[:w2]...)
- default:
- d.d.errorf("json: unsupported escaped value: %c", c)
- }
- } else {
- v = append(v, c)
- }
- }
- d.bs = v
-}
-
-func (d *jsonDecDriver) jsonU4(checkSlashU bool) rune {
- r := d.r
- if checkSlashU && !(r.readn1() == '\\' && r.readn1() == 'u') {
- d.d.errorf(`json: unquoteStr: invalid unicode sequence. Expecting \u`)
- return 0
- }
- // u, _ := strconv.ParseUint(string(d.bstr[:4]), 16, 64)
- var u uint32
- for i := 0; i < 4; i++ {
- v := r.readn1()
- if '0' <= v && v <= '9' {
- v = v - '0'
- } else if 'a' <= v && v <= 'z' {
- v = v - 'a' + 10
- } else if 'A' <= v && v <= 'Z' {
- v = v - 'A' + 10
- } else {
- d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, v)
- return 0
- }
- u = u*16 + uint32(v)
- }
- return rune(u)
-}
-
-func (d *jsonDecDriver) DecodeNaked() {
- z := &d.d.n
- // var decodeFurther bool
-
- if d.tok == 0 {
- var b byte
- r := d.r
- for b = r.readn1(); jsonIsWS(b); b = r.readn1() {
- }
- d.tok = b
- }
- switch d.tok {
- case 'n':
- d.readStrIdx(10, 13) // ull
- z.v = valueTypeNil
- case 'f':
- d.readStrIdx(5, 9) // alse
- z.v = valueTypeBool
- z.b = false
- case 't':
- d.readStrIdx(1, 4) // rue
- z.v = valueTypeBool
- z.b = true
- case '{':
- z.v = valueTypeMap
- // d.tok = 0 // don't consume. kInterfaceNaked will call ReadMapStart
- // decodeFurther = true
- case '[':
- z.v = valueTypeArray
- // d.tok = 0 // don't consume. kInterfaceNaked will call ReadArrayStart
- // decodeFurther = true
- case '"':
- z.v = valueTypeString
- z.s = d.DecodeString()
- default: // number
- d.decNum(true)
- n := &d.n
- // if the string had a any of [.eE], then decode as float.
- switch {
- case n.explicitExponent, n.dot, n.exponent < 0, n.manOverflow:
- z.v = valueTypeFloat
- z.f = d.floatVal()
- case n.exponent == 0:
- u := n.mantissa
- switch {
- case n.neg:
- z.v = valueTypeInt
- z.i = -int64(u)
- case d.h.SignedInteger:
- z.v = valueTypeInt
- z.i = int64(u)
- default:
- z.v = valueTypeUint
- z.u = u
- }
- default:
- u, overflow := n.uintExp()
- switch {
- case overflow:
- z.v = valueTypeFloat
- z.f = d.floatVal()
- case n.neg:
- z.v = valueTypeInt
- z.i = -int64(u)
- case d.h.SignedInteger:
- z.v = valueTypeInt
- z.i = int64(u)
- default:
- z.v = valueTypeUint
- z.u = u
- }
- }
- // fmt.Printf("DecodeNaked: Number: %T, %v\n", v, v)
- }
- // if decodeFurther {
- // d.s.sc.retryRead()
- // }
- return
-}
-
-//----------------------
-
-// JsonHandle is a handle for JSON encoding format.
-//
-// Json is comprehensively supported:
-// - decodes numbers into interface{} as int, uint or float64
-// - configurable way to encode/decode []byte .
-// by default, encodes and decodes []byte using base64 Std Encoding
-// - UTF-8 support for encoding and decoding
-//
-// It has better performance than the json library in the standard library,
-// by leveraging the performance improvements of the codec library and
-// minimizing allocations.
-//
-// In addition, it doesn't read more bytes than necessary during a decode, which allows
-// reading multiple values from a stream containing json and non-json content.
-// For example, a user can read a json value, then a cbor value, then a msgpack value,
-// all from the same stream in sequence.
-type JsonHandle struct {
- textEncodingType
- BasicHandle
- // RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way.
- // If not configured, raw bytes are encoded to/from base64 text.
- RawBytesExt InterfaceExt
-
- // Indent indicates how a value is encoded.
- // - If positive, indent by that number of spaces.
- // - If negative, indent by that number of tabs.
- Indent int8
-
- // IntegerAsString controls how integers (signed and unsigned) are encoded.
- //
- // Per the JSON Spec, JSON numbers are 64-bit floating point numbers.
- // Consequently, integers > 2^53 cannot be represented as a JSON number without losing precision.
- // This can be mitigated by configuring how to encode integers.
- //
- // IntegerAsString interpretes the following values:
- // - if 'L', then encode integers > 2^53 as a json string.
- // - if 'A', then encode all integers as a json string
- // containing the exact integer representation as a decimal.
- // - else encode all integers as a json number (default)
- IntegerAsString uint8
-}
-
-func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{i: ext})
-}
-
-func (h *JsonHandle) newEncDriver(e *Encoder) encDriver {
- hd := jsonEncDriver{e: e, h: h}
- hd.bs = hd.b[:0]
-
- hd.reset()
-
- return &hd
-}
-
-func (h *JsonHandle) newDecDriver(d *Decoder) decDriver {
- // d := jsonDecDriver{r: r.(*bytesDecReader), h: h}
- hd := jsonDecDriver{d: d, h: h}
- hd.bs = hd.b[:0]
- hd.reset()
- return &hd
-}
-
-func (e *jsonEncDriver) reset() {
- e.w = e.e.w
- e.se.i = e.h.RawBytesExt
- if e.bs != nil {
- e.bs = e.bs[:0]
- }
- e.d, e.dt, e.dl, e.ds = false, false, 0, ""
- e.c = 0
- if e.h.Indent > 0 {
- e.d = true
- e.ds = jsonSpaces[:e.h.Indent]
- } else if e.h.Indent < 0 {
- e.d = true
- e.dt = true
- e.ds = jsonTabs[:-(e.h.Indent)]
- }
-}
-
-func (d *jsonDecDriver) reset() {
- d.r = d.d.r
- d.se.i = d.h.RawBytesExt
- if d.bs != nil {
- d.bs = d.bs[:0]
- }
- d.c, d.tok = 0, 0
- d.n.reset()
-}
-
-var jsonEncodeTerminate = []byte{' '}
-
-func (h *JsonHandle) rpcEncodeTerminate() []byte {
- return jsonEncodeTerminate
-}
-
-var _ decDriver = (*jsonDecDriver)(nil)
-var _ encDriver = (*jsonEncDriver)(nil)
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/msgpack.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/msgpack.go
deleted file mode 100644
index e79830b56..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/msgpack.go
+++ /dev/null
@@ -1,852 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-/*
-MSGPACK
-
-Msgpack-c implementation powers the c, c++, python, ruby, etc libraries.
-We need to maintain compatibility with it and how it encodes integer values
-without caring about the type.
-
-For compatibility with behaviour of msgpack-c reference implementation:
- - Go intX (>0) and uintX
- IS ENCODED AS
- msgpack +ve fixnum, unsigned
- - Go intX (<0)
- IS ENCODED AS
- msgpack -ve fixnum, signed
-
-*/
-package codec
-
-import (
- "fmt"
- "io"
- "math"
- "net/rpc"
- "reflect"
-)
-
-const (
- mpPosFixNumMin byte = 0x00
- mpPosFixNumMax = 0x7f
- mpFixMapMin = 0x80
- mpFixMapMax = 0x8f
- mpFixArrayMin = 0x90
- mpFixArrayMax = 0x9f
- mpFixStrMin = 0xa0
- mpFixStrMax = 0xbf
- mpNil = 0xc0
- _ = 0xc1
- mpFalse = 0xc2
- mpTrue = 0xc3
- mpFloat = 0xca
- mpDouble = 0xcb
- mpUint8 = 0xcc
- mpUint16 = 0xcd
- mpUint32 = 0xce
- mpUint64 = 0xcf
- mpInt8 = 0xd0
- mpInt16 = 0xd1
- mpInt32 = 0xd2
- mpInt64 = 0xd3
-
- // extensions below
- mpBin8 = 0xc4
- mpBin16 = 0xc5
- mpBin32 = 0xc6
- mpExt8 = 0xc7
- mpExt16 = 0xc8
- mpExt32 = 0xc9
- mpFixExt1 = 0xd4
- mpFixExt2 = 0xd5
- mpFixExt4 = 0xd6
- mpFixExt8 = 0xd7
- mpFixExt16 = 0xd8
-
- mpStr8 = 0xd9 // new
- mpStr16 = 0xda
- mpStr32 = 0xdb
-
- mpArray16 = 0xdc
- mpArray32 = 0xdd
-
- mpMap16 = 0xde
- mpMap32 = 0xdf
-
- mpNegFixNumMin = 0xe0
- mpNegFixNumMax = 0xff
-)
-
-// MsgpackSpecRpcMultiArgs is a special type which signifies to the MsgpackSpecRpcCodec
-// that the backend RPC service takes multiple arguments, which have been arranged
-// in sequence in the slice.
-//
-// The Codec then passes it AS-IS to the rpc service (without wrapping it in an
-// array of 1 element).
-type MsgpackSpecRpcMultiArgs []interface{}
-
-// A MsgpackContainer type specifies the different types of msgpackContainers.
-type msgpackContainerType struct {
- fixCutoff int
- bFixMin, b8, b16, b32 byte
- hasFixMin, has8, has8Always bool
-}
-
-var (
- msgpackContainerStr = msgpackContainerType{32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false}
- msgpackContainerBin = msgpackContainerType{0, 0, mpBin8, mpBin16, mpBin32, false, true, true}
- msgpackContainerList = msgpackContainerType{16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false}
- msgpackContainerMap = msgpackContainerType{16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false}
-)
-
-//---------------------------------------------
-
-type msgpackEncDriver struct {
- noBuiltInTypes
- encNoSeparator
- e *Encoder
- w encWriter
- h *MsgpackHandle
- x [8]byte
-}
-
-func (e *msgpackEncDriver) EncodeNil() {
- e.w.writen1(mpNil)
-}
-
-func (e *msgpackEncDriver) EncodeInt(i int64) {
- if i >= 0 {
- e.EncodeUint(uint64(i))
- } else if i >= -32 {
- e.w.writen1(byte(i))
- } else if i >= math.MinInt8 {
- e.w.writen2(mpInt8, byte(i))
- } else if i >= math.MinInt16 {
- e.w.writen1(mpInt16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i))
- } else if i >= math.MinInt32 {
- e.w.writen1(mpInt32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i))
- } else {
- e.w.writen1(mpInt64)
- bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i))
- }
-}
-
-func (e *msgpackEncDriver) EncodeUint(i uint64) {
- if i <= math.MaxInt8 {
- e.w.writen1(byte(i))
- } else if i <= math.MaxUint8 {
- e.w.writen2(mpUint8, byte(i))
- } else if i <= math.MaxUint16 {
- e.w.writen1(mpUint16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i))
- } else if i <= math.MaxUint32 {
- e.w.writen1(mpUint32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i))
- } else {
- e.w.writen1(mpUint64)
- bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i))
- }
-}
-
-func (e *msgpackEncDriver) EncodeBool(b bool) {
- if b {
- e.w.writen1(mpTrue)
- } else {
- e.w.writen1(mpFalse)
- }
-}
-
-func (e *msgpackEncDriver) EncodeFloat32(f float32) {
- e.w.writen1(mpFloat)
- bigenHelper{e.x[:4], e.w}.writeUint32(math.Float32bits(f))
-}
-
-func (e *msgpackEncDriver) EncodeFloat64(f float64) {
- e.w.writen1(mpDouble)
- bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f))
-}
-
-func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Encoder) {
- bs := ext.WriteExt(v)
- if bs == nil {
- e.EncodeNil()
- return
- }
- if e.h.WriteExt {
- e.encodeExtPreamble(uint8(xtag), len(bs))
- e.w.writeb(bs)
- } else {
- e.EncodeStringBytes(c_RAW, bs)
- }
-}
-
-func (e *msgpackEncDriver) EncodeRawExt(re *RawExt, _ *Encoder) {
- e.encodeExtPreamble(uint8(re.Tag), len(re.Data))
- e.w.writeb(re.Data)
-}
-
-func (e *msgpackEncDriver) encodeExtPreamble(xtag byte, l int) {
- if l == 1 {
- e.w.writen2(mpFixExt1, xtag)
- } else if l == 2 {
- e.w.writen2(mpFixExt2, xtag)
- } else if l == 4 {
- e.w.writen2(mpFixExt4, xtag)
- } else if l == 8 {
- e.w.writen2(mpFixExt8, xtag)
- } else if l == 16 {
- e.w.writen2(mpFixExt16, xtag)
- } else if l < 256 {
- e.w.writen2(mpExt8, byte(l))
- e.w.writen1(xtag)
- } else if l < 65536 {
- e.w.writen1(mpExt16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(l))
- e.w.writen1(xtag)
- } else {
- e.w.writen1(mpExt32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(l))
- e.w.writen1(xtag)
- }
-}
-
-func (e *msgpackEncDriver) EncodeArrayStart(length int) {
- e.writeContainerLen(msgpackContainerList, length)
-}
-
-func (e *msgpackEncDriver) EncodeMapStart(length int) {
- e.writeContainerLen(msgpackContainerMap, length)
-}
-
-func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) {
- if c == c_RAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, len(s))
- } else {
- e.writeContainerLen(msgpackContainerStr, len(s))
- }
- if len(s) > 0 {
- e.w.writestr(s)
- }
-}
-
-func (e *msgpackEncDriver) EncodeSymbol(v string) {
- e.EncodeString(c_UTF8, v)
-}
-
-func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) {
- if c == c_RAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, len(bs))
- } else {
- e.writeContainerLen(msgpackContainerStr, len(bs))
- }
- if len(bs) > 0 {
- e.w.writeb(bs)
- }
-}
-
-func (e *msgpackEncDriver) writeContainerLen(ct msgpackContainerType, l int) {
- if ct.hasFixMin && l < ct.fixCutoff {
- e.w.writen1(ct.bFixMin | byte(l))
- } else if ct.has8 && l < 256 && (ct.has8Always || e.h.WriteExt) {
- e.w.writen2(ct.b8, uint8(l))
- } else if l < 65536 {
- e.w.writen1(ct.b16)
- bigenHelper{e.x[:2], e.w}.writeUint16(uint16(l))
- } else {
- e.w.writen1(ct.b32)
- bigenHelper{e.x[:4], e.w}.writeUint32(uint32(l))
- }
-}
-
-//---------------------------------------------
-
-type msgpackDecDriver struct {
- d *Decoder
- r decReader // *Decoder decReader decReaderT
- h *MsgpackHandle
- b [scratchByteArrayLen]byte
- bd byte
- bdRead bool
- br bool // bytes reader
- noBuiltInTypes
- noStreamingCodec
- decNoSeparator
-}
-
-// Note: This returns either a primitive (int, bool, etc) for non-containers,
-// or a containerType, or a specific type denoting nil or extension.
-// It is called when a nil interface{} is passed, leaving it up to the DecDriver
-// to introspect the stream and decide how best to decode.
-// It deciphers the value by looking at the stream first.
-func (d *msgpackDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
- bd := d.bd
- n := &d.d.n
- var decodeFurther bool
-
- switch bd {
- case mpNil:
- n.v = valueTypeNil
- d.bdRead = false
- case mpFalse:
- n.v = valueTypeBool
- n.b = false
- case mpTrue:
- n.v = valueTypeBool
- n.b = true
-
- case mpFloat:
- n.v = valueTypeFloat
- n.f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- case mpDouble:
- n.v = valueTypeFloat
- n.f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
-
- case mpUint8:
- n.v = valueTypeUint
- n.u = uint64(d.r.readn1())
- case mpUint16:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint16(d.r.readx(2)))
- case mpUint32:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint32(d.r.readx(4)))
- case mpUint64:
- n.v = valueTypeUint
- n.u = uint64(bigen.Uint64(d.r.readx(8)))
-
- case mpInt8:
- n.v = valueTypeInt
- n.i = int64(int8(d.r.readn1()))
- case mpInt16:
- n.v = valueTypeInt
- n.i = int64(int16(bigen.Uint16(d.r.readx(2))))
- case mpInt32:
- n.v = valueTypeInt
- n.i = int64(int32(bigen.Uint32(d.r.readx(4))))
- case mpInt64:
- n.v = valueTypeInt
- n.i = int64(int64(bigen.Uint64(d.r.readx(8))))
-
- default:
- switch {
- case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax:
- // positive fixnum (always signed)
- n.v = valueTypeInt
- n.i = int64(int8(bd))
- case bd >= mpNegFixNumMin && bd <= mpNegFixNumMax:
- // negative fixnum
- n.v = valueTypeInt
- n.i = int64(int8(bd))
- case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax:
- if d.h.RawToString {
- n.v = valueTypeString
- n.s = d.DecodeString()
- } else {
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- }
- case bd == mpBin8, bd == mpBin16, bd == mpBin32:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax:
- n.v = valueTypeArray
- decodeFurther = true
- case bd == mpMap16, bd == mpMap32, bd >= mpFixMapMin && bd <= mpFixMapMax:
- n.v = valueTypeMap
- decodeFurther = true
- case bd >= mpFixExt1 && bd <= mpFixExt16, bd >= mpExt8 && bd <= mpExt32:
- n.v = valueTypeExt
- clen := d.readExtLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(clen)
- default:
- d.d.errorf("Nil-Deciphered DecodeValue: %s: hex: %x, dec: %d", msgBadDesc, bd, bd)
- }
- }
- if !decodeFurther {
- d.bdRead = false
- }
- if n.v == valueTypeUint && d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = int64(n.u)
- }
- return
-}
-
-// int can be decoded from msgpack type: intXXX or uintXXX
-func (d *msgpackDecDriver) DecodeInt(bitsize uint8) (i int64) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case mpUint8:
- i = int64(uint64(d.r.readn1()))
- case mpUint16:
- i = int64(uint64(bigen.Uint16(d.r.readx(2))))
- case mpUint32:
- i = int64(uint64(bigen.Uint32(d.r.readx(4))))
- case mpUint64:
- i = int64(bigen.Uint64(d.r.readx(8)))
- case mpInt8:
- i = int64(int8(d.r.readn1()))
- case mpInt16:
- i = int64(int16(bigen.Uint16(d.r.readx(2))))
- case mpInt32:
- i = int64(int32(bigen.Uint32(d.r.readx(4))))
- case mpInt64:
- i = int64(bigen.Uint64(d.r.readx(8)))
- default:
- switch {
- case d.bd >= mpPosFixNumMin && d.bd <= mpPosFixNumMax:
- i = int64(int8(d.bd))
- case d.bd >= mpNegFixNumMin && d.bd <= mpNegFixNumMax:
- i = int64(int8(d.bd))
- default:
- d.d.errorf("Unhandled single-byte unsigned integer value: %s: %x", msgBadDesc, d.bd)
- return
- }
- }
- // check overflow (logic adapted from std pkg reflect/value.go OverflowUint()
- if bitsize > 0 {
- if trunc := (i << (64 - bitsize)) >> (64 - bitsize); i != trunc {
- d.d.errorf("Overflow int value: %v", i)
- return
- }
- }
- d.bdRead = false
- return
-}
-
-// uint can be decoded from msgpack type: intXXX or uintXXX
-func (d *msgpackDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case mpUint8:
- ui = uint64(d.r.readn1())
- case mpUint16:
- ui = uint64(bigen.Uint16(d.r.readx(2)))
- case mpUint32:
- ui = uint64(bigen.Uint32(d.r.readx(4)))
- case mpUint64:
- ui = bigen.Uint64(d.r.readx(8))
- case mpInt8:
- if i := int64(int8(d.r.readn1())); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt16:
- if i := int64(int16(bigen.Uint16(d.r.readx(2)))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt32:
- if i := int64(int32(bigen.Uint32(d.r.readx(4)))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- case mpInt64:
- if i := int64(bigen.Uint64(d.r.readx(8))); i >= 0 {
- ui = uint64(i)
- } else {
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", i)
- return
- }
- default:
- switch {
- case d.bd >= mpPosFixNumMin && d.bd <= mpPosFixNumMax:
- ui = uint64(d.bd)
- case d.bd >= mpNegFixNumMin && d.bd <= mpNegFixNumMax:
- d.d.errorf("Assigning negative signed value: %v, to unsigned type", int(d.bd))
- return
- default:
- d.d.errorf("Unhandled single-byte unsigned integer value: %s: %x", msgBadDesc, d.bd)
- return
- }
- }
- // check overflow (logic adapted from std pkg reflect/value.go OverflowUint()
- if bitsize > 0 {
- if trunc := (ui << (64 - bitsize)) >> (64 - bitsize); ui != trunc {
- d.d.errorf("Overflow uint value: %v", ui)
- return
- }
- }
- d.bdRead = false
- return
-}
-
-// float can either be decoded from msgpack type: float, double or intX
-func (d *msgpackDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpFloat {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if d.bd == mpDouble {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else {
- f = float64(d.DecodeInt(0))
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("msgpack: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool, fixnum 0 or 1.
-func (d *msgpackDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpFalse || d.bd == 0 {
- // b = false
- } else if d.bd == mpTrue || d.bd == 1 {
- b = true
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *msgpackDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- var clen int
- // ignore isstring. Expect that the bytes may be found from msgpackContainerStr or msgpackContainerBin
- if bd := d.bd; bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
- clen = d.readContainerLen(msgpackContainerBin)
- } else {
- clen = d.readContainerLen(msgpackContainerStr)
- }
- // println("DecodeBytes: clen: ", clen)
- d.bdRead = false
- // bytes may be nil, so handle it. if nil, clen=-1.
- if clen < 0 {
- return nil
- }
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *msgpackDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *msgpackDecDriver) readNextBd() {
- d.bd = d.r.readn1()
- d.bdRead = true
-}
-
-func (d *msgpackDecDriver) uncacheRead() {
- if d.bdRead {
- d.r.unreadn1()
- d.bdRead = false
- }
-}
-
-func (d *msgpackDecDriver) ContainerType() (vt valueType) {
- bd := d.bd
- if bd == mpNil {
- return valueTypeNil
- } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 ||
- (!d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax))) {
- return valueTypeBytes
- } else if d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax)) {
- return valueTypeString
- } else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) {
- return valueTypeArray
- } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) {
- return valueTypeMap
- } else {
- // d.d.errorf("isContainerType: unsupported parameter: %v", vt)
- }
- return valueTypeUnset
-}
-
-func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == mpNil {
- d.bdRead = false
- v = true
- }
- return
-}
-
-func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) {
- bd := d.bd
- if bd == mpNil {
- clen = -1 // to represent nil
- } else if bd == ct.b8 {
- clen = int(d.r.readn1())
- } else if bd == ct.b16 {
- clen = int(bigen.Uint16(d.r.readx(2)))
- } else if bd == ct.b32 {
- clen = int(bigen.Uint32(d.r.readx(4)))
- } else if (ct.bFixMin & bd) == ct.bFixMin {
- clen = int(ct.bFixMin ^ bd)
- } else {
- d.d.errorf("readContainerLen: %s: hex: %x, decimal: %d", msgBadDesc, bd, bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *msgpackDecDriver) ReadMapStart() int {
- return d.readContainerLen(msgpackContainerMap)
-}
-
-func (d *msgpackDecDriver) ReadArrayStart() int {
- return d.readContainerLen(msgpackContainerList)
-}
-
-func (d *msgpackDecDriver) readExtLen() (clen int) {
- switch d.bd {
- case mpNil:
- clen = -1 // to represent nil
- case mpFixExt1:
- clen = 1
- case mpFixExt2:
- clen = 2
- case mpFixExt4:
- clen = 4
- case mpFixExt8:
- clen = 8
- case mpFixExt16:
- clen = 16
- case mpExt8:
- clen = int(d.r.readn1())
- case mpExt16:
- clen = int(bigen.Uint16(d.r.readx(2)))
- case mpExt32:
- clen = int(bigen.Uint32(d.r.readx(4)))
- default:
- d.d.errorf("decoding ext bytes: found unexpected byte: %x", d.bd)
- return
- }
- return
-}
-
-func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- xbd := d.bd
- if xbd == mpBin8 || xbd == mpBin16 || xbd == mpBin32 {
- xbs = d.DecodeBytes(nil, false, true)
- } else if xbd == mpStr8 || xbd == mpStr16 || xbd == mpStr32 ||
- (xbd >= mpFixStrMin && xbd <= mpFixStrMax) {
- xbs = d.DecodeBytes(nil, true, true)
- } else {
- clen := d.readExtLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(clen)
- }
- d.bdRead = false
- return
-}
-
-//--------------------------------------------------
-
-//MsgpackHandle is a Handle for the Msgpack Schema-Free Encoding Format.
-type MsgpackHandle struct {
- BasicHandle
-
- // RawToString controls how raw bytes are decoded into a nil interface{}.
- RawToString bool
-
- // WriteExt flag supports encoding configured extensions with extension tags.
- // It also controls whether other elements of the new spec are encoded (ie Str8).
- //
- // With WriteExt=false, configured extensions are serialized as raw bytes
- // and Str8 is not encoded.
- //
- // A stream can still be decoded into a typed value, provided an appropriate value
- // is provided, but the type cannot be inferred from the stream. If no appropriate
- // type is provided (e.g. decoding into a nil interface{}), you get back
- // a []byte or string based on the setting of RawToString.
- WriteExt bool
- binaryEncodingType
-}
-
-func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver {
- return &msgpackEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *MsgpackHandle) newDecDriver(d *Decoder) decDriver {
- return &msgpackDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *msgpackEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *msgpackDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-//--------------------------------------------------
-
-type msgpackSpecRpcCodec struct {
- rpcCodec
-}
-
-// /////////////// Spec RPC Codec ///////////////////
-func (c *msgpackSpecRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error {
- // WriteRequest can write to both a Go service, and other services that do
- // not abide by the 1 argument rule of a Go service.
- // We discriminate based on if the body is a MsgpackSpecRpcMultiArgs
- var bodyArr []interface{}
- if m, ok := body.(MsgpackSpecRpcMultiArgs); ok {
- bodyArr = ([]interface{})(m)
- } else {
- bodyArr = []interface{}{body}
- }
- r2 := []interface{}{0, uint32(r.Seq), r.ServiceMethod, bodyArr}
- return c.write(r2, nil, false, true)
-}
-
-func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error {
- var moe interface{}
- if r.Error != "" {
- moe = r.Error
- }
- if moe != nil && body != nil {
- body = nil
- }
- r2 := []interface{}{1, uint32(r.Seq), moe, body}
- return c.write(r2, nil, false, true)
-}
-
-func (c *msgpackSpecRpcCodec) ReadResponseHeader(r *rpc.Response) error {
- return c.parseCustomHeader(1, &r.Seq, &r.Error)
-}
-
-func (c *msgpackSpecRpcCodec) ReadRequestHeader(r *rpc.Request) error {
- return c.parseCustomHeader(0, &r.Seq, &r.ServiceMethod)
-}
-
-func (c *msgpackSpecRpcCodec) ReadRequestBody(body interface{}) error {
- if body == nil { // read and discard
- return c.read(nil)
- }
- bodyArr := []interface{}{body}
- return c.read(&bodyArr)
-}
-
-func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint64, methodOrError *string) (err error) {
-
- if c.isClosed() {
- return io.EOF
- }
-
- // We read the response header by hand
- // so that the body can be decoded on its own from the stream at a later time.
-
- const fia byte = 0x94 //four item array descriptor value
- // Not sure why the panic of EOF is swallowed above.
- // if bs1 := c.dec.r.readn1(); bs1 != fia {
- // err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, bs1)
- // return
- // }
- var b byte
- b, err = c.br.ReadByte()
- if err != nil {
- return
- }
- if b != fia {
- err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, b)
- return
- }
-
- if err = c.read(&b); err != nil {
- return
- }
- if b != expectTypeByte {
- err = fmt.Errorf("Unexpected byte descriptor in header. Expecting %v. Received %v", expectTypeByte, b)
- return
- }
- if err = c.read(msgid); err != nil {
- return
- }
- if err = c.read(methodOrError); err != nil {
- return
- }
- return
-}
-
-//--------------------------------------------------
-
-// msgpackSpecRpc is the implementation of Rpc that uses custom communication protocol
-// as defined in the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-type msgpackSpecRpc struct{}
-
-// MsgpackSpecRpc implements Rpc using the communication protocol defined in
-// the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md .
-// Its methods (ServerCodec and ClientCodec) return values that implement RpcCodecBuffered.
-var MsgpackSpecRpc msgpackSpecRpc
-
-func (x msgpackSpecRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec {
- return &msgpackSpecRpcCodec{newRPCCodec(conn, h)}
-}
-
-func (x msgpackSpecRpc) ClientCodec(conn io.ReadWriteCloser, h Handle) rpc.ClientCodec {
- return &msgpackSpecRpcCodec{newRPCCodec(conn, h)}
-}
-
-var _ decDriver = (*msgpackDecDriver)(nil)
-var _ encDriver = (*msgpackEncDriver)(nil)
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/noop.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/noop.go
deleted file mode 100644
index cfee3d084..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/noop.go
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
- "math/rand"
- "time"
-)
-
-// NoopHandle returns a no-op handle. It basically does nothing.
-// It is only useful for benchmarking, as it gives an idea of the
-// overhead from the codec framework.
-//
-// LIBRARY USERS: *** DO NOT USE ***
-func NoopHandle(slen int) *noopHandle {
- h := noopHandle{}
- h.rand = rand.New(rand.NewSource(time.Now().UnixNano()))
- h.B = make([][]byte, slen)
- h.S = make([]string, slen)
- for i := 0; i < len(h.S); i++ {
- b := make([]byte, i+1)
- for j := 0; j < len(b); j++ {
- b[j] = 'a' + byte(i)
- }
- h.B[i] = b
- h.S[i] = string(b)
- }
- return &h
-}
-
-// noopHandle does nothing.
-// It is used to simulate the overhead of the codec framework.
-type noopHandle struct {
- BasicHandle
- binaryEncodingType
- noopDrv // noopDrv is unexported here, so we can get a copy of it when needed.
-}
-
-type noopDrv struct {
- d *Decoder
- e *Encoder
- i int
- S []string
- B [][]byte
- mks []bool // stack. if map (true), else if array (false)
- mk bool // top of stack. what container are we on? map or array?
- ct valueType // last response for IsContainerType.
- cb int // counter for ContainerType
- rand *rand.Rand
-}
-
-func (h *noopDrv) r(v int) int { return h.rand.Intn(v) }
-func (h *noopDrv) m(v int) int { h.i++; return h.i % v }
-
-func (h *noopDrv) newEncDriver(e *Encoder) encDriver { h.e = e; return h }
-func (h *noopDrv) newDecDriver(d *Decoder) decDriver { h.d = d; return h }
-
-func (h *noopDrv) reset() {}
-func (h *noopDrv) uncacheRead() {}
-
-// --- encDriver
-
-// stack functions (for map and array)
-func (h *noopDrv) start(b bool) {
- // println("start", len(h.mks)+1)
- h.mks = append(h.mks, b)
- h.mk = b
-}
-func (h *noopDrv) end() {
- // println("end: ", len(h.mks)-1)
- h.mks = h.mks[:len(h.mks)-1]
- if len(h.mks) > 0 {
- h.mk = h.mks[len(h.mks)-1]
- } else {
- h.mk = false
- }
-}
-
-func (h *noopDrv) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (h *noopDrv) EncodeNil() {}
-func (h *noopDrv) EncodeInt(i int64) {}
-func (h *noopDrv) EncodeUint(i uint64) {}
-func (h *noopDrv) EncodeBool(b bool) {}
-func (h *noopDrv) EncodeFloat32(f float32) {}
-func (h *noopDrv) EncodeFloat64(f float64) {}
-func (h *noopDrv) EncodeRawExt(re *RawExt, e *Encoder) {}
-func (h *noopDrv) EncodeArrayStart(length int) { h.start(true) }
-func (h *noopDrv) EncodeMapStart(length int) { h.start(false) }
-func (h *noopDrv) EncodeEnd() { h.end() }
-
-func (h *noopDrv) EncodeString(c charEncoding, v string) {}
-func (h *noopDrv) EncodeSymbol(v string) {}
-func (h *noopDrv) EncodeStringBytes(c charEncoding, v []byte) {}
-
-func (h *noopDrv) EncodeExt(rv interface{}, xtag uint64, ext Ext, e *Encoder) {}
-
-// ---- decDriver
-func (h *noopDrv) initReadNext() {}
-func (h *noopDrv) CheckBreak() bool { return false }
-func (h *noopDrv) IsBuiltinType(rt uintptr) bool { return false }
-func (h *noopDrv) DecodeBuiltin(rt uintptr, v interface{}) {}
-func (h *noopDrv) DecodeInt(bitsize uint8) (i int64) { return int64(h.m(15)) }
-func (h *noopDrv) DecodeUint(bitsize uint8) (ui uint64) { return uint64(h.m(35)) }
-func (h *noopDrv) DecodeFloat(chkOverflow32 bool) (f float64) { return float64(h.m(95)) }
-func (h *noopDrv) DecodeBool() (b bool) { return h.m(2) == 0 }
-func (h *noopDrv) DecodeString() (s string) { return h.S[h.m(8)] }
-
-// func (h *noopDrv) DecodeStringAsBytes(bs []byte) []byte { return h.DecodeBytes(bs) }
-
-func (h *noopDrv) DecodeBytes(bs []byte, isstring, zerocopy bool) []byte { return h.B[h.m(len(h.B))] }
-
-func (h *noopDrv) ReadEnd() { h.end() }
-
-// toggle map/slice
-func (h *noopDrv) ReadMapStart() int { h.start(true); return h.m(10) }
-func (h *noopDrv) ReadArrayStart() int { h.start(false); return h.m(10) }
-
-func (h *noopDrv) ContainerType() (vt valueType) {
- // return h.m(2) == 0
- // handle kStruct, which will bomb is it calls this and doesn't get back a map or array.
- // consequently, if the return value is not map or array, reset it to one of them based on h.m(7) % 2
- // for kstruct: at least one out of every 2 times, return one of valueTypeMap or Array (else kstruct bombs)
- // however, every 10th time it is called, we just return something else.
- var vals = [...]valueType{valueTypeArray, valueTypeMap}
- // ------------ TAKE ------------
- // if h.cb%2 == 0 {
- // if h.ct == valueTypeMap || h.ct == valueTypeArray {
- // } else {
- // h.ct = vals[h.m(2)]
- // }
- // } else if h.cb%5 == 0 {
- // h.ct = valueType(h.m(8))
- // } else {
- // h.ct = vals[h.m(2)]
- // }
- // ------------ TAKE ------------
- // if h.cb%16 == 0 {
- // h.ct = valueType(h.cb % 8)
- // } else {
- // h.ct = vals[h.cb%2]
- // }
- h.ct = vals[h.cb%2]
- h.cb++
- return h.ct
-
- // if h.ct == valueTypeNil || h.ct == valueTypeString || h.ct == valueTypeBytes {
- // return h.ct
- // }
- // return valueTypeUnset
- // TODO: may need to tweak this so it works.
- // if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap {
- // h.cb = !h.cb
- // h.ct = vt
- // return h.cb
- // }
- // // go in a loop and check it.
- // h.ct = vt
- // h.cb = h.m(7) == 0
- // return h.cb
-}
-func (h *noopDrv) TryDecodeAsNil() bool {
- if h.mk {
- return false
- } else {
- return h.m(8) == 0
- }
-}
-func (h *noopDrv) DecodeExt(rv interface{}, xtag uint64, ext Ext) uint64 {
- return 0
-}
-
-func (h *noopDrv) DecodeNaked() {
- // use h.r (random) not h.m() because h.m() could cause the same value to be given.
- var sk int
- if h.mk {
- // if mapkey, do not support values of nil OR bytes, array, map or rawext
- sk = h.r(7) + 1
- } else {
- sk = h.r(12)
- }
- n := &h.d.n
- switch sk {
- case 0:
- n.v = valueTypeNil
- case 1:
- n.v, n.b = valueTypeBool, false
- case 2:
- n.v, n.b = valueTypeBool, true
- case 3:
- n.v, n.i = valueTypeInt, h.DecodeInt(64)
- case 4:
- n.v, n.u = valueTypeUint, h.DecodeUint(64)
- case 5:
- n.v, n.f = valueTypeFloat, h.DecodeFloat(true)
- case 6:
- n.v, n.f = valueTypeFloat, h.DecodeFloat(false)
- case 7:
- n.v, n.s = valueTypeString, h.DecodeString()
- case 8:
- n.v, n.l = valueTypeBytes, h.B[h.m(len(h.B))]
- case 9:
- n.v = valueTypeArray
- case 10:
- n.v = valueTypeMap
- default:
- n.v = valueTypeExt
- n.u = h.DecodeUint(64)
- n.l = h.B[h.m(len(h.B))]
- }
- h.ct = n.v
- return
-}
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.go b/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.go
deleted file mode 100644
index 2353263e8..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package codec
-
-//go:generate bash prebuild.sh
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.sh b/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.sh
deleted file mode 100644
index 909f4bb0f..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/prebuild.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/bin/bash
-
-# _needgen is a helper function to tell if we need to generate files for msgp, codecgen.
-_needgen() {
- local a="$1"
- zneedgen=0
- if [[ ! -e "$a" ]]
- then
- zneedgen=1
- echo 1
- return 0
- fi
- for i in `ls -1 *.go.tmpl gen.go values_test.go`
- do
- if [[ "$a" -ot "$i" ]]
- then
- zneedgen=1
- echo 1
- return 0
- fi
- done
- echo 0
-}
-
-# _build generates fast-path.go and gen-helper.go.
-#
-# It is needed because there is some dependency between the generated code
-# and the other classes. Consequently, we have to totally remove the
-# generated files and put stubs in place, before calling "go run" again
-# to recreate them.
-_build() {
- if ! [[ "${zforce}" == "1" ||
- "1" == $( _needgen "fast-path.generated.go" ) ||
- "1" == $( _needgen "gen-helper.generated.go" ) ||
- "1" == $( _needgen "gen.generated.go" ) ||
- 1 == 0 ]]
- then
- return 0
- fi
-
- # echo "Running prebuild"
- if [ "${zbak}" == "1" ]
- then
- # echo "Backing up old generated files"
- _zts=`date '+%m%d%Y_%H%M%S'`
- _gg=".generated.go"
- [ -e "gen-helper${_gg}" ] && mv gen-helper${_gg} gen-helper${_gg}__${_zts}.bak
- [ -e "fast-path${_gg}" ] && mv fast-path${_gg} fast-path${_gg}__${_zts}.bak
- # [ -e "safe${_gg}" ] && mv safe${_gg} safe${_gg}__${_zts}.bak
- # [ -e "unsafe${_gg}" ] && mv unsafe${_gg} unsafe${_gg}__${_zts}.bak
- else
- rm -f fast-path.generated.go gen.generated.go gen-helper.generated.go \
- *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go
- fi
-
- cat > gen.generated.go <> gen.generated.go < gen-dec-map.go.tmpl
-
- cat >> gen.generated.go <> gen.generated.go < gen-dec-array.go.tmpl
-
- cat >> gen.generated.go < gen-from-tmpl.codec.generated.go < gen-from-tmpl.generated.go < math.MaxInt64 {
- // d.d.errorf("decIntAny: Integer out of range for signed int64: %v", ui)
- // return
- // }
- return
-}
-
-func (d *simpleDecDriver) DecodeInt(bitsize uint8) (i int64) {
- ui, neg := d.decCheckInteger()
- i, overflow := chkOvf.SignedInt(ui)
- if overflow {
- d.d.errorf("simple: overflow converting %v to signed integer", ui)
- return
- }
- if neg {
- i = -i
- }
- if chkOvf.Int(i, bitsize) {
- d.d.errorf("simple: overflow integer: %v", i)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- ui, neg := d.decCheckInteger()
- if neg {
- d.d.errorf("Assigning negative signed value to unsigned type")
- return
- }
- if chkOvf.Uint(ui, bitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdFloat32 {
- f = float64(math.Float32frombits(bigen.Uint32(d.r.readx(4))))
- } else if d.bd == simpleVdFloat64 {
- f = math.Float64frombits(bigen.Uint64(d.r.readx(8)))
- } else {
- if d.bd >= simpleVdPosInt && d.bd <= simpleVdNegInt+3 {
- f = float64(d.DecodeInt(64))
- } else {
- d.d.errorf("Float only valid from float32/64: Invalid descriptor: %v", d.bd)
- return
- }
- }
- if chkOverflow32 && chkOvf.Float32(f) {
- d.d.errorf("msgpack: float32 overflow: %v", f)
- return
- }
- d.bdRead = false
- return
-}
-
-// bool can be decoded from bool only (single byte).
-func (d *simpleDecDriver) DecodeBool() (b bool) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdTrue {
- b = true
- } else if d.bd == simpleVdFalse {
- } else {
- d.d.errorf("Invalid single-byte value for bool: %s: %x", msgBadDesc, d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) ReadMapStart() (length int) {
- d.bdRead = false
- return d.decLen()
-}
-
-func (d *simpleDecDriver) ReadArrayStart() (length int) {
- d.bdRead = false
- return d.decLen()
-}
-
-func (d *simpleDecDriver) decLen() int {
- switch d.bd % 8 {
- case 0:
- return 0
- case 1:
- return int(d.r.readn1())
- case 2:
- return int(bigen.Uint16(d.r.readx(2)))
- case 3:
- ui := uint64(bigen.Uint32(d.r.readx(4)))
- if chkOvf.Uint(ui, intBitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return 0
- }
- return int(ui)
- case 4:
- ui := bigen.Uint64(d.r.readx(8))
- if chkOvf.Uint(ui, intBitsize) {
- d.d.errorf("simple: overflow integer: %v", ui)
- return 0
- }
- return int(ui)
- }
- d.d.errorf("decLen: Cannot read length: bd%%8 must be in range 0..4. Got: %d", d.bd%8)
- return -1
-}
-
-func (d *simpleDecDriver) DecodeString() (s string) {
- return string(d.DecodeBytes(d.b[:], true, true))
-}
-
-func (d *simpleDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- if d.bd == simpleVdNil {
- d.bdRead = false
- return
- }
- clen := d.decLen()
- d.bdRead = false
- if zerocopy {
- if d.br {
- return d.r.readx(clen)
- } else if len(bs) == 0 {
- bs = d.b[:]
- }
- }
- return decByteSlice(d.r, clen, bs)
-}
-
-func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
- if xtag > 0xff {
- d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag)
- return
- }
- realxtag1, xbs := d.decodeExtV(ext != nil, uint8(xtag))
- realxtag = uint64(realxtag1)
- if ext == nil {
- re := rv.(*RawExt)
- re.Tag = realxtag
- re.Data = detachZeroCopyBytes(d.br, re.Data, xbs)
- } else {
- ext.ReadExt(rv, xbs)
- }
- return
-}
-
-func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []byte) {
- if !d.bdRead {
- d.readNextBd()
- }
- switch d.bd {
- case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4:
- l := d.decLen()
- xtag = d.r.readn1()
- if verifyTag && xtag != tag {
- d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", xtag, tag)
- return
- }
- xbs = d.r.readx(l)
- case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4:
- xbs = d.DecodeBytes(nil, false, true)
- default:
- d.d.errorf("Invalid d.bd for extensions (Expecting extensions or byte array). Got: 0x%x", d.bd)
- return
- }
- d.bdRead = false
- return
-}
-
-func (d *simpleDecDriver) DecodeNaked() {
- if !d.bdRead {
- d.readNextBd()
- }
-
- n := &d.d.n
- var decodeFurther bool
-
- switch d.bd {
- case simpleVdNil:
- n.v = valueTypeNil
- case simpleVdFalse:
- n.v = valueTypeBool
- n.b = false
- case simpleVdTrue:
- n.v = valueTypeBool
- n.b = true
- case simpleVdPosInt, simpleVdPosInt + 1, simpleVdPosInt + 2, simpleVdPosInt + 3:
- if d.h.SignedInteger {
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- } else {
- n.v = valueTypeUint
- n.u = d.DecodeUint(64)
- }
- case simpleVdNegInt, simpleVdNegInt + 1, simpleVdNegInt + 2, simpleVdNegInt + 3:
- n.v = valueTypeInt
- n.i = d.DecodeInt(64)
- case simpleVdFloat32:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(true)
- case simpleVdFloat64:
- n.v = valueTypeFloat
- n.f = d.DecodeFloat(false)
- case simpleVdString, simpleVdString + 1, simpleVdString + 2, simpleVdString + 3, simpleVdString + 4:
- n.v = valueTypeString
- n.s = d.DecodeString()
- case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false, false)
- case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4:
- n.v = valueTypeExt
- l := d.decLen()
- n.u = uint64(d.r.readn1())
- n.l = d.r.readx(l)
- case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4:
- n.v = valueTypeArray
- decodeFurther = true
- case simpleVdMap, simpleVdMap + 1, simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4:
- n.v = valueTypeMap
- decodeFurther = true
- default:
- d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd)
- }
-
- if !decodeFurther {
- d.bdRead = false
- }
- return
-}
-
-//------------------------------------
-
-// SimpleHandle is a Handle for a very simple encoding format.
-//
-// simple is a simplistic codec similar to binc, but not as compact.
-// - Encoding of a value is always preceded by the descriptor byte (bd)
-// - True, false, nil are encoded fully in 1 byte (the descriptor)
-// - Integers (intXXX, uintXXX) are encoded in 1, 2, 4 or 8 bytes (plus a descriptor byte).
-// There are positive (uintXXX and intXXX >= 0) and negative (intXXX < 0) integers.
-// - Floats are encoded in 4 or 8 bytes (plus a descriptor byte)
-// - Lenght of containers (strings, bytes, array, map, extensions)
-// are encoded in 0, 1, 2, 4 or 8 bytes.
-// Zero-length containers have no length encoded.
-// For others, the number of bytes is given by pow(2, bd%3)
-// - maps are encoded as [bd] [length] [[key][value]]...
-// - arrays are encoded as [bd] [length] [value]...
-// - extensions are encoded as [bd] [length] [tag] [byte]...
-// - strings/bytearrays are encoded as [bd] [length] [byte]...
-//
-// The full spec will be published soon.
-type SimpleHandle struct {
- BasicHandle
- binaryEncodingType
-}
-
-func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &setExtWrapper{b: ext})
-}
-
-func (h *SimpleHandle) newEncDriver(e *Encoder) encDriver {
- return &simpleEncDriver{e: e, w: e.w, h: h}
-}
-
-func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver {
- return &simpleDecDriver{d: d, r: d.r, h: h, br: d.bytes}
-}
-
-func (e *simpleEncDriver) reset() {
- e.w = e.e.w
-}
-
-func (d *simpleDecDriver) reset() {
- d.r = d.d.r
- d.bd, d.bdRead = 0, false
-}
-
-var _ decDriver = (*simpleDecDriver)(nil)
-var _ encDriver = (*simpleEncDriver)(nil)
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json b/archived/event-adapter/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json
deleted file mode 100644
index 902858671..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/test-cbor-goldens.json
+++ /dev/null
@@ -1,639 +0,0 @@
-[
- {
- "cbor": "AA==",
- "hex": "00",
- "roundtrip": true,
- "decoded": 0
- },
- {
- "cbor": "AQ==",
- "hex": "01",
- "roundtrip": true,
- "decoded": 1
- },
- {
- "cbor": "Cg==",
- "hex": "0a",
- "roundtrip": true,
- "decoded": 10
- },
- {
- "cbor": "Fw==",
- "hex": "17",
- "roundtrip": true,
- "decoded": 23
- },
- {
- "cbor": "GBg=",
- "hex": "1818",
- "roundtrip": true,
- "decoded": 24
- },
- {
- "cbor": "GBk=",
- "hex": "1819",
- "roundtrip": true,
- "decoded": 25
- },
- {
- "cbor": "GGQ=",
- "hex": "1864",
- "roundtrip": true,
- "decoded": 100
- },
- {
- "cbor": "GQPo",
- "hex": "1903e8",
- "roundtrip": true,
- "decoded": 1000
- },
- {
- "cbor": "GgAPQkA=",
- "hex": "1a000f4240",
- "roundtrip": true,
- "decoded": 1000000
- },
- {
- "cbor": "GwAAAOjUpRAA",
- "hex": "1b000000e8d4a51000",
- "roundtrip": true,
- "decoded": 1000000000000
- },
- {
- "cbor": "G///////////",
- "hex": "1bffffffffffffffff",
- "roundtrip": true,
- "decoded": 18446744073709551615
- },
- {
- "cbor": "wkkBAAAAAAAAAAA=",
- "hex": "c249010000000000000000",
- "roundtrip": true,
- "decoded": 18446744073709551616
- },
- {
- "cbor": "O///////////",
- "hex": "3bffffffffffffffff",
- "roundtrip": true,
- "decoded": -18446744073709551616,
- "skip": true
- },
- {
- "cbor": "w0kBAAAAAAAAAAA=",
- "hex": "c349010000000000000000",
- "roundtrip": true,
- "decoded": -18446744073709551617
- },
- {
- "cbor": "IA==",
- "hex": "20",
- "roundtrip": true,
- "decoded": -1
- },
- {
- "cbor": "KQ==",
- "hex": "29",
- "roundtrip": true,
- "decoded": -10
- },
- {
- "cbor": "OGM=",
- "hex": "3863",
- "roundtrip": true,
- "decoded": -100
- },
- {
- "cbor": "OQPn",
- "hex": "3903e7",
- "roundtrip": true,
- "decoded": -1000
- },
- {
- "cbor": "+QAA",
- "hex": "f90000",
- "roundtrip": true,
- "decoded": 0.0
- },
- {
- "cbor": "+YAA",
- "hex": "f98000",
- "roundtrip": true,
- "decoded": -0.0
- },
- {
- "cbor": "+TwA",
- "hex": "f93c00",
- "roundtrip": true,
- "decoded": 1.0
- },
- {
- "cbor": "+z/xmZmZmZma",
- "hex": "fb3ff199999999999a",
- "roundtrip": true,
- "decoded": 1.1
- },
- {
- "cbor": "+T4A",
- "hex": "f93e00",
- "roundtrip": true,
- "decoded": 1.5
- },
- {
- "cbor": "+Xv/",
- "hex": "f97bff",
- "roundtrip": true,
- "decoded": 65504.0
- },
- {
- "cbor": "+kfDUAA=",
- "hex": "fa47c35000",
- "roundtrip": true,
- "decoded": 100000.0
- },
- {
- "cbor": "+n9///8=",
- "hex": "fa7f7fffff",
- "roundtrip": true,
- "decoded": 3.4028234663852886e+38
- },
- {
- "cbor": "+3435DyIAHWc",
- "hex": "fb7e37e43c8800759c",
- "roundtrip": true,
- "decoded": 1.0e+300
- },
- {
- "cbor": "+QAB",
- "hex": "f90001",
- "roundtrip": true,
- "decoded": 5.960464477539063e-08
- },
- {
- "cbor": "+QQA",
- "hex": "f90400",
- "roundtrip": true,
- "decoded": 6.103515625e-05
- },
- {
- "cbor": "+cQA",
- "hex": "f9c400",
- "roundtrip": true,
- "decoded": -4.0
- },
- {
- "cbor": "+8AQZmZmZmZm",
- "hex": "fbc010666666666666",
- "roundtrip": true,
- "decoded": -4.1
- },
- {
- "cbor": "+XwA",
- "hex": "f97c00",
- "roundtrip": true,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+X4A",
- "hex": "f97e00",
- "roundtrip": true,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+fwA",
- "hex": "f9fc00",
- "roundtrip": true,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "+n+AAAA=",
- "hex": "fa7f800000",
- "roundtrip": false,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+n/AAAA=",
- "hex": "fa7fc00000",
- "roundtrip": false,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+v+AAAA=",
- "hex": "faff800000",
- "roundtrip": false,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "+3/wAAAAAAAA",
- "hex": "fb7ff0000000000000",
- "roundtrip": false,
- "diagnostic": "Infinity"
- },
- {
- "cbor": "+3/4AAAAAAAA",
- "hex": "fb7ff8000000000000",
- "roundtrip": false,
- "diagnostic": "NaN"
- },
- {
- "cbor": "+//wAAAAAAAA",
- "hex": "fbfff0000000000000",
- "roundtrip": false,
- "diagnostic": "-Infinity"
- },
- {
- "cbor": "9A==",
- "hex": "f4",
- "roundtrip": true,
- "decoded": false
- },
- {
- "cbor": "9Q==",
- "hex": "f5",
- "roundtrip": true,
- "decoded": true
- },
- {
- "cbor": "9g==",
- "hex": "f6",
- "roundtrip": true,
- "decoded": null
- },
- {
- "cbor": "9w==",
- "hex": "f7",
- "roundtrip": true,
- "diagnostic": "undefined"
- },
- {
- "cbor": "8A==",
- "hex": "f0",
- "roundtrip": true,
- "diagnostic": "simple(16)"
- },
- {
- "cbor": "+Bg=",
- "hex": "f818",
- "roundtrip": true,
- "diagnostic": "simple(24)"
- },
- {
- "cbor": "+P8=",
- "hex": "f8ff",
- "roundtrip": true,
- "diagnostic": "simple(255)"
- },
- {
- "cbor": "wHQyMDEzLTAzLTIxVDIwOjA0OjAwWg==",
- "hex": "c074323031332d30332d32315432303a30343a30305a",
- "roundtrip": true,
- "diagnostic": "0(\"2013-03-21T20:04:00Z\")"
- },
- {
- "cbor": "wRpRS2ew",
- "hex": "c11a514b67b0",
- "roundtrip": true,
- "diagnostic": "1(1363896240)"
- },
- {
- "cbor": "wftB1FLZ7CAAAA==",
- "hex": "c1fb41d452d9ec200000",
- "roundtrip": true,
- "diagnostic": "1(1363896240.5)"
- },
- {
- "cbor": "10QBAgME",
- "hex": "d74401020304",
- "roundtrip": true,
- "diagnostic": "23(h'01020304')"
- },
- {
- "cbor": "2BhFZElFVEY=",
- "hex": "d818456449455446",
- "roundtrip": true,
- "diagnostic": "24(h'6449455446')"
- },
- {
- "cbor": "2CB2aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==",
- "hex": "d82076687474703a2f2f7777772e6578616d706c652e636f6d",
- "roundtrip": true,
- "diagnostic": "32(\"http://www.example.com\")"
- },
- {
- "cbor": "QA==",
- "hex": "40",
- "roundtrip": true,
- "diagnostic": "h''"
- },
- {
- "cbor": "RAECAwQ=",
- "hex": "4401020304",
- "roundtrip": true,
- "diagnostic": "h'01020304'"
- },
- {
- "cbor": "YA==",
- "hex": "60",
- "roundtrip": true,
- "decoded": ""
- },
- {
- "cbor": "YWE=",
- "hex": "6161",
- "roundtrip": true,
- "decoded": "a"
- },
- {
- "cbor": "ZElFVEY=",
- "hex": "6449455446",
- "roundtrip": true,
- "decoded": "IETF"
- },
- {
- "cbor": "YiJc",
- "hex": "62225c",
- "roundtrip": true,
- "decoded": "\"\\"
- },
- {
- "cbor": "YsO8",
- "hex": "62c3bc",
- "roundtrip": true,
- "decoded": "ü"
- },
- {
- "cbor": "Y+awtA==",
- "hex": "63e6b0b4",
- "roundtrip": true,
- "decoded": "水"
- },
- {
- "cbor": "ZPCQhZE=",
- "hex": "64f0908591",
- "roundtrip": true,
- "decoded": "𐅑"
- },
- {
- "cbor": "gA==",
- "hex": "80",
- "roundtrip": true,
- "decoded": [
-
- ]
- },
- {
- "cbor": "gwECAw==",
- "hex": "83010203",
- "roundtrip": true,
- "decoded": [
- 1,
- 2,
- 3
- ]
- },
- {
- "cbor": "gwGCAgOCBAU=",
- "hex": "8301820203820405",
- "roundtrip": true,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "mBkBAgMEBQYHCAkKCwwNDg8QERITFBUWFxgYGBk=",
- "hex": "98190102030405060708090a0b0c0d0e0f101112131415161718181819",
- "roundtrip": true,
- "decoded": [
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25
- ]
- },
- {
- "cbor": "oA==",
- "hex": "a0",
- "roundtrip": true,
- "decoded": {
- }
- },
- {
- "cbor": "ogECAwQ=",
- "hex": "a201020304",
- "roundtrip": true,
- "skip": true,
- "diagnostic": "{1: 2, 3: 4}"
- },
- {
- "cbor": "omFhAWFiggID",
- "hex": "a26161016162820203",
- "roundtrip": true,
- "decoded": {
- "a": 1,
- "b": [
- 2,
- 3
- ]
- }
- },
- {
- "cbor": "gmFhoWFiYWM=",
- "hex": "826161a161626163",
- "roundtrip": true,
- "decoded": [
- "a",
- {
- "b": "c"
- }
- ]
- },
- {
- "cbor": "pWFhYUFhYmFCYWNhQ2FkYURhZWFF",
- "hex": "a56161614161626142616361436164614461656145",
- "roundtrip": true,
- "decoded": {
- "a": "A",
- "b": "B",
- "c": "C",
- "d": "D",
- "e": "E"
- }
- },
- {
- "cbor": "X0IBAkMDBAX/",
- "hex": "5f42010243030405ff",
- "roundtrip": false,
- "skip": true,
- "diagnostic": "(_ h'0102', h'030405')"
- },
- {
- "cbor": "f2VzdHJlYWRtaW5n/w==",
- "hex": "7f657374726561646d696e67ff",
- "roundtrip": false,
- "decoded": "streaming"
- },
- {
- "cbor": "n/8=",
- "hex": "9fff",
- "roundtrip": false,
- "decoded": [
-
- ]
- },
- {
- "cbor": "nwGCAgOfBAX//w==",
- "hex": "9f018202039f0405ffff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "nwGCAgOCBAX/",
- "hex": "9f01820203820405ff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "gwGCAgOfBAX/",
- "hex": "83018202039f0405ff",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "gwGfAgP/ggQF",
- "hex": "83019f0203ff820405",
- "roundtrip": false,
- "decoded": [
- 1,
- [
- 2,
- 3
- ],
- [
- 4,
- 5
- ]
- ]
- },
- {
- "cbor": "nwECAwQFBgcICQoLDA0ODxAREhMUFRYXGBgYGf8=",
- "hex": "9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff",
- "roundtrip": false,
- "decoded": [
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25
- ]
- },
- {
- "cbor": "v2FhAWFinwID//8=",
- "hex": "bf61610161629f0203ffff",
- "roundtrip": false,
- "decoded": {
- "a": 1,
- "b": [
- 2,
- 3
- ]
- }
- },
- {
- "cbor": "gmFhv2FiYWP/",
- "hex": "826161bf61626163ff",
- "roundtrip": false,
- "decoded": [
- "a",
- {
- "b": "c"
- }
- ]
- },
- {
- "cbor": "v2NGdW71Y0FtdCH/",
- "hex": "bf6346756ef563416d7421ff",
- "roundtrip": false,
- "decoded": {
- "Fun": true,
- "Amt": -2
- }
- }
-]
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/test.py b/archived/event-adapter/vendor/github.com/ugorji/go/codec/test.py
deleted file mode 100644
index c0ad20b34..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/test.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-
-# This will create golden files in a directory passed to it.
-# A Test calls this internally to create the golden files
-# So it can process them (so we don't have to checkin the files).
-
-# Ensure msgpack-python and cbor are installed first, using:
-# sudo apt-get install python-dev
-# sudo apt-get install python-pip
-# pip install --user msgpack-python msgpack-rpc-python cbor
-
-# Ensure all "string" keys are utf strings (else encoded as bytes)
-
-import cbor, msgpack, msgpackrpc, sys, os, threading
-
-def get_test_data_list():
- # get list with all primitive types, and a combo type
- l0 = [
- -8,
- -1616,
- -32323232,
- -6464646464646464,
- 192,
- 1616,
- 32323232,
- 6464646464646464,
- 192,
- -3232.0,
- -6464646464.0,
- 3232.0,
- 6464.0,
- 6464646464.0,
- False,
- True,
- u"null",
- None,
- u"someday",
- 1328176922000002000,
- u"",
- -2206187877999998000,
- u"bytestring",
- 270,
- u"none",
- -2013855847999995777,
- #-6795364578871345152,
- ]
- l1 = [
- { "true": True,
- "false": False },
- { "true": u"True",
- "false": False,
- "uint16(1616)": 1616 },
- { "list": [1616, 32323232, True, -3232.0, {"TRUE":True, "FALSE":False}, [True, False] ],
- "int32":32323232, "bool": True,
- "LONG STRING": u"123456789012345678901234567890123456789012345678901234567890",
- "SHORT STRING": u"1234567890" },
- { True: "true", 138: False, "false": 200 }
- ]
-
- l = []
- l.extend(l0)
- l.append(l0)
- l.append(1)
- l.extend(l1)
- return l
-
-def build_test_data(destdir):
- l = get_test_data_list()
- for i in range(len(l)):
- # packer = msgpack.Packer()
- serialized = msgpack.dumps(l[i])
- f = open(os.path.join(destdir, str(i) + '.msgpack.golden'), 'wb')
- f.write(serialized)
- f.close()
- serialized = cbor.dumps(l[i])
- f = open(os.path.join(destdir, str(i) + '.cbor.golden'), 'wb')
- f.write(serialized)
- f.close()
-
-def doRpcServer(port, stopTimeSec):
- class EchoHandler(object):
- def Echo123(self, msg1, msg2, msg3):
- return ("1:%s 2:%s 3:%s" % (msg1, msg2, msg3))
- def EchoStruct(self, msg):
- return ("%s" % msg)
-
- addr = msgpackrpc.Address('localhost', port)
- server = msgpackrpc.Server(EchoHandler())
- server.listen(addr)
- # run thread to stop it after stopTimeSec seconds if > 0
- if stopTimeSec > 0:
- def myStopRpcServer():
- server.stop()
- t = threading.Timer(stopTimeSec, myStopRpcServer)
- t.start()
- server.start()
-
-def doRpcClientToPythonSvc(port):
- address = msgpackrpc.Address('localhost', port)
- client = msgpackrpc.Client(address, unpack_encoding='utf-8')
- print client.call("Echo123", "A1", "B2", "C3")
- print client.call("EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
-
-def doRpcClientToGoSvc(port):
- # print ">>>> port: ", port, " <<<<<"
- address = msgpackrpc.Address('localhost', port)
- client = msgpackrpc.Client(address, unpack_encoding='utf-8')
- print client.call("TestRpcInt.Echo123", ["A1", "B2", "C3"])
- print client.call("TestRpcInt.EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})
-
-def doMain(args):
- if len(args) == 2 and args[0] == "testdata":
- build_test_data(args[1])
- elif len(args) == 3 and args[0] == "rpc-server":
- doRpcServer(int(args[1]), int(args[2]))
- elif len(args) == 2 and args[0] == "rpc-client-python-service":
- doRpcClientToPythonSvc(int(args[1]))
- elif len(args) == 2 and args[0] == "rpc-client-go-service":
- doRpcClientToGoSvc(int(args[1]))
- else:
- print("Usage: test.py " +
- "[testdata|rpc-server|rpc-client-python-service|rpc-client-go-service] ...")
-
-if __name__ == "__main__":
- doMain(sys.argv[1:])
-
diff --git a/archived/event-adapter/vendor/github.com/ugorji/go/codec/tests.sh b/archived/event-adapter/vendor/github.com/ugorji/go/codec/tests.sh
deleted file mode 100644
index 342f336df..000000000
--- a/archived/event-adapter/vendor/github.com/ugorji/go/codec/tests.sh
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/bash
-
-# Run all the different permutations of all the tests.
-# This helps ensure that nothing gets broken.
-
-_run() {
- # 1. VARIATIONS: regular (t), canonical (c), IO R/W (i),
- # binc-nosymbols (n), struct2array (s), intern string (e),
- # json-indent (d), circular (l)
- # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f)
- # 3. OPTIONS: verbose (v), reset (z), must (m),
- #
- # Use combinations of mode to get exactly what you want,
- # and then pass the variations you need.
-
- ztags=""
- zargs=""
- local OPTIND
- OPTIND=1
- while getopts "_xurtcinsvgzmefdl" flag
- do
- case "x$flag" in
- 'xr') ;;
- 'xf') ztags="$ztags notfastpath" ;;
- 'xg') ztags="$ztags codecgen" ;;
- 'xx') ztags="$ztags x" ;;
- 'xu') ztags="$ztags unsafe" ;;
- 'xv') zargs="$zargs -tv" ;;
- 'xz') zargs="$zargs -tr" ;;
- 'xm') zargs="$zargs -tm" ;;
- 'xl') zargs="$zargs -tl" ;;
- *) ;;
- esac
- done
- # shift $((OPTIND-1))
- printf '............. TAGS: %s .............\n' "$ztags"
- # echo ">>>>>>> TAGS: $ztags"
-
- OPTIND=1
- while getopts "_xurtcinsvgzmefdl" flag
- do
- case "x$flag" in
- 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;;
- 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;;
- 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;;
- 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;;
- 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;;
- 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;;
- 'xd') printf ">>>>>>> INDENT : ";
- go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs;
- go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs;
- sleep 2 ;;
- *) ;;
- esac
- done
- shift $((OPTIND-1))
-
- OPTIND=1
-}
-
-# echo ">>>>>>> RUNNING VARIATIONS OF TESTS"
-if [[ "x$@" = "x" || "x$@" = "x-A" ]]; then
- # All: r, x, g, gu
- _run "-_tcinsed_ml" # regular
- _run "-_tcinsed_ml_z" # regular with reset
- _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath)
- _run "-x_tcinsed_ml" # external
- _run "-gx_tcinsed_ml" # codecgen: requires external
- _run "-gxu_tcinsed_ml" # codecgen + unsafe
-elif [[ "x$@" = "x-Z" ]]; then
- # Regular
- _run "-_tcinsed_ml" # regular
- _run "-_tcinsed_ml_z" # regular with reset
-elif [[ "x$@" = "x-F" ]]; then
- # regular with notfastpath
- _run "-_tcinsed_ml_f" # regular
- _run "-_tcinsed_ml_zf" # regular with reset
-elif [[ "x$@" = "x-C" ]]; then
- # codecgen
- _run "-gx_tcinsed_ml" # codecgen: requires external
- _run "-gxu_tcinsed_ml" # codecgen + unsafe
-elif [[ "x$@" = "x-X" ]]; then
- # external
- _run "-x_tcinsed_ml" # external
-elif [[ "x$@" = "x-h" || "x$@" = "x-?" ]]; then
- cat <= 0)
- bd = bd | (byte(7-f) << 2)
- copy(bs[i:], btmp[f:])
- i = i + (8 - f)
- }
- if tnsecs != 0 {
- bd = bd | 0x40
- bigen.PutUint32(btmp[:4], uint32(tnsecs))
- f := pruneSignExt(btmp[:4], true)
- bd = bd | byte(3-f)
- copy(bs[i:], btmp[f:4])
- i = i + (4 - f)
- }
- if l != nil {
- bd = bd | 0x20
- // Note that Go Libs do not give access to dst flag.
- _, zoneOffset := t.Zone()
- //zoneName, zoneOffset := t.Zone()
- zoneOffset /= 60
- z := uint16(zoneOffset)
- bigen.PutUint16(btmp[:2], z)
- // clear dst flags
- bs[i] = btmp[0] & 0x3f
- bs[i+1] = btmp[1]
- i = i + 2
- }
- bs[0] = bd
- return bs[0:i]
-}
-
-// DecodeTime decodes a []byte into a time.Time.
-func decodeTime(bs []byte) (tt time.Time, err error) {
- bd := bs[0]
- var (
- tsec int64
- tnsec uint32
- tz uint16
- i byte = 1
- i2 byte
- n byte
- )
- if bd&(1<<7) != 0 {
- var btmp [8]byte
- n = ((bd >> 2) & 0x7) + 1
- i2 = i + n
- copy(btmp[8-n:], bs[i:i2])
- //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it)
- if bs[i]&(1<<7) != 0 {
- copy(btmp[0:8-n], bsAll0xff)
- //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff }
- }
- i = i2
- tsec = int64(bigen.Uint64(btmp[:]))
- }
- if bd&(1<<6) != 0 {
- var btmp [4]byte
- n = (bd & 0x3) + 1
- i2 = i + n
- copy(btmp[4-n:], bs[i:i2])
- i = i2
- tnsec = bigen.Uint32(btmp[:])
- }
- if bd&(1<<5) == 0 {
- tt = time.Unix(tsec, int64(tnsec)).UTC()
- return
- }
- // In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name.
- // However, we need name here, so it can be shown when time is printed.
- // Zone name is in form: UTC-08:00.
- // Note that Go Libs do not give access to dst flag, so we ignore dst bits
-
- i2 = i + 2
- tz = bigen.Uint16(bs[i:i2])
- i = i2
- // sign extend sign bit into top 2 MSB (which were dst bits):
- if tz&(1<<13) == 0 { // positive
- tz = tz & 0x3fff //clear 2 MSBs: dst bits
- } else { // negative
- tz = tz | 0xc000 //set 2 MSBs: dst bits
- //tzname[3] = '-' (TODO: verify. this works here)
- }
- tzint := int16(tz)
- if tzint == 0 {
- tt = time.Unix(tsec, int64(tnsec)).UTC()
- } else {
- // For Go Time, do not use a descriptive timezone.
- // It's unnecessary, and makes it harder to do a reflect.DeepEqual.
- // The Offset already tells what the offset should be, if not on UTC and unknown zone name.
- // var zoneName = timeLocUTCName(tzint)
- tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60))
- }
- return
-}
-
-func timeLocUTCName(tzint int16) string {
- if tzint == 0 {
- return "UTC"
- }
- var tzname = []byte("UTC+00:00")
- //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below.
- //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first
- var tzhr, tzmin int16
- if tzint < 0 {
- tzname[3] = '-' // (TODO: verify. this works here)
- tzhr, tzmin = -tzint/60, (-tzint)%60
- } else {
- tzhr, tzmin = tzint/60, tzint%60
- }
- tzname[4] = timeDigits[tzhr/10]
- tzname[5] = timeDigits[tzhr%10]
- tzname[7] = timeDigits[tzmin/10]
- tzname[8] = timeDigits[tzmin%10]
- return string(tzname)
- //return time.FixedZone(string(tzname), int(tzint)*60)
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/AUTHORS b/archived/event-adapter/vendor/golang.org/x/crypto/AUTHORS
deleted file mode 100644
index 15167cd74..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/CONTRIBUTORS b/archived/event-adapter/vendor/golang.org/x/crypto/CONTRIBUTORS
deleted file mode 100644
index 1c4577e96..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/LICENSE b/archived/event-adapter/vendor/golang.org/x/crypto/LICENSE
deleted file mode 100644
index 6a66aea5e..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/PATENTS b/archived/event-adapter/vendor/golang.org/x/crypto/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
deleted file mode 100644
index 741eeb13f..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
+++ /dev/null
@@ -1,892 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package terminal
-
-import (
- "bytes"
- "io"
- "sync"
- "unicode/utf8"
-)
-
-// EscapeCodes contains escape sequences that can be written to the terminal in
-// order to achieve different styles of text.
-type EscapeCodes struct {
- // Foreground colors
- Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
-
- // Reset all attributes
- Reset []byte
-}
-
-var vt100EscapeCodes = EscapeCodes{
- Black: []byte{keyEscape, '[', '3', '0', 'm'},
- Red: []byte{keyEscape, '[', '3', '1', 'm'},
- Green: []byte{keyEscape, '[', '3', '2', 'm'},
- Yellow: []byte{keyEscape, '[', '3', '3', 'm'},
- Blue: []byte{keyEscape, '[', '3', '4', 'm'},
- Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
- Cyan: []byte{keyEscape, '[', '3', '6', 'm'},
- White: []byte{keyEscape, '[', '3', '7', 'm'},
-
- Reset: []byte{keyEscape, '[', '0', 'm'},
-}
-
-// Terminal contains the state for running a VT100 terminal that is capable of
-// reading lines of input.
-type Terminal struct {
- // AutoCompleteCallback, if non-null, is called for each keypress with
- // the full input line and the current position of the cursor (in
- // bytes, as an index into |line|). If it returns ok=false, the key
- // press is processed normally. Otherwise it returns a replacement line
- // and the new cursor position.
- AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
-
- // Escape contains a pointer to the escape codes for this terminal.
- // It's always a valid pointer, although the escape codes themselves
- // may be empty if the terminal doesn't support them.
- Escape *EscapeCodes
-
- // lock protects the terminal and the state in this object from
- // concurrent processing of a key press and a Write() call.
- lock sync.Mutex
-
- c io.ReadWriter
- prompt []rune
-
- // line is the current line being entered.
- line []rune
- // pos is the logical position of the cursor in line
- pos int
- // echo is true if local echo is enabled
- echo bool
- // pasteActive is true iff there is a bracketed paste operation in
- // progress.
- pasteActive bool
-
- // cursorX contains the current X value of the cursor where the left
- // edge is 0. cursorY contains the row number where the first row of
- // the current line is 0.
- cursorX, cursorY int
- // maxLine is the greatest value of cursorY so far.
- maxLine int
-
- termWidth, termHeight int
-
- // outBuf contains the terminal data to be sent.
- outBuf []byte
- // remainder contains the remainder of any partial key sequences after
- // a read. It aliases into inBuf.
- remainder []byte
- inBuf [256]byte
-
- // history contains previously entered commands so that they can be
- // accessed with the up and down keys.
- history stRingBuffer
- // historyIndex stores the currently accessed history entry, where zero
- // means the immediately previous entry.
- historyIndex int
- // When navigating up and down the history it's possible to return to
- // the incomplete, initial line. That value is stored in
- // historyPending.
- historyPending string
-}
-
-// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
-// a local terminal, that terminal must first have been put into raw mode.
-// prompt is a string that is written at the start of each input line (i.e.
-// "> ").
-func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
- return &Terminal{
- Escape: &vt100EscapeCodes,
- c: c,
- prompt: []rune(prompt),
- termWidth: 80,
- termHeight: 24,
- echo: true,
- historyIndex: -1,
- }
-}
-
-const (
- keyCtrlD = 4
- keyCtrlU = 21
- keyEnter = '\r'
- keyEscape = 27
- keyBackspace = 127
- keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
- keyUp
- keyDown
- keyLeft
- keyRight
- keyAltLeft
- keyAltRight
- keyHome
- keyEnd
- keyDeleteWord
- keyDeleteLine
- keyClearScreen
- keyPasteStart
- keyPasteEnd
-)
-
-var pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
-var pasteEnd = []byte{keyEscape, '[', '2', '0', '1', '~'}
-
-// bytesToKey tries to parse a key sequence from b. If successful, it returns
-// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
-func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
- if len(b) == 0 {
- return utf8.RuneError, nil
- }
-
- if !pasteActive {
- switch b[0] {
- case 1: // ^A
- return keyHome, b[1:]
- case 5: // ^E
- return keyEnd, b[1:]
- case 8: // ^H
- return keyBackspace, b[1:]
- case 11: // ^K
- return keyDeleteLine, b[1:]
- case 12: // ^L
- return keyClearScreen, b[1:]
- case 23: // ^W
- return keyDeleteWord, b[1:]
- }
- }
-
- if b[0] != keyEscape {
- if !utf8.FullRune(b) {
- return utf8.RuneError, b
- }
- r, l := utf8.DecodeRune(b)
- return r, b[l:]
- }
-
- if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
- switch b[2] {
- case 'A':
- return keyUp, b[3:]
- case 'B':
- return keyDown, b[3:]
- case 'C':
- return keyRight, b[3:]
- case 'D':
- return keyLeft, b[3:]
- case 'H':
- return keyHome, b[3:]
- case 'F':
- return keyEnd, b[3:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
- switch b[5] {
- case 'C':
- return keyAltRight, b[6:]
- case 'D':
- return keyAltLeft, b[6:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
- return keyPasteStart, b[6:]
- }
-
- if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
- return keyPasteEnd, b[6:]
- }
-
- // If we get here then we have a key that we don't recognise, or a
- // partial sequence. It's not clear how one should find the end of a
- // sequence without knowing them all, but it seems that [a-zA-Z~] only
- // appears at the end of a sequence.
- for i, c := range b[0:] {
- if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
- return keyUnknown, b[i+1:]
- }
- }
-
- return utf8.RuneError, b
-}
-
-// queue appends data to the end of t.outBuf
-func (t *Terminal) queue(data []rune) {
- t.outBuf = append(t.outBuf, []byte(string(data))...)
-}
-
-var eraseUnderCursor = []rune{' ', keyEscape, '[', 'D'}
-var space = []rune{' '}
-
-func isPrintable(key rune) bool {
- isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
- return key >= 32 && !isInSurrogateArea
-}
-
-// moveCursorToPos appends data to t.outBuf which will move the cursor to the
-// given, logical position in the text.
-func (t *Terminal) moveCursorToPos(pos int) {
- if !t.echo {
- return
- }
-
- x := visualLength(t.prompt) + pos
- y := x / t.termWidth
- x = x % t.termWidth
-
- up := 0
- if y < t.cursorY {
- up = t.cursorY - y
- }
-
- down := 0
- if y > t.cursorY {
- down = y - t.cursorY
- }
-
- left := 0
- if x < t.cursorX {
- left = t.cursorX - x
- }
-
- right := 0
- if x > t.cursorX {
- right = x - t.cursorX
- }
-
- t.cursorX = x
- t.cursorY = y
- t.move(up, down, left, right)
-}
-
-func (t *Terminal) move(up, down, left, right int) {
- movement := make([]rune, 3*(up+down+left+right))
- m := movement
- for i := 0; i < up; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'A'
- m = m[3:]
- }
- for i := 0; i < down; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'B'
- m = m[3:]
- }
- for i := 0; i < left; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'D'
- m = m[3:]
- }
- for i := 0; i < right; i++ {
- m[0] = keyEscape
- m[1] = '['
- m[2] = 'C'
- m = m[3:]
- }
-
- t.queue(movement)
-}
-
-func (t *Terminal) clearLineToRight() {
- op := []rune{keyEscape, '[', 'K'}
- t.queue(op)
-}
-
-const maxLineLength = 4096
-
-func (t *Terminal) setLine(newLine []rune, newPos int) {
- if t.echo {
- t.moveCursorToPos(0)
- t.writeLine(newLine)
- for i := len(newLine); i < len(t.line); i++ {
- t.writeLine(space)
- }
- t.moveCursorToPos(newPos)
- }
- t.line = newLine
- t.pos = newPos
-}
-
-func (t *Terminal) advanceCursor(places int) {
- t.cursorX += places
- t.cursorY += t.cursorX / t.termWidth
- if t.cursorY > t.maxLine {
- t.maxLine = t.cursorY
- }
- t.cursorX = t.cursorX % t.termWidth
-
- if places > 0 && t.cursorX == 0 {
- // Normally terminals will advance the current position
- // when writing a character. But that doesn't happen
- // for the last character in a line. However, when
- // writing a character (except a new line) that causes
- // a line wrap, the position will be advanced two
- // places.
- //
- // So, if we are stopping at the end of a line, we
- // need to write a newline so that our cursor can be
- // advanced to the next line.
- t.outBuf = append(t.outBuf, '\n')
- }
-}
-
-func (t *Terminal) eraseNPreviousChars(n int) {
- if n == 0 {
- return
- }
-
- if t.pos < n {
- n = t.pos
- }
- t.pos -= n
- t.moveCursorToPos(t.pos)
-
- copy(t.line[t.pos:], t.line[n+t.pos:])
- t.line = t.line[:len(t.line)-n]
- if t.echo {
- t.writeLine(t.line[t.pos:])
- for i := 0; i < n; i++ {
- t.queue(space)
- }
- t.advanceCursor(n)
- t.moveCursorToPos(t.pos)
- }
-}
-
-// countToLeftWord returns then number of characters from the cursor to the
-// start of the previous word.
-func (t *Terminal) countToLeftWord() int {
- if t.pos == 0 {
- return 0
- }
-
- pos := t.pos - 1
- for pos > 0 {
- if t.line[pos] != ' ' {
- break
- }
- pos--
- }
- for pos > 0 {
- if t.line[pos] == ' ' {
- pos++
- break
- }
- pos--
- }
-
- return t.pos - pos
-}
-
-// countToRightWord returns then number of characters from the cursor to the
-// start of the next word.
-func (t *Terminal) countToRightWord() int {
- pos := t.pos
- for pos < len(t.line) {
- if t.line[pos] == ' ' {
- break
- }
- pos++
- }
- for pos < len(t.line) {
- if t.line[pos] != ' ' {
- break
- }
- pos++
- }
- return pos - t.pos
-}
-
-// visualLength returns the number of visible glyphs in s.
-func visualLength(runes []rune) int {
- inEscapeSeq := false
- length := 0
-
- for _, r := range runes {
- switch {
- case inEscapeSeq:
- if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
- inEscapeSeq = false
- }
- case r == '\x1b':
- inEscapeSeq = true
- default:
- length++
- }
- }
-
- return length
-}
-
-// handleKey processes the given key and, optionally, returns a line of text
-// that the user has entered.
-func (t *Terminal) handleKey(key rune) (line string, ok bool) {
- if t.pasteActive && key != keyEnter {
- t.addKeyToLine(key)
- return
- }
-
- switch key {
- case keyBackspace:
- if t.pos == 0 {
- return
- }
- t.eraseNPreviousChars(1)
- case keyAltLeft:
- // move left by a word.
- t.pos -= t.countToLeftWord()
- t.moveCursorToPos(t.pos)
- case keyAltRight:
- // move right by a word.
- t.pos += t.countToRightWord()
- t.moveCursorToPos(t.pos)
- case keyLeft:
- if t.pos == 0 {
- return
- }
- t.pos--
- t.moveCursorToPos(t.pos)
- case keyRight:
- if t.pos == len(t.line) {
- return
- }
- t.pos++
- t.moveCursorToPos(t.pos)
- case keyHome:
- if t.pos == 0 {
- return
- }
- t.pos = 0
- t.moveCursorToPos(t.pos)
- case keyEnd:
- if t.pos == len(t.line) {
- return
- }
- t.pos = len(t.line)
- t.moveCursorToPos(t.pos)
- case keyUp:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
- if !ok {
- return "", false
- }
- if t.historyIndex == -1 {
- t.historyPending = string(t.line)
- }
- t.historyIndex++
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- case keyDown:
- switch t.historyIndex {
- case -1:
- return
- case 0:
- runes := []rune(t.historyPending)
- t.setLine(runes, len(runes))
- t.historyIndex--
- default:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
- if ok {
- t.historyIndex--
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- }
- }
- case keyEnter:
- t.moveCursorToPos(len(t.line))
- t.queue([]rune("\r\n"))
- line = string(t.line)
- ok = true
- t.line = t.line[:0]
- t.pos = 0
- t.cursorX = 0
- t.cursorY = 0
- t.maxLine = 0
- case keyDeleteWord:
- // Delete zero or more spaces and then one or more characters.
- t.eraseNPreviousChars(t.countToLeftWord())
- case keyDeleteLine:
- // Delete everything from the current cursor position to the
- // end of line.
- for i := t.pos; i < len(t.line); i++ {
- t.queue(space)
- t.advanceCursor(1)
- }
- t.line = t.line[:t.pos]
- t.moveCursorToPos(t.pos)
- case keyCtrlD:
- // Erase the character under the current position.
- // The EOF case when the line is empty is handled in
- // readLine().
- if t.pos < len(t.line) {
- t.pos++
- t.eraseNPreviousChars(1)
- }
- case keyCtrlU:
- t.eraseNPreviousChars(t.pos)
- case keyClearScreen:
- // Erases the screen and moves the cursor to the home position.
- t.queue([]rune("\x1b[2J\x1b[H"))
- t.queue(t.prompt)
- t.cursorX, t.cursorY = 0, 0
- t.advanceCursor(visualLength(t.prompt))
- t.setLine(t.line, t.pos)
- default:
- if t.AutoCompleteCallback != nil {
- prefix := string(t.line[:t.pos])
- suffix := string(t.line[t.pos:])
-
- t.lock.Unlock()
- newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
- t.lock.Lock()
-
- if completeOk {
- t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
- return
- }
- }
- if !isPrintable(key) {
- return
- }
- if len(t.line) == maxLineLength {
- return
- }
- t.addKeyToLine(key)
- }
- return
-}
-
-// addKeyToLine inserts the given key at the current position in the current
-// line.
-func (t *Terminal) addKeyToLine(key rune) {
- if len(t.line) == cap(t.line) {
- newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
- copy(newLine, t.line)
- t.line = newLine
- }
- t.line = t.line[:len(t.line)+1]
- copy(t.line[t.pos+1:], t.line[t.pos:])
- t.line[t.pos] = key
- if t.echo {
- t.writeLine(t.line[t.pos:])
- }
- t.pos++
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) writeLine(line []rune) {
- for len(line) != 0 {
- remainingOnLine := t.termWidth - t.cursorX
- todo := len(line)
- if todo > remainingOnLine {
- todo = remainingOnLine
- }
- t.queue(line[:todo])
- t.advanceCursor(visualLength(line[:todo]))
- line = line[todo:]
- }
-}
-
-func (t *Terminal) Write(buf []byte) (n int, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if t.cursorX == 0 && t.cursorY == 0 {
- // This is the easy case: there's nothing on the screen that we
- // have to move out of the way.
- return t.c.Write(buf)
- }
-
- // We have a prompt and possibly user input on the screen. We
- // have to clear it first.
- t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
- t.cursorX = 0
- t.clearLineToRight()
-
- for t.cursorY > 0 {
- t.move(1 /* up */, 0, 0, 0)
- t.cursorY--
- t.clearLineToRight()
- }
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
-
- if n, err = t.c.Write(buf); err != nil {
- return
- }
-
- t.writeLine(t.prompt)
- if t.echo {
- t.writeLine(t.line)
- }
-
- t.moveCursorToPos(t.pos)
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
- return
-}
-
-// ReadPassword temporarily changes the prompt and reads a password, without
-// echo, from the terminal.
-func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- oldPrompt := t.prompt
- t.prompt = []rune(prompt)
- t.echo = false
-
- line, err = t.readLine()
-
- t.prompt = oldPrompt
- t.echo = true
-
- return
-}
-
-// ReadLine returns a line of input from the terminal.
-func (t *Terminal) ReadLine() (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- return t.readLine()
-}
-
-func (t *Terminal) readLine() (line string, err error) {
- // t.lock must be held at this point
-
- if t.cursorX == 0 && t.cursorY == 0 {
- t.writeLine(t.prompt)
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- }
-
- lineIsPasted := t.pasteActive
-
- for {
- rest := t.remainder
- lineOk := false
- for !lineOk {
- var key rune
- key, rest = bytesToKey(rest, t.pasteActive)
- if key == utf8.RuneError {
- break
- }
- if !t.pasteActive {
- if key == keyCtrlD {
- if len(t.line) == 0 {
- return "", io.EOF
- }
- }
- if key == keyPasteStart {
- t.pasteActive = true
- if len(t.line) == 0 {
- lineIsPasted = true
- }
- continue
- }
- } else if key == keyPasteEnd {
- t.pasteActive = false
- continue
- }
- if !t.pasteActive {
- lineIsPasted = false
- }
- line, lineOk = t.handleKey(key)
- }
- if len(rest) > 0 {
- n := copy(t.inBuf[:], rest)
- t.remainder = t.inBuf[:n]
- } else {
- t.remainder = nil
- }
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- if lineOk {
- if t.echo {
- t.historyIndex = -1
- t.history.Add(line)
- }
- if lineIsPasted {
- err = ErrPasteIndicator
- }
- return
- }
-
- // t.remainder is a slice at the beginning of t.inBuf
- // containing a partial key sequence
- readBuf := t.inBuf[len(t.remainder):]
- var n int
-
- t.lock.Unlock()
- n, err = t.c.Read(readBuf)
- t.lock.Lock()
-
- if err != nil {
- return
- }
-
- t.remainder = t.inBuf[:n+len(t.remainder)]
- }
-
- panic("unreachable") // for Go 1.0.
-}
-
-// SetPrompt sets the prompt to be used when reading subsequent lines.
-func (t *Terminal) SetPrompt(prompt string) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- t.prompt = []rune(prompt)
-}
-
-func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
- // Move cursor to column zero at the start of the line.
- t.move(t.cursorY, 0, t.cursorX, 0)
- t.cursorX, t.cursorY = 0, 0
- t.clearLineToRight()
- for t.cursorY < numPrevLines {
- // Move down a line
- t.move(0, 1, 0, 0)
- t.cursorY++
- t.clearLineToRight()
- }
- // Move back to beginning.
- t.move(t.cursorY, 0, 0, 0)
- t.cursorX, t.cursorY = 0, 0
-
- t.queue(t.prompt)
- t.advanceCursor(visualLength(t.prompt))
- t.writeLine(t.line)
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) SetSize(width, height int) error {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if width == 0 {
- width = 1
- }
-
- oldWidth := t.termWidth
- t.termWidth, t.termHeight = width, height
-
- switch {
- case width == oldWidth:
- // If the width didn't change then nothing else needs to be
- // done.
- return nil
- case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
- // If there is nothing on current line and no prompt printed,
- // just do nothing
- return nil
- case width < oldWidth:
- // Some terminals (e.g. xterm) will truncate lines that were
- // too long when shinking. Others, (e.g. gnome-terminal) will
- // attempt to wrap them. For the former, repainting t.maxLine
- // works great, but that behaviour goes badly wrong in the case
- // of the latter because they have doubled every full line.
-
- // We assume that we are working on a terminal that wraps lines
- // and adjust the cursor position based on every previous line
- // wrapping and turning into two. This causes the prompt on
- // xterms to move upwards, which isn't great, but it avoids a
- // huge mess with gnome-terminal.
- if t.cursorX >= t.termWidth {
- t.cursorX = t.termWidth - 1
- }
- t.cursorY *= 2
- t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
- case width > oldWidth:
- // If the terminal expands then our position calculations will
- // be wrong in the future because we think the cursor is
- // |t.pos| chars into the string, but there will be a gap at
- // the end of any wrapped line.
- //
- // But the position will actually be correct until we move, so
- // we can move back to the beginning and repaint everything.
- t.clearAndRepaintLinePlusNPrevious(t.maxLine)
- }
-
- _, err := t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- return err
-}
-
-type pasteIndicatorError struct{}
-
-func (pasteIndicatorError) Error() string {
- return "terminal: ErrPasteIndicator not correctly handled"
-}
-
-// ErrPasteIndicator may be returned from ReadLine as the error, in addition
-// to valid line data. It indicates that bracketed paste mode is enabled and
-// that the returned line consists only of pasted data. Programs may wish to
-// interpret pasted data more literally than typed data.
-var ErrPasteIndicator = pasteIndicatorError{}
-
-// SetBracketedPasteMode requests that the terminal bracket paste operations
-// with markers. Not all terminals support this but, if it is supported, then
-// enabling this mode will stop any autocomplete callback from running due to
-// pastes. Additionally, any lines that are completely pasted will be returned
-// from ReadLine with the error set to ErrPasteIndicator.
-func (t *Terminal) SetBracketedPasteMode(on bool) {
- if on {
- io.WriteString(t.c, "\x1b[?2004h")
- } else {
- io.WriteString(t.c, "\x1b[?2004l")
- }
-}
-
-// stRingBuffer is a ring buffer of strings.
-type stRingBuffer struct {
- // entries contains max elements.
- entries []string
- max int
- // head contains the index of the element most recently added to the ring.
- head int
- // size contains the number of elements in the ring.
- size int
-}
-
-func (s *stRingBuffer) Add(a string) {
- if s.entries == nil {
- const defaultNumEntries = 100
- s.entries = make([]string, defaultNumEntries)
- s.max = defaultNumEntries
- }
-
- s.head = (s.head + 1) % s.max
- s.entries[s.head] = a
- if s.size < s.max {
- s.size++
- }
-}
-
-// NthPreviousEntry returns the value passed to the nth previous call to Add.
-// If n is zero then the immediately prior value is returned, if one, then the
-// next most recent, and so on. If such an element doesn't exist then ok is
-// false.
-func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
- if n >= s.size {
- return "", false
- }
- index := s.head - n
- if index < 0 {
- index += s.max
- }
- return s.entries[index], true
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util.go
deleted file mode 100644
index c869213ec..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
- "io"
- "syscall"
- "unsafe"
-)
-
-// State contains the state of a terminal.
-type State struct {
- termios syscall.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- var oldState State
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 {
- return nil, err
- }
-
- newState := oldState.termios
- // This attempts to replicate the behaviour documented for cfmakeraw in
- // the termios(3) manpage.
- newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON
- newState.Oflag &^= syscall.OPOST
- newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN
- newState.Cflag &^= syscall.CSIZE | syscall.PARENB
- newState.Cflag |= syscall.CS8
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 {
- return nil, err
- }
-
- return &oldState, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- var oldState State
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 {
- return nil, err
- }
-
- return &oldState, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0)
- return err
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- var dimensions [4]uint16
-
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0); err != 0 {
- return -1, -1, err
- }
- return int(dimensions[1]), int(dimensions[0]), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- var oldState syscall.Termios
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); err != 0 {
- return nil, err
- }
-
- newState := oldState
- newState.Lflag &^= syscall.ECHO
- newState.Lflag |= syscall.ICANON | syscall.ISIG
- newState.Iflag |= syscall.ICRNL
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 {
- return nil, err
- }
-
- defer func() {
- syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0)
- }()
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(fd, buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go
deleted file mode 100644
index 9c1ffd145..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package terminal
-
-import "syscall"
-
-const ioctlReadTermios = syscall.TIOCGETA
-const ioctlWriteTermios = syscall.TIOCSETA
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go
deleted file mode 100644
index 5883b22d7..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package terminal
-
-// These constants are declared here, rather than importing
-// them from the syscall package as some syscall packages, even
-// on linux, for example gccgo, do not declare them.
-const ioctlReadTermios = 0x5401 // syscall.TCGETS
-const ioctlWriteTermios = 0x5402 // syscall.TCSETS
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go
deleted file mode 100644
index 799f049f0..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal
-
-import (
- "fmt"
- "runtime"
-)
-
-type State struct{}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- return false
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go
deleted file mode 100644
index 07eb5edd7..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build solaris
-
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
- "golang.org/x/sys/unix"
- "io"
- "syscall"
-)
-
-// State contains the state of a terminal.
-type State struct {
- termios syscall.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
- var termio unix.Termio
- err := unix.IoctlSetTermio(fd, unix.TCGETA, &termio)
- return err == nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- // see also: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libast/common/uwin/getpass.c
- val, err := unix.IoctlGetTermios(fd, unix.TCGETS)
- if err != nil {
- return nil, err
- }
- oldState := *val
-
- newState := oldState
- newState.Lflag &^= syscall.ECHO
- newState.Lflag |= syscall.ICANON | syscall.ISIG
- newState.Iflag |= syscall.ICRNL
- err = unix.IoctlSetTermios(fd, unix.TCSETS, &newState)
- if err != nil {
- return nil, err
- }
-
- defer unix.IoctlSetTermios(fd, unix.TCSETS, &oldState)
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(fd, buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go b/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
deleted file mode 100644
index ae9fa9ec1..000000000
--- a/archived/event-adapter/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := terminal.MakeRaw(0)
-// if err != nil {
-// panic(err)
-// }
-// defer terminal.Restore(0, oldState)
-package terminal
-
-import (
- "io"
- "syscall"
- "unsafe"
-)
-
-const (
- enableLineInput = 2
- enableEchoInput = 4
- enableProcessedInput = 1
- enableWindowInput = 8
- enableMouseInput = 16
- enableInsertMode = 32
- enableQuickEditMode = 64
- enableExtendedFlags = 128
- enableAutoPosition = 256
- enableProcessedOutput = 1
- enableWrapAtEolOutput = 2
-)
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-
-var (
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
- procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
-)
-
-type (
- short int16
- word uint16
-
- coord struct {
- x short
- y short
- }
- smallRect struct {
- left short
- top short
- right short
- bottom short
- }
- consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
- }
-)
-
-type State struct {
- mode uint32
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- raw := st &^ (enableEchoInput | enableProcessedInput | enableLineInput | enableProcessedOutput)
- _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(raw), 0)
- if e != 0 {
- return nil, error(e)
- }
- return &State{st}, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- return &State{st}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
- _, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(state.mode), 0)
- return err
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
- var info consoleScreenBufferInfo
- _, _, e := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
- if e != 0 {
- return 0, 0, error(e)
- }
- return int(info.size.x), int(info.size.y), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- var st uint32
- _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
- if e != 0 {
- return nil, error(e)
- }
- old := st
-
- st &^= (enableEchoInput)
- st |= (enableProcessedInput | enableLineInput | enableProcessedOutput)
- _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(st), 0)
- if e != 0 {
- return nil, error(e)
- }
-
- defer func() {
- syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(old), 0)
- }()
-
- var buf [16]byte
- var ret []byte
- for {
- n, err := syscall.Read(syscall.Handle(fd), buf[:])
- if err != nil {
- return nil, err
- }
- if n == 0 {
- if len(ret) == 0 {
- return nil, io.EOF
- }
- break
- }
- if buf[n-1] == '\n' {
- n--
- }
- if n > 0 && buf[n-1] == '\r' {
- n--
- }
- ret = append(ret, buf[:n]...)
- if n < len(buf) {
- break
- }
- }
-
- return ret, nil
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/AUTHORS b/archived/event-adapter/vendor/golang.org/x/net/AUTHORS
deleted file mode 100644
index 15167cd74..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/archived/event-adapter/vendor/golang.org/x/net/CONTRIBUTORS b/archived/event-adapter/vendor/golang.org/x/net/CONTRIBUTORS
deleted file mode 100644
index 1c4577e96..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/archived/event-adapter/vendor/golang.org/x/net/LICENSE b/archived/event-adapter/vendor/golang.org/x/net/LICENSE
deleted file mode 100644
index 6a66aea5e..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. 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.
diff --git a/archived/event-adapter/vendor/golang.org/x/net/PATENTS b/archived/event-adapter/vendor/golang.org/x/net/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/archived/event-adapter/vendor/golang.org/x/net/context/context.go b/archived/event-adapter/vendor/golang.org/x/net/context/context.go
deleted file mode 100644
index 134654cf7..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/context/context.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package context defines the Context type, which carries deadlines,
-// cancelation signals, and other request-scoped values across API boundaries
-// and between processes.
-//
-// Incoming requests to a server should create a Context, and outgoing calls to
-// servers should accept a Context. The chain of function calls between must
-// propagate the Context, optionally replacing it with a modified copy created
-// using WithDeadline, WithTimeout, WithCancel, or WithValue.
-//
-// Programs that use Contexts should follow these rules to keep interfaces
-// consistent across packages and enable static analysis tools to check context
-// propagation:
-//
-// Do not store Contexts inside a struct type; instead, pass a Context
-// explicitly to each function that needs it. The Context should be the first
-// parameter, typically named ctx:
-//
-// func DoSomething(ctx context.Context, arg Arg) error {
-// // ... use ctx ...
-// }
-//
-// Do not pass a nil Context, even if a function permits it. Pass context.TODO
-// if you are unsure about which Context to use.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-//
-// The same Context may be passed to functions running in different goroutines;
-// Contexts are safe for simultaneous use by multiple goroutines.
-//
-// See http://blog.golang.org/context for example code for a server that uses
-// Contexts.
-package context // import "golang.org/x/net/context"
-
-import "time"
-
-// A Context carries a deadline, a cancelation signal, and other values across
-// API boundaries.
-//
-// Context's methods may be called by multiple goroutines simultaneously.
-type Context interface {
- // Deadline returns the time when work done on behalf of this context
- // should be canceled. Deadline returns ok==false when no deadline is
- // set. Successive calls to Deadline return the same results.
- Deadline() (deadline time.Time, ok bool)
-
- // Done returns a channel that's closed when work done on behalf of this
- // context should be canceled. Done may return nil if this context can
- // never be canceled. Successive calls to Done return the same value.
- //
- // WithCancel arranges for Done to be closed when cancel is called;
- // WithDeadline arranges for Done to be closed when the deadline
- // expires; WithTimeout arranges for Done to be closed when the timeout
- // elapses.
- //
- // Done is provided for use in select statements:
- //
- // // Stream generates values with DoSomething and sends them to out
- // // until DoSomething returns an error or ctx.Done is closed.
- // func Stream(ctx context.Context, out chan<- Value) error {
- // for {
- // v, err := DoSomething(ctx)
- // if err != nil {
- // return err
- // }
- // select {
- // case <-ctx.Done():
- // return ctx.Err()
- // case out <- v:
- // }
- // }
- // }
- //
- // See http://blog.golang.org/pipelines for more examples of how to use
- // a Done channel for cancelation.
- Done() <-chan struct{}
-
- // Err returns a non-nil error value after Done is closed. Err returns
- // Canceled if the context was canceled or DeadlineExceeded if the
- // context's deadline passed. No other values for Err are defined.
- // After Done is closed, successive calls to Err return the same value.
- Err() error
-
- // Value returns the value associated with this context for key, or nil
- // if no value is associated with key. Successive calls to Value with
- // the same key returns the same result.
- //
- // Use context values only for request-scoped data that transits
- // processes and API boundaries, not for passing optional parameters to
- // functions.
- //
- // A key identifies a specific value in a Context. Functions that wish
- // to store values in Context typically allocate a key in a global
- // variable then use that key as the argument to context.WithValue and
- // Context.Value. A key can be any type that supports equality;
- // packages should define keys as an unexported type to avoid
- // collisions.
- //
- // Packages that define a Context key should provide type-safe accessors
- // for the values stores using that key:
- //
- // // Package user defines a User type that's stored in Contexts.
- // package user
- //
- // import "golang.org/x/net/context"
- //
- // // User is the type of value stored in the Contexts.
- // type User struct {...}
- //
- // // key is an unexported type for keys defined in this package.
- // // This prevents collisions with keys defined in other packages.
- // type key int
- //
- // // userKey is the key for user.User values in Contexts. It is
- // // unexported; clients use user.NewContext and user.FromContext
- // // instead of using this key directly.
- // var userKey key = 0
- //
- // // NewContext returns a new Context that carries value u.
- // func NewContext(ctx context.Context, u *User) context.Context {
- // return context.WithValue(ctx, userKey, u)
- // }
- //
- // // FromContext returns the User value stored in ctx, if any.
- // func FromContext(ctx context.Context) (*User, bool) {
- // u, ok := ctx.Value(userKey).(*User)
- // return u, ok
- // }
- Value(key interface{}) interface{}
-}
-
-// Background returns a non-nil, empty Context. It is never canceled, has no
-// values, and has no deadline. It is typically used by the main function,
-// initialization, and tests, and as the top-level Context for incoming
-// requests.
-func Background() Context {
- return background
-}
-
-// TODO returns a non-nil, empty Context. Code should use context.TODO when
-// it's unclear which Context to use or it is not yet available (because the
-// surrounding function has not yet been extended to accept a Context
-// parameter). TODO is recognized by static analysis tools that determine
-// whether Contexts are propagated correctly in a program.
-func TODO() Context {
- return todo
-}
-
-// A CancelFunc tells an operation to abandon its work.
-// A CancelFunc does not wait for the work to stop.
-// After the first call, subsequent calls to a CancelFunc do nothing.
-type CancelFunc func()
diff --git a/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go b/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
deleted file mode 100644
index aa288de64..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
-package ctxhttp // import "golang.org/x/net/context/ctxhttp"
-
-import (
- "io"
- "net/http"
- "net/url"
- "strings"
-
- "golang.org/x/net/context"
-)
-
-// Do sends an HTTP request with the provided http.Client and returns
-// an HTTP response.
-//
-// If the client is nil, http.DefaultClient is used.
-//
-// The provided ctx must be non-nil. If it is canceled or times out,
-// ctx.Err() will be returned.
-func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
- if client == nil {
- client = http.DefaultClient
- }
- return client.Do(req.WithContext(ctx))
-}
-
-// Get issues a GET request via the Do function.
-func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Head issues a HEAD request via the Do function.
-func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Post issues a POST request via the Do function.
-func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", bodyType)
- return Do(ctx, client, req)
-}
-
-// PostForm issues a POST request via the Do function.
-func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
- return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go b/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
deleted file mode 100644
index 926870cc2..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package ctxhttp // import "golang.org/x/net/context/ctxhttp"
-
-import (
- "io"
- "net/http"
- "net/url"
- "strings"
-
- "golang.org/x/net/context"
-)
-
-func nop() {}
-
-var (
- testHookContextDoneBeforeHeaders = nop
- testHookDoReturned = nop
- testHookDidBodyClose = nop
-)
-
-// Do sends an HTTP request with the provided http.Client and returns an HTTP response.
-// If the client is nil, http.DefaultClient is used.
-// If the context is canceled or times out, ctx.Err() will be returned.
-func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
- if client == nil {
- client = http.DefaultClient
- }
-
- // TODO(djd): Respect any existing value of req.Cancel.
- cancel := make(chan struct{})
- req.Cancel = cancel
-
- type responseAndError struct {
- resp *http.Response
- err error
- }
- result := make(chan responseAndError, 1)
-
- // Make local copies of test hooks closed over by goroutines below.
- // Prevents data races in tests.
- testHookDoReturned := testHookDoReturned
- testHookDidBodyClose := testHookDidBodyClose
-
- go func() {
- resp, err := client.Do(req)
- testHookDoReturned()
- result <- responseAndError{resp, err}
- }()
-
- var resp *http.Response
-
- select {
- case <-ctx.Done():
- testHookContextDoneBeforeHeaders()
- close(cancel)
- // Clean up after the goroutine calling client.Do:
- go func() {
- if r := <-result; r.resp != nil {
- testHookDidBodyClose()
- r.resp.Body.Close()
- }
- }()
- return nil, ctx.Err()
- case r := <-result:
- var err error
- resp, err = r.resp, r.err
- if err != nil {
- return resp, err
- }
- }
-
- c := make(chan struct{})
- go func() {
- select {
- case <-ctx.Done():
- close(cancel)
- case <-c:
- // The response's Body is closed.
- }
- }()
- resp.Body = ¬ifyingReader{resp.Body, c}
-
- return resp, nil
-}
-
-// Get issues a GET request via the Do function.
-func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Head issues a HEAD request via the Do function.
-func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Post issues a POST request via the Do function.
-func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", bodyType)
- return Do(ctx, client, req)
-}
-
-// PostForm issues a POST request via the Do function.
-func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
- return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
-}
-
-// notifyingReader is an io.ReadCloser that closes the notify channel after
-// Close is called or a Read fails on the underlying ReadCloser.
-type notifyingReader struct {
- io.ReadCloser
- notify chan<- struct{}
-}
-
-func (r *notifyingReader) Read(p []byte) (int, error) {
- n, err := r.ReadCloser.Read(p)
- if err != nil && r.notify != nil {
- close(r.notify)
- r.notify = nil
- }
- return n, err
-}
-
-func (r *notifyingReader) Close() error {
- err := r.ReadCloser.Close()
- if r.notify != nil {
- close(r.notify)
- r.notify = nil
- }
- return err
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/context/go17.go b/archived/event-adapter/vendor/golang.org/x/net/context/go17.go
deleted file mode 100644
index f8cda19ad..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/context/go17.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package context
-
-import (
- "context" // standard library's context, as of Go 1.7
- "time"
-)
-
-var (
- todo = context.TODO()
- background = context.Background()
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = context.Canceled
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = context.DeadlineExceeded
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- ctx, f := context.WithCancel(parent)
- return ctx, CancelFunc(f)
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- ctx, f := context.WithDeadline(parent, deadline)
- return ctx, CancelFunc(f)
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return context.WithValue(parent, key, val)
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/context/pre_go17.go b/archived/event-adapter/vendor/golang.org/x/net/context/pre_go17.go
deleted file mode 100644
index 5a30acabd..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/context/pre_go17.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package context
-
-import (
- "errors"
- "fmt"
- "sync"
- "time"
-)
-
-// An emptyCtx is never canceled, has no values, and has no deadline. It is not
-// struct{}, since vars of this type must have distinct addresses.
-type emptyCtx int
-
-func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
- return
-}
-
-func (*emptyCtx) Done() <-chan struct{} {
- return nil
-}
-
-func (*emptyCtx) Err() error {
- return nil
-}
-
-func (*emptyCtx) Value(key interface{}) interface{} {
- return nil
-}
-
-func (e *emptyCtx) String() string {
- switch e {
- case background:
- return "context.Background"
- case todo:
- return "context.TODO"
- }
- return "unknown empty Context"
-}
-
-var (
- background = new(emptyCtx)
- todo = new(emptyCtx)
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = errors.New("context canceled")
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = errors.New("context deadline exceeded")
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- c := newCancelCtx(parent)
- propagateCancel(parent, c)
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// newCancelCtx returns an initialized cancelCtx.
-func newCancelCtx(parent Context) *cancelCtx {
- return &cancelCtx{
- Context: parent,
- done: make(chan struct{}),
- }
-}
-
-// propagateCancel arranges for child to be canceled when parent is.
-func propagateCancel(parent Context, child canceler) {
- if parent.Done() == nil {
- return // parent is never canceled
- }
- if p, ok := parentCancelCtx(parent); ok {
- p.mu.Lock()
- if p.err != nil {
- // parent has already been canceled
- child.cancel(false, p.err)
- } else {
- if p.children == nil {
- p.children = make(map[canceler]bool)
- }
- p.children[child] = true
- }
- p.mu.Unlock()
- } else {
- go func() {
- select {
- case <-parent.Done():
- child.cancel(false, parent.Err())
- case <-child.Done():
- }
- }()
- }
-}
-
-// parentCancelCtx follows a chain of parent references until it finds a
-// *cancelCtx. This function understands how each of the concrete types in this
-// package represents its parent.
-func parentCancelCtx(parent Context) (*cancelCtx, bool) {
- for {
- switch c := parent.(type) {
- case *cancelCtx:
- return c, true
- case *timerCtx:
- return c.cancelCtx, true
- case *valueCtx:
- parent = c.Context
- default:
- return nil, false
- }
- }
-}
-
-// removeChild removes a context from its parent.
-func removeChild(parent Context, child canceler) {
- p, ok := parentCancelCtx(parent)
- if !ok {
- return
- }
- p.mu.Lock()
- if p.children != nil {
- delete(p.children, child)
- }
- p.mu.Unlock()
-}
-
-// A canceler is a context type that can be canceled directly. The
-// implementations are *cancelCtx and *timerCtx.
-type canceler interface {
- cancel(removeFromParent bool, err error)
- Done() <-chan struct{}
-}
-
-// A cancelCtx can be canceled. When canceled, it also cancels any children
-// that implement canceler.
-type cancelCtx struct {
- Context
-
- done chan struct{} // closed by the first cancel call.
-
- mu sync.Mutex
- children map[canceler]bool // set to nil by the first cancel call
- err error // set to non-nil by the first cancel call
-}
-
-func (c *cancelCtx) Done() <-chan struct{} {
- return c.done
-}
-
-func (c *cancelCtx) Err() error {
- c.mu.Lock()
- defer c.mu.Unlock()
- return c.err
-}
-
-func (c *cancelCtx) String() string {
- return fmt.Sprintf("%v.WithCancel", c.Context)
-}
-
-// cancel closes c.done, cancels each of c's children, and, if
-// removeFromParent is true, removes c from its parent's children.
-func (c *cancelCtx) cancel(removeFromParent bool, err error) {
- if err == nil {
- panic("context: internal error: missing cancel error")
- }
- c.mu.Lock()
- if c.err != nil {
- c.mu.Unlock()
- return // already canceled
- }
- c.err = err
- close(c.done)
- for child := range c.children {
- // NOTE: acquiring the child's lock while holding parent's lock.
- child.cancel(false, err)
- }
- c.children = nil
- c.mu.Unlock()
-
- if removeFromParent {
- removeChild(c.Context, c)
- }
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- if cur, ok := parent.Deadline(); ok && cur.Before(deadline) {
- // The current deadline is already sooner than the new one.
- return WithCancel(parent)
- }
- c := &timerCtx{
- cancelCtx: newCancelCtx(parent),
- deadline: deadline,
- }
- propagateCancel(parent, c)
- d := deadline.Sub(time.Now())
- if d <= 0 {
- c.cancel(true, DeadlineExceeded) // deadline has already passed
- return c, func() { c.cancel(true, Canceled) }
- }
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.err == nil {
- c.timer = time.AfterFunc(d, func() {
- c.cancel(true, DeadlineExceeded)
- })
- }
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
-// implement Done and Err. It implements cancel by stopping its timer then
-// delegating to cancelCtx.cancel.
-type timerCtx struct {
- *cancelCtx
- timer *time.Timer // Under cancelCtx.mu.
-
- deadline time.Time
-}
-
-func (c *timerCtx) Deadline() (deadline time.Time, ok bool) {
- return c.deadline, true
-}
-
-func (c *timerCtx) String() string {
- return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now()))
-}
-
-func (c *timerCtx) cancel(removeFromParent bool, err error) {
- c.cancelCtx.cancel(false, err)
- if removeFromParent {
- // Remove this timerCtx from its parent cancelCtx's children.
- removeChild(c.cancelCtx.Context, c)
- }
- c.mu.Lock()
- if c.timer != nil {
- c.timer.Stop()
- c.timer = nil
- }
- c.mu.Unlock()
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return &valueCtx{parent, key, val}
-}
-
-// A valueCtx carries a key-value pair. It implements Value for that key and
-// delegates all other calls to the embedded Context.
-type valueCtx struct {
- Context
- key, val interface{}
-}
-
-func (c *valueCtx) String() string {
- return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val)
-}
-
-func (c *valueCtx) Value(key interface{}) interface{} {
- if c.key == key {
- return c.val
- }
- return c.Context.Value(key)
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/atom/atom.go b/archived/event-adapter/vendor/golang.org/x/net/html/atom/atom.go
deleted file mode 100644
index cd0a8ac15..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/atom/atom.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package atom provides integer codes (also known as atoms) for a fixed set of
-// frequently occurring HTML strings: tag names and attribute keys such as "p"
-// and "id".
-//
-// Sharing an atom's name between all elements with the same tag can result in
-// fewer string allocations when tokenizing and parsing HTML. Integer
-// comparisons are also generally faster than string comparisons.
-//
-// The value of an atom's particular code is not guaranteed to stay the same
-// between versions of this package. Neither is any ordering guaranteed:
-// whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to
-// be dense. The only guarantees are that e.g. looking up "div" will yield
-// atom.Div, calling atom.Div.String will return "div", and atom.Div != 0.
-package atom // import "golang.org/x/net/html/atom"
-
-// Atom is an integer code for a string. The zero value maps to "".
-type Atom uint32
-
-// String returns the atom's name.
-func (a Atom) String() string {
- start := uint32(a >> 8)
- n := uint32(a & 0xff)
- if start+n > uint32(len(atomText)) {
- return ""
- }
- return atomText[start : start+n]
-}
-
-func (a Atom) string() string {
- return atomText[a>>8 : a>>8+a&0xff]
-}
-
-// fnv computes the FNV hash with an arbitrary starting value h.
-func fnv(h uint32, s []byte) uint32 {
- for i := range s {
- h ^= uint32(s[i])
- h *= 16777619
- }
- return h
-}
-
-func match(s string, t []byte) bool {
- for i, c := range t {
- if s[i] != c {
- return false
- }
- }
- return true
-}
-
-// Lookup returns the atom whose name is s. It returns zero if there is no
-// such atom. The lookup is case sensitive.
-func Lookup(s []byte) Atom {
- if len(s) == 0 || len(s) > maxAtomLen {
- return 0
- }
- h := fnv(hash0, s)
- if a := table[h&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) {
- return a
- }
- if a := table[(h>>16)&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) {
- return a
- }
- return 0
-}
-
-// String returns a string whose contents are equal to s. In that sense, it is
-// equivalent to string(s) but may be more efficient.
-func String(s []byte) string {
- if a := Lookup(s); a != 0 {
- return a.String()
- }
- return string(s)
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/atom/table.go b/archived/event-adapter/vendor/golang.org/x/net/html/atom/table.go
deleted file mode 100644
index 2605ba310..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/atom/table.go
+++ /dev/null
@@ -1,713 +0,0 @@
-// generated by go run gen.go; DO NOT EDIT
-
-package atom
-
-const (
- A Atom = 0x1
- Abbr Atom = 0x4
- Accept Atom = 0x2106
- AcceptCharset Atom = 0x210e
- Accesskey Atom = 0x3309
- Action Atom = 0x1f606
- Address Atom = 0x4f307
- Align Atom = 0x1105
- Alt Atom = 0x4503
- Annotation Atom = 0x1670a
- AnnotationXml Atom = 0x1670e
- Applet Atom = 0x2b306
- Area Atom = 0x2fa04
- Article Atom = 0x38807
- Aside Atom = 0x8305
- Async Atom = 0x7b05
- Audio Atom = 0xa605
- Autocomplete Atom = 0x1fc0c
- Autofocus Atom = 0xb309
- Autoplay Atom = 0xce08
- B Atom = 0x101
- Base Atom = 0xd604
- Basefont Atom = 0xd608
- Bdi Atom = 0x1a03
- Bdo Atom = 0xe703
- Bgsound Atom = 0x11807
- Big Atom = 0x12403
- Blink Atom = 0x12705
- Blockquote Atom = 0x12c0a
- Body Atom = 0x2f04
- Br Atom = 0x202
- Button Atom = 0x13606
- Canvas Atom = 0x7f06
- Caption Atom = 0x1bb07
- Center Atom = 0x5b506
- Challenge Atom = 0x21f09
- Charset Atom = 0x2807
- Checked Atom = 0x32807
- Cite Atom = 0x3c804
- Class Atom = 0x4de05
- Code Atom = 0x14904
- Col Atom = 0x15003
- Colgroup Atom = 0x15008
- Color Atom = 0x15d05
- Cols Atom = 0x16204
- Colspan Atom = 0x16207
- Command Atom = 0x17507
- Content Atom = 0x42307
- Contenteditable Atom = 0x4230f
- Contextmenu Atom = 0x3310b
- Controls Atom = 0x18808
- Coords Atom = 0x19406
- Crossorigin Atom = 0x19f0b
- Data Atom = 0x44a04
- Datalist Atom = 0x44a08
- Datetime Atom = 0x23c08
- Dd Atom = 0x26702
- Default Atom = 0x8607
- Defer Atom = 0x14b05
- Del Atom = 0x3ef03
- Desc Atom = 0x4db04
- Details Atom = 0x4807
- Dfn Atom = 0x6103
- Dialog Atom = 0x1b06
- Dir Atom = 0x6903
- Dirname Atom = 0x6907
- Disabled Atom = 0x10c08
- Div Atom = 0x11303
- Dl Atom = 0x11e02
- Download Atom = 0x40008
- Draggable Atom = 0x17b09
- Dropzone Atom = 0x39108
- Dt Atom = 0x50902
- Em Atom = 0x6502
- Embed Atom = 0x6505
- Enctype Atom = 0x21107
- Face Atom = 0x5b304
- Fieldset Atom = 0x1b008
- Figcaption Atom = 0x1b80a
- Figure Atom = 0x1cc06
- Font Atom = 0xda04
- Footer Atom = 0x8d06
- For Atom = 0x1d803
- ForeignObject Atom = 0x1d80d
- Foreignobject Atom = 0x1e50d
- Form Atom = 0x1f204
- Formaction Atom = 0x1f20a
- Formenctype Atom = 0x20d0b
- Formmethod Atom = 0x2280a
- Formnovalidate Atom = 0x2320e
- Formtarget Atom = 0x2470a
- Frame Atom = 0x9a05
- Frameset Atom = 0x9a08
- H1 Atom = 0x26e02
- H2 Atom = 0x29402
- H3 Atom = 0x2a702
- H4 Atom = 0x2e902
- H5 Atom = 0x2f302
- H6 Atom = 0x50b02
- Head Atom = 0x2d504
- Header Atom = 0x2d506
- Headers Atom = 0x2d507
- Height Atom = 0x25106
- Hgroup Atom = 0x25906
- Hidden Atom = 0x26506
- High Atom = 0x26b04
- Hr Atom = 0x27002
- Href Atom = 0x27004
- Hreflang Atom = 0x27008
- Html Atom = 0x25504
- HttpEquiv Atom = 0x2780a
- I Atom = 0x601
- Icon Atom = 0x42204
- Id Atom = 0x8502
- Iframe Atom = 0x29606
- Image Atom = 0x29c05
- Img Atom = 0x2a103
- Input Atom = 0x3e805
- Inputmode Atom = 0x3e809
- Ins Atom = 0x1a803
- Isindex Atom = 0x2a907
- Ismap Atom = 0x2b005
- Itemid Atom = 0x33c06
- Itemprop Atom = 0x3c908
- Itemref Atom = 0x5ad07
- Itemscope Atom = 0x2b909
- Itemtype Atom = 0x2c308
- Kbd Atom = 0x1903
- Keygen Atom = 0x3906
- Keytype Atom = 0x53707
- Kind Atom = 0x10904
- Label Atom = 0xf005
- Lang Atom = 0x27404
- Legend Atom = 0x18206
- Li Atom = 0x1202
- Link Atom = 0x12804
- List Atom = 0x44e04
- Listing Atom = 0x44e07
- Loop Atom = 0xf404
- Low Atom = 0x11f03
- Malignmark Atom = 0x100a
- Manifest Atom = 0x5f108
- Map Atom = 0x2b203
- Mark Atom = 0x1604
- Marquee Atom = 0x2cb07
- Math Atom = 0x2d204
- Max Atom = 0x2e103
- Maxlength Atom = 0x2e109
- Media Atom = 0x6e05
- Mediagroup Atom = 0x6e0a
- Menu Atom = 0x33804
- Menuitem Atom = 0x33808
- Meta Atom = 0x45d04
- Meter Atom = 0x24205
- Method Atom = 0x22c06
- Mglyph Atom = 0x2a206
- Mi Atom = 0x2eb02
- Min Atom = 0x2eb03
- Minlength Atom = 0x2eb09
- Mn Atom = 0x23502
- Mo Atom = 0x3ed02
- Ms Atom = 0x2bc02
- Mtext Atom = 0x2f505
- Multiple Atom = 0x30308
- Muted Atom = 0x30b05
- Name Atom = 0x6c04
- Nav Atom = 0x3e03
- Nobr Atom = 0x5704
- Noembed Atom = 0x6307
- Noframes Atom = 0x9808
- Noscript Atom = 0x3d208
- Novalidate Atom = 0x2360a
- Object Atom = 0x1ec06
- Ol Atom = 0xc902
- Onabort Atom = 0x13a07
- Onafterprint Atom = 0x1c00c
- Onautocomplete Atom = 0x1fa0e
- Onautocompleteerror Atom = 0x1fa13
- Onbeforeprint Atom = 0x6040d
- Onbeforeunload Atom = 0x4e70e
- Onblur Atom = 0xaa06
- Oncancel Atom = 0xe908
- Oncanplay Atom = 0x28509
- Oncanplaythrough Atom = 0x28510
- Onchange Atom = 0x3a708
- Onclick Atom = 0x31007
- Onclose Atom = 0x31707
- Oncontextmenu Atom = 0x32f0d
- Oncuechange Atom = 0x3420b
- Ondblclick Atom = 0x34d0a
- Ondrag Atom = 0x35706
- Ondragend Atom = 0x35709
- Ondragenter Atom = 0x3600b
- Ondragleave Atom = 0x36b0b
- Ondragover Atom = 0x3760a
- Ondragstart Atom = 0x3800b
- Ondrop Atom = 0x38f06
- Ondurationchange Atom = 0x39f10
- Onemptied Atom = 0x39609
- Onended Atom = 0x3af07
- Onerror Atom = 0x3b607
- Onfocus Atom = 0x3bd07
- Onhashchange Atom = 0x3da0c
- Oninput Atom = 0x3e607
- Oninvalid Atom = 0x3f209
- Onkeydown Atom = 0x3fb09
- Onkeypress Atom = 0x4080a
- Onkeyup Atom = 0x41807
- Onlanguagechange Atom = 0x43210
- Onload Atom = 0x44206
- Onloadeddata Atom = 0x4420c
- Onloadedmetadata Atom = 0x45510
- Onloadstart Atom = 0x46b0b
- Onmessage Atom = 0x47609
- Onmousedown Atom = 0x47f0b
- Onmousemove Atom = 0x48a0b
- Onmouseout Atom = 0x4950a
- Onmouseover Atom = 0x4a20b
- Onmouseup Atom = 0x4ad09
- Onmousewheel Atom = 0x4b60c
- Onoffline Atom = 0x4c209
- Ononline Atom = 0x4cb08
- Onpagehide Atom = 0x4d30a
- Onpageshow Atom = 0x4fe0a
- Onpause Atom = 0x50d07
- Onplay Atom = 0x51706
- Onplaying Atom = 0x51709
- Onpopstate Atom = 0x5200a
- Onprogress Atom = 0x52a0a
- Onratechange Atom = 0x53e0c
- Onreset Atom = 0x54a07
- Onresize Atom = 0x55108
- Onscroll Atom = 0x55f08
- Onseeked Atom = 0x56708
- Onseeking Atom = 0x56f09
- Onselect Atom = 0x57808
- Onshow Atom = 0x58206
- Onsort Atom = 0x58b06
- Onstalled Atom = 0x59509
- Onstorage Atom = 0x59e09
- Onsubmit Atom = 0x5a708
- Onsuspend Atom = 0x5bb09
- Ontimeupdate Atom = 0xdb0c
- Ontoggle Atom = 0x5c408
- Onunload Atom = 0x5cc08
- Onvolumechange Atom = 0x5d40e
- Onwaiting Atom = 0x5e209
- Open Atom = 0x3cf04
- Optgroup Atom = 0xf608
- Optimum Atom = 0x5eb07
- Option Atom = 0x60006
- Output Atom = 0x49c06
- P Atom = 0xc01
- Param Atom = 0xc05
- Pattern Atom = 0x5107
- Ping Atom = 0x7704
- Placeholder Atom = 0xc30b
- Plaintext Atom = 0xfd09
- Poster Atom = 0x15706
- Pre Atom = 0x25e03
- Preload Atom = 0x25e07
- Progress Atom = 0x52c08
- Prompt Atom = 0x5fa06
- Public Atom = 0x41e06
- Q Atom = 0x13101
- Radiogroup Atom = 0x30a
- Readonly Atom = 0x2fb08
- Rel Atom = 0x25f03
- Required Atom = 0x1d008
- Reversed Atom = 0x5a08
- Rows Atom = 0x9204
- Rowspan Atom = 0x9207
- Rp Atom = 0x1c602
- Rt Atom = 0x13f02
- Ruby Atom = 0xaf04
- S Atom = 0x2c01
- Samp Atom = 0x4e04
- Sandbox Atom = 0xbb07
- Scope Atom = 0x2bd05
- Scoped Atom = 0x2bd06
- Script Atom = 0x3d406
- Seamless Atom = 0x31c08
- Section Atom = 0x4e207
- Select Atom = 0x57a06
- Selected Atom = 0x57a08
- Shape Atom = 0x4f905
- Size Atom = 0x55504
- Sizes Atom = 0x55505
- Small Atom = 0x18f05
- Sortable Atom = 0x58d08
- Sorted Atom = 0x19906
- Source Atom = 0x1aa06
- Spacer Atom = 0x2db06
- Span Atom = 0x9504
- Spellcheck Atom = 0x3230a
- Src Atom = 0x3c303
- Srcdoc Atom = 0x3c306
- Srclang Atom = 0x41107
- Start Atom = 0x38605
- Step Atom = 0x5f704
- Strike Atom = 0x53306
- Strong Atom = 0x55906
- Style Atom = 0x61105
- Sub Atom = 0x5a903
- Summary Atom = 0x61607
- Sup Atom = 0x61d03
- Svg Atom = 0x62003
- System Atom = 0x62306
- Tabindex Atom = 0x46308
- Table Atom = 0x42d05
- Target Atom = 0x24b06
- Tbody Atom = 0x2e05
- Td Atom = 0x4702
- Template Atom = 0x62608
- Textarea Atom = 0x2f608
- Tfoot Atom = 0x8c05
- Th Atom = 0x22e02
- Thead Atom = 0x2d405
- Time Atom = 0xdd04
- Title Atom = 0xa105
- Tr Atom = 0x10502
- Track Atom = 0x10505
- Translate Atom = 0x14009
- Tt Atom = 0x5302
- Type Atom = 0x21404
- Typemustmatch Atom = 0x2140d
- U Atom = 0xb01
- Ul Atom = 0x8a02
- Usemap Atom = 0x51106
- Value Atom = 0x4005
- Var Atom = 0x11503
- Video Atom = 0x28105
- Wbr Atom = 0x12103
- Width Atom = 0x50705
- Wrap Atom = 0x58704
- Xmp Atom = 0xc103
-)
-
-const hash0 = 0xc17da63e
-
-const maxAtomLen = 19
-
-var table = [1 << 9]Atom{
- 0x1: 0x48a0b, // onmousemove
- 0x2: 0x5e209, // onwaiting
- 0x3: 0x1fa13, // onautocompleteerror
- 0x4: 0x5fa06, // prompt
- 0x7: 0x5eb07, // optimum
- 0x8: 0x1604, // mark
- 0xa: 0x5ad07, // itemref
- 0xb: 0x4fe0a, // onpageshow
- 0xc: 0x57a06, // select
- 0xd: 0x17b09, // draggable
- 0xe: 0x3e03, // nav
- 0xf: 0x17507, // command
- 0x11: 0xb01, // u
- 0x14: 0x2d507, // headers
- 0x15: 0x44a08, // datalist
- 0x17: 0x4e04, // samp
- 0x1a: 0x3fb09, // onkeydown
- 0x1b: 0x55f08, // onscroll
- 0x1c: 0x15003, // col
- 0x20: 0x3c908, // itemprop
- 0x21: 0x2780a, // http-equiv
- 0x22: 0x61d03, // sup
- 0x24: 0x1d008, // required
- 0x2b: 0x25e07, // preload
- 0x2c: 0x6040d, // onbeforeprint
- 0x2d: 0x3600b, // ondragenter
- 0x2e: 0x50902, // dt
- 0x2f: 0x5a708, // onsubmit
- 0x30: 0x27002, // hr
- 0x31: 0x32f0d, // oncontextmenu
- 0x33: 0x29c05, // image
- 0x34: 0x50d07, // onpause
- 0x35: 0x25906, // hgroup
- 0x36: 0x7704, // ping
- 0x37: 0x57808, // onselect
- 0x3a: 0x11303, // div
- 0x3b: 0x1fa0e, // onautocomplete
- 0x40: 0x2eb02, // mi
- 0x41: 0x31c08, // seamless
- 0x42: 0x2807, // charset
- 0x43: 0x8502, // id
- 0x44: 0x5200a, // onpopstate
- 0x45: 0x3ef03, // del
- 0x46: 0x2cb07, // marquee
- 0x47: 0x3309, // accesskey
- 0x49: 0x8d06, // footer
- 0x4a: 0x44e04, // list
- 0x4b: 0x2b005, // ismap
- 0x51: 0x33804, // menu
- 0x52: 0x2f04, // body
- 0x55: 0x9a08, // frameset
- 0x56: 0x54a07, // onreset
- 0x57: 0x12705, // blink
- 0x58: 0xa105, // title
- 0x59: 0x38807, // article
- 0x5b: 0x22e02, // th
- 0x5d: 0x13101, // q
- 0x5e: 0x3cf04, // open
- 0x5f: 0x2fa04, // area
- 0x61: 0x44206, // onload
- 0x62: 0xda04, // font
- 0x63: 0xd604, // base
- 0x64: 0x16207, // colspan
- 0x65: 0x53707, // keytype
- 0x66: 0x11e02, // dl
- 0x68: 0x1b008, // fieldset
- 0x6a: 0x2eb03, // min
- 0x6b: 0x11503, // var
- 0x6f: 0x2d506, // header
- 0x70: 0x13f02, // rt
- 0x71: 0x15008, // colgroup
- 0x72: 0x23502, // mn
- 0x74: 0x13a07, // onabort
- 0x75: 0x3906, // keygen
- 0x76: 0x4c209, // onoffline
- 0x77: 0x21f09, // challenge
- 0x78: 0x2b203, // map
- 0x7a: 0x2e902, // h4
- 0x7b: 0x3b607, // onerror
- 0x7c: 0x2e109, // maxlength
- 0x7d: 0x2f505, // mtext
- 0x7e: 0xbb07, // sandbox
- 0x7f: 0x58b06, // onsort
- 0x80: 0x100a, // malignmark
- 0x81: 0x45d04, // meta
- 0x82: 0x7b05, // async
- 0x83: 0x2a702, // h3
- 0x84: 0x26702, // dd
- 0x85: 0x27004, // href
- 0x86: 0x6e0a, // mediagroup
- 0x87: 0x19406, // coords
- 0x88: 0x41107, // srclang
- 0x89: 0x34d0a, // ondblclick
- 0x8a: 0x4005, // value
- 0x8c: 0xe908, // oncancel
- 0x8e: 0x3230a, // spellcheck
- 0x8f: 0x9a05, // frame
- 0x91: 0x12403, // big
- 0x94: 0x1f606, // action
- 0x95: 0x6903, // dir
- 0x97: 0x2fb08, // readonly
- 0x99: 0x42d05, // table
- 0x9a: 0x61607, // summary
- 0x9b: 0x12103, // wbr
- 0x9c: 0x30a, // radiogroup
- 0x9d: 0x6c04, // name
- 0x9f: 0x62306, // system
- 0xa1: 0x15d05, // color
- 0xa2: 0x7f06, // canvas
- 0xa3: 0x25504, // html
- 0xa5: 0x56f09, // onseeking
- 0xac: 0x4f905, // shape
- 0xad: 0x25f03, // rel
- 0xae: 0x28510, // oncanplaythrough
- 0xaf: 0x3760a, // ondragover
- 0xb0: 0x62608, // template
- 0xb1: 0x1d80d, // foreignObject
- 0xb3: 0x9204, // rows
- 0xb6: 0x44e07, // listing
- 0xb7: 0x49c06, // output
- 0xb9: 0x3310b, // contextmenu
- 0xbb: 0x11f03, // low
- 0xbc: 0x1c602, // rp
- 0xbd: 0x5bb09, // onsuspend
- 0xbe: 0x13606, // button
- 0xbf: 0x4db04, // desc
- 0xc1: 0x4e207, // section
- 0xc2: 0x52a0a, // onprogress
- 0xc3: 0x59e09, // onstorage
- 0xc4: 0x2d204, // math
- 0xc5: 0x4503, // alt
- 0xc7: 0x8a02, // ul
- 0xc8: 0x5107, // pattern
- 0xc9: 0x4b60c, // onmousewheel
- 0xca: 0x35709, // ondragend
- 0xcb: 0xaf04, // ruby
- 0xcc: 0xc01, // p
- 0xcd: 0x31707, // onclose
- 0xce: 0x24205, // meter
- 0xcf: 0x11807, // bgsound
- 0xd2: 0x25106, // height
- 0xd4: 0x101, // b
- 0xd5: 0x2c308, // itemtype
- 0xd8: 0x1bb07, // caption
- 0xd9: 0x10c08, // disabled
- 0xdb: 0x33808, // menuitem
- 0xdc: 0x62003, // svg
- 0xdd: 0x18f05, // small
- 0xde: 0x44a04, // data
- 0xe0: 0x4cb08, // ononline
- 0xe1: 0x2a206, // mglyph
- 0xe3: 0x6505, // embed
- 0xe4: 0x10502, // tr
- 0xe5: 0x46b0b, // onloadstart
- 0xe7: 0x3c306, // srcdoc
- 0xeb: 0x5c408, // ontoggle
- 0xed: 0xe703, // bdo
- 0xee: 0x4702, // td
- 0xef: 0x8305, // aside
- 0xf0: 0x29402, // h2
- 0xf1: 0x52c08, // progress
- 0xf2: 0x12c0a, // blockquote
- 0xf4: 0xf005, // label
- 0xf5: 0x601, // i
- 0xf7: 0x9207, // rowspan
- 0xfb: 0x51709, // onplaying
- 0xfd: 0x2a103, // img
- 0xfe: 0xf608, // optgroup
- 0xff: 0x42307, // content
- 0x101: 0x53e0c, // onratechange
- 0x103: 0x3da0c, // onhashchange
- 0x104: 0x4807, // details
- 0x106: 0x40008, // download
- 0x109: 0x14009, // translate
- 0x10b: 0x4230f, // contenteditable
- 0x10d: 0x36b0b, // ondragleave
- 0x10e: 0x2106, // accept
- 0x10f: 0x57a08, // selected
- 0x112: 0x1f20a, // formaction
- 0x113: 0x5b506, // center
- 0x115: 0x45510, // onloadedmetadata
- 0x116: 0x12804, // link
- 0x117: 0xdd04, // time
- 0x118: 0x19f0b, // crossorigin
- 0x119: 0x3bd07, // onfocus
- 0x11a: 0x58704, // wrap
- 0x11b: 0x42204, // icon
- 0x11d: 0x28105, // video
- 0x11e: 0x4de05, // class
- 0x121: 0x5d40e, // onvolumechange
- 0x122: 0xaa06, // onblur
- 0x123: 0x2b909, // itemscope
- 0x124: 0x61105, // style
- 0x127: 0x41e06, // public
- 0x129: 0x2320e, // formnovalidate
- 0x12a: 0x58206, // onshow
- 0x12c: 0x51706, // onplay
- 0x12d: 0x3c804, // cite
- 0x12e: 0x2bc02, // ms
- 0x12f: 0xdb0c, // ontimeupdate
- 0x130: 0x10904, // kind
- 0x131: 0x2470a, // formtarget
- 0x135: 0x3af07, // onended
- 0x136: 0x26506, // hidden
- 0x137: 0x2c01, // s
- 0x139: 0x2280a, // formmethod
- 0x13a: 0x3e805, // input
- 0x13c: 0x50b02, // h6
- 0x13d: 0xc902, // ol
- 0x13e: 0x3420b, // oncuechange
- 0x13f: 0x1e50d, // foreignobject
- 0x143: 0x4e70e, // onbeforeunload
- 0x144: 0x2bd05, // scope
- 0x145: 0x39609, // onemptied
- 0x146: 0x14b05, // defer
- 0x147: 0xc103, // xmp
- 0x148: 0x39f10, // ondurationchange
- 0x149: 0x1903, // kbd
- 0x14c: 0x47609, // onmessage
- 0x14d: 0x60006, // option
- 0x14e: 0x2eb09, // minlength
- 0x14f: 0x32807, // checked
- 0x150: 0xce08, // autoplay
- 0x152: 0x202, // br
- 0x153: 0x2360a, // novalidate
- 0x156: 0x6307, // noembed
- 0x159: 0x31007, // onclick
- 0x15a: 0x47f0b, // onmousedown
- 0x15b: 0x3a708, // onchange
- 0x15e: 0x3f209, // oninvalid
- 0x15f: 0x2bd06, // scoped
- 0x160: 0x18808, // controls
- 0x161: 0x30b05, // muted
- 0x162: 0x58d08, // sortable
- 0x163: 0x51106, // usemap
- 0x164: 0x1b80a, // figcaption
- 0x165: 0x35706, // ondrag
- 0x166: 0x26b04, // high
- 0x168: 0x3c303, // src
- 0x169: 0x15706, // poster
- 0x16b: 0x1670e, // annotation-xml
- 0x16c: 0x5f704, // step
- 0x16d: 0x4, // abbr
- 0x16e: 0x1b06, // dialog
- 0x170: 0x1202, // li
- 0x172: 0x3ed02, // mo
- 0x175: 0x1d803, // for
- 0x176: 0x1a803, // ins
- 0x178: 0x55504, // size
- 0x179: 0x43210, // onlanguagechange
- 0x17a: 0x8607, // default
- 0x17b: 0x1a03, // bdi
- 0x17c: 0x4d30a, // onpagehide
- 0x17d: 0x6907, // dirname
- 0x17e: 0x21404, // type
- 0x17f: 0x1f204, // form
- 0x181: 0x28509, // oncanplay
- 0x182: 0x6103, // dfn
- 0x183: 0x46308, // tabindex
- 0x186: 0x6502, // em
- 0x187: 0x27404, // lang
- 0x189: 0x39108, // dropzone
- 0x18a: 0x4080a, // onkeypress
- 0x18b: 0x23c08, // datetime
- 0x18c: 0x16204, // cols
- 0x18d: 0x1, // a
- 0x18e: 0x4420c, // onloadeddata
- 0x190: 0xa605, // audio
- 0x192: 0x2e05, // tbody
- 0x193: 0x22c06, // method
- 0x195: 0xf404, // loop
- 0x196: 0x29606, // iframe
- 0x198: 0x2d504, // head
- 0x19e: 0x5f108, // manifest
- 0x19f: 0xb309, // autofocus
- 0x1a0: 0x14904, // code
- 0x1a1: 0x55906, // strong
- 0x1a2: 0x30308, // multiple
- 0x1a3: 0xc05, // param
- 0x1a6: 0x21107, // enctype
- 0x1a7: 0x5b304, // face
- 0x1a8: 0xfd09, // plaintext
- 0x1a9: 0x26e02, // h1
- 0x1aa: 0x59509, // onstalled
- 0x1ad: 0x3d406, // script
- 0x1ae: 0x2db06, // spacer
- 0x1af: 0x55108, // onresize
- 0x1b0: 0x4a20b, // onmouseover
- 0x1b1: 0x5cc08, // onunload
- 0x1b2: 0x56708, // onseeked
- 0x1b4: 0x2140d, // typemustmatch
- 0x1b5: 0x1cc06, // figure
- 0x1b6: 0x4950a, // onmouseout
- 0x1b7: 0x25e03, // pre
- 0x1b8: 0x50705, // width
- 0x1b9: 0x19906, // sorted
- 0x1bb: 0x5704, // nobr
- 0x1be: 0x5302, // tt
- 0x1bf: 0x1105, // align
- 0x1c0: 0x3e607, // oninput
- 0x1c3: 0x41807, // onkeyup
- 0x1c6: 0x1c00c, // onafterprint
- 0x1c7: 0x210e, // accept-charset
- 0x1c8: 0x33c06, // itemid
- 0x1c9: 0x3e809, // inputmode
- 0x1cb: 0x53306, // strike
- 0x1cc: 0x5a903, // sub
- 0x1cd: 0x10505, // track
- 0x1ce: 0x38605, // start
- 0x1d0: 0xd608, // basefont
- 0x1d6: 0x1aa06, // source
- 0x1d7: 0x18206, // legend
- 0x1d8: 0x2d405, // thead
- 0x1da: 0x8c05, // tfoot
- 0x1dd: 0x1ec06, // object
- 0x1de: 0x6e05, // media
- 0x1df: 0x1670a, // annotation
- 0x1e0: 0x20d0b, // formenctype
- 0x1e2: 0x3d208, // noscript
- 0x1e4: 0x55505, // sizes
- 0x1e5: 0x1fc0c, // autocomplete
- 0x1e6: 0x9504, // span
- 0x1e7: 0x9808, // noframes
- 0x1e8: 0x24b06, // target
- 0x1e9: 0x38f06, // ondrop
- 0x1ea: 0x2b306, // applet
- 0x1ec: 0x5a08, // reversed
- 0x1f0: 0x2a907, // isindex
- 0x1f3: 0x27008, // hreflang
- 0x1f5: 0x2f302, // h5
- 0x1f6: 0x4f307, // address
- 0x1fa: 0x2e103, // max
- 0x1fb: 0xc30b, // placeholder
- 0x1fc: 0x2f608, // textarea
- 0x1fe: 0x4ad09, // onmouseup
- 0x1ff: 0x3800b, // ondragstart
-}
-
-const atomText = "abbradiogrouparamalignmarkbdialogaccept-charsetbodyaccesskey" +
- "genavaluealtdetailsampatternobreversedfnoembedirnamediagroup" +
- "ingasyncanvasidefaultfooterowspanoframesetitleaudionblurubya" +
- "utofocusandboxmplaceholderautoplaybasefontimeupdatebdoncance" +
- "labelooptgrouplaintextrackindisabledivarbgsoundlowbrbigblink" +
- "blockquotebuttonabortranslatecodefercolgroupostercolorcolspa" +
- "nnotation-xmlcommandraggablegendcontrolsmallcoordsortedcross" +
- "originsourcefieldsetfigcaptionafterprintfigurequiredforeignO" +
- "bjectforeignobjectformactionautocompleteerrorformenctypemust" +
- "matchallengeformmethodformnovalidatetimeterformtargetheightm" +
- "lhgroupreloadhiddenhigh1hreflanghttp-equivideoncanplaythroug" +
- "h2iframeimageimglyph3isindexismappletitemscopeditemtypemarqu" +
- "eematheaderspacermaxlength4minlength5mtextareadonlymultiplem" +
- "utedonclickoncloseamlesspellcheckedoncontextmenuitemidoncuec" +
- "hangeondblclickondragendondragenterondragleaveondragoverondr" +
- "agstarticleondropzonemptiedondurationchangeonendedonerroronf" +
- "ocusrcdocitempropenoscriptonhashchangeoninputmodeloninvalido" +
- "nkeydownloadonkeypressrclangonkeyupublicontenteditableonlang" +
- "uagechangeonloadeddatalistingonloadedmetadatabindexonloadsta" +
- "rtonmessageonmousedownonmousemoveonmouseoutputonmouseoveronm" +
- "ouseuponmousewheelonofflineononlineonpagehidesclassectionbef" +
- "oreunloaddresshapeonpageshowidth6onpausemaponplayingonpopsta" +
- "teonprogresstrikeytypeonratechangeonresetonresizestrongonscr" +
- "ollonseekedonseekingonselectedonshowraponsortableonstalledon" +
- "storageonsubmitemrefacenteronsuspendontoggleonunloadonvolume" +
- "changeonwaitingoptimumanifestepromptoptionbeforeprintstylesu" +
- "mmarysupsvgsystemplate"
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/const.go b/archived/event-adapter/vendor/golang.org/x/net/html/const.go
deleted file mode 100644
index 52f651ff6..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/const.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-// Section 12.2.3.2 of the HTML5 specification says "The following elements
-// have varying levels of special parsing rules".
-// https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements
-var isSpecialElementMap = map[string]bool{
- "address": true,
- "applet": true,
- "area": true,
- "article": true,
- "aside": true,
- "base": true,
- "basefont": true,
- "bgsound": true,
- "blockquote": true,
- "body": true,
- "br": true,
- "button": true,
- "caption": true,
- "center": true,
- "col": true,
- "colgroup": true,
- "dd": true,
- "details": true,
- "dir": true,
- "div": true,
- "dl": true,
- "dt": true,
- "embed": true,
- "fieldset": true,
- "figcaption": true,
- "figure": true,
- "footer": true,
- "form": true,
- "frame": true,
- "frameset": true,
- "h1": true,
- "h2": true,
- "h3": true,
- "h4": true,
- "h5": true,
- "h6": true,
- "head": true,
- "header": true,
- "hgroup": true,
- "hr": true,
- "html": true,
- "iframe": true,
- "img": true,
- "input": true,
- "isindex": true,
- "li": true,
- "link": true,
- "listing": true,
- "marquee": true,
- "menu": true,
- "meta": true,
- "nav": true,
- "noembed": true,
- "noframes": true,
- "noscript": true,
- "object": true,
- "ol": true,
- "p": true,
- "param": true,
- "plaintext": true,
- "pre": true,
- "script": true,
- "section": true,
- "select": true,
- "source": true,
- "style": true,
- "summary": true,
- "table": true,
- "tbody": true,
- "td": true,
- "template": true,
- "textarea": true,
- "tfoot": true,
- "th": true,
- "thead": true,
- "title": true,
- "tr": true,
- "track": true,
- "ul": true,
- "wbr": true,
- "xmp": true,
-}
-
-func isSpecialElement(element *Node) bool {
- switch element.Namespace {
- case "", "html":
- return isSpecialElementMap[element.Data]
- case "svg":
- return element.Data == "foreignObject"
- }
- return false
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/doc.go b/archived/event-adapter/vendor/golang.org/x/net/html/doc.go
deleted file mode 100644
index 94f496874..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/doc.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package html implements an HTML5-compliant tokenizer and parser.
-
-Tokenization is done by creating a Tokenizer for an io.Reader r. It is the
-caller's responsibility to ensure that r provides UTF-8 encoded HTML.
-
- z := html.NewTokenizer(r)
-
-Given a Tokenizer z, the HTML is tokenized by repeatedly calling z.Next(),
-which parses the next token and returns its type, or an error:
-
- for {
- tt := z.Next()
- if tt == html.ErrorToken {
- // ...
- return ...
- }
- // Process the current token.
- }
-
-There are two APIs for retrieving the current token. The high-level API is to
-call Token; the low-level API is to call Text or TagName / TagAttr. Both APIs
-allow optionally calling Raw after Next but before Token, Text, TagName, or
-TagAttr. In EBNF notation, the valid call sequence per token is:
-
- Next {Raw} [ Token | Text | TagName {TagAttr} ]
-
-Token returns an independent data structure that completely describes a token.
-Entities (such as "<") are unescaped, tag names and attribute keys are
-lower-cased, and attributes are collected into a []Attribute. For example:
-
- for {
- if z.Next() == html.ErrorToken {
- // Returning io.EOF indicates success.
- return z.Err()
- }
- emitToken(z.Token())
- }
-
-The low-level API performs fewer allocations and copies, but the contents of
-the []byte values returned by Text, TagName and TagAttr may change on the next
-call to Next. For example, to extract an HTML page's anchor text:
-
- depth := 0
- for {
- tt := z.Next()
- switch tt {
- case ErrorToken:
- return z.Err()
- case TextToken:
- if depth > 0 {
- // emitBytes should copy the []byte it receives,
- // if it doesn't process it immediately.
- emitBytes(z.Text())
- }
- case StartTagToken, EndTagToken:
- tn, _ := z.TagName()
- if len(tn) == 1 && tn[0] == 'a' {
- if tt == StartTagToken {
- depth++
- } else {
- depth--
- }
- }
- }
- }
-
-Parsing is done by calling Parse with an io.Reader, which returns the root of
-the parse tree (the document element) as a *Node. It is the caller's
-responsibility to ensure that the Reader provides UTF-8 encoded HTML. For
-example, to process each anchor node in depth-first order:
-
- doc, err := html.Parse(r)
- if err != nil {
- // ...
- }
- var f func(*html.Node)
- f = func(n *html.Node) {
- if n.Type == html.ElementNode && n.Data == "a" {
- // Do something with n...
- }
- for c := n.FirstChild; c != nil; c = c.NextSibling {
- f(c)
- }
- }
- f(doc)
-
-The relevant specifications include:
-https://html.spec.whatwg.org/multipage/syntax.html and
-https://html.spec.whatwg.org/multipage/syntax.html#tokenization
-*/
-package html // import "golang.org/x/net/html"
-
-// The tokenization algorithm implemented by this package is not a line-by-line
-// transliteration of the relatively verbose state-machine in the WHATWG
-// specification. A more direct approach is used instead, where the program
-// counter implies the state, such as whether it is tokenizing a tag or a text
-// node. Specification compliance is verified by checking expected and actual
-// outputs over a test suite rather than aiming for algorithmic fidelity.
-
-// TODO(nigeltao): Does a DOM API belong in this package or a separate one?
-// TODO(nigeltao): How does parsing interact with a JavaScript engine?
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/doctype.go b/archived/event-adapter/vendor/golang.org/x/net/html/doctype.go
deleted file mode 100644
index c484e5a94..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/doctype.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-import (
- "strings"
-)
-
-// parseDoctype parses the data from a DoctypeToken into a name,
-// public identifier, and system identifier. It returns a Node whose Type
-// is DoctypeNode, whose Data is the name, and which has attributes
-// named "system" and "public" for the two identifiers if they were present.
-// quirks is whether the document should be parsed in "quirks mode".
-func parseDoctype(s string) (n *Node, quirks bool) {
- n = &Node{Type: DoctypeNode}
-
- // Find the name.
- space := strings.IndexAny(s, whitespace)
- if space == -1 {
- space = len(s)
- }
- n.Data = s[:space]
- // The comparison to "html" is case-sensitive.
- if n.Data != "html" {
- quirks = true
- }
- n.Data = strings.ToLower(n.Data)
- s = strings.TrimLeft(s[space:], whitespace)
-
- if len(s) < 6 {
- // It can't start with "PUBLIC" or "SYSTEM".
- // Ignore the rest of the string.
- return n, quirks || s != ""
- }
-
- key := strings.ToLower(s[:6])
- s = s[6:]
- for key == "public" || key == "system" {
- s = strings.TrimLeft(s, whitespace)
- if s == "" {
- break
- }
- quote := s[0]
- if quote != '"' && quote != '\'' {
- break
- }
- s = s[1:]
- q := strings.IndexRune(s, rune(quote))
- var id string
- if q == -1 {
- id = s
- s = ""
- } else {
- id = s[:q]
- s = s[q+1:]
- }
- n.Attr = append(n.Attr, Attribute{Key: key, Val: id})
- if key == "public" {
- key = "system"
- } else {
- key = ""
- }
- }
-
- if key != "" || s != "" {
- quirks = true
- } else if len(n.Attr) > 0 {
- if n.Attr[0].Key == "public" {
- public := strings.ToLower(n.Attr[0].Val)
- switch public {
- case "-//w3o//dtd w3 html strict 3.0//en//", "-/w3d/dtd html 4.0 transitional/en", "html":
- quirks = true
- default:
- for _, q := range quirkyIDs {
- if strings.HasPrefix(public, q) {
- quirks = true
- break
- }
- }
- }
- // The following two public IDs only cause quirks mode if there is no system ID.
- if len(n.Attr) == 1 && (strings.HasPrefix(public, "-//w3c//dtd html 4.01 frameset//") ||
- strings.HasPrefix(public, "-//w3c//dtd html 4.01 transitional//")) {
- quirks = true
- }
- }
- if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
- strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {
- quirks = true
- }
- }
-
- return n, quirks
-}
-
-// quirkyIDs is a list of public doctype identifiers that cause a document
-// to be interpreted in quirks mode. The identifiers should be in lower case.
-var quirkyIDs = []string{
- "+//silmaril//dtd html pro v0r11 19970101//",
- "-//advasoft ltd//dtd html 3.0 aswedit + extensions//",
- "-//as//dtd html 3.0 aswedit + extensions//",
- "-//ietf//dtd html 2.0 level 1//",
- "-//ietf//dtd html 2.0 level 2//",
- "-//ietf//dtd html 2.0 strict level 1//",
- "-//ietf//dtd html 2.0 strict level 2//",
- "-//ietf//dtd html 2.0 strict//",
- "-//ietf//dtd html 2.0//",
- "-//ietf//dtd html 2.1e//",
- "-//ietf//dtd html 3.0//",
- "-//ietf//dtd html 3.2 final//",
- "-//ietf//dtd html 3.2//",
- "-//ietf//dtd html 3//",
- "-//ietf//dtd html level 0//",
- "-//ietf//dtd html level 1//",
- "-//ietf//dtd html level 2//",
- "-//ietf//dtd html level 3//",
- "-//ietf//dtd html strict level 0//",
- "-//ietf//dtd html strict level 1//",
- "-//ietf//dtd html strict level 2//",
- "-//ietf//dtd html strict level 3//",
- "-//ietf//dtd html strict//",
- "-//ietf//dtd html//",
- "-//metrius//dtd metrius presentational//",
- "-//microsoft//dtd internet explorer 2.0 html strict//",
- "-//microsoft//dtd internet explorer 2.0 html//",
- "-//microsoft//dtd internet explorer 2.0 tables//",
- "-//microsoft//dtd internet explorer 3.0 html strict//",
- "-//microsoft//dtd internet explorer 3.0 html//",
- "-//microsoft//dtd internet explorer 3.0 tables//",
- "-//netscape comm. corp.//dtd html//",
- "-//netscape comm. corp.//dtd strict html//",
- "-//o'reilly and associates//dtd html 2.0//",
- "-//o'reilly and associates//dtd html extended 1.0//",
- "-//o'reilly and associates//dtd html extended relaxed 1.0//",
- "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//",
- "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//",
- "-//spyglass//dtd html 2.0 extended//",
- "-//sq//dtd html 2.0 hotmetal + extensions//",
- "-//sun microsystems corp.//dtd hotjava html//",
- "-//sun microsystems corp.//dtd hotjava strict html//",
- "-//w3c//dtd html 3 1995-03-24//",
- "-//w3c//dtd html 3.2 draft//",
- "-//w3c//dtd html 3.2 final//",
- "-//w3c//dtd html 3.2//",
- "-//w3c//dtd html 3.2s draft//",
- "-//w3c//dtd html 4.0 frameset//",
- "-//w3c//dtd html 4.0 transitional//",
- "-//w3c//dtd html experimental 19960712//",
- "-//w3c//dtd html experimental 970421//",
- "-//w3c//dtd w3 html//",
- "-//w3o//dtd w3 html 3.0//",
- "-//webtechs//dtd mozilla html 2.0//",
- "-//webtechs//dtd mozilla html//",
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/entity.go b/archived/event-adapter/vendor/golang.org/x/net/html/entity.go
deleted file mode 100644
index a50c04c60..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/entity.go
+++ /dev/null
@@ -1,2253 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-// All entities that do not end with ';' are 6 or fewer bytes long.
-const longestEntityWithoutSemicolon = 6
-
-// entity is a map from HTML entity names to their values. The semicolon matters:
-// https://html.spec.whatwg.org/multipage/syntax.html#named-character-references
-// lists both "amp" and "amp;" as two separate entries.
-//
-// Note that the HTML5 list is larger than the HTML4 list at
-// http://www.w3.org/TR/html4/sgml/entities.html
-var entity = map[string]rune{
- "AElig;": '\U000000C6',
- "AMP;": '\U00000026',
- "Aacute;": '\U000000C1',
- "Abreve;": '\U00000102',
- "Acirc;": '\U000000C2',
- "Acy;": '\U00000410',
- "Afr;": '\U0001D504',
- "Agrave;": '\U000000C0',
- "Alpha;": '\U00000391',
- "Amacr;": '\U00000100',
- "And;": '\U00002A53',
- "Aogon;": '\U00000104',
- "Aopf;": '\U0001D538',
- "ApplyFunction;": '\U00002061',
- "Aring;": '\U000000C5',
- "Ascr;": '\U0001D49C',
- "Assign;": '\U00002254',
- "Atilde;": '\U000000C3',
- "Auml;": '\U000000C4',
- "Backslash;": '\U00002216',
- "Barv;": '\U00002AE7',
- "Barwed;": '\U00002306',
- "Bcy;": '\U00000411',
- "Because;": '\U00002235',
- "Bernoullis;": '\U0000212C',
- "Beta;": '\U00000392',
- "Bfr;": '\U0001D505',
- "Bopf;": '\U0001D539',
- "Breve;": '\U000002D8',
- "Bscr;": '\U0000212C',
- "Bumpeq;": '\U0000224E',
- "CHcy;": '\U00000427',
- "COPY;": '\U000000A9',
- "Cacute;": '\U00000106',
- "Cap;": '\U000022D2',
- "CapitalDifferentialD;": '\U00002145',
- "Cayleys;": '\U0000212D',
- "Ccaron;": '\U0000010C',
- "Ccedil;": '\U000000C7',
- "Ccirc;": '\U00000108',
- "Cconint;": '\U00002230',
- "Cdot;": '\U0000010A',
- "Cedilla;": '\U000000B8',
- "CenterDot;": '\U000000B7',
- "Cfr;": '\U0000212D',
- "Chi;": '\U000003A7',
- "CircleDot;": '\U00002299',
- "CircleMinus;": '\U00002296',
- "CirclePlus;": '\U00002295',
- "CircleTimes;": '\U00002297',
- "ClockwiseContourIntegral;": '\U00002232',
- "CloseCurlyDoubleQuote;": '\U0000201D',
- "CloseCurlyQuote;": '\U00002019',
- "Colon;": '\U00002237',
- "Colone;": '\U00002A74',
- "Congruent;": '\U00002261',
- "Conint;": '\U0000222F',
- "ContourIntegral;": '\U0000222E',
- "Copf;": '\U00002102',
- "Coproduct;": '\U00002210',
- "CounterClockwiseContourIntegral;": '\U00002233',
- "Cross;": '\U00002A2F',
- "Cscr;": '\U0001D49E',
- "Cup;": '\U000022D3',
- "CupCap;": '\U0000224D',
- "DD;": '\U00002145',
- "DDotrahd;": '\U00002911',
- "DJcy;": '\U00000402',
- "DScy;": '\U00000405',
- "DZcy;": '\U0000040F',
- "Dagger;": '\U00002021',
- "Darr;": '\U000021A1',
- "Dashv;": '\U00002AE4',
- "Dcaron;": '\U0000010E',
- "Dcy;": '\U00000414',
- "Del;": '\U00002207',
- "Delta;": '\U00000394',
- "Dfr;": '\U0001D507',
- "DiacriticalAcute;": '\U000000B4',
- "DiacriticalDot;": '\U000002D9',
- "DiacriticalDoubleAcute;": '\U000002DD',
- "DiacriticalGrave;": '\U00000060',
- "DiacriticalTilde;": '\U000002DC',
- "Diamond;": '\U000022C4',
- "DifferentialD;": '\U00002146',
- "Dopf;": '\U0001D53B',
- "Dot;": '\U000000A8',
- "DotDot;": '\U000020DC',
- "DotEqual;": '\U00002250',
- "DoubleContourIntegral;": '\U0000222F',
- "DoubleDot;": '\U000000A8',
- "DoubleDownArrow;": '\U000021D3',
- "DoubleLeftArrow;": '\U000021D0',
- "DoubleLeftRightArrow;": '\U000021D4',
- "DoubleLeftTee;": '\U00002AE4',
- "DoubleLongLeftArrow;": '\U000027F8',
- "DoubleLongLeftRightArrow;": '\U000027FA',
- "DoubleLongRightArrow;": '\U000027F9',
- "DoubleRightArrow;": '\U000021D2',
- "DoubleRightTee;": '\U000022A8',
- "DoubleUpArrow;": '\U000021D1',
- "DoubleUpDownArrow;": '\U000021D5',
- "DoubleVerticalBar;": '\U00002225',
- "DownArrow;": '\U00002193',
- "DownArrowBar;": '\U00002913',
- "DownArrowUpArrow;": '\U000021F5',
- "DownBreve;": '\U00000311',
- "DownLeftRightVector;": '\U00002950',
- "DownLeftTeeVector;": '\U0000295E',
- "DownLeftVector;": '\U000021BD',
- "DownLeftVectorBar;": '\U00002956',
- "DownRightTeeVector;": '\U0000295F',
- "DownRightVector;": '\U000021C1',
- "DownRightVectorBar;": '\U00002957',
- "DownTee;": '\U000022A4',
- "DownTeeArrow;": '\U000021A7',
- "Downarrow;": '\U000021D3',
- "Dscr;": '\U0001D49F',
- "Dstrok;": '\U00000110',
- "ENG;": '\U0000014A',
- "ETH;": '\U000000D0',
- "Eacute;": '\U000000C9',
- "Ecaron;": '\U0000011A',
- "Ecirc;": '\U000000CA',
- "Ecy;": '\U0000042D',
- "Edot;": '\U00000116',
- "Efr;": '\U0001D508',
- "Egrave;": '\U000000C8',
- "Element;": '\U00002208',
- "Emacr;": '\U00000112',
- "EmptySmallSquare;": '\U000025FB',
- "EmptyVerySmallSquare;": '\U000025AB',
- "Eogon;": '\U00000118',
- "Eopf;": '\U0001D53C',
- "Epsilon;": '\U00000395',
- "Equal;": '\U00002A75',
- "EqualTilde;": '\U00002242',
- "Equilibrium;": '\U000021CC',
- "Escr;": '\U00002130',
- "Esim;": '\U00002A73',
- "Eta;": '\U00000397',
- "Euml;": '\U000000CB',
- "Exists;": '\U00002203',
- "ExponentialE;": '\U00002147',
- "Fcy;": '\U00000424',
- "Ffr;": '\U0001D509',
- "FilledSmallSquare;": '\U000025FC',
- "FilledVerySmallSquare;": '\U000025AA',
- "Fopf;": '\U0001D53D',
- "ForAll;": '\U00002200',
- "Fouriertrf;": '\U00002131',
- "Fscr;": '\U00002131',
- "GJcy;": '\U00000403',
- "GT;": '\U0000003E',
- "Gamma;": '\U00000393',
- "Gammad;": '\U000003DC',
- "Gbreve;": '\U0000011E',
- "Gcedil;": '\U00000122',
- "Gcirc;": '\U0000011C',
- "Gcy;": '\U00000413',
- "Gdot;": '\U00000120',
- "Gfr;": '\U0001D50A',
- "Gg;": '\U000022D9',
- "Gopf;": '\U0001D53E',
- "GreaterEqual;": '\U00002265',
- "GreaterEqualLess;": '\U000022DB',
- "GreaterFullEqual;": '\U00002267',
- "GreaterGreater;": '\U00002AA2',
- "GreaterLess;": '\U00002277',
- "GreaterSlantEqual;": '\U00002A7E',
- "GreaterTilde;": '\U00002273',
- "Gscr;": '\U0001D4A2',
- "Gt;": '\U0000226B',
- "HARDcy;": '\U0000042A',
- "Hacek;": '\U000002C7',
- "Hat;": '\U0000005E',
- "Hcirc;": '\U00000124',
- "Hfr;": '\U0000210C',
- "HilbertSpace;": '\U0000210B',
- "Hopf;": '\U0000210D',
- "HorizontalLine;": '\U00002500',
- "Hscr;": '\U0000210B',
- "Hstrok;": '\U00000126',
- "HumpDownHump;": '\U0000224E',
- "HumpEqual;": '\U0000224F',
- "IEcy;": '\U00000415',
- "IJlig;": '\U00000132',
- "IOcy;": '\U00000401',
- "Iacute;": '\U000000CD',
- "Icirc;": '\U000000CE',
- "Icy;": '\U00000418',
- "Idot;": '\U00000130',
- "Ifr;": '\U00002111',
- "Igrave;": '\U000000CC',
- "Im;": '\U00002111',
- "Imacr;": '\U0000012A',
- "ImaginaryI;": '\U00002148',
- "Implies;": '\U000021D2',
- "Int;": '\U0000222C',
- "Integral;": '\U0000222B',
- "Intersection;": '\U000022C2',
- "InvisibleComma;": '\U00002063',
- "InvisibleTimes;": '\U00002062',
- "Iogon;": '\U0000012E',
- "Iopf;": '\U0001D540',
- "Iota;": '\U00000399',
- "Iscr;": '\U00002110',
- "Itilde;": '\U00000128',
- "Iukcy;": '\U00000406',
- "Iuml;": '\U000000CF',
- "Jcirc;": '\U00000134',
- "Jcy;": '\U00000419',
- "Jfr;": '\U0001D50D',
- "Jopf;": '\U0001D541',
- "Jscr;": '\U0001D4A5',
- "Jsercy;": '\U00000408',
- "Jukcy;": '\U00000404',
- "KHcy;": '\U00000425',
- "KJcy;": '\U0000040C',
- "Kappa;": '\U0000039A',
- "Kcedil;": '\U00000136',
- "Kcy;": '\U0000041A',
- "Kfr;": '\U0001D50E',
- "Kopf;": '\U0001D542',
- "Kscr;": '\U0001D4A6',
- "LJcy;": '\U00000409',
- "LT;": '\U0000003C',
- "Lacute;": '\U00000139',
- "Lambda;": '\U0000039B',
- "Lang;": '\U000027EA',
- "Laplacetrf;": '\U00002112',
- "Larr;": '\U0000219E',
- "Lcaron;": '\U0000013D',
- "Lcedil;": '\U0000013B',
- "Lcy;": '\U0000041B',
- "LeftAngleBracket;": '\U000027E8',
- "LeftArrow;": '\U00002190',
- "LeftArrowBar;": '\U000021E4',
- "LeftArrowRightArrow;": '\U000021C6',
- "LeftCeiling;": '\U00002308',
- "LeftDoubleBracket;": '\U000027E6',
- "LeftDownTeeVector;": '\U00002961',
- "LeftDownVector;": '\U000021C3',
- "LeftDownVectorBar;": '\U00002959',
- "LeftFloor;": '\U0000230A',
- "LeftRightArrow;": '\U00002194',
- "LeftRightVector;": '\U0000294E',
- "LeftTee;": '\U000022A3',
- "LeftTeeArrow;": '\U000021A4',
- "LeftTeeVector;": '\U0000295A',
- "LeftTriangle;": '\U000022B2',
- "LeftTriangleBar;": '\U000029CF',
- "LeftTriangleEqual;": '\U000022B4',
- "LeftUpDownVector;": '\U00002951',
- "LeftUpTeeVector;": '\U00002960',
- "LeftUpVector;": '\U000021BF',
- "LeftUpVectorBar;": '\U00002958',
- "LeftVector;": '\U000021BC',
- "LeftVectorBar;": '\U00002952',
- "Leftarrow;": '\U000021D0',
- "Leftrightarrow;": '\U000021D4',
- "LessEqualGreater;": '\U000022DA',
- "LessFullEqual;": '\U00002266',
- "LessGreater;": '\U00002276',
- "LessLess;": '\U00002AA1',
- "LessSlantEqual;": '\U00002A7D',
- "LessTilde;": '\U00002272',
- "Lfr;": '\U0001D50F',
- "Ll;": '\U000022D8',
- "Lleftarrow;": '\U000021DA',
- "Lmidot;": '\U0000013F',
- "LongLeftArrow;": '\U000027F5',
- "LongLeftRightArrow;": '\U000027F7',
- "LongRightArrow;": '\U000027F6',
- "Longleftarrow;": '\U000027F8',
- "Longleftrightarrow;": '\U000027FA',
- "Longrightarrow;": '\U000027F9',
- "Lopf;": '\U0001D543',
- "LowerLeftArrow;": '\U00002199',
- "LowerRightArrow;": '\U00002198',
- "Lscr;": '\U00002112',
- "Lsh;": '\U000021B0',
- "Lstrok;": '\U00000141',
- "Lt;": '\U0000226A',
- "Map;": '\U00002905',
- "Mcy;": '\U0000041C',
- "MediumSpace;": '\U0000205F',
- "Mellintrf;": '\U00002133',
- "Mfr;": '\U0001D510',
- "MinusPlus;": '\U00002213',
- "Mopf;": '\U0001D544',
- "Mscr;": '\U00002133',
- "Mu;": '\U0000039C',
- "NJcy;": '\U0000040A',
- "Nacute;": '\U00000143',
- "Ncaron;": '\U00000147',
- "Ncedil;": '\U00000145',
- "Ncy;": '\U0000041D',
- "NegativeMediumSpace;": '\U0000200B',
- "NegativeThickSpace;": '\U0000200B',
- "NegativeThinSpace;": '\U0000200B',
- "NegativeVeryThinSpace;": '\U0000200B',
- "NestedGreaterGreater;": '\U0000226B',
- "NestedLessLess;": '\U0000226A',
- "NewLine;": '\U0000000A',
- "Nfr;": '\U0001D511',
- "NoBreak;": '\U00002060',
- "NonBreakingSpace;": '\U000000A0',
- "Nopf;": '\U00002115',
- "Not;": '\U00002AEC',
- "NotCongruent;": '\U00002262',
- "NotCupCap;": '\U0000226D',
- "NotDoubleVerticalBar;": '\U00002226',
- "NotElement;": '\U00002209',
- "NotEqual;": '\U00002260',
- "NotExists;": '\U00002204',
- "NotGreater;": '\U0000226F',
- "NotGreaterEqual;": '\U00002271',
- "NotGreaterLess;": '\U00002279',
- "NotGreaterTilde;": '\U00002275',
- "NotLeftTriangle;": '\U000022EA',
- "NotLeftTriangleEqual;": '\U000022EC',
- "NotLess;": '\U0000226E',
- "NotLessEqual;": '\U00002270',
- "NotLessGreater;": '\U00002278',
- "NotLessTilde;": '\U00002274',
- "NotPrecedes;": '\U00002280',
- "NotPrecedesSlantEqual;": '\U000022E0',
- "NotReverseElement;": '\U0000220C',
- "NotRightTriangle;": '\U000022EB',
- "NotRightTriangleEqual;": '\U000022ED',
- "NotSquareSubsetEqual;": '\U000022E2',
- "NotSquareSupersetEqual;": '\U000022E3',
- "NotSubsetEqual;": '\U00002288',
- "NotSucceeds;": '\U00002281',
- "NotSucceedsSlantEqual;": '\U000022E1',
- "NotSupersetEqual;": '\U00002289',
- "NotTilde;": '\U00002241',
- "NotTildeEqual;": '\U00002244',
- "NotTildeFullEqual;": '\U00002247',
- "NotTildeTilde;": '\U00002249',
- "NotVerticalBar;": '\U00002224',
- "Nscr;": '\U0001D4A9',
- "Ntilde;": '\U000000D1',
- "Nu;": '\U0000039D',
- "OElig;": '\U00000152',
- "Oacute;": '\U000000D3',
- "Ocirc;": '\U000000D4',
- "Ocy;": '\U0000041E',
- "Odblac;": '\U00000150',
- "Ofr;": '\U0001D512',
- "Ograve;": '\U000000D2',
- "Omacr;": '\U0000014C',
- "Omega;": '\U000003A9',
- "Omicron;": '\U0000039F',
- "Oopf;": '\U0001D546',
- "OpenCurlyDoubleQuote;": '\U0000201C',
- "OpenCurlyQuote;": '\U00002018',
- "Or;": '\U00002A54',
- "Oscr;": '\U0001D4AA',
- "Oslash;": '\U000000D8',
- "Otilde;": '\U000000D5',
- "Otimes;": '\U00002A37',
- "Ouml;": '\U000000D6',
- "OverBar;": '\U0000203E',
- "OverBrace;": '\U000023DE',
- "OverBracket;": '\U000023B4',
- "OverParenthesis;": '\U000023DC',
- "PartialD;": '\U00002202',
- "Pcy;": '\U0000041F',
- "Pfr;": '\U0001D513',
- "Phi;": '\U000003A6',
- "Pi;": '\U000003A0',
- "PlusMinus;": '\U000000B1',
- "Poincareplane;": '\U0000210C',
- "Popf;": '\U00002119',
- "Pr;": '\U00002ABB',
- "Precedes;": '\U0000227A',
- "PrecedesEqual;": '\U00002AAF',
- "PrecedesSlantEqual;": '\U0000227C',
- "PrecedesTilde;": '\U0000227E',
- "Prime;": '\U00002033',
- "Product;": '\U0000220F',
- "Proportion;": '\U00002237',
- "Proportional;": '\U0000221D',
- "Pscr;": '\U0001D4AB',
- "Psi;": '\U000003A8',
- "QUOT;": '\U00000022',
- "Qfr;": '\U0001D514',
- "Qopf;": '\U0000211A',
- "Qscr;": '\U0001D4AC',
- "RBarr;": '\U00002910',
- "REG;": '\U000000AE',
- "Racute;": '\U00000154',
- "Rang;": '\U000027EB',
- "Rarr;": '\U000021A0',
- "Rarrtl;": '\U00002916',
- "Rcaron;": '\U00000158',
- "Rcedil;": '\U00000156',
- "Rcy;": '\U00000420',
- "Re;": '\U0000211C',
- "ReverseElement;": '\U0000220B',
- "ReverseEquilibrium;": '\U000021CB',
- "ReverseUpEquilibrium;": '\U0000296F',
- "Rfr;": '\U0000211C',
- "Rho;": '\U000003A1',
- "RightAngleBracket;": '\U000027E9',
- "RightArrow;": '\U00002192',
- "RightArrowBar;": '\U000021E5',
- "RightArrowLeftArrow;": '\U000021C4',
- "RightCeiling;": '\U00002309',
- "RightDoubleBracket;": '\U000027E7',
- "RightDownTeeVector;": '\U0000295D',
- "RightDownVector;": '\U000021C2',
- "RightDownVectorBar;": '\U00002955',
- "RightFloor;": '\U0000230B',
- "RightTee;": '\U000022A2',
- "RightTeeArrow;": '\U000021A6',
- "RightTeeVector;": '\U0000295B',
- "RightTriangle;": '\U000022B3',
- "RightTriangleBar;": '\U000029D0',
- "RightTriangleEqual;": '\U000022B5',
- "RightUpDownVector;": '\U0000294F',
- "RightUpTeeVector;": '\U0000295C',
- "RightUpVector;": '\U000021BE',
- "RightUpVectorBar;": '\U00002954',
- "RightVector;": '\U000021C0',
- "RightVectorBar;": '\U00002953',
- "Rightarrow;": '\U000021D2',
- "Ropf;": '\U0000211D',
- "RoundImplies;": '\U00002970',
- "Rrightarrow;": '\U000021DB',
- "Rscr;": '\U0000211B',
- "Rsh;": '\U000021B1',
- "RuleDelayed;": '\U000029F4',
- "SHCHcy;": '\U00000429',
- "SHcy;": '\U00000428',
- "SOFTcy;": '\U0000042C',
- "Sacute;": '\U0000015A',
- "Sc;": '\U00002ABC',
- "Scaron;": '\U00000160',
- "Scedil;": '\U0000015E',
- "Scirc;": '\U0000015C',
- "Scy;": '\U00000421',
- "Sfr;": '\U0001D516',
- "ShortDownArrow;": '\U00002193',
- "ShortLeftArrow;": '\U00002190',
- "ShortRightArrow;": '\U00002192',
- "ShortUpArrow;": '\U00002191',
- "Sigma;": '\U000003A3',
- "SmallCircle;": '\U00002218',
- "Sopf;": '\U0001D54A',
- "Sqrt;": '\U0000221A',
- "Square;": '\U000025A1',
- "SquareIntersection;": '\U00002293',
- "SquareSubset;": '\U0000228F',
- "SquareSubsetEqual;": '\U00002291',
- "SquareSuperset;": '\U00002290',
- "SquareSupersetEqual;": '\U00002292',
- "SquareUnion;": '\U00002294',
- "Sscr;": '\U0001D4AE',
- "Star;": '\U000022C6',
- "Sub;": '\U000022D0',
- "Subset;": '\U000022D0',
- "SubsetEqual;": '\U00002286',
- "Succeeds;": '\U0000227B',
- "SucceedsEqual;": '\U00002AB0',
- "SucceedsSlantEqual;": '\U0000227D',
- "SucceedsTilde;": '\U0000227F',
- "SuchThat;": '\U0000220B',
- "Sum;": '\U00002211',
- "Sup;": '\U000022D1',
- "Superset;": '\U00002283',
- "SupersetEqual;": '\U00002287',
- "Supset;": '\U000022D1',
- "THORN;": '\U000000DE',
- "TRADE;": '\U00002122',
- "TSHcy;": '\U0000040B',
- "TScy;": '\U00000426',
- "Tab;": '\U00000009',
- "Tau;": '\U000003A4',
- "Tcaron;": '\U00000164',
- "Tcedil;": '\U00000162',
- "Tcy;": '\U00000422',
- "Tfr;": '\U0001D517',
- "Therefore;": '\U00002234',
- "Theta;": '\U00000398',
- "ThinSpace;": '\U00002009',
- "Tilde;": '\U0000223C',
- "TildeEqual;": '\U00002243',
- "TildeFullEqual;": '\U00002245',
- "TildeTilde;": '\U00002248',
- "Topf;": '\U0001D54B',
- "TripleDot;": '\U000020DB',
- "Tscr;": '\U0001D4AF',
- "Tstrok;": '\U00000166',
- "Uacute;": '\U000000DA',
- "Uarr;": '\U0000219F',
- "Uarrocir;": '\U00002949',
- "Ubrcy;": '\U0000040E',
- "Ubreve;": '\U0000016C',
- "Ucirc;": '\U000000DB',
- "Ucy;": '\U00000423',
- "Udblac;": '\U00000170',
- "Ufr;": '\U0001D518',
- "Ugrave;": '\U000000D9',
- "Umacr;": '\U0000016A',
- "UnderBar;": '\U0000005F',
- "UnderBrace;": '\U000023DF',
- "UnderBracket;": '\U000023B5',
- "UnderParenthesis;": '\U000023DD',
- "Union;": '\U000022C3',
- "UnionPlus;": '\U0000228E',
- "Uogon;": '\U00000172',
- "Uopf;": '\U0001D54C',
- "UpArrow;": '\U00002191',
- "UpArrowBar;": '\U00002912',
- "UpArrowDownArrow;": '\U000021C5',
- "UpDownArrow;": '\U00002195',
- "UpEquilibrium;": '\U0000296E',
- "UpTee;": '\U000022A5',
- "UpTeeArrow;": '\U000021A5',
- "Uparrow;": '\U000021D1',
- "Updownarrow;": '\U000021D5',
- "UpperLeftArrow;": '\U00002196',
- "UpperRightArrow;": '\U00002197',
- "Upsi;": '\U000003D2',
- "Upsilon;": '\U000003A5',
- "Uring;": '\U0000016E',
- "Uscr;": '\U0001D4B0',
- "Utilde;": '\U00000168',
- "Uuml;": '\U000000DC',
- "VDash;": '\U000022AB',
- "Vbar;": '\U00002AEB',
- "Vcy;": '\U00000412',
- "Vdash;": '\U000022A9',
- "Vdashl;": '\U00002AE6',
- "Vee;": '\U000022C1',
- "Verbar;": '\U00002016',
- "Vert;": '\U00002016',
- "VerticalBar;": '\U00002223',
- "VerticalLine;": '\U0000007C',
- "VerticalSeparator;": '\U00002758',
- "VerticalTilde;": '\U00002240',
- "VeryThinSpace;": '\U0000200A',
- "Vfr;": '\U0001D519',
- "Vopf;": '\U0001D54D',
- "Vscr;": '\U0001D4B1',
- "Vvdash;": '\U000022AA',
- "Wcirc;": '\U00000174',
- "Wedge;": '\U000022C0',
- "Wfr;": '\U0001D51A',
- "Wopf;": '\U0001D54E',
- "Wscr;": '\U0001D4B2',
- "Xfr;": '\U0001D51B',
- "Xi;": '\U0000039E',
- "Xopf;": '\U0001D54F',
- "Xscr;": '\U0001D4B3',
- "YAcy;": '\U0000042F',
- "YIcy;": '\U00000407',
- "YUcy;": '\U0000042E',
- "Yacute;": '\U000000DD',
- "Ycirc;": '\U00000176',
- "Ycy;": '\U0000042B',
- "Yfr;": '\U0001D51C',
- "Yopf;": '\U0001D550',
- "Yscr;": '\U0001D4B4',
- "Yuml;": '\U00000178',
- "ZHcy;": '\U00000416',
- "Zacute;": '\U00000179',
- "Zcaron;": '\U0000017D',
- "Zcy;": '\U00000417',
- "Zdot;": '\U0000017B',
- "ZeroWidthSpace;": '\U0000200B',
- "Zeta;": '\U00000396',
- "Zfr;": '\U00002128',
- "Zopf;": '\U00002124',
- "Zscr;": '\U0001D4B5',
- "aacute;": '\U000000E1',
- "abreve;": '\U00000103',
- "ac;": '\U0000223E',
- "acd;": '\U0000223F',
- "acirc;": '\U000000E2',
- "acute;": '\U000000B4',
- "acy;": '\U00000430',
- "aelig;": '\U000000E6',
- "af;": '\U00002061',
- "afr;": '\U0001D51E',
- "agrave;": '\U000000E0',
- "alefsym;": '\U00002135',
- "aleph;": '\U00002135',
- "alpha;": '\U000003B1',
- "amacr;": '\U00000101',
- "amalg;": '\U00002A3F',
- "amp;": '\U00000026',
- "and;": '\U00002227',
- "andand;": '\U00002A55',
- "andd;": '\U00002A5C',
- "andslope;": '\U00002A58',
- "andv;": '\U00002A5A',
- "ang;": '\U00002220',
- "ange;": '\U000029A4',
- "angle;": '\U00002220',
- "angmsd;": '\U00002221',
- "angmsdaa;": '\U000029A8',
- "angmsdab;": '\U000029A9',
- "angmsdac;": '\U000029AA',
- "angmsdad;": '\U000029AB',
- "angmsdae;": '\U000029AC',
- "angmsdaf;": '\U000029AD',
- "angmsdag;": '\U000029AE',
- "angmsdah;": '\U000029AF',
- "angrt;": '\U0000221F',
- "angrtvb;": '\U000022BE',
- "angrtvbd;": '\U0000299D',
- "angsph;": '\U00002222',
- "angst;": '\U000000C5',
- "angzarr;": '\U0000237C',
- "aogon;": '\U00000105',
- "aopf;": '\U0001D552',
- "ap;": '\U00002248',
- "apE;": '\U00002A70',
- "apacir;": '\U00002A6F',
- "ape;": '\U0000224A',
- "apid;": '\U0000224B',
- "apos;": '\U00000027',
- "approx;": '\U00002248',
- "approxeq;": '\U0000224A',
- "aring;": '\U000000E5',
- "ascr;": '\U0001D4B6',
- "ast;": '\U0000002A',
- "asymp;": '\U00002248',
- "asympeq;": '\U0000224D',
- "atilde;": '\U000000E3',
- "auml;": '\U000000E4',
- "awconint;": '\U00002233',
- "awint;": '\U00002A11',
- "bNot;": '\U00002AED',
- "backcong;": '\U0000224C',
- "backepsilon;": '\U000003F6',
- "backprime;": '\U00002035',
- "backsim;": '\U0000223D',
- "backsimeq;": '\U000022CD',
- "barvee;": '\U000022BD',
- "barwed;": '\U00002305',
- "barwedge;": '\U00002305',
- "bbrk;": '\U000023B5',
- "bbrktbrk;": '\U000023B6',
- "bcong;": '\U0000224C',
- "bcy;": '\U00000431',
- "bdquo;": '\U0000201E',
- "becaus;": '\U00002235',
- "because;": '\U00002235',
- "bemptyv;": '\U000029B0',
- "bepsi;": '\U000003F6',
- "bernou;": '\U0000212C',
- "beta;": '\U000003B2',
- "beth;": '\U00002136',
- "between;": '\U0000226C',
- "bfr;": '\U0001D51F',
- "bigcap;": '\U000022C2',
- "bigcirc;": '\U000025EF',
- "bigcup;": '\U000022C3',
- "bigodot;": '\U00002A00',
- "bigoplus;": '\U00002A01',
- "bigotimes;": '\U00002A02',
- "bigsqcup;": '\U00002A06',
- "bigstar;": '\U00002605',
- "bigtriangledown;": '\U000025BD',
- "bigtriangleup;": '\U000025B3',
- "biguplus;": '\U00002A04',
- "bigvee;": '\U000022C1',
- "bigwedge;": '\U000022C0',
- "bkarow;": '\U0000290D',
- "blacklozenge;": '\U000029EB',
- "blacksquare;": '\U000025AA',
- "blacktriangle;": '\U000025B4',
- "blacktriangledown;": '\U000025BE',
- "blacktriangleleft;": '\U000025C2',
- "blacktriangleright;": '\U000025B8',
- "blank;": '\U00002423',
- "blk12;": '\U00002592',
- "blk14;": '\U00002591',
- "blk34;": '\U00002593',
- "block;": '\U00002588',
- "bnot;": '\U00002310',
- "bopf;": '\U0001D553',
- "bot;": '\U000022A5',
- "bottom;": '\U000022A5',
- "bowtie;": '\U000022C8',
- "boxDL;": '\U00002557',
- "boxDR;": '\U00002554',
- "boxDl;": '\U00002556',
- "boxDr;": '\U00002553',
- "boxH;": '\U00002550',
- "boxHD;": '\U00002566',
- "boxHU;": '\U00002569',
- "boxHd;": '\U00002564',
- "boxHu;": '\U00002567',
- "boxUL;": '\U0000255D',
- "boxUR;": '\U0000255A',
- "boxUl;": '\U0000255C',
- "boxUr;": '\U00002559',
- "boxV;": '\U00002551',
- "boxVH;": '\U0000256C',
- "boxVL;": '\U00002563',
- "boxVR;": '\U00002560',
- "boxVh;": '\U0000256B',
- "boxVl;": '\U00002562',
- "boxVr;": '\U0000255F',
- "boxbox;": '\U000029C9',
- "boxdL;": '\U00002555',
- "boxdR;": '\U00002552',
- "boxdl;": '\U00002510',
- "boxdr;": '\U0000250C',
- "boxh;": '\U00002500',
- "boxhD;": '\U00002565',
- "boxhU;": '\U00002568',
- "boxhd;": '\U0000252C',
- "boxhu;": '\U00002534',
- "boxminus;": '\U0000229F',
- "boxplus;": '\U0000229E',
- "boxtimes;": '\U000022A0',
- "boxuL;": '\U0000255B',
- "boxuR;": '\U00002558',
- "boxul;": '\U00002518',
- "boxur;": '\U00002514',
- "boxv;": '\U00002502',
- "boxvH;": '\U0000256A',
- "boxvL;": '\U00002561',
- "boxvR;": '\U0000255E',
- "boxvh;": '\U0000253C',
- "boxvl;": '\U00002524',
- "boxvr;": '\U0000251C',
- "bprime;": '\U00002035',
- "breve;": '\U000002D8',
- "brvbar;": '\U000000A6',
- "bscr;": '\U0001D4B7',
- "bsemi;": '\U0000204F',
- "bsim;": '\U0000223D',
- "bsime;": '\U000022CD',
- "bsol;": '\U0000005C',
- "bsolb;": '\U000029C5',
- "bsolhsub;": '\U000027C8',
- "bull;": '\U00002022',
- "bullet;": '\U00002022',
- "bump;": '\U0000224E',
- "bumpE;": '\U00002AAE',
- "bumpe;": '\U0000224F',
- "bumpeq;": '\U0000224F',
- "cacute;": '\U00000107',
- "cap;": '\U00002229',
- "capand;": '\U00002A44',
- "capbrcup;": '\U00002A49',
- "capcap;": '\U00002A4B',
- "capcup;": '\U00002A47',
- "capdot;": '\U00002A40',
- "caret;": '\U00002041',
- "caron;": '\U000002C7',
- "ccaps;": '\U00002A4D',
- "ccaron;": '\U0000010D',
- "ccedil;": '\U000000E7',
- "ccirc;": '\U00000109',
- "ccups;": '\U00002A4C',
- "ccupssm;": '\U00002A50',
- "cdot;": '\U0000010B',
- "cedil;": '\U000000B8',
- "cemptyv;": '\U000029B2',
- "cent;": '\U000000A2',
- "centerdot;": '\U000000B7',
- "cfr;": '\U0001D520',
- "chcy;": '\U00000447',
- "check;": '\U00002713',
- "checkmark;": '\U00002713',
- "chi;": '\U000003C7',
- "cir;": '\U000025CB',
- "cirE;": '\U000029C3',
- "circ;": '\U000002C6',
- "circeq;": '\U00002257',
- "circlearrowleft;": '\U000021BA',
- "circlearrowright;": '\U000021BB',
- "circledR;": '\U000000AE',
- "circledS;": '\U000024C8',
- "circledast;": '\U0000229B',
- "circledcirc;": '\U0000229A',
- "circleddash;": '\U0000229D',
- "cire;": '\U00002257',
- "cirfnint;": '\U00002A10',
- "cirmid;": '\U00002AEF',
- "cirscir;": '\U000029C2',
- "clubs;": '\U00002663',
- "clubsuit;": '\U00002663',
- "colon;": '\U0000003A',
- "colone;": '\U00002254',
- "coloneq;": '\U00002254',
- "comma;": '\U0000002C',
- "commat;": '\U00000040',
- "comp;": '\U00002201',
- "compfn;": '\U00002218',
- "complement;": '\U00002201',
- "complexes;": '\U00002102',
- "cong;": '\U00002245',
- "congdot;": '\U00002A6D',
- "conint;": '\U0000222E',
- "copf;": '\U0001D554',
- "coprod;": '\U00002210',
- "copy;": '\U000000A9',
- "copysr;": '\U00002117',
- "crarr;": '\U000021B5',
- "cross;": '\U00002717',
- "cscr;": '\U0001D4B8',
- "csub;": '\U00002ACF',
- "csube;": '\U00002AD1',
- "csup;": '\U00002AD0',
- "csupe;": '\U00002AD2',
- "ctdot;": '\U000022EF',
- "cudarrl;": '\U00002938',
- "cudarrr;": '\U00002935',
- "cuepr;": '\U000022DE',
- "cuesc;": '\U000022DF',
- "cularr;": '\U000021B6',
- "cularrp;": '\U0000293D',
- "cup;": '\U0000222A',
- "cupbrcap;": '\U00002A48',
- "cupcap;": '\U00002A46',
- "cupcup;": '\U00002A4A',
- "cupdot;": '\U0000228D',
- "cupor;": '\U00002A45',
- "curarr;": '\U000021B7',
- "curarrm;": '\U0000293C',
- "curlyeqprec;": '\U000022DE',
- "curlyeqsucc;": '\U000022DF',
- "curlyvee;": '\U000022CE',
- "curlywedge;": '\U000022CF',
- "curren;": '\U000000A4',
- "curvearrowleft;": '\U000021B6',
- "curvearrowright;": '\U000021B7',
- "cuvee;": '\U000022CE',
- "cuwed;": '\U000022CF',
- "cwconint;": '\U00002232',
- "cwint;": '\U00002231',
- "cylcty;": '\U0000232D',
- "dArr;": '\U000021D3',
- "dHar;": '\U00002965',
- "dagger;": '\U00002020',
- "daleth;": '\U00002138',
- "darr;": '\U00002193',
- "dash;": '\U00002010',
- "dashv;": '\U000022A3',
- "dbkarow;": '\U0000290F',
- "dblac;": '\U000002DD',
- "dcaron;": '\U0000010F',
- "dcy;": '\U00000434',
- "dd;": '\U00002146',
- "ddagger;": '\U00002021',
- "ddarr;": '\U000021CA',
- "ddotseq;": '\U00002A77',
- "deg;": '\U000000B0',
- "delta;": '\U000003B4',
- "demptyv;": '\U000029B1',
- "dfisht;": '\U0000297F',
- "dfr;": '\U0001D521',
- "dharl;": '\U000021C3',
- "dharr;": '\U000021C2',
- "diam;": '\U000022C4',
- "diamond;": '\U000022C4',
- "diamondsuit;": '\U00002666',
- "diams;": '\U00002666',
- "die;": '\U000000A8',
- "digamma;": '\U000003DD',
- "disin;": '\U000022F2',
- "div;": '\U000000F7',
- "divide;": '\U000000F7',
- "divideontimes;": '\U000022C7',
- "divonx;": '\U000022C7',
- "djcy;": '\U00000452',
- "dlcorn;": '\U0000231E',
- "dlcrop;": '\U0000230D',
- "dollar;": '\U00000024',
- "dopf;": '\U0001D555',
- "dot;": '\U000002D9',
- "doteq;": '\U00002250',
- "doteqdot;": '\U00002251',
- "dotminus;": '\U00002238',
- "dotplus;": '\U00002214',
- "dotsquare;": '\U000022A1',
- "doublebarwedge;": '\U00002306',
- "downarrow;": '\U00002193',
- "downdownarrows;": '\U000021CA',
- "downharpoonleft;": '\U000021C3',
- "downharpoonright;": '\U000021C2',
- "drbkarow;": '\U00002910',
- "drcorn;": '\U0000231F',
- "drcrop;": '\U0000230C',
- "dscr;": '\U0001D4B9',
- "dscy;": '\U00000455',
- "dsol;": '\U000029F6',
- "dstrok;": '\U00000111',
- "dtdot;": '\U000022F1',
- "dtri;": '\U000025BF',
- "dtrif;": '\U000025BE',
- "duarr;": '\U000021F5',
- "duhar;": '\U0000296F',
- "dwangle;": '\U000029A6',
- "dzcy;": '\U0000045F',
- "dzigrarr;": '\U000027FF',
- "eDDot;": '\U00002A77',
- "eDot;": '\U00002251',
- "eacute;": '\U000000E9',
- "easter;": '\U00002A6E',
- "ecaron;": '\U0000011B',
- "ecir;": '\U00002256',
- "ecirc;": '\U000000EA',
- "ecolon;": '\U00002255',
- "ecy;": '\U0000044D',
- "edot;": '\U00000117',
- "ee;": '\U00002147',
- "efDot;": '\U00002252',
- "efr;": '\U0001D522',
- "eg;": '\U00002A9A',
- "egrave;": '\U000000E8',
- "egs;": '\U00002A96',
- "egsdot;": '\U00002A98',
- "el;": '\U00002A99',
- "elinters;": '\U000023E7',
- "ell;": '\U00002113',
- "els;": '\U00002A95',
- "elsdot;": '\U00002A97',
- "emacr;": '\U00000113',
- "empty;": '\U00002205',
- "emptyset;": '\U00002205',
- "emptyv;": '\U00002205',
- "emsp;": '\U00002003',
- "emsp13;": '\U00002004',
- "emsp14;": '\U00002005',
- "eng;": '\U0000014B',
- "ensp;": '\U00002002',
- "eogon;": '\U00000119',
- "eopf;": '\U0001D556',
- "epar;": '\U000022D5',
- "eparsl;": '\U000029E3',
- "eplus;": '\U00002A71',
- "epsi;": '\U000003B5',
- "epsilon;": '\U000003B5',
- "epsiv;": '\U000003F5',
- "eqcirc;": '\U00002256',
- "eqcolon;": '\U00002255',
- "eqsim;": '\U00002242',
- "eqslantgtr;": '\U00002A96',
- "eqslantless;": '\U00002A95',
- "equals;": '\U0000003D',
- "equest;": '\U0000225F',
- "equiv;": '\U00002261',
- "equivDD;": '\U00002A78',
- "eqvparsl;": '\U000029E5',
- "erDot;": '\U00002253',
- "erarr;": '\U00002971',
- "escr;": '\U0000212F',
- "esdot;": '\U00002250',
- "esim;": '\U00002242',
- "eta;": '\U000003B7',
- "eth;": '\U000000F0',
- "euml;": '\U000000EB',
- "euro;": '\U000020AC',
- "excl;": '\U00000021',
- "exist;": '\U00002203',
- "expectation;": '\U00002130',
- "exponentiale;": '\U00002147',
- "fallingdotseq;": '\U00002252',
- "fcy;": '\U00000444',
- "female;": '\U00002640',
- "ffilig;": '\U0000FB03',
- "fflig;": '\U0000FB00',
- "ffllig;": '\U0000FB04',
- "ffr;": '\U0001D523',
- "filig;": '\U0000FB01',
- "flat;": '\U0000266D',
- "fllig;": '\U0000FB02',
- "fltns;": '\U000025B1',
- "fnof;": '\U00000192',
- "fopf;": '\U0001D557',
- "forall;": '\U00002200',
- "fork;": '\U000022D4',
- "forkv;": '\U00002AD9',
- "fpartint;": '\U00002A0D',
- "frac12;": '\U000000BD',
- "frac13;": '\U00002153',
- "frac14;": '\U000000BC',
- "frac15;": '\U00002155',
- "frac16;": '\U00002159',
- "frac18;": '\U0000215B',
- "frac23;": '\U00002154',
- "frac25;": '\U00002156',
- "frac34;": '\U000000BE',
- "frac35;": '\U00002157',
- "frac38;": '\U0000215C',
- "frac45;": '\U00002158',
- "frac56;": '\U0000215A',
- "frac58;": '\U0000215D',
- "frac78;": '\U0000215E',
- "frasl;": '\U00002044',
- "frown;": '\U00002322',
- "fscr;": '\U0001D4BB',
- "gE;": '\U00002267',
- "gEl;": '\U00002A8C',
- "gacute;": '\U000001F5',
- "gamma;": '\U000003B3',
- "gammad;": '\U000003DD',
- "gap;": '\U00002A86',
- "gbreve;": '\U0000011F',
- "gcirc;": '\U0000011D',
- "gcy;": '\U00000433',
- "gdot;": '\U00000121',
- "ge;": '\U00002265',
- "gel;": '\U000022DB',
- "geq;": '\U00002265',
- "geqq;": '\U00002267',
- "geqslant;": '\U00002A7E',
- "ges;": '\U00002A7E',
- "gescc;": '\U00002AA9',
- "gesdot;": '\U00002A80',
- "gesdoto;": '\U00002A82',
- "gesdotol;": '\U00002A84',
- "gesles;": '\U00002A94',
- "gfr;": '\U0001D524',
- "gg;": '\U0000226B',
- "ggg;": '\U000022D9',
- "gimel;": '\U00002137',
- "gjcy;": '\U00000453',
- "gl;": '\U00002277',
- "glE;": '\U00002A92',
- "gla;": '\U00002AA5',
- "glj;": '\U00002AA4',
- "gnE;": '\U00002269',
- "gnap;": '\U00002A8A',
- "gnapprox;": '\U00002A8A',
- "gne;": '\U00002A88',
- "gneq;": '\U00002A88',
- "gneqq;": '\U00002269',
- "gnsim;": '\U000022E7',
- "gopf;": '\U0001D558',
- "grave;": '\U00000060',
- "gscr;": '\U0000210A',
- "gsim;": '\U00002273',
- "gsime;": '\U00002A8E',
- "gsiml;": '\U00002A90',
- "gt;": '\U0000003E',
- "gtcc;": '\U00002AA7',
- "gtcir;": '\U00002A7A',
- "gtdot;": '\U000022D7',
- "gtlPar;": '\U00002995',
- "gtquest;": '\U00002A7C',
- "gtrapprox;": '\U00002A86',
- "gtrarr;": '\U00002978',
- "gtrdot;": '\U000022D7',
- "gtreqless;": '\U000022DB',
- "gtreqqless;": '\U00002A8C',
- "gtrless;": '\U00002277',
- "gtrsim;": '\U00002273',
- "hArr;": '\U000021D4',
- "hairsp;": '\U0000200A',
- "half;": '\U000000BD',
- "hamilt;": '\U0000210B',
- "hardcy;": '\U0000044A',
- "harr;": '\U00002194',
- "harrcir;": '\U00002948',
- "harrw;": '\U000021AD',
- "hbar;": '\U0000210F',
- "hcirc;": '\U00000125',
- "hearts;": '\U00002665',
- "heartsuit;": '\U00002665',
- "hellip;": '\U00002026',
- "hercon;": '\U000022B9',
- "hfr;": '\U0001D525',
- "hksearow;": '\U00002925',
- "hkswarow;": '\U00002926',
- "hoarr;": '\U000021FF',
- "homtht;": '\U0000223B',
- "hookleftarrow;": '\U000021A9',
- "hookrightarrow;": '\U000021AA',
- "hopf;": '\U0001D559',
- "horbar;": '\U00002015',
- "hscr;": '\U0001D4BD',
- "hslash;": '\U0000210F',
- "hstrok;": '\U00000127',
- "hybull;": '\U00002043',
- "hyphen;": '\U00002010',
- "iacute;": '\U000000ED',
- "ic;": '\U00002063',
- "icirc;": '\U000000EE',
- "icy;": '\U00000438',
- "iecy;": '\U00000435',
- "iexcl;": '\U000000A1',
- "iff;": '\U000021D4',
- "ifr;": '\U0001D526',
- "igrave;": '\U000000EC',
- "ii;": '\U00002148',
- "iiiint;": '\U00002A0C',
- "iiint;": '\U0000222D',
- "iinfin;": '\U000029DC',
- "iiota;": '\U00002129',
- "ijlig;": '\U00000133',
- "imacr;": '\U0000012B',
- "image;": '\U00002111',
- "imagline;": '\U00002110',
- "imagpart;": '\U00002111',
- "imath;": '\U00000131',
- "imof;": '\U000022B7',
- "imped;": '\U000001B5',
- "in;": '\U00002208',
- "incare;": '\U00002105',
- "infin;": '\U0000221E',
- "infintie;": '\U000029DD',
- "inodot;": '\U00000131',
- "int;": '\U0000222B',
- "intcal;": '\U000022BA',
- "integers;": '\U00002124',
- "intercal;": '\U000022BA',
- "intlarhk;": '\U00002A17',
- "intprod;": '\U00002A3C',
- "iocy;": '\U00000451',
- "iogon;": '\U0000012F',
- "iopf;": '\U0001D55A',
- "iota;": '\U000003B9',
- "iprod;": '\U00002A3C',
- "iquest;": '\U000000BF',
- "iscr;": '\U0001D4BE',
- "isin;": '\U00002208',
- "isinE;": '\U000022F9',
- "isindot;": '\U000022F5',
- "isins;": '\U000022F4',
- "isinsv;": '\U000022F3',
- "isinv;": '\U00002208',
- "it;": '\U00002062',
- "itilde;": '\U00000129',
- "iukcy;": '\U00000456',
- "iuml;": '\U000000EF',
- "jcirc;": '\U00000135',
- "jcy;": '\U00000439',
- "jfr;": '\U0001D527',
- "jmath;": '\U00000237',
- "jopf;": '\U0001D55B',
- "jscr;": '\U0001D4BF',
- "jsercy;": '\U00000458',
- "jukcy;": '\U00000454',
- "kappa;": '\U000003BA',
- "kappav;": '\U000003F0',
- "kcedil;": '\U00000137',
- "kcy;": '\U0000043A',
- "kfr;": '\U0001D528',
- "kgreen;": '\U00000138',
- "khcy;": '\U00000445',
- "kjcy;": '\U0000045C',
- "kopf;": '\U0001D55C',
- "kscr;": '\U0001D4C0',
- "lAarr;": '\U000021DA',
- "lArr;": '\U000021D0',
- "lAtail;": '\U0000291B',
- "lBarr;": '\U0000290E',
- "lE;": '\U00002266',
- "lEg;": '\U00002A8B',
- "lHar;": '\U00002962',
- "lacute;": '\U0000013A',
- "laemptyv;": '\U000029B4',
- "lagran;": '\U00002112',
- "lambda;": '\U000003BB',
- "lang;": '\U000027E8',
- "langd;": '\U00002991',
- "langle;": '\U000027E8',
- "lap;": '\U00002A85',
- "laquo;": '\U000000AB',
- "larr;": '\U00002190',
- "larrb;": '\U000021E4',
- "larrbfs;": '\U0000291F',
- "larrfs;": '\U0000291D',
- "larrhk;": '\U000021A9',
- "larrlp;": '\U000021AB',
- "larrpl;": '\U00002939',
- "larrsim;": '\U00002973',
- "larrtl;": '\U000021A2',
- "lat;": '\U00002AAB',
- "latail;": '\U00002919',
- "late;": '\U00002AAD',
- "lbarr;": '\U0000290C',
- "lbbrk;": '\U00002772',
- "lbrace;": '\U0000007B',
- "lbrack;": '\U0000005B',
- "lbrke;": '\U0000298B',
- "lbrksld;": '\U0000298F',
- "lbrkslu;": '\U0000298D',
- "lcaron;": '\U0000013E',
- "lcedil;": '\U0000013C',
- "lceil;": '\U00002308',
- "lcub;": '\U0000007B',
- "lcy;": '\U0000043B',
- "ldca;": '\U00002936',
- "ldquo;": '\U0000201C',
- "ldquor;": '\U0000201E',
- "ldrdhar;": '\U00002967',
- "ldrushar;": '\U0000294B',
- "ldsh;": '\U000021B2',
- "le;": '\U00002264',
- "leftarrow;": '\U00002190',
- "leftarrowtail;": '\U000021A2',
- "leftharpoondown;": '\U000021BD',
- "leftharpoonup;": '\U000021BC',
- "leftleftarrows;": '\U000021C7',
- "leftrightarrow;": '\U00002194',
- "leftrightarrows;": '\U000021C6',
- "leftrightharpoons;": '\U000021CB',
- "leftrightsquigarrow;": '\U000021AD',
- "leftthreetimes;": '\U000022CB',
- "leg;": '\U000022DA',
- "leq;": '\U00002264',
- "leqq;": '\U00002266',
- "leqslant;": '\U00002A7D',
- "les;": '\U00002A7D',
- "lescc;": '\U00002AA8',
- "lesdot;": '\U00002A7F',
- "lesdoto;": '\U00002A81',
- "lesdotor;": '\U00002A83',
- "lesges;": '\U00002A93',
- "lessapprox;": '\U00002A85',
- "lessdot;": '\U000022D6',
- "lesseqgtr;": '\U000022DA',
- "lesseqqgtr;": '\U00002A8B',
- "lessgtr;": '\U00002276',
- "lesssim;": '\U00002272',
- "lfisht;": '\U0000297C',
- "lfloor;": '\U0000230A',
- "lfr;": '\U0001D529',
- "lg;": '\U00002276',
- "lgE;": '\U00002A91',
- "lhard;": '\U000021BD',
- "lharu;": '\U000021BC',
- "lharul;": '\U0000296A',
- "lhblk;": '\U00002584',
- "ljcy;": '\U00000459',
- "ll;": '\U0000226A',
- "llarr;": '\U000021C7',
- "llcorner;": '\U0000231E',
- "llhard;": '\U0000296B',
- "lltri;": '\U000025FA',
- "lmidot;": '\U00000140',
- "lmoust;": '\U000023B0',
- "lmoustache;": '\U000023B0',
- "lnE;": '\U00002268',
- "lnap;": '\U00002A89',
- "lnapprox;": '\U00002A89',
- "lne;": '\U00002A87',
- "lneq;": '\U00002A87',
- "lneqq;": '\U00002268',
- "lnsim;": '\U000022E6',
- "loang;": '\U000027EC',
- "loarr;": '\U000021FD',
- "lobrk;": '\U000027E6',
- "longleftarrow;": '\U000027F5',
- "longleftrightarrow;": '\U000027F7',
- "longmapsto;": '\U000027FC',
- "longrightarrow;": '\U000027F6',
- "looparrowleft;": '\U000021AB',
- "looparrowright;": '\U000021AC',
- "lopar;": '\U00002985',
- "lopf;": '\U0001D55D',
- "loplus;": '\U00002A2D',
- "lotimes;": '\U00002A34',
- "lowast;": '\U00002217',
- "lowbar;": '\U0000005F',
- "loz;": '\U000025CA',
- "lozenge;": '\U000025CA',
- "lozf;": '\U000029EB',
- "lpar;": '\U00000028',
- "lparlt;": '\U00002993',
- "lrarr;": '\U000021C6',
- "lrcorner;": '\U0000231F',
- "lrhar;": '\U000021CB',
- "lrhard;": '\U0000296D',
- "lrm;": '\U0000200E',
- "lrtri;": '\U000022BF',
- "lsaquo;": '\U00002039',
- "lscr;": '\U0001D4C1',
- "lsh;": '\U000021B0',
- "lsim;": '\U00002272',
- "lsime;": '\U00002A8D',
- "lsimg;": '\U00002A8F',
- "lsqb;": '\U0000005B',
- "lsquo;": '\U00002018',
- "lsquor;": '\U0000201A',
- "lstrok;": '\U00000142',
- "lt;": '\U0000003C',
- "ltcc;": '\U00002AA6',
- "ltcir;": '\U00002A79',
- "ltdot;": '\U000022D6',
- "lthree;": '\U000022CB',
- "ltimes;": '\U000022C9',
- "ltlarr;": '\U00002976',
- "ltquest;": '\U00002A7B',
- "ltrPar;": '\U00002996',
- "ltri;": '\U000025C3',
- "ltrie;": '\U000022B4',
- "ltrif;": '\U000025C2',
- "lurdshar;": '\U0000294A',
- "luruhar;": '\U00002966',
- "mDDot;": '\U0000223A',
- "macr;": '\U000000AF',
- "male;": '\U00002642',
- "malt;": '\U00002720',
- "maltese;": '\U00002720',
- "map;": '\U000021A6',
- "mapsto;": '\U000021A6',
- "mapstodown;": '\U000021A7',
- "mapstoleft;": '\U000021A4',
- "mapstoup;": '\U000021A5',
- "marker;": '\U000025AE',
- "mcomma;": '\U00002A29',
- "mcy;": '\U0000043C',
- "mdash;": '\U00002014',
- "measuredangle;": '\U00002221',
- "mfr;": '\U0001D52A',
- "mho;": '\U00002127',
- "micro;": '\U000000B5',
- "mid;": '\U00002223',
- "midast;": '\U0000002A',
- "midcir;": '\U00002AF0',
- "middot;": '\U000000B7',
- "minus;": '\U00002212',
- "minusb;": '\U0000229F',
- "minusd;": '\U00002238',
- "minusdu;": '\U00002A2A',
- "mlcp;": '\U00002ADB',
- "mldr;": '\U00002026',
- "mnplus;": '\U00002213',
- "models;": '\U000022A7',
- "mopf;": '\U0001D55E',
- "mp;": '\U00002213',
- "mscr;": '\U0001D4C2',
- "mstpos;": '\U0000223E',
- "mu;": '\U000003BC',
- "multimap;": '\U000022B8',
- "mumap;": '\U000022B8',
- "nLeftarrow;": '\U000021CD',
- "nLeftrightarrow;": '\U000021CE',
- "nRightarrow;": '\U000021CF',
- "nVDash;": '\U000022AF',
- "nVdash;": '\U000022AE',
- "nabla;": '\U00002207',
- "nacute;": '\U00000144',
- "nap;": '\U00002249',
- "napos;": '\U00000149',
- "napprox;": '\U00002249',
- "natur;": '\U0000266E',
- "natural;": '\U0000266E',
- "naturals;": '\U00002115',
- "nbsp;": '\U000000A0',
- "ncap;": '\U00002A43',
- "ncaron;": '\U00000148',
- "ncedil;": '\U00000146',
- "ncong;": '\U00002247',
- "ncup;": '\U00002A42',
- "ncy;": '\U0000043D',
- "ndash;": '\U00002013',
- "ne;": '\U00002260',
- "neArr;": '\U000021D7',
- "nearhk;": '\U00002924',
- "nearr;": '\U00002197',
- "nearrow;": '\U00002197',
- "nequiv;": '\U00002262',
- "nesear;": '\U00002928',
- "nexist;": '\U00002204',
- "nexists;": '\U00002204',
- "nfr;": '\U0001D52B',
- "nge;": '\U00002271',
- "ngeq;": '\U00002271',
- "ngsim;": '\U00002275',
- "ngt;": '\U0000226F',
- "ngtr;": '\U0000226F',
- "nhArr;": '\U000021CE',
- "nharr;": '\U000021AE',
- "nhpar;": '\U00002AF2',
- "ni;": '\U0000220B',
- "nis;": '\U000022FC',
- "nisd;": '\U000022FA',
- "niv;": '\U0000220B',
- "njcy;": '\U0000045A',
- "nlArr;": '\U000021CD',
- "nlarr;": '\U0000219A',
- "nldr;": '\U00002025',
- "nle;": '\U00002270',
- "nleftarrow;": '\U0000219A',
- "nleftrightarrow;": '\U000021AE',
- "nleq;": '\U00002270',
- "nless;": '\U0000226E',
- "nlsim;": '\U00002274',
- "nlt;": '\U0000226E',
- "nltri;": '\U000022EA',
- "nltrie;": '\U000022EC',
- "nmid;": '\U00002224',
- "nopf;": '\U0001D55F',
- "not;": '\U000000AC',
- "notin;": '\U00002209',
- "notinva;": '\U00002209',
- "notinvb;": '\U000022F7',
- "notinvc;": '\U000022F6',
- "notni;": '\U0000220C',
- "notniva;": '\U0000220C',
- "notnivb;": '\U000022FE',
- "notnivc;": '\U000022FD',
- "npar;": '\U00002226',
- "nparallel;": '\U00002226',
- "npolint;": '\U00002A14',
- "npr;": '\U00002280',
- "nprcue;": '\U000022E0',
- "nprec;": '\U00002280',
- "nrArr;": '\U000021CF',
- "nrarr;": '\U0000219B',
- "nrightarrow;": '\U0000219B',
- "nrtri;": '\U000022EB',
- "nrtrie;": '\U000022ED',
- "nsc;": '\U00002281',
- "nsccue;": '\U000022E1',
- "nscr;": '\U0001D4C3',
- "nshortmid;": '\U00002224',
- "nshortparallel;": '\U00002226',
- "nsim;": '\U00002241',
- "nsime;": '\U00002244',
- "nsimeq;": '\U00002244',
- "nsmid;": '\U00002224',
- "nspar;": '\U00002226',
- "nsqsube;": '\U000022E2',
- "nsqsupe;": '\U000022E3',
- "nsub;": '\U00002284',
- "nsube;": '\U00002288',
- "nsubseteq;": '\U00002288',
- "nsucc;": '\U00002281',
- "nsup;": '\U00002285',
- "nsupe;": '\U00002289',
- "nsupseteq;": '\U00002289',
- "ntgl;": '\U00002279',
- "ntilde;": '\U000000F1',
- "ntlg;": '\U00002278',
- "ntriangleleft;": '\U000022EA',
- "ntrianglelefteq;": '\U000022EC',
- "ntriangleright;": '\U000022EB',
- "ntrianglerighteq;": '\U000022ED',
- "nu;": '\U000003BD',
- "num;": '\U00000023',
- "numero;": '\U00002116',
- "numsp;": '\U00002007',
- "nvDash;": '\U000022AD',
- "nvHarr;": '\U00002904',
- "nvdash;": '\U000022AC',
- "nvinfin;": '\U000029DE',
- "nvlArr;": '\U00002902',
- "nvrArr;": '\U00002903',
- "nwArr;": '\U000021D6',
- "nwarhk;": '\U00002923',
- "nwarr;": '\U00002196',
- "nwarrow;": '\U00002196',
- "nwnear;": '\U00002927',
- "oS;": '\U000024C8',
- "oacute;": '\U000000F3',
- "oast;": '\U0000229B',
- "ocir;": '\U0000229A',
- "ocirc;": '\U000000F4',
- "ocy;": '\U0000043E',
- "odash;": '\U0000229D',
- "odblac;": '\U00000151',
- "odiv;": '\U00002A38',
- "odot;": '\U00002299',
- "odsold;": '\U000029BC',
- "oelig;": '\U00000153',
- "ofcir;": '\U000029BF',
- "ofr;": '\U0001D52C',
- "ogon;": '\U000002DB',
- "ograve;": '\U000000F2',
- "ogt;": '\U000029C1',
- "ohbar;": '\U000029B5',
- "ohm;": '\U000003A9',
- "oint;": '\U0000222E',
- "olarr;": '\U000021BA',
- "olcir;": '\U000029BE',
- "olcross;": '\U000029BB',
- "oline;": '\U0000203E',
- "olt;": '\U000029C0',
- "omacr;": '\U0000014D',
- "omega;": '\U000003C9',
- "omicron;": '\U000003BF',
- "omid;": '\U000029B6',
- "ominus;": '\U00002296',
- "oopf;": '\U0001D560',
- "opar;": '\U000029B7',
- "operp;": '\U000029B9',
- "oplus;": '\U00002295',
- "or;": '\U00002228',
- "orarr;": '\U000021BB',
- "ord;": '\U00002A5D',
- "order;": '\U00002134',
- "orderof;": '\U00002134',
- "ordf;": '\U000000AA',
- "ordm;": '\U000000BA',
- "origof;": '\U000022B6',
- "oror;": '\U00002A56',
- "orslope;": '\U00002A57',
- "orv;": '\U00002A5B',
- "oscr;": '\U00002134',
- "oslash;": '\U000000F8',
- "osol;": '\U00002298',
- "otilde;": '\U000000F5',
- "otimes;": '\U00002297',
- "otimesas;": '\U00002A36',
- "ouml;": '\U000000F6',
- "ovbar;": '\U0000233D',
- "par;": '\U00002225',
- "para;": '\U000000B6',
- "parallel;": '\U00002225',
- "parsim;": '\U00002AF3',
- "parsl;": '\U00002AFD',
- "part;": '\U00002202',
- "pcy;": '\U0000043F',
- "percnt;": '\U00000025',
- "period;": '\U0000002E',
- "permil;": '\U00002030',
- "perp;": '\U000022A5',
- "pertenk;": '\U00002031',
- "pfr;": '\U0001D52D',
- "phi;": '\U000003C6',
- "phiv;": '\U000003D5',
- "phmmat;": '\U00002133',
- "phone;": '\U0000260E',
- "pi;": '\U000003C0',
- "pitchfork;": '\U000022D4',
- "piv;": '\U000003D6',
- "planck;": '\U0000210F',
- "planckh;": '\U0000210E',
- "plankv;": '\U0000210F',
- "plus;": '\U0000002B',
- "plusacir;": '\U00002A23',
- "plusb;": '\U0000229E',
- "pluscir;": '\U00002A22',
- "plusdo;": '\U00002214',
- "plusdu;": '\U00002A25',
- "pluse;": '\U00002A72',
- "plusmn;": '\U000000B1',
- "plussim;": '\U00002A26',
- "plustwo;": '\U00002A27',
- "pm;": '\U000000B1',
- "pointint;": '\U00002A15',
- "popf;": '\U0001D561',
- "pound;": '\U000000A3',
- "pr;": '\U0000227A',
- "prE;": '\U00002AB3',
- "prap;": '\U00002AB7',
- "prcue;": '\U0000227C',
- "pre;": '\U00002AAF',
- "prec;": '\U0000227A',
- "precapprox;": '\U00002AB7',
- "preccurlyeq;": '\U0000227C',
- "preceq;": '\U00002AAF',
- "precnapprox;": '\U00002AB9',
- "precneqq;": '\U00002AB5',
- "precnsim;": '\U000022E8',
- "precsim;": '\U0000227E',
- "prime;": '\U00002032',
- "primes;": '\U00002119',
- "prnE;": '\U00002AB5',
- "prnap;": '\U00002AB9',
- "prnsim;": '\U000022E8',
- "prod;": '\U0000220F',
- "profalar;": '\U0000232E',
- "profline;": '\U00002312',
- "profsurf;": '\U00002313',
- "prop;": '\U0000221D',
- "propto;": '\U0000221D',
- "prsim;": '\U0000227E',
- "prurel;": '\U000022B0',
- "pscr;": '\U0001D4C5',
- "psi;": '\U000003C8',
- "puncsp;": '\U00002008',
- "qfr;": '\U0001D52E',
- "qint;": '\U00002A0C',
- "qopf;": '\U0001D562',
- "qprime;": '\U00002057',
- "qscr;": '\U0001D4C6',
- "quaternions;": '\U0000210D',
- "quatint;": '\U00002A16',
- "quest;": '\U0000003F',
- "questeq;": '\U0000225F',
- "quot;": '\U00000022',
- "rAarr;": '\U000021DB',
- "rArr;": '\U000021D2',
- "rAtail;": '\U0000291C',
- "rBarr;": '\U0000290F',
- "rHar;": '\U00002964',
- "racute;": '\U00000155',
- "radic;": '\U0000221A',
- "raemptyv;": '\U000029B3',
- "rang;": '\U000027E9',
- "rangd;": '\U00002992',
- "range;": '\U000029A5',
- "rangle;": '\U000027E9',
- "raquo;": '\U000000BB',
- "rarr;": '\U00002192',
- "rarrap;": '\U00002975',
- "rarrb;": '\U000021E5',
- "rarrbfs;": '\U00002920',
- "rarrc;": '\U00002933',
- "rarrfs;": '\U0000291E',
- "rarrhk;": '\U000021AA',
- "rarrlp;": '\U000021AC',
- "rarrpl;": '\U00002945',
- "rarrsim;": '\U00002974',
- "rarrtl;": '\U000021A3',
- "rarrw;": '\U0000219D',
- "ratail;": '\U0000291A',
- "ratio;": '\U00002236',
- "rationals;": '\U0000211A',
- "rbarr;": '\U0000290D',
- "rbbrk;": '\U00002773',
- "rbrace;": '\U0000007D',
- "rbrack;": '\U0000005D',
- "rbrke;": '\U0000298C',
- "rbrksld;": '\U0000298E',
- "rbrkslu;": '\U00002990',
- "rcaron;": '\U00000159',
- "rcedil;": '\U00000157',
- "rceil;": '\U00002309',
- "rcub;": '\U0000007D',
- "rcy;": '\U00000440',
- "rdca;": '\U00002937',
- "rdldhar;": '\U00002969',
- "rdquo;": '\U0000201D',
- "rdquor;": '\U0000201D',
- "rdsh;": '\U000021B3',
- "real;": '\U0000211C',
- "realine;": '\U0000211B',
- "realpart;": '\U0000211C',
- "reals;": '\U0000211D',
- "rect;": '\U000025AD',
- "reg;": '\U000000AE',
- "rfisht;": '\U0000297D',
- "rfloor;": '\U0000230B',
- "rfr;": '\U0001D52F',
- "rhard;": '\U000021C1',
- "rharu;": '\U000021C0',
- "rharul;": '\U0000296C',
- "rho;": '\U000003C1',
- "rhov;": '\U000003F1',
- "rightarrow;": '\U00002192',
- "rightarrowtail;": '\U000021A3',
- "rightharpoondown;": '\U000021C1',
- "rightharpoonup;": '\U000021C0',
- "rightleftarrows;": '\U000021C4',
- "rightleftharpoons;": '\U000021CC',
- "rightrightarrows;": '\U000021C9',
- "rightsquigarrow;": '\U0000219D',
- "rightthreetimes;": '\U000022CC',
- "ring;": '\U000002DA',
- "risingdotseq;": '\U00002253',
- "rlarr;": '\U000021C4',
- "rlhar;": '\U000021CC',
- "rlm;": '\U0000200F',
- "rmoust;": '\U000023B1',
- "rmoustache;": '\U000023B1',
- "rnmid;": '\U00002AEE',
- "roang;": '\U000027ED',
- "roarr;": '\U000021FE',
- "robrk;": '\U000027E7',
- "ropar;": '\U00002986',
- "ropf;": '\U0001D563',
- "roplus;": '\U00002A2E',
- "rotimes;": '\U00002A35',
- "rpar;": '\U00000029',
- "rpargt;": '\U00002994',
- "rppolint;": '\U00002A12',
- "rrarr;": '\U000021C9',
- "rsaquo;": '\U0000203A',
- "rscr;": '\U0001D4C7',
- "rsh;": '\U000021B1',
- "rsqb;": '\U0000005D',
- "rsquo;": '\U00002019',
- "rsquor;": '\U00002019',
- "rthree;": '\U000022CC',
- "rtimes;": '\U000022CA',
- "rtri;": '\U000025B9',
- "rtrie;": '\U000022B5',
- "rtrif;": '\U000025B8',
- "rtriltri;": '\U000029CE',
- "ruluhar;": '\U00002968',
- "rx;": '\U0000211E',
- "sacute;": '\U0000015B',
- "sbquo;": '\U0000201A',
- "sc;": '\U0000227B',
- "scE;": '\U00002AB4',
- "scap;": '\U00002AB8',
- "scaron;": '\U00000161',
- "sccue;": '\U0000227D',
- "sce;": '\U00002AB0',
- "scedil;": '\U0000015F',
- "scirc;": '\U0000015D',
- "scnE;": '\U00002AB6',
- "scnap;": '\U00002ABA',
- "scnsim;": '\U000022E9',
- "scpolint;": '\U00002A13',
- "scsim;": '\U0000227F',
- "scy;": '\U00000441',
- "sdot;": '\U000022C5',
- "sdotb;": '\U000022A1',
- "sdote;": '\U00002A66',
- "seArr;": '\U000021D8',
- "searhk;": '\U00002925',
- "searr;": '\U00002198',
- "searrow;": '\U00002198',
- "sect;": '\U000000A7',
- "semi;": '\U0000003B',
- "seswar;": '\U00002929',
- "setminus;": '\U00002216',
- "setmn;": '\U00002216',
- "sext;": '\U00002736',
- "sfr;": '\U0001D530',
- "sfrown;": '\U00002322',
- "sharp;": '\U0000266F',
- "shchcy;": '\U00000449',
- "shcy;": '\U00000448',
- "shortmid;": '\U00002223',
- "shortparallel;": '\U00002225',
- "shy;": '\U000000AD',
- "sigma;": '\U000003C3',
- "sigmaf;": '\U000003C2',
- "sigmav;": '\U000003C2',
- "sim;": '\U0000223C',
- "simdot;": '\U00002A6A',
- "sime;": '\U00002243',
- "simeq;": '\U00002243',
- "simg;": '\U00002A9E',
- "simgE;": '\U00002AA0',
- "siml;": '\U00002A9D',
- "simlE;": '\U00002A9F',
- "simne;": '\U00002246',
- "simplus;": '\U00002A24',
- "simrarr;": '\U00002972',
- "slarr;": '\U00002190',
- "smallsetminus;": '\U00002216',
- "smashp;": '\U00002A33',
- "smeparsl;": '\U000029E4',
- "smid;": '\U00002223',
- "smile;": '\U00002323',
- "smt;": '\U00002AAA',
- "smte;": '\U00002AAC',
- "softcy;": '\U0000044C',
- "sol;": '\U0000002F',
- "solb;": '\U000029C4',
- "solbar;": '\U0000233F',
- "sopf;": '\U0001D564',
- "spades;": '\U00002660',
- "spadesuit;": '\U00002660',
- "spar;": '\U00002225',
- "sqcap;": '\U00002293',
- "sqcup;": '\U00002294',
- "sqsub;": '\U0000228F',
- "sqsube;": '\U00002291',
- "sqsubset;": '\U0000228F',
- "sqsubseteq;": '\U00002291',
- "sqsup;": '\U00002290',
- "sqsupe;": '\U00002292',
- "sqsupset;": '\U00002290',
- "sqsupseteq;": '\U00002292',
- "squ;": '\U000025A1',
- "square;": '\U000025A1',
- "squarf;": '\U000025AA',
- "squf;": '\U000025AA',
- "srarr;": '\U00002192',
- "sscr;": '\U0001D4C8',
- "ssetmn;": '\U00002216',
- "ssmile;": '\U00002323',
- "sstarf;": '\U000022C6',
- "star;": '\U00002606',
- "starf;": '\U00002605',
- "straightepsilon;": '\U000003F5',
- "straightphi;": '\U000003D5',
- "strns;": '\U000000AF',
- "sub;": '\U00002282',
- "subE;": '\U00002AC5',
- "subdot;": '\U00002ABD',
- "sube;": '\U00002286',
- "subedot;": '\U00002AC3',
- "submult;": '\U00002AC1',
- "subnE;": '\U00002ACB',
- "subne;": '\U0000228A',
- "subplus;": '\U00002ABF',
- "subrarr;": '\U00002979',
- "subset;": '\U00002282',
- "subseteq;": '\U00002286',
- "subseteqq;": '\U00002AC5',
- "subsetneq;": '\U0000228A',
- "subsetneqq;": '\U00002ACB',
- "subsim;": '\U00002AC7',
- "subsub;": '\U00002AD5',
- "subsup;": '\U00002AD3',
- "succ;": '\U0000227B',
- "succapprox;": '\U00002AB8',
- "succcurlyeq;": '\U0000227D',
- "succeq;": '\U00002AB0',
- "succnapprox;": '\U00002ABA',
- "succneqq;": '\U00002AB6',
- "succnsim;": '\U000022E9',
- "succsim;": '\U0000227F',
- "sum;": '\U00002211',
- "sung;": '\U0000266A',
- "sup;": '\U00002283',
- "sup1;": '\U000000B9',
- "sup2;": '\U000000B2',
- "sup3;": '\U000000B3',
- "supE;": '\U00002AC6',
- "supdot;": '\U00002ABE',
- "supdsub;": '\U00002AD8',
- "supe;": '\U00002287',
- "supedot;": '\U00002AC4',
- "suphsol;": '\U000027C9',
- "suphsub;": '\U00002AD7',
- "suplarr;": '\U0000297B',
- "supmult;": '\U00002AC2',
- "supnE;": '\U00002ACC',
- "supne;": '\U0000228B',
- "supplus;": '\U00002AC0',
- "supset;": '\U00002283',
- "supseteq;": '\U00002287',
- "supseteqq;": '\U00002AC6',
- "supsetneq;": '\U0000228B',
- "supsetneqq;": '\U00002ACC',
- "supsim;": '\U00002AC8',
- "supsub;": '\U00002AD4',
- "supsup;": '\U00002AD6',
- "swArr;": '\U000021D9',
- "swarhk;": '\U00002926',
- "swarr;": '\U00002199',
- "swarrow;": '\U00002199',
- "swnwar;": '\U0000292A',
- "szlig;": '\U000000DF',
- "target;": '\U00002316',
- "tau;": '\U000003C4',
- "tbrk;": '\U000023B4',
- "tcaron;": '\U00000165',
- "tcedil;": '\U00000163',
- "tcy;": '\U00000442',
- "tdot;": '\U000020DB',
- "telrec;": '\U00002315',
- "tfr;": '\U0001D531',
- "there4;": '\U00002234',
- "therefore;": '\U00002234',
- "theta;": '\U000003B8',
- "thetasym;": '\U000003D1',
- "thetav;": '\U000003D1',
- "thickapprox;": '\U00002248',
- "thicksim;": '\U0000223C',
- "thinsp;": '\U00002009',
- "thkap;": '\U00002248',
- "thksim;": '\U0000223C',
- "thorn;": '\U000000FE',
- "tilde;": '\U000002DC',
- "times;": '\U000000D7',
- "timesb;": '\U000022A0',
- "timesbar;": '\U00002A31',
- "timesd;": '\U00002A30',
- "tint;": '\U0000222D',
- "toea;": '\U00002928',
- "top;": '\U000022A4',
- "topbot;": '\U00002336',
- "topcir;": '\U00002AF1',
- "topf;": '\U0001D565',
- "topfork;": '\U00002ADA',
- "tosa;": '\U00002929',
- "tprime;": '\U00002034',
- "trade;": '\U00002122',
- "triangle;": '\U000025B5',
- "triangledown;": '\U000025BF',
- "triangleleft;": '\U000025C3',
- "trianglelefteq;": '\U000022B4',
- "triangleq;": '\U0000225C',
- "triangleright;": '\U000025B9',
- "trianglerighteq;": '\U000022B5',
- "tridot;": '\U000025EC',
- "trie;": '\U0000225C',
- "triminus;": '\U00002A3A',
- "triplus;": '\U00002A39',
- "trisb;": '\U000029CD',
- "tritime;": '\U00002A3B',
- "trpezium;": '\U000023E2',
- "tscr;": '\U0001D4C9',
- "tscy;": '\U00000446',
- "tshcy;": '\U0000045B',
- "tstrok;": '\U00000167',
- "twixt;": '\U0000226C',
- "twoheadleftarrow;": '\U0000219E',
- "twoheadrightarrow;": '\U000021A0',
- "uArr;": '\U000021D1',
- "uHar;": '\U00002963',
- "uacute;": '\U000000FA',
- "uarr;": '\U00002191',
- "ubrcy;": '\U0000045E',
- "ubreve;": '\U0000016D',
- "ucirc;": '\U000000FB',
- "ucy;": '\U00000443',
- "udarr;": '\U000021C5',
- "udblac;": '\U00000171',
- "udhar;": '\U0000296E',
- "ufisht;": '\U0000297E',
- "ufr;": '\U0001D532',
- "ugrave;": '\U000000F9',
- "uharl;": '\U000021BF',
- "uharr;": '\U000021BE',
- "uhblk;": '\U00002580',
- "ulcorn;": '\U0000231C',
- "ulcorner;": '\U0000231C',
- "ulcrop;": '\U0000230F',
- "ultri;": '\U000025F8',
- "umacr;": '\U0000016B',
- "uml;": '\U000000A8',
- "uogon;": '\U00000173',
- "uopf;": '\U0001D566',
- "uparrow;": '\U00002191',
- "updownarrow;": '\U00002195',
- "upharpoonleft;": '\U000021BF',
- "upharpoonright;": '\U000021BE',
- "uplus;": '\U0000228E',
- "upsi;": '\U000003C5',
- "upsih;": '\U000003D2',
- "upsilon;": '\U000003C5',
- "upuparrows;": '\U000021C8',
- "urcorn;": '\U0000231D',
- "urcorner;": '\U0000231D',
- "urcrop;": '\U0000230E',
- "uring;": '\U0000016F',
- "urtri;": '\U000025F9',
- "uscr;": '\U0001D4CA',
- "utdot;": '\U000022F0',
- "utilde;": '\U00000169',
- "utri;": '\U000025B5',
- "utrif;": '\U000025B4',
- "uuarr;": '\U000021C8',
- "uuml;": '\U000000FC',
- "uwangle;": '\U000029A7',
- "vArr;": '\U000021D5',
- "vBar;": '\U00002AE8',
- "vBarv;": '\U00002AE9',
- "vDash;": '\U000022A8',
- "vangrt;": '\U0000299C',
- "varepsilon;": '\U000003F5',
- "varkappa;": '\U000003F0',
- "varnothing;": '\U00002205',
- "varphi;": '\U000003D5',
- "varpi;": '\U000003D6',
- "varpropto;": '\U0000221D',
- "varr;": '\U00002195',
- "varrho;": '\U000003F1',
- "varsigma;": '\U000003C2',
- "vartheta;": '\U000003D1',
- "vartriangleleft;": '\U000022B2',
- "vartriangleright;": '\U000022B3',
- "vcy;": '\U00000432',
- "vdash;": '\U000022A2',
- "vee;": '\U00002228',
- "veebar;": '\U000022BB',
- "veeeq;": '\U0000225A',
- "vellip;": '\U000022EE',
- "verbar;": '\U0000007C',
- "vert;": '\U0000007C',
- "vfr;": '\U0001D533',
- "vltri;": '\U000022B2',
- "vopf;": '\U0001D567',
- "vprop;": '\U0000221D',
- "vrtri;": '\U000022B3',
- "vscr;": '\U0001D4CB',
- "vzigzag;": '\U0000299A',
- "wcirc;": '\U00000175',
- "wedbar;": '\U00002A5F',
- "wedge;": '\U00002227',
- "wedgeq;": '\U00002259',
- "weierp;": '\U00002118',
- "wfr;": '\U0001D534',
- "wopf;": '\U0001D568',
- "wp;": '\U00002118',
- "wr;": '\U00002240',
- "wreath;": '\U00002240',
- "wscr;": '\U0001D4CC',
- "xcap;": '\U000022C2',
- "xcirc;": '\U000025EF',
- "xcup;": '\U000022C3',
- "xdtri;": '\U000025BD',
- "xfr;": '\U0001D535',
- "xhArr;": '\U000027FA',
- "xharr;": '\U000027F7',
- "xi;": '\U000003BE',
- "xlArr;": '\U000027F8',
- "xlarr;": '\U000027F5',
- "xmap;": '\U000027FC',
- "xnis;": '\U000022FB',
- "xodot;": '\U00002A00',
- "xopf;": '\U0001D569',
- "xoplus;": '\U00002A01',
- "xotime;": '\U00002A02',
- "xrArr;": '\U000027F9',
- "xrarr;": '\U000027F6',
- "xscr;": '\U0001D4CD',
- "xsqcup;": '\U00002A06',
- "xuplus;": '\U00002A04',
- "xutri;": '\U000025B3',
- "xvee;": '\U000022C1',
- "xwedge;": '\U000022C0',
- "yacute;": '\U000000FD',
- "yacy;": '\U0000044F',
- "ycirc;": '\U00000177',
- "ycy;": '\U0000044B',
- "yen;": '\U000000A5',
- "yfr;": '\U0001D536',
- "yicy;": '\U00000457',
- "yopf;": '\U0001D56A',
- "yscr;": '\U0001D4CE',
- "yucy;": '\U0000044E',
- "yuml;": '\U000000FF',
- "zacute;": '\U0000017A',
- "zcaron;": '\U0000017E',
- "zcy;": '\U00000437',
- "zdot;": '\U0000017C',
- "zeetrf;": '\U00002128',
- "zeta;": '\U000003B6',
- "zfr;": '\U0001D537',
- "zhcy;": '\U00000436',
- "zigrarr;": '\U000021DD',
- "zopf;": '\U0001D56B',
- "zscr;": '\U0001D4CF',
- "zwj;": '\U0000200D',
- "zwnj;": '\U0000200C',
- "AElig": '\U000000C6',
- "AMP": '\U00000026',
- "Aacute": '\U000000C1',
- "Acirc": '\U000000C2',
- "Agrave": '\U000000C0',
- "Aring": '\U000000C5',
- "Atilde": '\U000000C3',
- "Auml": '\U000000C4',
- "COPY": '\U000000A9',
- "Ccedil": '\U000000C7',
- "ETH": '\U000000D0',
- "Eacute": '\U000000C9',
- "Ecirc": '\U000000CA',
- "Egrave": '\U000000C8',
- "Euml": '\U000000CB',
- "GT": '\U0000003E',
- "Iacute": '\U000000CD',
- "Icirc": '\U000000CE',
- "Igrave": '\U000000CC',
- "Iuml": '\U000000CF',
- "LT": '\U0000003C',
- "Ntilde": '\U000000D1',
- "Oacute": '\U000000D3',
- "Ocirc": '\U000000D4',
- "Ograve": '\U000000D2',
- "Oslash": '\U000000D8',
- "Otilde": '\U000000D5',
- "Ouml": '\U000000D6',
- "QUOT": '\U00000022',
- "REG": '\U000000AE',
- "THORN": '\U000000DE',
- "Uacute": '\U000000DA',
- "Ucirc": '\U000000DB',
- "Ugrave": '\U000000D9',
- "Uuml": '\U000000DC',
- "Yacute": '\U000000DD',
- "aacute": '\U000000E1',
- "acirc": '\U000000E2',
- "acute": '\U000000B4',
- "aelig": '\U000000E6',
- "agrave": '\U000000E0',
- "amp": '\U00000026',
- "aring": '\U000000E5',
- "atilde": '\U000000E3',
- "auml": '\U000000E4',
- "brvbar": '\U000000A6',
- "ccedil": '\U000000E7',
- "cedil": '\U000000B8',
- "cent": '\U000000A2',
- "copy": '\U000000A9',
- "curren": '\U000000A4',
- "deg": '\U000000B0',
- "divide": '\U000000F7',
- "eacute": '\U000000E9',
- "ecirc": '\U000000EA',
- "egrave": '\U000000E8',
- "eth": '\U000000F0',
- "euml": '\U000000EB',
- "frac12": '\U000000BD',
- "frac14": '\U000000BC',
- "frac34": '\U000000BE',
- "gt": '\U0000003E',
- "iacute": '\U000000ED',
- "icirc": '\U000000EE',
- "iexcl": '\U000000A1',
- "igrave": '\U000000EC',
- "iquest": '\U000000BF',
- "iuml": '\U000000EF',
- "laquo": '\U000000AB',
- "lt": '\U0000003C',
- "macr": '\U000000AF',
- "micro": '\U000000B5',
- "middot": '\U000000B7',
- "nbsp": '\U000000A0',
- "not": '\U000000AC',
- "ntilde": '\U000000F1',
- "oacute": '\U000000F3',
- "ocirc": '\U000000F4',
- "ograve": '\U000000F2',
- "ordf": '\U000000AA',
- "ordm": '\U000000BA',
- "oslash": '\U000000F8',
- "otilde": '\U000000F5',
- "ouml": '\U000000F6',
- "para": '\U000000B6',
- "plusmn": '\U000000B1',
- "pound": '\U000000A3',
- "quot": '\U00000022',
- "raquo": '\U000000BB',
- "reg": '\U000000AE',
- "sect": '\U000000A7',
- "shy": '\U000000AD',
- "sup1": '\U000000B9',
- "sup2": '\U000000B2',
- "sup3": '\U000000B3',
- "szlig": '\U000000DF',
- "thorn": '\U000000FE',
- "times": '\U000000D7',
- "uacute": '\U000000FA',
- "ucirc": '\U000000FB',
- "ugrave": '\U000000F9',
- "uml": '\U000000A8',
- "uuml": '\U000000FC',
- "yacute": '\U000000FD',
- "yen": '\U000000A5',
- "yuml": '\U000000FF',
-}
-
-// HTML entities that are two unicode codepoints.
-var entity2 = map[string][2]rune{
- // TODO(nigeltao): Handle replacements that are wider than their names.
- // "nLt;": {'\u226A', '\u20D2'},
- // "nGt;": {'\u226B', '\u20D2'},
- "NotEqualTilde;": {'\u2242', '\u0338'},
- "NotGreaterFullEqual;": {'\u2267', '\u0338'},
- "NotGreaterGreater;": {'\u226B', '\u0338'},
- "NotGreaterSlantEqual;": {'\u2A7E', '\u0338'},
- "NotHumpDownHump;": {'\u224E', '\u0338'},
- "NotHumpEqual;": {'\u224F', '\u0338'},
- "NotLeftTriangleBar;": {'\u29CF', '\u0338'},
- "NotLessLess;": {'\u226A', '\u0338'},
- "NotLessSlantEqual;": {'\u2A7D', '\u0338'},
- "NotNestedGreaterGreater;": {'\u2AA2', '\u0338'},
- "NotNestedLessLess;": {'\u2AA1', '\u0338'},
- "NotPrecedesEqual;": {'\u2AAF', '\u0338'},
- "NotRightTriangleBar;": {'\u29D0', '\u0338'},
- "NotSquareSubset;": {'\u228F', '\u0338'},
- "NotSquareSuperset;": {'\u2290', '\u0338'},
- "NotSubset;": {'\u2282', '\u20D2'},
- "NotSucceedsEqual;": {'\u2AB0', '\u0338'},
- "NotSucceedsTilde;": {'\u227F', '\u0338'},
- "NotSuperset;": {'\u2283', '\u20D2'},
- "ThickSpace;": {'\u205F', '\u200A'},
- "acE;": {'\u223E', '\u0333'},
- "bne;": {'\u003D', '\u20E5'},
- "bnequiv;": {'\u2261', '\u20E5'},
- "caps;": {'\u2229', '\uFE00'},
- "cups;": {'\u222A', '\uFE00'},
- "fjlig;": {'\u0066', '\u006A'},
- "gesl;": {'\u22DB', '\uFE00'},
- "gvertneqq;": {'\u2269', '\uFE00'},
- "gvnE;": {'\u2269', '\uFE00'},
- "lates;": {'\u2AAD', '\uFE00'},
- "lesg;": {'\u22DA', '\uFE00'},
- "lvertneqq;": {'\u2268', '\uFE00'},
- "lvnE;": {'\u2268', '\uFE00'},
- "nGg;": {'\u22D9', '\u0338'},
- "nGtv;": {'\u226B', '\u0338'},
- "nLl;": {'\u22D8', '\u0338'},
- "nLtv;": {'\u226A', '\u0338'},
- "nang;": {'\u2220', '\u20D2'},
- "napE;": {'\u2A70', '\u0338'},
- "napid;": {'\u224B', '\u0338'},
- "nbump;": {'\u224E', '\u0338'},
- "nbumpe;": {'\u224F', '\u0338'},
- "ncongdot;": {'\u2A6D', '\u0338'},
- "nedot;": {'\u2250', '\u0338'},
- "nesim;": {'\u2242', '\u0338'},
- "ngE;": {'\u2267', '\u0338'},
- "ngeqq;": {'\u2267', '\u0338'},
- "ngeqslant;": {'\u2A7E', '\u0338'},
- "nges;": {'\u2A7E', '\u0338'},
- "nlE;": {'\u2266', '\u0338'},
- "nleqq;": {'\u2266', '\u0338'},
- "nleqslant;": {'\u2A7D', '\u0338'},
- "nles;": {'\u2A7D', '\u0338'},
- "notinE;": {'\u22F9', '\u0338'},
- "notindot;": {'\u22F5', '\u0338'},
- "nparsl;": {'\u2AFD', '\u20E5'},
- "npart;": {'\u2202', '\u0338'},
- "npre;": {'\u2AAF', '\u0338'},
- "npreceq;": {'\u2AAF', '\u0338'},
- "nrarrc;": {'\u2933', '\u0338'},
- "nrarrw;": {'\u219D', '\u0338'},
- "nsce;": {'\u2AB0', '\u0338'},
- "nsubE;": {'\u2AC5', '\u0338'},
- "nsubset;": {'\u2282', '\u20D2'},
- "nsubseteqq;": {'\u2AC5', '\u0338'},
- "nsucceq;": {'\u2AB0', '\u0338'},
- "nsupE;": {'\u2AC6', '\u0338'},
- "nsupset;": {'\u2283', '\u20D2'},
- "nsupseteqq;": {'\u2AC6', '\u0338'},
- "nvap;": {'\u224D', '\u20D2'},
- "nvge;": {'\u2265', '\u20D2'},
- "nvgt;": {'\u003E', '\u20D2'},
- "nvle;": {'\u2264', '\u20D2'},
- "nvlt;": {'\u003C', '\u20D2'},
- "nvltrie;": {'\u22B4', '\u20D2'},
- "nvrtrie;": {'\u22B5', '\u20D2'},
- "nvsim;": {'\u223C', '\u20D2'},
- "race;": {'\u223D', '\u0331'},
- "smtes;": {'\u2AAC', '\uFE00'},
- "sqcaps;": {'\u2293', '\uFE00'},
- "sqcups;": {'\u2294', '\uFE00'},
- "varsubsetneq;": {'\u228A', '\uFE00'},
- "varsubsetneqq;": {'\u2ACB', '\uFE00'},
- "varsupsetneq;": {'\u228B', '\uFE00'},
- "varsupsetneqq;": {'\u2ACC', '\uFE00'},
- "vnsub;": {'\u2282', '\u20D2'},
- "vnsup;": {'\u2283', '\u20D2'},
- "vsubnE;": {'\u2ACB', '\uFE00'},
- "vsubne;": {'\u228A', '\uFE00'},
- "vsupnE;": {'\u2ACC', '\uFE00'},
- "vsupne;": {'\u228B', '\uFE00'},
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/escape.go b/archived/event-adapter/vendor/golang.org/x/net/html/escape.go
deleted file mode 100644
index d85613962..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/escape.go
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-import (
- "bytes"
- "strings"
- "unicode/utf8"
-)
-
-// These replacements permit compatibility with old numeric entities that
-// assumed Windows-1252 encoding.
-// https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference
-var replacementTable = [...]rune{
- '\u20AC', // First entry is what 0x80 should be replaced with.
- '\u0081',
- '\u201A',
- '\u0192',
- '\u201E',
- '\u2026',
- '\u2020',
- '\u2021',
- '\u02C6',
- '\u2030',
- '\u0160',
- '\u2039',
- '\u0152',
- '\u008D',
- '\u017D',
- '\u008F',
- '\u0090',
- '\u2018',
- '\u2019',
- '\u201C',
- '\u201D',
- '\u2022',
- '\u2013',
- '\u2014',
- '\u02DC',
- '\u2122',
- '\u0161',
- '\u203A',
- '\u0153',
- '\u009D',
- '\u017E',
- '\u0178', // Last entry is 0x9F.
- // 0x00->'\uFFFD' is handled programmatically.
- // 0x0D->'\u000D' is a no-op.
-}
-
-// unescapeEntity reads an entity like "<" from b[src:] and writes the
-// corresponding "<" to b[dst:], returning the incremented dst and src cursors.
-// Precondition: b[src] == '&' && dst <= src.
-// attribute should be true if parsing an attribute value.
-func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
- // https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference
-
- // i starts at 1 because we already know that s[0] == '&'.
- i, s := 1, b[src:]
-
- if len(s) <= 1 {
- b[dst] = b[src]
- return dst + 1, src + 1
- }
-
- if s[i] == '#' {
- if len(s) <= 3 { // We need to have at least ".".
- b[dst] = b[src]
- return dst + 1, src + 1
- }
- i++
- c := s[i]
- hex := false
- if c == 'x' || c == 'X' {
- hex = true
- i++
- }
-
- x := '\x00'
- for i < len(s) {
- c = s[i]
- i++
- if hex {
- if '0' <= c && c <= '9' {
- x = 16*x + rune(c) - '0'
- continue
- } else if 'a' <= c && c <= 'f' {
- x = 16*x + rune(c) - 'a' + 10
- continue
- } else if 'A' <= c && c <= 'F' {
- x = 16*x + rune(c) - 'A' + 10
- continue
- }
- } else if '0' <= c && c <= '9' {
- x = 10*x + rune(c) - '0'
- continue
- }
- if c != ';' {
- i--
- }
- break
- }
-
- if i <= 3 { // No characters matched.
- b[dst] = b[src]
- return dst + 1, src + 1
- }
-
- if 0x80 <= x && x <= 0x9F {
- // Replace characters from Windows-1252 with UTF-8 equivalents.
- x = replacementTable[x-0x80]
- } else if x == 0 || (0xD800 <= x && x <= 0xDFFF) || x > 0x10FFFF {
- // Replace invalid characters with the replacement character.
- x = '\uFFFD'
- }
-
- return dst + utf8.EncodeRune(b[dst:], x), src + i
- }
-
- // Consume the maximum number of characters possible, with the
- // consumed characters matching one of the named references.
-
- for i < len(s) {
- c := s[i]
- i++
- // Lower-cased characters are more common in entities, so we check for them first.
- if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c && c <= '9' {
- continue
- }
- if c != ';' {
- i--
- }
- break
- }
-
- entityName := string(s[1:i])
- if entityName == "" {
- // No-op.
- } else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' {
- // No-op.
- } else if x := entity[entityName]; x != 0 {
- return dst + utf8.EncodeRune(b[dst:], x), src + i
- } else if x := entity2[entityName]; x[0] != 0 {
- dst1 := dst + utf8.EncodeRune(b[dst:], x[0])
- return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i
- } else if !attribute {
- maxLen := len(entityName) - 1
- if maxLen > longestEntityWithoutSemicolon {
- maxLen = longestEntityWithoutSemicolon
- }
- for j := maxLen; j > 1; j-- {
- if x := entity[entityName[:j]]; x != 0 {
- return dst + utf8.EncodeRune(b[dst:], x), src + j + 1
- }
- }
- }
-
- dst1, src1 = dst+i, src+i
- copy(b[dst:dst1], b[src:src1])
- return dst1, src1
-}
-
-// unescape unescapes b's entities in-place, so that "a<b" becomes "a':
- esc = ">"
- case '"':
- // """ is shorter than """.
- esc = """
- case '\r':
- esc = "
"
- default:
- panic("unrecognized escape character")
- }
- s = s[i+1:]
- if _, err := w.WriteString(esc); err != nil {
- return err
- }
- i = strings.IndexAny(s, escapedChars)
- }
- _, err := w.WriteString(s)
- return err
-}
-
-// EscapeString escapes special characters like "<" to become "<". It
-// escapes only five such characters: <, >, &, ' and ".
-// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't
-// always true.
-func EscapeString(s string) string {
- if strings.IndexAny(s, escapedChars) == -1 {
- return s
- }
- var buf bytes.Buffer
- escape(&buf, s)
- return buf.String()
-}
-
-// UnescapeString unescapes entities like "<" to become "<". It unescapes a
-// larger range of entities than EscapeString escapes. For example, "á"
-// unescapes to "á", as does "á" and "&xE1;".
-// UnescapeString(EscapeString(s)) == s always holds, but the converse isn't
-// always true.
-func UnescapeString(s string) string {
- for _, c := range s {
- if c == '&' {
- return string(unescape([]byte(s), false))
- }
- }
- return s
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/foreign.go b/archived/event-adapter/vendor/golang.org/x/net/html/foreign.go
deleted file mode 100644
index d3b384409..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/foreign.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-import (
- "strings"
-)
-
-func adjustAttributeNames(aa []Attribute, nameMap map[string]string) {
- for i := range aa {
- if newName, ok := nameMap[aa[i].Key]; ok {
- aa[i].Key = newName
- }
- }
-}
-
-func adjustForeignAttributes(aa []Attribute) {
- for i, a := range aa {
- if a.Key == "" || a.Key[0] != 'x' {
- continue
- }
- switch a.Key {
- case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show",
- "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink":
- j := strings.Index(a.Key, ":")
- aa[i].Namespace = a.Key[:j]
- aa[i].Key = a.Key[j+1:]
- }
- }
-}
-
-func htmlIntegrationPoint(n *Node) bool {
- if n.Type != ElementNode {
- return false
- }
- switch n.Namespace {
- case "math":
- if n.Data == "annotation-xml" {
- for _, a := range n.Attr {
- if a.Key == "encoding" {
- val := strings.ToLower(a.Val)
- if val == "text/html" || val == "application/xhtml+xml" {
- return true
- }
- }
- }
- }
- case "svg":
- switch n.Data {
- case "desc", "foreignObject", "title":
- return true
- }
- }
- return false
-}
-
-func mathMLTextIntegrationPoint(n *Node) bool {
- if n.Namespace != "math" {
- return false
- }
- switch n.Data {
- case "mi", "mo", "mn", "ms", "mtext":
- return true
- }
- return false
-}
-
-// Section 12.2.5.5.
-var breakout = map[string]bool{
- "b": true,
- "big": true,
- "blockquote": true,
- "body": true,
- "br": true,
- "center": true,
- "code": true,
- "dd": true,
- "div": true,
- "dl": true,
- "dt": true,
- "em": true,
- "embed": true,
- "h1": true,
- "h2": true,
- "h3": true,
- "h4": true,
- "h5": true,
- "h6": true,
- "head": true,
- "hr": true,
- "i": true,
- "img": true,
- "li": true,
- "listing": true,
- "menu": true,
- "meta": true,
- "nobr": true,
- "ol": true,
- "p": true,
- "pre": true,
- "ruby": true,
- "s": true,
- "small": true,
- "span": true,
- "strong": true,
- "strike": true,
- "sub": true,
- "sup": true,
- "table": true,
- "tt": true,
- "u": true,
- "ul": true,
- "var": true,
-}
-
-// Section 12.2.5.5.
-var svgTagNameAdjustments = map[string]string{
- "altglyph": "altGlyph",
- "altglyphdef": "altGlyphDef",
- "altglyphitem": "altGlyphItem",
- "animatecolor": "animateColor",
- "animatemotion": "animateMotion",
- "animatetransform": "animateTransform",
- "clippath": "clipPath",
- "feblend": "feBlend",
- "fecolormatrix": "feColorMatrix",
- "fecomponenttransfer": "feComponentTransfer",
- "fecomposite": "feComposite",
- "feconvolvematrix": "feConvolveMatrix",
- "fediffuselighting": "feDiffuseLighting",
- "fedisplacementmap": "feDisplacementMap",
- "fedistantlight": "feDistantLight",
- "feflood": "feFlood",
- "fefunca": "feFuncA",
- "fefuncb": "feFuncB",
- "fefuncg": "feFuncG",
- "fefuncr": "feFuncR",
- "fegaussianblur": "feGaussianBlur",
- "feimage": "feImage",
- "femerge": "feMerge",
- "femergenode": "feMergeNode",
- "femorphology": "feMorphology",
- "feoffset": "feOffset",
- "fepointlight": "fePointLight",
- "fespecularlighting": "feSpecularLighting",
- "fespotlight": "feSpotLight",
- "fetile": "feTile",
- "feturbulence": "feTurbulence",
- "foreignobject": "foreignObject",
- "glyphref": "glyphRef",
- "lineargradient": "linearGradient",
- "radialgradient": "radialGradient",
- "textpath": "textPath",
-}
-
-// Section 12.2.5.1
-var mathMLAttributeAdjustments = map[string]string{
- "definitionurl": "definitionURL",
-}
-
-var svgAttributeAdjustments = map[string]string{
- "attributename": "attributeName",
- "attributetype": "attributeType",
- "basefrequency": "baseFrequency",
- "baseprofile": "baseProfile",
- "calcmode": "calcMode",
- "clippathunits": "clipPathUnits",
- "contentscripttype": "contentScriptType",
- "contentstyletype": "contentStyleType",
- "diffuseconstant": "diffuseConstant",
- "edgemode": "edgeMode",
- "externalresourcesrequired": "externalResourcesRequired",
- "filterres": "filterRes",
- "filterunits": "filterUnits",
- "glyphref": "glyphRef",
- "gradienttransform": "gradientTransform",
- "gradientunits": "gradientUnits",
- "kernelmatrix": "kernelMatrix",
- "kernelunitlength": "kernelUnitLength",
- "keypoints": "keyPoints",
- "keysplines": "keySplines",
- "keytimes": "keyTimes",
- "lengthadjust": "lengthAdjust",
- "limitingconeangle": "limitingConeAngle",
- "markerheight": "markerHeight",
- "markerunits": "markerUnits",
- "markerwidth": "markerWidth",
- "maskcontentunits": "maskContentUnits",
- "maskunits": "maskUnits",
- "numoctaves": "numOctaves",
- "pathlength": "pathLength",
- "patterncontentunits": "patternContentUnits",
- "patterntransform": "patternTransform",
- "patternunits": "patternUnits",
- "pointsatx": "pointsAtX",
- "pointsaty": "pointsAtY",
- "pointsatz": "pointsAtZ",
- "preservealpha": "preserveAlpha",
- "preserveaspectratio": "preserveAspectRatio",
- "primitiveunits": "primitiveUnits",
- "refx": "refX",
- "refy": "refY",
- "repeatcount": "repeatCount",
- "repeatdur": "repeatDur",
- "requiredextensions": "requiredExtensions",
- "requiredfeatures": "requiredFeatures",
- "specularconstant": "specularConstant",
- "specularexponent": "specularExponent",
- "spreadmethod": "spreadMethod",
- "startoffset": "startOffset",
- "stddeviation": "stdDeviation",
- "stitchtiles": "stitchTiles",
- "surfacescale": "surfaceScale",
- "systemlanguage": "systemLanguage",
- "tablevalues": "tableValues",
- "targetx": "targetX",
- "targety": "targetY",
- "textlength": "textLength",
- "viewbox": "viewBox",
- "viewtarget": "viewTarget",
- "xchannelselector": "xChannelSelector",
- "ychannelselector": "yChannelSelector",
- "zoomandpan": "zoomAndPan",
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/node.go b/archived/event-adapter/vendor/golang.org/x/net/html/node.go
deleted file mode 100644
index 26b657aec..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/node.go
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-import (
- "golang.org/x/net/html/atom"
-)
-
-// A NodeType is the type of a Node.
-type NodeType uint32
-
-const (
- ErrorNode NodeType = iota
- TextNode
- DocumentNode
- ElementNode
- CommentNode
- DoctypeNode
- scopeMarkerNode
-)
-
-// Section 12.2.3.3 says "scope markers are inserted when entering applet
-// elements, buttons, object elements, marquees, table cells, and table
-// captions, and are used to prevent formatting from 'leaking'".
-var scopeMarker = Node{Type: scopeMarkerNode}
-
-// A Node consists of a NodeType and some Data (tag name for element nodes,
-// content for text) and are part of a tree of Nodes. Element nodes may also
-// have a Namespace and contain a slice of Attributes. Data is unescaped, so
-// that it looks like "a 0 {
- return (*s)[i-1]
- }
- return nil
-}
-
-// index returns the index of the top-most occurrence of n in the stack, or -1
-// if n is not present.
-func (s *nodeStack) index(n *Node) int {
- for i := len(*s) - 1; i >= 0; i-- {
- if (*s)[i] == n {
- return i
- }
- }
- return -1
-}
-
-// insert inserts a node at the given index.
-func (s *nodeStack) insert(i int, n *Node) {
- (*s) = append(*s, nil)
- copy((*s)[i+1:], (*s)[i:])
- (*s)[i] = n
-}
-
-// remove removes a node from the stack. It is a no-op if n is not present.
-func (s *nodeStack) remove(n *Node) {
- i := s.index(n)
- if i == -1 {
- return
- }
- copy((*s)[i:], (*s)[i+1:])
- j := len(*s) - 1
- (*s)[j] = nil
- *s = (*s)[:j]
-}
diff --git a/archived/event-adapter/vendor/golang.org/x/net/html/parse.go b/archived/event-adapter/vendor/golang.org/x/net/html/parse.go
deleted file mode 100644
index be4b2bf5a..000000000
--- a/archived/event-adapter/vendor/golang.org/x/net/html/parse.go
+++ /dev/null
@@ -1,2094 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package html
-
-import (
- "errors"
- "fmt"
- "io"
- "strings"
-
- a "golang.org/x/net/html/atom"
-)
-
-// A parser implements the HTML5 parsing algorithm:
-// https://html.spec.whatwg.org/multipage/syntax.html#tree-construction
-type parser struct {
- // tokenizer provides the tokens for the parser.
- tokenizer *Tokenizer
- // tok is the most recently read token.
- tok Token
- // Self-closing tags like
are treated as start tags, except that
- // hasSelfClosingToken is set while they are being processed.
- hasSelfClosingToken bool
- // doc is the document root element.
- doc *Node
- // The stack of open elements (section 12.2.3.2) and active formatting
- // elements (section 12.2.3.3).
- oe, afe nodeStack
- // Element pointers (section 12.2.3.4).
- head, form *Node
- // Other parsing state flags (section 12.2.3.5).
- scripting, framesetOK bool
- // im is the current insertion mode.
- im insertionMode
- // originalIM is the insertion mode to go back to after completing a text
- // or inTableText insertion mode.
- originalIM insertionMode
- // fosterParenting is whether new elements should be inserted according to
- // the foster parenting rules (section 12.2.5.3).
- fosterParenting bool
- // quirks is whether the parser is operating in "quirks mode."
- quirks bool
- // fragment is whether the parser is parsing an HTML fragment.
- fragment bool
- // context is the context element when parsing an HTML fragment
- // (section 12.4).
- context *Node
-}
-
-func (p *parser) top() *Node {
- if n := p.oe.top(); n != nil {
- return n
- }
- return p.doc
-}
-
-// Stop tags for use in popUntil. These come from section 12.2.3.2.
-var (
- defaultScopeStopTags = map[string][]a.Atom{
- "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template},
- "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext},
- "svg": {a.Desc, a.ForeignObject, a.Title},
- }
-)
-
-type scope int
-
-const (
- defaultScope scope = iota
- listItemScope
- buttonScope
- tableScope
- tableRowScope
- tableBodyScope
- selectScope
-)
-
-// popUntil pops the stack of open elements at the highest element whose tag
-// is in matchTags, provided there is no higher element in the scope's stop
-// tags (as defined in section 12.2.3.2). It returns whether or not there was
-// such an element. If there was not, popUntil leaves the stack unchanged.
-//
-// For example, the set of stop tags for table scope is: "html", "table". If
-// the stack was:
-// ["html", "body", "font", "table", "b", "i", "u"]
-// then popUntil(tableScope, "font") would return false, but
-// popUntil(tableScope, "i") would return true and the stack would become:
-// ["html", "body", "font", "table", "b"]
-//
-// If an element's tag is in both the stop tags and matchTags, then the stack
-// will be popped and the function returns true (provided, of course, there was
-// no higher element in the stack that was also in the stop tags). For example,
-// popUntil(tableScope, "table") returns true and leaves:
-// ["html", "body", "font"]
-func (p *parser) popUntil(s scope, matchTags ...a.Atom) bool {
- if i := p.indexOfElementInScope(s, matchTags...); i != -1 {
- p.oe = p.oe[:i]
- return true
- }
- return false
-}
-
-// indexOfElementInScope returns the index in p.oe of the highest element whose
-// tag is in matchTags that is in scope. If no matching element is in scope, it
-// returns -1.
-func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int {
- for i := len(p.oe) - 1; i >= 0; i-- {
- tagAtom := p.oe[i].DataAtom
- if p.oe[i].Namespace == "" {
- for _, t := range matchTags {
- if t == tagAtom {
- return i
- }
- }
- switch s {
- case defaultScope:
- // No-op.
- case listItemScope:
- if tagAtom == a.Ol || tagAtom == a.Ul {
- return -1
- }
- case buttonScope:
- if tagAtom == a.Button {
- return -1
- }
- case tableScope:
- if tagAtom == a.Html || tagAtom == a.Table {
- return -1
- }
- case selectScope:
- if tagAtom != a.Optgroup && tagAtom != a.Option {
- return -1
- }
- default:
- panic("unreachable")
- }
- }
- switch s {
- case defaultScope, listItemScope, buttonScope:
- for _, t := range defaultScopeStopTags[p.oe[i].Namespace] {
- if t == tagAtom {
- return -1
- }
- }
- }
- }
- return -1
-}
-
-// elementInScope is like popUntil, except that it doesn't modify the stack of
-// open elements.
-func (p *parser) elementInScope(s scope, matchTags ...a.Atom) bool {
- return p.indexOfElementInScope(s, matchTags...) != -1
-}
-
-// clearStackToContext pops elements off the stack of open elements until a
-// scope-defined element is found.
-func (p *parser) clearStackToContext(s scope) {
- for i := len(p.oe) - 1; i >= 0; i-- {
- tagAtom := p.oe[i].DataAtom
- switch s {
- case tableScope:
- if tagAtom == a.Html || tagAtom == a.Table {
- p.oe = p.oe[:i+1]
- return
- }
- case tableRowScope:
- if tagAtom == a.Html || tagAtom == a.Tr {
- p.oe = p.oe[:i+1]
- return
- }
- case tableBodyScope:
- if tagAtom == a.Html || tagAtom == a.Tbody || tagAtom == a.Tfoot || tagAtom == a.Thead {
- p.oe = p.oe[:i+1]
- return
- }
- default:
- panic("unreachable")
- }
- }
-}
-
-// generateImpliedEndTags pops nodes off the stack of open elements as long as
-// the top node has a tag name of dd, dt, li, option, optgroup, p, rp, or rt.
-// If exceptions are specified, nodes with that name will not be popped off.
-func (p *parser) generateImpliedEndTags(exceptions ...string) {
- var i int
-loop:
- for i = len(p.oe) - 1; i >= 0; i-- {
- n := p.oe[i]
- if n.Type == ElementNode {
- switch n.DataAtom {
- case a.Dd, a.Dt, a.Li, a.Option, a.Optgroup, a.P, a.Rp, a.Rt:
- for _, except := range exceptions {
- if n.Data == except {
- break loop
- }
- }
- continue
- }
- }
- break
- }
-
- p.oe = p.oe[:i+1]
-}
-
-// addChild adds a child node n to the top element, and pushes n onto the stack
-// of open elements if it is an element node.
-func (p *parser) addChild(n *Node) {
- if p.shouldFosterParent() {
- p.fosterParent(n)
- } else {
- p.top().AppendChild(n)
- }
-
- if n.Type == ElementNode {
- p.oe = append(p.oe, n)
- }
-}
-
-// shouldFosterParent returns whether the next node to be added should be
-// foster parented.
-func (p *parser) shouldFosterParent() bool {
- if p.fosterParenting {
- switch p.top().DataAtom {
- case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
- return true
- }
- }
- return false
-}
-
-// fosterParent adds a child node according to the foster parenting rules.
-// Section 12.2.5.3, "foster parenting".
-func (p *parser) fosterParent(n *Node) {
- var table, parent, prev *Node
- var i int
- for i = len(p.oe) - 1; i >= 0; i-- {
- if p.oe[i].DataAtom == a.Table {
- table = p.oe[i]
- break
- }
- }
-
- if table == nil {
- // The foster parent is the html element.
- parent = p.oe[0]
- } else {
- parent = table.Parent
- }
- if parent == nil {
- parent = p.oe[i-1]
- }
-
- if table != nil {
- prev = table.PrevSibling
- } else {
- prev = parent.LastChild
- }
- if prev != nil && prev.Type == TextNode && n.Type == TextNode {
- prev.Data += n.Data
- return
- }
-
- parent.InsertBefore(n, table)
-}
-
-// addText adds text to the preceding node if it is a text node, or else it
-// calls addChild with a new text node.
-func (p *parser) addText(text string) {
- if text == "" {
- return
- }
-
- if p.shouldFosterParent() {
- p.fosterParent(&Node{
- Type: TextNode,
- Data: text,
- })
- return
- }
-
- t := p.top()
- if n := t.LastChild; n != nil && n.Type == TextNode {
- n.Data += text
- return
- }
- p.addChild(&Node{
- Type: TextNode,
- Data: text,
- })
-}
-
-// addElement adds a child element based on the current token.
-func (p *parser) addElement() {
- p.addChild(&Node{
- Type: ElementNode,
- DataAtom: p.tok.DataAtom,
- Data: p.tok.Data,
- Attr: p.tok.Attr,
- })
-}
-
-// Section 12.2.3.3.
-func (p *parser) addFormattingElement() {
- tagAtom, attr := p.tok.DataAtom, p.tok.Attr
- p.addElement()
-
- // Implement the Noah's Ark clause, but with three per family instead of two.
- identicalElements := 0
-findIdenticalElements:
- for i := len(p.afe) - 1; i >= 0; i-- {
- n := p.afe[i]
- if n.Type == scopeMarkerNode {
- break
- }
- if n.Type != ElementNode {
- continue
- }
- if n.Namespace != "" {
- continue
- }
- if n.DataAtom != tagAtom {
- continue
- }
- if len(n.Attr) != len(attr) {
- continue
- }
- compareAttributes:
- for _, t0 := range n.Attr {
- for _, t1 := range attr {
- if t0.Key == t1.Key && t0.Namespace == t1.Namespace && t0.Val == t1.Val {
- // Found a match for this attribute, continue with the next attribute.
- continue compareAttributes
- }
- }
- // If we get here, there is no attribute that matches a.
- // Therefore the element is not identical to the new one.
- continue findIdenticalElements
- }
-
- identicalElements++
- if identicalElements >= 3 {
- p.afe.remove(n)
- }
- }
-
- p.afe = append(p.afe, p.top())
-}
-
-// Section 12.2.3.3.
-func (p *parser) clearActiveFormattingElements() {
- for {
- n := p.afe.pop()
- if len(p.afe) == 0 || n.Type == scopeMarkerNode {
- return
- }
- }
-}
-
-// Section 12.2.3.3.
-func (p *parser) reconstructActiveFormattingElements() {
- n := p.afe.top()
- if n == nil {
- return
- }
- if n.Type == scopeMarkerNode || p.oe.index(n) != -1 {
- return
- }
- i := len(p.afe) - 1
- for n.Type != scopeMarkerNode && p.oe.index(n) == -1 {
- if i == 0 {
- i = -1
- break
- }
- i--
- n = p.afe[i]
- }
- for {
- i++
- clone := p.afe[i].clone()
- p.addChild(clone)
- p.afe[i] = clone
- if i == len(p.afe)-1 {
- break
- }
- }
-}
-
-// Section 12.2.4.
-func (p *parser) acknowledgeSelfClosingTag() {
- p.hasSelfClosingToken = false
-}
-
-// An insertion mode (section 12.2.3.1) is the state transition function from
-// a particular state in the HTML5 parser's state machine. It updates the
-// parser's fields depending on parser.tok (where ErrorToken means EOF).
-// It returns whether the token was consumed.
-type insertionMode func(*parser) bool
-
-// setOriginalIM sets the insertion mode to return to after completing a text or
-// inTableText insertion mode.
-// Section 12.2.3.1, "using the rules for".
-func (p *parser) setOriginalIM() {
- if p.originalIM != nil {
- panic("html: bad parser state: originalIM was set twice")
- }
- p.originalIM = p.im
-}
-
-// Section 12.2.3.1, "reset the insertion mode".
-func (p *parser) resetInsertionMode() {
- for i := len(p.oe) - 1; i >= 0; i-- {
- n := p.oe[i]
- if i == 0 && p.context != nil {
- n = p.context
- }
-
- switch n.DataAtom {
- case a.Select:
- p.im = inSelectIM
- case a.Td, a.Th:
- p.im = inCellIM
- case a.Tr:
- p.im = inRowIM
- case a.Tbody, a.Thead, a.Tfoot:
- p.im = inTableBodyIM
- case a.Caption:
- p.im = inCaptionIM
- case a.Colgroup:
- p.im = inColumnGroupIM
- case a.Table:
- p.im = inTableIM
- case a.Head:
- p.im = inBodyIM
- case a.Body:
- p.im = inBodyIM
- case a.Frameset:
- p.im = inFramesetIM
- case a.Html:
- p.im = beforeHeadIM
- default:
- continue
- }
- return
- }
- p.im = inBodyIM
-}
-
-const whitespace = " \t\r\n\f"
-
-// Section 12.2.5.4.1.
-func initialIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace)
- if len(p.tok.Data) == 0 {
- // It was all whitespace, so ignore it.
- return true
- }
- case CommentToken:
- p.doc.AppendChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- return true
- case DoctypeToken:
- n, quirks := parseDoctype(p.tok.Data)
- p.doc.AppendChild(n)
- p.quirks = quirks
- p.im = beforeHTMLIM
- return true
- }
- p.quirks = true
- p.im = beforeHTMLIM
- return false
-}
-
-// Section 12.2.5.4.2.
-func beforeHTMLIM(p *parser) bool {
- switch p.tok.Type {
- case DoctypeToken:
- // Ignore the token.
- return true
- case TextToken:
- p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace)
- if len(p.tok.Data) == 0 {
- // It was all whitespace, so ignore it.
- return true
- }
- case StartTagToken:
- if p.tok.DataAtom == a.Html {
- p.addElement()
- p.im = beforeHeadIM
- return true
- }
- case EndTagToken:
- switch p.tok.DataAtom {
- case a.Head, a.Body, a.Html, a.Br:
- p.parseImpliedToken(StartTagToken, a.Html, a.Html.String())
- return false
- default:
- // Ignore the token.
- return true
- }
- case CommentToken:
- p.doc.AppendChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- return true
- }
- p.parseImpliedToken(StartTagToken, a.Html, a.Html.String())
- return false
-}
-
-// Section 12.2.5.4.3.
-func beforeHeadIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- p.tok.Data = strings.TrimLeft(p.tok.Data, whitespace)
- if len(p.tok.Data) == 0 {
- // It was all whitespace, so ignore it.
- return true
- }
- case StartTagToken:
- switch p.tok.DataAtom {
- case a.Head:
- p.addElement()
- p.head = p.top()
- p.im = inHeadIM
- return true
- case a.Html:
- return inBodyIM(p)
- }
- case EndTagToken:
- switch p.tok.DataAtom {
- case a.Head, a.Body, a.Html, a.Br:
- p.parseImpliedToken(StartTagToken, a.Head, a.Head.String())
- return false
- default:
- // Ignore the token.
- return true
- }
- case CommentToken:
- p.addChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- return true
- case DoctypeToken:
- // Ignore the token.
- return true
- }
-
- p.parseImpliedToken(StartTagToken, a.Head, a.Head.String())
- return false
-}
-
-// Section 12.2.5.4.4.
-func inHeadIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- s := strings.TrimLeft(p.tok.Data, whitespace)
- if len(s) < len(p.tok.Data) {
- // Add the initial whitespace to the current node.
- p.addText(p.tok.Data[:len(p.tok.Data)-len(s)])
- if s == "" {
- return true
- }
- p.tok.Data = s
- }
- case StartTagToken:
- switch p.tok.DataAtom {
- case a.Html:
- return inBodyIM(p)
- case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta:
- p.addElement()
- p.oe.pop()
- p.acknowledgeSelfClosingTag()
- return true
- case a.Script, a.Title, a.Noscript, a.Noframes, a.Style:
- p.addElement()
- p.setOriginalIM()
- p.im = textIM
- return true
- case a.Head:
- // Ignore the token.
- return true
- }
- case EndTagToken:
- switch p.tok.DataAtom {
- case a.Head:
- n := p.oe.pop()
- if n.DataAtom != a.Head {
- panic("html: bad parser state: element not found, in the in-head insertion mode")
- }
- p.im = afterHeadIM
- return true
- case a.Body, a.Html, a.Br:
- p.parseImpliedToken(EndTagToken, a.Head, a.Head.String())
- return false
- default:
- // Ignore the token.
- return true
- }
- case CommentToken:
- p.addChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- return true
- case DoctypeToken:
- // Ignore the token.
- return true
- }
-
- p.parseImpliedToken(EndTagToken, a.Head, a.Head.String())
- return false
-}
-
-// Section 12.2.5.4.6.
-func afterHeadIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- s := strings.TrimLeft(p.tok.Data, whitespace)
- if len(s) < len(p.tok.Data) {
- // Add the initial whitespace to the current node.
- p.addText(p.tok.Data[:len(p.tok.Data)-len(s)])
- if s == "" {
- return true
- }
- p.tok.Data = s
- }
- case StartTagToken:
- switch p.tok.DataAtom {
- case a.Html:
- return inBodyIM(p)
- case a.Body:
- p.addElement()
- p.framesetOK = false
- p.im = inBodyIM
- return true
- case a.Frameset:
- p.addElement()
- p.im = inFramesetIM
- return true
- case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
- p.oe = append(p.oe, p.head)
- defer p.oe.remove(p.head)
- return inHeadIM(p)
- case a.Head:
- // Ignore the token.
- return true
- }
- case EndTagToken:
- switch p.tok.DataAtom {
- case a.Body, a.Html, a.Br:
- // Drop down to creating an implied tag.
- default:
- // Ignore the token.
- return true
- }
- case CommentToken:
- p.addChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- return true
- case DoctypeToken:
- // Ignore the token.
- return true
- }
-
- p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
- p.framesetOK = true
- return false
-}
-
-// copyAttributes copies attributes of src not found on dst to dst.
-func copyAttributes(dst *Node, src Token) {
- if len(src.Attr) == 0 {
- return
- }
- attr := map[string]string{}
- for _, t := range dst.Attr {
- attr[t.Key] = t.Val
- }
- for _, t := range src.Attr {
- if _, ok := attr[t.Key]; !ok {
- dst.Attr = append(dst.Attr, t)
- attr[t.Key] = t.Val
- }
- }
-}
-
-// Section 12.2.5.4.7.
-func inBodyIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- d := p.tok.Data
- switch n := p.oe.top(); n.DataAtom {
- case a.Pre, a.Listing:
- if n.FirstChild == nil {
- // Ignore a newline at the start of a block.
- if d != "" && d[0] == '\r' {
- d = d[1:]
- }
- if d != "" && d[0] == '\n' {
- d = d[1:]
- }
- }
- }
- d = strings.Replace(d, "\x00", "", -1)
- if d == "" {
- return true
- }
- p.reconstructActiveFormattingElements()
- p.addText(d)
- if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
- // There were non-whitespace characters inserted.
- p.framesetOK = false
- }
- case StartTagToken:
- switch p.tok.DataAtom {
- case a.Html:
- copyAttributes(p.oe[0], p.tok)
- case a.Base, a.Basefont, a.Bgsound, a.Command, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
- return inHeadIM(p)
- case a.Body:
- if len(p.oe) >= 2 {
- body := p.oe[1]
- if body.Type == ElementNode && body.DataAtom == a.Body {
- p.framesetOK = false
- copyAttributes(body, p.tok)
- }
- }
- case a.Frameset:
- if !p.framesetOK || len(p.oe) < 2 || p.oe[1].DataAtom != a.Body {
- // Ignore the token.
- return true
- }
- body := p.oe[1]
- if body.Parent != nil {
- body.Parent.RemoveChild(body)
- }
- p.oe = p.oe[:1]
- p.addElement()
- p.im = inFramesetIM
- return true
- case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul:
- p.popUntil(buttonScope, a.P)
- p.addElement()
- case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
- p.popUntil(buttonScope, a.P)
- switch n := p.top(); n.DataAtom {
- case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
- p.oe.pop()
- }
- p.addElement()
- case a.Pre, a.Listing:
- p.popUntil(buttonScope, a.P)
- p.addElement()
- // The newline, if any, will be dealt with by the TextToken case.
- p.framesetOK = false
- case a.Form:
- if p.form == nil {
- p.popUntil(buttonScope, a.P)
- p.addElement()
- p.form = p.top()
- }
- case a.Li:
- p.framesetOK = false
- for i := len(p.oe) - 1; i >= 0; i-- {
- node := p.oe[i]
- switch node.DataAtom {
- case a.Li:
- p.oe = p.oe[:i]
- case a.Address, a.Div, a.P:
- continue
- default:
- if !isSpecialElement(node) {
- continue
- }
- }
- break
- }
- p.popUntil(buttonScope, a.P)
- p.addElement()
- case a.Dd, a.Dt:
- p.framesetOK = false
- for i := len(p.oe) - 1; i >= 0; i-- {
- node := p.oe[i]
- switch node.DataAtom {
- case a.Dd, a.Dt:
- p.oe = p.oe[:i]
- case a.Address, a.Div, a.P:
- continue
- default:
- if !isSpecialElement(node) {
- continue
- }
- }
- break
- }
- p.popUntil(buttonScope, a.P)
- p.addElement()
- case a.Plaintext:
- p.popUntil(buttonScope, a.P)
- p.addElement()
- case a.Button:
- p.popUntil(defaultScope, a.Button)
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.framesetOK = false
- case a.A:
- for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- {
- if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A {
- p.inBodyEndTagFormatting(a.A)
- p.oe.remove(n)
- p.afe.remove(n)
- break
- }
- }
- p.reconstructActiveFormattingElements()
- p.addFormattingElement()
- case a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
- p.reconstructActiveFormattingElements()
- p.addFormattingElement()
- case a.Nobr:
- p.reconstructActiveFormattingElements()
- if p.elementInScope(defaultScope, a.Nobr) {
- p.inBodyEndTagFormatting(a.Nobr)
- p.reconstructActiveFormattingElements()
- }
- p.addFormattingElement()
- case a.Applet, a.Marquee, a.Object:
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.afe = append(p.afe, &scopeMarker)
- p.framesetOK = false
- case a.Table:
- if !p.quirks {
- p.popUntil(buttonScope, a.P)
- }
- p.addElement()
- p.framesetOK = false
- p.im = inTableIM
- return true
- case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr:
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.oe.pop()
- p.acknowledgeSelfClosingTag()
- if p.tok.DataAtom == a.Input {
- for _, t := range p.tok.Attr {
- if t.Key == "type" {
- if strings.ToLower(t.Val) == "hidden" {
- // Skip setting framesetOK = false
- return true
- }
- }
- }
- }
- p.framesetOK = false
- case a.Param, a.Source, a.Track:
- p.addElement()
- p.oe.pop()
- p.acknowledgeSelfClosingTag()
- case a.Hr:
- p.popUntil(buttonScope, a.P)
- p.addElement()
- p.oe.pop()
- p.acknowledgeSelfClosingTag()
- p.framesetOK = false
- case a.Image:
- p.tok.DataAtom = a.Img
- p.tok.Data = a.Img.String()
- return false
- case a.Isindex:
- if p.form != nil {
- // Ignore the token.
- return true
- }
- action := ""
- prompt := "This is a searchable index. Enter search keywords: "
- attr := []Attribute{{Key: "name", Val: "isindex"}}
- for _, t := range p.tok.Attr {
- switch t.Key {
- case "action":
- action = t.Val
- case "name":
- // Ignore the attribute.
- case "prompt":
- prompt = t.Val
- default:
- attr = append(attr, t)
- }
- }
- p.acknowledgeSelfClosingTag()
- p.popUntil(buttonScope, a.P)
- p.parseImpliedToken(StartTagToken, a.Form, a.Form.String())
- if action != "" {
- p.form.Attr = []Attribute{{Key: "action", Val: action}}
- }
- p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
- p.parseImpliedToken(StartTagToken, a.Label, a.Label.String())
- p.addText(prompt)
- p.addChild(&Node{
- Type: ElementNode,
- DataAtom: a.Input,
- Data: a.Input.String(),
- Attr: attr,
- })
- p.oe.pop()
- p.parseImpliedToken(EndTagToken, a.Label, a.Label.String())
- p.parseImpliedToken(StartTagToken, a.Hr, a.Hr.String())
- p.parseImpliedToken(EndTagToken, a.Form, a.Form.String())
- case a.Textarea:
- p.addElement()
- p.setOriginalIM()
- p.framesetOK = false
- p.im = textIM
- case a.Xmp:
- p.popUntil(buttonScope, a.P)
- p.reconstructActiveFormattingElements()
- p.framesetOK = false
- p.addElement()
- p.setOriginalIM()
- p.im = textIM
- case a.Iframe:
- p.framesetOK = false
- p.addElement()
- p.setOriginalIM()
- p.im = textIM
- case a.Noembed, a.Noscript:
- p.addElement()
- p.setOriginalIM()
- p.im = textIM
- case a.Select:
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.framesetOK = false
- p.im = inSelectIM
- return true
- case a.Optgroup, a.Option:
- if p.top().DataAtom == a.Option {
- p.oe.pop()
- }
- p.reconstructActiveFormattingElements()
- p.addElement()
- case a.Rp, a.Rt:
- if p.elementInScope(defaultScope, a.Ruby) {
- p.generateImpliedEndTags()
- }
- p.addElement()
- case a.Math, a.Svg:
- p.reconstructActiveFormattingElements()
- if p.tok.DataAtom == a.Math {
- adjustAttributeNames(p.tok.Attr, mathMLAttributeAdjustments)
- } else {
- adjustAttributeNames(p.tok.Attr, svgAttributeAdjustments)
- }
- adjustForeignAttributes(p.tok.Attr)
- p.addElement()
- p.top().Namespace = p.tok.Data
- if p.hasSelfClosingToken {
- p.oe.pop()
- p.acknowledgeSelfClosingTag()
- }
- return true
- case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
- // Ignore the token.
- default:
- p.reconstructActiveFormattingElements()
- p.addElement()
- }
- case EndTagToken:
- switch p.tok.DataAtom {
- case a.Body:
- if p.elementInScope(defaultScope, a.Body) {
- p.im = afterBodyIM
- }
- case a.Html:
- if p.elementInScope(defaultScope, a.Body) {
- p.parseImpliedToken(EndTagToken, a.Body, a.Body.String())
- return false
- }
- return true
- case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul:
- p.popUntil(defaultScope, p.tok.DataAtom)
- case a.Form:
- node := p.form
- p.form = nil
- i := p.indexOfElementInScope(defaultScope, a.Form)
- if node == nil || i == -1 || p.oe[i] != node {
- // Ignore the token.
- return true
- }
- p.generateImpliedEndTags()
- p.oe.remove(node)
- case a.P:
- if !p.elementInScope(buttonScope, a.P) {
- p.parseImpliedToken(StartTagToken, a.P, a.P.String())
- }
- p.popUntil(buttonScope, a.P)
- case a.Li:
- p.popUntil(listItemScope, a.Li)
- case a.Dd, a.Dt:
- p.popUntil(defaultScope, p.tok.DataAtom)
- case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
- p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6)
- case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U:
- p.inBodyEndTagFormatting(p.tok.DataAtom)
- case a.Applet, a.Marquee, a.Object:
- if p.popUntil(defaultScope, p.tok.DataAtom) {
- p.clearActiveFormattingElements()
- }
- case a.Br:
- p.tok.Type = StartTagToken
- return false
- default:
- p.inBodyEndTagOther(p.tok.DataAtom)
- }
- case CommentToken:
- p.addChild(&Node{
- Type: CommentNode,
- Data: p.tok.Data,
- })
- }
-
- return true
-}
-
-func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
- // This is the "adoption agency" algorithm, described at
- // https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency
-
- // TODO: this is a fairly literal line-by-line translation of that algorithm.
- // Once the code successfully parses the comprehensive test suite, we should
- // refactor this code to be more idiomatic.
-
- // Steps 1-4. The outer loop.
- for i := 0; i < 8; i++ {
- // Step 5. Find the formatting element.
- var formattingElement *Node
- for j := len(p.afe) - 1; j >= 0; j-- {
- if p.afe[j].Type == scopeMarkerNode {
- break
- }
- if p.afe[j].DataAtom == tagAtom {
- formattingElement = p.afe[j]
- break
- }
- }
- if formattingElement == nil {
- p.inBodyEndTagOther(tagAtom)
- return
- }
- feIndex := p.oe.index(formattingElement)
- if feIndex == -1 {
- p.afe.remove(formattingElement)
- return
- }
- if !p.elementInScope(defaultScope, tagAtom) {
- // Ignore the tag.
- return
- }
-
- // Steps 9-10. Find the furthest block.
- var furthestBlock *Node
- for _, e := range p.oe[feIndex:] {
- if isSpecialElement(e) {
- furthestBlock = e
- break
- }
- }
- if furthestBlock == nil {
- e := p.oe.pop()
- for e != formattingElement {
- e = p.oe.pop()
- }
- p.afe.remove(e)
- return
- }
-
- // Steps 11-12. Find the common ancestor and bookmark node.
- commonAncestor := p.oe[feIndex-1]
- bookmark := p.afe.index(formattingElement)
-
- // Step 13. The inner loop. Find the lastNode to reparent.
- lastNode := furthestBlock
- node := furthestBlock
- x := p.oe.index(node)
- // Steps 13.1-13.2
- for j := 0; j < 3; j++ {
- // Step 13.3.
- x--
- node = p.oe[x]
- // Step 13.4 - 13.5.
- if p.afe.index(node) == -1 {
- p.oe.remove(node)
- continue
- }
- // Step 13.6.
- if node == formattingElement {
- break
- }
- // Step 13.7.
- clone := node.clone()
- p.afe[p.afe.index(node)] = clone
- p.oe[p.oe.index(node)] = clone
- node = clone
- // Step 13.8.
- if lastNode == furthestBlock {
- bookmark = p.afe.index(node) + 1
- }
- // Step 13.9.
- if lastNode.Parent != nil {
- lastNode.Parent.RemoveChild(lastNode)
- }
- node.AppendChild(lastNode)
- // Step 13.10.
- lastNode = node
- }
-
- // Step 14. Reparent lastNode to the common ancestor,
- // or for misnested table nodes, to the foster parent.
- if lastNode.Parent != nil {
- lastNode.Parent.RemoveChild(lastNode)
- }
- switch commonAncestor.DataAtom {
- case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
- p.fosterParent(lastNode)
- default:
- commonAncestor.AppendChild(lastNode)
- }
-
- // Steps 15-17. Reparent nodes from the furthest block's children
- // to a clone of the formatting element.
- clone := formattingElement.clone()
- reparentChildren(clone, furthestBlock)
- furthestBlock.AppendChild(clone)
-
- // Step 18. Fix up the list of active formatting elements.
- if oldLoc := p.afe.index(formattingElement); oldLoc != -1 && oldLoc < bookmark {
- // Move the bookmark with the rest of the list.
- bookmark--
- }
- p.afe.remove(formattingElement)
- p.afe.insert(bookmark, clone)
-
- // Step 19. Fix up the stack of open elements.
- p.oe.remove(formattingElement)
- p.oe.insert(p.oe.index(furthestBlock)+1, clone)
- }
-}
-
-// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
-// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content
-// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
-func (p *parser) inBodyEndTagOther(tagAtom a.Atom) {
- for i := len(p.oe) - 1; i >= 0; i-- {
- if p.oe[i].DataAtom == tagAtom {
- p.oe = p.oe[:i]
- break
- }
- if isSpecialElement(p.oe[i]) {
- break
- }
- }
-}
-
-// Section 12.2.5.4.8.
-func textIM(p *parser) bool {
- switch p.tok.Type {
- case ErrorToken:
- p.oe.pop()
- case TextToken:
- d := p.tok.Data
- if n := p.oe.top(); n.DataAtom == a.Textarea && n.FirstChild == nil {
- // Ignore a newline at the start of a