diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES
index b5cd8c3b75..65ad8b692c 100644
--- a/OWNERS_ALIASES
+++ b/OWNERS_ALIASES
@@ -16,13 +16,6 @@ aliases:
- nicolaferraro
- matzew
- github-approvers:
- - lberk
- - mattmoor
- github-reviewers:
- - lberk
- - rootfs
-
gitlab-approvers:
- sebgoa
- tzununbekov
@@ -42,11 +35,6 @@ aliases:
natss-reviewers:
- devguyio
- couchdb-approvers:
- - lionelvillard
- couchdb-reviewers:
- - lionelvillard
-
prometheus-approvers:
- syedriko
- matzew
diff --git a/couchdb/OWNERS b/couchdb/OWNERS
deleted file mode 100644
index 12fef781b8..0000000000
--- a/couchdb/OWNERS
+++ /dev/null
@@ -1,9 +0,0 @@
-approvers:
- - couchdb-approvers
-
-reviewers:
- - couchdb-reviewers
-
-labels:
- - area/Couchdb
-
diff --git a/couchdb/README.md b/couchdb/README.md
deleted file mode 100644
index 134f1eb7a7..0000000000
--- a/couchdb/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Apache CouchDB source for Knative
-
-The Apache CouchDB Event source enables Knative Eventing integration with
-[Apache CouchDB](http://couchdb.apache.org/).
-
-## Deployment steps
-
-1. Setup [Knative Eventing](../DEVELOPMENT.md)
-1. Create a secret containing the data needed to access your CouchDB service.
- For example:
-
- ```yaml
- apiVersion: v1
- kind: Secret
- metadata:
- name: couchdb-binding
- stringData:
- # The URL pointing to the CouchDB http server
- url: "https://username:password/..."
- ```
-
-1. Create the `CouchDbSource` custom objects, by configuring the required
- `credentials` and `database` values on the CR file of your source. Below is
- an example:
-
- ```yaml
- apiVersion: sources.knative.dev/v1alpha1
- kind: CouchDbSource
- metadata:
- name: couchdb-photographer
- spec:
- # reference to a secret containing the CouchDB credentials
- feed: continuous # default value. For polling every 2 seconds, use "normal"
- credentials:
- name: couchdb-binding
- database: photographers
- sink:
- ref:
- apiVersion: serving.knative.dev/v1alpha1
- kind: Service
- name: event-display
- ```
diff --git a/couchdb/source/cmd/controller/main.go b/couchdb/source/cmd/controller/main.go
deleted file mode 100644
index bf8f99648f..0000000000
--- a/couchdb/source/cmd/controller/main.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Copyright 2019 The Knative 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 (
- "knative.dev/eventing-contrib/couchdb/source/pkg/reconciler"
- "knative.dev/pkg/injection/sharedmain"
-)
-
-func main() {
- sharedmain.Main("couchdb-controller", reconciler.NewController)
-}
diff --git a/couchdb/source/cmd/receive_adapter/main.go b/couchdb/source/cmd/receive_adapter/main.go
deleted file mode 100644
index ea08cccc20..0000000000
--- a/couchdb/source/cmd/receive_adapter/main.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2019 The Knative 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
-
- 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 main
-
-import (
- "knative.dev/eventing/pkg/adapter/v2"
-
- couchdbadapter "knative.dev/eventing-contrib/couchdb/source/pkg/adapter"
-)
-
-func main() {
- adapter.Main("couchdbsource", couchdbadapter.NewEnvConfig, couchdbadapter.NewAdapter)
-}
diff --git a/couchdb/source/cmd/webhook/main.go b/couchdb/source/cmd/webhook/main.go
deleted file mode 100644
index 2279f089e1..0000000000
--- a/couchdb/source/cmd/webhook/main.go
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Copyright 2018 The Knative 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 (
- "context"
-
- "k8s.io/apimachinery/pkg/runtime/schema"
- couchdbv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- "knative.dev/eventing/pkg/logconfig"
- "knative.dev/pkg/configmap"
- "knative.dev/pkg/controller"
- "knative.dev/pkg/injection/sharedmain"
- "knative.dev/pkg/signals"
- "knative.dev/pkg/webhook"
- "knative.dev/pkg/webhook/certificates"
- "knative.dev/pkg/webhook/resourcesemantics"
- "knative.dev/pkg/webhook/resourcesemantics/defaulting"
- "knative.dev/pkg/webhook/resourcesemantics/validation"
-)
-
-var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
- couchdbv1alpha1.SchemeGroupVersion.WithKind("CouchDbSource"): &couchdbv1alpha1.CouchDbSource{},
-}
-
-var callbacks = map[schema.GroupVersionKind]validation.Callback{}
-
-func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
- return defaulting.NewAdmissionController(ctx,
- // Name of the resource webhook.
- "defaulting.webhook.couchdb.messaging.knative.dev",
-
- // The path on which to serve the webhook.
- "/defaulting",
-
- // The resources to default.
- types,
-
- // A function that infuses the context passed to Validate/SetDefaults with custom metadata.
- func(ctx context.Context) context.Context {
- return ctx
- },
-
- // Whether to disallow unknown fields.
- true,
- )
-}
-
-func NewValidationAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
- return validation.NewAdmissionController(ctx,
- // Name of the resource webhook.
- "validation.webhook.couchdb.messaging.knative.dev",
-
- // The path on which to serve the webhook.
- "/validation",
-
- // The resources to validate.
- types,
-
- // A function that infuses the context passed to Validate/SetDefaults with custom metadata.
- func(ctx context.Context) context.Context {
- return ctx
- },
-
- // Whether to disallow unknown fields.
- true,
-
- // Extra validating callbacks to be applied to resources.
- callbacks,
- )
-}
-
-func main() {
- // Set up a signal context with our webhook options
- ctx := webhook.WithOptions(signals.NewContext(), webhook.Options{
- ServiceName: logconfig.WebhookName(),
- Port: 8443,
- SecretName: "eventing-webhook-certs",
- })
-
- sharedmain.WebhookMainWithContext(ctx, logconfig.WebhookName(),
- certificates.NewController,
- NewDefaultingAdmissionController,
- NewValidationAdmissionController,
- // TODO(mattmoor): Support config validation in eventing-contrib.
- )
-}
diff --git a/couchdb/source/config/100-namespace.yaml b/couchdb/source/config/100-namespace.yaml
deleted file mode 100644
index 869c97bf5f..0000000000
--- a/couchdb/source/config/100-namespace.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: v1
-kind: Namespace
-metadata:
- name: knative-sources
diff --git a/couchdb/source/config/200-serviceaccount.yaml b/couchdb/source/config/200-serviceaccount.yaml
deleted file mode 100644
index 21f8c473b6..0000000000
--- a/couchdb/source/config/200-serviceaccount.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: couchdb-controller-manager
- namespace: knative-sources
----
-apiVersion: v1
-kind: ServiceAccount
-metadata:
- name: couchdb-webhook
- namespace: knative-sources
- labels:
- eventing.knative.dev/release: devel
diff --git a/couchdb/source/config/201-clusterrole.yaml b/couchdb/source/config/201-clusterrole.yaml
deleted file mode 100644
index 4a0d749009..0000000000
--- a/couchdb/source/config/201-clusterrole.yaml
+++ /dev/null
@@ -1,105 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: couchdb-controller
-rules:
-- apiGroups:
- - apps
- resources:
- - deployments
- verbs: &everything
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
-- apiGroups:
- - rbac.authorization.k8s.io
- resources:
- - clusterroles
- verbs:
- - list
-- apiGroups:
- - ""
- resources:
- - events
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
-- apiGroups:
- - sources.knative.dev
- resources:
- - couchdbsources
- verbs:
- - get
- - list
- - watch
- - create
- - update
- - patch
- - delete
-- apiGroups:
- - sources.knative.dev
- resources:
- - couchdbsources/status
- - couchdbsources/finalizers
- verbs:
- - get
- - update
- - patch
-- apiGroups:
- - ""
- resources:
- - secrets
- - configmaps
- verbs:
- - get
- - list
- - watch
-
-- apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs: *everything
-
----
-# The role is needed for the aggregated role source-observer in knative-eventing to provide readonly access to "Sources".
-# Ref: https://github.com/knative/eventing/tree/master/config/core/rolessource-observer-clusterrole.yaml.
-kind: ClusterRole
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
- name: eventing-contrib-couchdb-source-observer
- labels:
- eventing.knative.dev/release: devel
- duck.knative.dev/source: "true"
-rules:
- - apiGroups:
- - "sources.knative.dev"
- resources:
- - "couchdbsources"
- verbs:
- - get
- - list
- - watch
diff --git a/couchdb/source/config/201-webhook-clusterrole.yaml b/couchdb/source/config/201-webhook-clusterrole.yaml
deleted file mode 100644
index cc994419c3..0000000000
--- a/couchdb/source/config/201-webhook-clusterrole.yaml
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: couchdb-webhook
- labels:
- contrib.eventing.knative.dev/release: devel
-rules:
- # For watching logging configuration and getting certs.
- - apiGroups:
- - ""
- resources:
- - "configmaps"
- verbs:
- - "get"
- - "list"
- - "watch"
-
- # For manipulating certs into secrets.
- - apiGroups:
- - ""
- resources:
- - "secrets"
- verbs:
- - "get"
- - "create"
-
- # For getting our Deployment so we can decorate with ownerref.
- - apiGroups:
- - "apps"
- resources:
- - "deployments"
- verbs:
- - "get"
-
- - apiGroups:
- - "apps"
- resources:
- - "deployments/finalizers"
- verbs:
- - update
-
- # For actually registering our webhook.
- - apiGroups:
- - "admissionregistration.k8s.io"
- resources:
- - "mutatingwebhookconfigurations"
- verbs: &everything
- - "get"
- - "list"
- - "create"
- - "update"
- - "delete"
- - "patch"
- - "watch"
-
- # Our own resources and statuses we care about.
- - apiGroups:
- - "sources.knative.dev"
- resources:
- - "couchdbsources"
- - "couchdbsources/status"
- verbs:
- - "get"
- - "list"
- - "watch"
-
- # For leader election
- - apiGroups:
- - "coordination.k8s.io"
- resources:
- - "leases"
- verbs: *everything
diff --git a/couchdb/source/config/202-clusterrolebinding.yaml b/couchdb/source/config/202-clusterrolebinding.yaml
deleted file mode 100644
index 841c0b73a8..0000000000
--- a/couchdb/source/config/202-clusterrolebinding.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: couchdb-controller-rolebinding
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: couchdb-controller
-subjects:
-- kind: ServiceAccount
- name: couchdb-controller-manager
- namespace: knative-sources
-
----
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: eventing-sources-couchdb-controller-addressable-resolver
-subjects:
-- kind: ServiceAccount
- name: couchdb-controller-manager
- namespace: knative-sources
-# An aggregated ClusterRole for all Addressable CRDs.
-# Ref: https://github.com/knative/eventing/tree/master/config/core/rolesaddressable-resolvers-clusterrole.yaml
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: addressable-resolver
-
----
-
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: couchdb-webhook
- labels:
- eventing.knative.dev/release: devel
-subjects:
- - kind: ServiceAccount
- name: couchdb-webhook
- namespace: knative-sources
-roleRef:
- kind: ClusterRole
- name: couchdb-webhook
- apiGroup: rbac.authorization.k8s.io
diff --git a/couchdb/source/config/300-couchdbsource.yaml b/couchdb/source/config/300-couchdbsource.yaml
deleted file mode 100644
index b4dab4a6f8..0000000000
--- a/couchdb/source/config/300-couchdbsource.yaml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-# Copyright 2019 The Knative 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.
-
-apiVersion: apiextensions.k8s.io/v1beta1
-kind: CustomResourceDefinition
-metadata:
- creationTimestamp: null
- labels:
- contrib.eventing.knative.dev/release: devel
- eventing.knative.dev/source: "true"
- duck.knative.dev/source: "true"
- knative.dev/crd-install: "true"
- annotations:
- registry.knative.dev/eventTypes: |
- [
- { "type": "org.apache.couchdb.document.update" },
- { "type": "org.apache.couchdb.document.delete" }
- ]
- name: couchdbsources.sources.knative.dev
-spec:
- group: sources.knative.dev
- names:
- categories:
- - all
- - knative
- - eventing
- - sources
- kind: CouchDbSource
- plural: couchdbsources
- scope: Namespaced
- subresources:
- status: {}
- validation:
- openAPIV3Schema:
- properties:
- apiVersion:
- type: string
- kind:
- type: string
- metadata:
- type: object
- spec:
- properties:
- serviceAccountName:
- type: string
- sink:
- anyOf:
- - type: object
- description: "the destination that should receive events."
- properties:
- ref:
- type: object
- description: "a reference to a Kubernetes object from which to retrieve the target URI."
- required:
- - apiVersion
- - kind
- - name
- properties:
- apiVersion:
- type: string
- minLength: 1
- kind:
- type: string
- minLength: 1
- name:
- type: string
- minLength: 1
- uri:
- type: string
- description: "the target URI. If ref is provided, this must be relative URI reference."
- - type: object
- description: "DEPRECATED: a reference to a Kubernetes object from which to retrieve the target URI."
- required:
- - apiVersion
- - kind
- - name
- properties:
- apiVersion:
- type: string
- minLength: 1
- kind:
- type: string
- minLength: 1
- name:
- type: string
- minLength: 1
- uri:
- type: string
- description: "the target URI. If ref is provided, this must be relative URI reference."
- feed:
- type: string
- enum: ["continuous", "normal"]
- database:
- type: string
- credentials:
- type: object
- required:
- - database
- - credentials
- - sink
- type: object
- status:
- properties:
- conditions:
- items:
- properties:
- lastTransitionTime:
- type: string
- message:
- type: string
- reason:
- type: string
- severity:
- type: string
- status:
- type: string
- type:
- type: string
- required:
- - type
- - status
- type: object
- type: array
- sinkUri:
- type: string
- type: object
- version: v1alpha1
diff --git a/couchdb/source/config/400-controller-service.yaml b/couchdb/source/config/400-controller-service.yaml
deleted file mode 100644
index 7f96f70882..0000000000
--- a/couchdb/source/config/400-controller-service.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-apiVersion: v1
-kind: Service
-metadata:
- labels:
- control-plane: couchdb-controller-manager
- name: couchdb-controller-manager
- namespace: knative-sources
-spec:
- selector:
- control-plane: couchdb-controller-manager
- ports:
- - name: https-couchdb
- port: 443
diff --git a/couchdb/source/config/400-webhook-service.yaml b/couchdb/source/config/400-webhook-service.yaml
deleted file mode 100644
index ebd5a64d16..0000000000
--- a/couchdb/source/config/400-webhook-service.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 The Knative 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
-#
-# 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.
-
-apiVersion: v1
-kind: Service
-metadata:
- labels:
- eventing.knative.dev/release: devel
- role: couchdb-webhook
- name: couchdb-webhook
- namespace: knative-sources
-spec:
- ports:
- - name: https-webhook
- port: 443
- targetPort: 8443
- selector:
- role: couchdb-webhook
diff --git a/couchdb/source/config/500-controller.yaml b/couchdb/source/config/500-controller.yaml
deleted file mode 100644
index 5c9f08bf94..0000000000
--- a/couchdb/source/config/500-controller.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 2019 The Knative 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.
-
-
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: couchdb-controller-manager
- namespace: knative-sources
- labels:
- contrib.eventing.knative.dev/release: devel
- control-plane: couchdb-controller-manager
-spec:
- selector:
- matchLabels: &labels
- control-plane: couchdb-controller-manager
- serviceName: couchdb-controller-manager
- template:
- metadata:
- labels: *labels
- spec:
- serviceAccountName: couchdb-controller-manager
- containers:
- - image: ko://knative.dev/eventing-contrib/couchdb/source/cmd/controller
- name: manager
- env:
- - name: SYSTEM_NAMESPACE
- valueFrom:
- fieldRef:
- fieldPath: metadata.namespace
- - name: CONFIG_LOGGING_NAME
- value: config-logging
- - name: CONFIG_OBSERVABILITY_NAME
- value: config-observability
- - name: METRICS_DOMAIN
- value: knative.dev/sources
- - name: CONFIG_LEADERELECTION_NAME
- value: config-leader-election-couchdb
- - name: COUCHDB_RA_IMAGE
- value: ko://knative.dev/eventing-contrib/couchdb/source/cmd/receive_adapter
- resources:
- requests:
- cpu: 100m
- memory: 100Mi
- limits:
- cpu: 1000m
- memory: 1000Mi
- terminationGracePeriodSeconds: 10
- volumes:
- - name: config-logging
- configMap:
- name: config-logging
-
diff --git a/couchdb/source/config/500-webhook-configuration.yaml b/couchdb/source/config/500-webhook-configuration.yaml
deleted file mode 100644
index 7a83ceee5b..0000000000
--- a/couchdb/source/config/500-webhook-configuration.yaml
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2019 The Knative 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
-#
-# 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.
-
-apiVersion: admissionregistration.k8s.io/v1beta1
-kind: MutatingWebhookConfiguration
-metadata:
- name: defaulting.webhook.couchdb.messaging.knative.dev
- labels:
- contrib.eventing.knative.dev/release: devel
-webhooks:
-- admissionReviewVersions:
- - v1beta1
- clientConfig:
- service:
- name: couchdb-webhook
- namespace: knative-eventing
- failurePolicy: Fail
- name: defaulting.webhook.couchdb.eventing.knative.dev
----
-apiVersion: admissionregistration.k8s.io/v1beta1
-kind: ValidatingWebhookConfiguration
-metadata:
- name: validation.webhook.couchdb.messaging.knative.dev
- labels:
- contrib.eventing.knative.dev/release: devel
-webhooks:
-- admissionReviewVersions:
- - v1beta1
- clientConfig:
- service:
- name: couchdb-webhook
- namespace: knative-eventing
- failurePolicy: Fail
- name: validation.webhook.couchdb.eventing.knative.dev
----
-apiVersion: v1
-kind: Secret
-metadata:
- name: eventing-webhook-certs
- namespace: knative-eventing
- labels:
- contrib.eventing.knative.dev/release: devel
-# The data is populated at install time.
diff --git a/couchdb/source/config/500-webhook.yaml b/couchdb/source/config/500-webhook.yaml
deleted file mode 100644
index e78d6e2aaf..0000000000
--- a/couchdb/source/config/500-webhook.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2019 The Knative 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
-#
-# 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.
-
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: couchdb-webhook
- namespace: knative-sources
- labels:
- contrib.eventing.knative.dev/release: devel
-spec:
- replicas: 1
- selector:
- matchLabels: &labels
- app: couchdb-webhook
- role: couchdb-webhook
- template:
- metadata:
- annotations:
- sidecar.istio.io/inject: "false"
- labels: *labels
- spec:
- serviceAccountName: couchdb-webhook
- containers:
- - name: couchdb-webhook
- terminationMessagePolicy: FallbackToLogsOnError
- image: ko://knative.dev/eventing-contrib/couchdb/source/cmd/webhook
- env:
- - name: SYSTEM_NAMESPACE
- valueFrom:
- fieldRef:
- fieldPath: metadata.namespace
- - name: CONFIG_LOGGING_NAME
- value: config-logging
- - name: METRICS_DOMAIN
- value: knative.dev/eventing
- - name: WEBHOOK_NAME
- value: couchdb-webhook
- ports:
- - containerPort: 9090
- name: metrics
- # TODO set proper resource limits.
-
- readinessProbe: &probe
- periodSeconds: 1
- httpGet:
- scheme: HTTPS
- port: 8443
- httpHeaders:
- - name: k-kubelet-probe
- value: "webhook"
- livenessProbe: *probe
diff --git a/couchdb/source/config/config-leader-election.yaml b/couchdb/source/config/config-leader-election.yaml
deleted file mode 100644
index 219af7a690..0000000000
--- a/couchdb/source/config/config-leader-election.yaml
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2020 The Knative 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
-#
-# 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.
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: config-leader-election-couchdb
- namespace: knative-sources
- labels:
- contrib.eventing.knative.dev/release: devel
-data:
- # An inactive but valid configuration follows; see example.
- resourceLock: "leases"
- leaseDuration: "15s"
- renewDeadline: "10s"
- retryPeriod: "2s"
- _example: |
- ################################
- # #
- # EXAMPLE CONFIGURATION #
- # #
- ################################
-
- # This block is not actually functional configuration,
- # but serves to illustrate the available configuration
- # options and document them in a way that is accessible
- # to users that `kubectl edit` this config map.
- #
- # These sample configuration options may be copied out of
- # this example block and unindented to be in the data block
- # to actually change the configuration.
-
- # resourceLock controls which API resource is used as the basis for the
- # leader election lock. Valid values are:
- #
- # - leases -> use the coordination API
- # - configmaps -> use configmaps
- # - endpoints -> use endpoints
- resourceLock: "leases"
-
- # leaseDuration is how long non-leaders will wait to try to acquire the
- # lock; 15 seconds is the value used by core kubernetes controllers.
- leaseDuration: "15s"
- # renewDeadline is how long a leader will try to renew the lease before
- # giving up; 10 seconds is the value used by core kubernetes controllers.
- renewDeadline: "10s"
- # retryPeriod is how long the leader election client waits between tries of
- # actions; 2 seconds is the value used by core kuberntes controllers.
- retryPeriod: "2s"
- # enabledComponents is a comma-delimited list of component names for which
- # leader election is enabled. Valid values are:
- #
- # - couchdb-controller
- enabledComponents: "couchdb-controller"
diff --git a/couchdb/source/config/config-logging.yaml b/couchdb/source/config/config-logging.yaml
deleted file mode 100644
index 800b0e7bed..0000000000
--- a/couchdb/source/config/config-logging.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2019 The Knative 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
-#
-# 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.
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: config-logging
- namespace: knative-sources
-data:
- # Common configuration for all Knative codebase
- zap-logger-config: |
- {
- "level": "info",
- "development": false,
- "outputPaths": ["stdout"],
- "errorOutputPaths": ["stderr"],
- "encoding": "json",
- "encoderConfig": {
- "timeKey": "ts",
- "levelKey": "level",
- "nameKey": "logger",
- "callerKey": "caller",
- "messageKey": "msg",
- "stacktraceKey": "stacktrace",
- "lineEnding": "",
- "levelEncoder": "",
- "timeEncoder": "iso8601",
- "durationEncoder": "",
- "callerEncoder": ""
- }
- }
-
- # Log level overrides
- # For all components changes are be picked up immediately.
- loglevel.controller: "info"
- loglevel.webhook: "info"
diff --git a/couchdb/source/config/config-observability.yaml b/couchdb/source/config/config-observability.yaml
deleted file mode 100644
index b1e9eacb5e..0000000000
--- a/couchdb/source/config/config-observability.yaml
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright 2019 The Knative 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
-#
-# 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.
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: config-observability
- namespace: knative-sources
-data:
- _example: |
- ################################
- # #
- # EXAMPLE CONFIGURATION #
- # #
- ################################
-
- # This block is not actually functional configuration,
- # but serves to illustrate the available configuration
- # options and document them in a way that is accessible
- # to users that `kubectl edit` this config map.
- #
- # These sample configuration options may be copied out of
- # this example block and unindented to be in the data block
- # to actually change the configuration.
-
- # logging.enable-var-log-collection defaults to false.
- # A fluentd sidecar will be set up to collect var log if
- # this flag is true.
- logging.enable-var-log-collection: false
-
- # logging.fluentd-sidecar-image provides the fluentd sidecar image
- # to inject as a sidecar to collect logs from /var/log.
- # Must be presented if logging.enable-var-log-collection is true.
- logging.fluentd-sidecar-image: k8s.gcr.io/fluentd-elasticsearch:v2.0.4
-
- # logging.fluentd-sidecar-output-config provides the configuration
- # for the fluentd sidecar, which will be placed into a configmap and
- # mounted into the fluentd sidecar image.
- logging.fluentd-sidecar-output-config: |
- # Parse json log before sending to Elastic Search
-
- @type parser
- key_name log
-
- @type multi_format
-
- format json
- time_key fluentd-time # fluentd-time is reserved for structured logs
- time_format %Y-%m-%dT%H:%M:%S.%NZ
-
-
- format none
- message_key log
-
-
-
- # Send to Elastic Search
-
- @id elasticsearch
- @type elasticsearch
- @log_level info
- include_tag_key true
- # Elasticsearch service is in monitoring namespace.
- host elasticsearch-logging.knative-monitoring
- port 9200
- logstash_format true
-
- @type file
- path /var/log/fluentd-buffers/kubernetes.system.buffer
- flush_mode interval
- retry_type exponential_backoff
- flush_thread_count 2
- flush_interval 5s
- retry_forever
- retry_max_interval 30
- chunk_limit_size 2M
- queue_limit_length 8
- overflow_action block
-
-
-
- # logging.revision-url-template provides a template to use for producing the
- # logging URL that is injected into the status of each Revision.
- # This value is what you might use the the Knative monitoring bundle, and provides
- # access to Kibana after setting up kubectl proxy.
- logging.revision-url-template: |
- http://localhost:8001/api/v1/namespaces/knative-monitoring/services/kibana-logging/proxy/app/kibana#/discover?_a=(query:(match:(kubernetes.labels.knative-dev%2FrevisionUID:(query:'${REVISION_UID}',type:phrase))))
-
- # If non-empty, this enables queue proxy writing request logs to stdout.
- # The value determines the shape of the request logs and it must be a valid go text/template.
- # It is important to keep this as a single line. Multiple lines are parsed as separate entities
- # by most collection agents and will split the request logs into multiple records.
- #
- # The following fields and functions are available to the template:
- #
- # Request: An http.Request (see https://golang.org/pkg/net/http/#Request)
- # representing an HTTP request received by the server.
- #
- # Response:
- # struct {
- # Code int // HTTP status code (see https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
- # Size int // An int representing the size of the response.
- # Latency float64 // A float64 representing the latency of the response in seconds.
- # }
- #
- # Revision:
- # struct {
- # Name string // Knative revision name
- # Namespace string // Knative revision namespace
- # Service string // Knative service name
- # Configuration string // Knative configuration name
- # PodName string // Name of the pod hosting the revision
- # PodIP string // IP of the pod hosting the revision
- # }
- #
- logging.request-log-template: '{"httpRequest": {"requestMethod": "{{.Request.Method}}", "requestUrl": "{{js .Request.RequestURI}}", "requestSize": "{{.Request.ContentLength}}", "status": {{.Response.Code}}, "responseSize": "{{.Response.Size}}", "userAgent": "{{js .Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp": "{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency": "{{.Response.Latency}}s", "protocol": "{{.Request.Proto}}"}, "traceId": "{{index .Request.Header "X-B3-Traceid"}}"}'
-
- # metrics.backend-destination field specifies the system metrics destination.
- # It supports either prometheus (the default) or stackdriver.
- # Note: Using stackdriver will incur additional charges
- metrics.backend-destination: prometheus
-
- # metrics.request-metrics-backend-destination specifies the request metrics
- # destination. If non-empty, it enables queue proxy to send request metrics.
- # Currently supported values: prometheus, stackdriver.
- metrics.request-metrics-backend-destination: prometheus
-
- # metrics.stackdriver-project-id field specifies the stackdriver project ID. This
- # field is optional. When running on GCE, application default credentials will be
- # used if this field is not provided.
- metrics.stackdriver-project-id: ""
-
- # metrics.allow-stackdriver-custom-metrics indicates whether it is allowed to send metrics to
- # Stackdriver using "global" resource type and custom metric type if the
- # metrics are not supported by "knative_revision" resource type. Setting this
- # flag to "true" could cause extra Stackdriver charge.
- # If metrics.backend-destination is not Stackdriver, this is ignored.
- metrics.allow-stackdriver-custom-metrics: "false"
diff --git a/couchdb/source/config/dummy.go b/couchdb/source/config/dummy.go
deleted file mode 100644
index ec36cc370d..0000000000
--- a/couchdb/source/config/dummy.go
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Copyright 2020 The Knative 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
-
- 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 config is a placeholder that allows us to pull in config files
-// via go mod vendor.
-package config
diff --git a/couchdb/source/pkg/adapter/adapter.go b/couchdb/source/pkg/adapter/adapter.go
deleted file mode 100644
index 6d6ba68333..0000000000
--- a/couchdb/source/pkg/adapter/adapter.go
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-Copyright 2019 The Knative 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 adapter
-
-import (
- "context"
- "io"
- "io/ioutil"
- "net/http"
- "strings"
- "time"
-
- cloudevents "github.com/cloudevents/sdk-go/v2"
- "github.com/go-kivik/couchdb/v3"
- "github.com/go-kivik/kivik/v3"
- "go.uber.org/zap"
- "golang.org/x/net/http2"
- "k8s.io/apimachinery/pkg/util/wait"
- "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- "knative.dev/eventing/pkg/adapter/v2"
- "knative.dev/pkg/logging"
-)
-
-type envConfig struct {
- adapter.EnvConfig
-
- CouchDbCredentialsPath string `envconfig:"COUCHDB_CREDENTIALS" required:"true"`
- Database string `envconfig:"COUCHDB_DATABASE" required:"true"`
- EventSource string `envconfig:"EVENT_SOURCE" required:"true"`
- Feed string `envconfig:"COUCHDB_FEED" required:"true"`
-}
-
-type couchDbAdapter struct {
- namespace string
- ce cloudevents.Client
- logger *zap.SugaredLogger
-
- source string
- feed string
- couchDB *kivik.DB
- options kivik.Options
-}
-
-func init() {
- // Need to disable compression for Cloudant.
- var transport = http2.Transport{
- DisableCompression: true,
- }
- kivik.Register("cloudant", &couchdb.Couch{
- HTTPClient: &http.Client{Transport: &transport},
- })
-}
-
-// NewEnvConfig creates an empty configuration
-func NewEnvConfig() adapter.EnvConfigAccessor {
- return &envConfig{}
-}
-
-// NewAdapter creates an adapter to convert incoming CouchDb changes events to CloudEvents and
-// then sends them to the specified Sink
-func NewAdapter(ctx context.Context, processed adapter.EnvConfigAccessor, ceClient cloudevents.Client) adapter.Adapter {
- logger := logging.FromContext(ctx)
- env := processed.(*envConfig)
-
- rawurl, err := ioutil.ReadFile(env.CouchDbCredentialsPath + "/url")
- if err != nil {
- logger.Fatal("Missing url key in secret", zap.Error(err))
- }
- url := string(rawurl)
-
- driver := "couch"
-
- // Use cloudant driver only when the server is Cloudant.
- if strings.Contains(url, "cloudant") {
- driver = "cloudant"
- }
-
- return newAdapter(ctx, env, ceClient, url, driver)
-}
-
-func newAdapter(ctx context.Context, env *envConfig, ceClient cloudevents.Client, url string, driver string) adapter.Adapter {
- logger := logging.FromContext(ctx)
-
- client, err := kivik.New(driver, url)
- if err != nil {
- logger.Fatal("Error creating connection to couchDB", zap.Error(err))
- }
-
- db := client.DB(context.TODO(), env.Database)
- if db.Err() != nil {
- logger.Fatal("Error connection to couchDB database", zap.Any("dabase", env.Database), zap.Error(err))
- }
-
- return &couchDbAdapter{
- namespace: env.Namespace,
- ce: ceClient,
- logger: logger,
-
- couchDB: db,
- source: env.EventSource,
- feed: env.Feed,
- options: map[string]interface{}{
- "feed": env.Feed,
- "since": "0",
- },
- }
-}
-
-func (a *couchDbAdapter) Start(ctx context.Context) error {
- return a.start(ctx.Done())
-}
-
-func (a *couchDbAdapter) start(stopCh <-chan struct{}) error {
- period := 2 * time.Second
- if a.feed == "continuous" {
- a.options["heartbeat"] = 6000
- }
- wait.Until(a.processChanges, period, stopCh)
- return nil
-}
-
-func (a *couchDbAdapter) processChanges() {
- changes, err := a.couchDB.Changes(context.TODO(), a.options)
- if err != nil {
- a.logger.Error("Error getting the list of changes", zap.Error(err))
- return
- }
-
- for changes.Next() {
- if changes.Seq() != "" {
- event, err := a.makeEvent(changes)
-
- if err != nil {
- a.logger.Error("error making event", zap.Error(err))
- }
-
- if err := a.ce.Send(context.TODO(), *event); err != nil {
- a.logger.Error("event delivery failed", zap.Error(err))
- }
-
- a.options["since"] = changes.Seq()
- }
- }
-
- if changes.Err() != nil {
- if changes.Err() == io.EOF {
- a.logger.Error("The connection to the changes feed was interrupted.", zap.Error(changes.Err()))
- } else {
- a.logger.Error("Error found in the changes feed.", zap.Error(changes.Err()))
- }
- }
-}
-
-func (a *couchDbAdapter) makeEvent(changes *kivik.Changes) (*cloudevents.Event, error) {
- event := cloudevents.NewEvent(cloudevents.VersionV1)
- event.SetID(changes.Seq())
- event.SetSource(a.source)
- event.SetSubject(changes.ID())
-
- if changes.Deleted() {
- event.SetType(v1alpha1.CouchDbSourceDeleteEventType)
- } else {
- event.SetType(v1alpha1.CouchDbSourceUpdateEventType)
- }
-
- if err := event.SetData(cloudevents.ApplicationJSON, changes.Changes()); err != nil {
- return nil, err
- }
- return &event, nil
-}
diff --git a/couchdb/source/pkg/adapter/adapter_test.go b/couchdb/source/pkg/adapter/adapter_test.go
deleted file mode 100644
index c31b699191..0000000000
--- a/couchdb/source/pkg/adapter/adapter_test.go
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-Copyright 2019 The Knative 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 adapter
-
-import (
- "context"
- "testing"
-
- cloudevents "github.com/cloudevents/sdk-go/v2"
- "github.com/google/go-cmp/cmp"
- "go.uber.org/zap"
- "knative.dev/eventing/pkg/adapter/v2"
- kncetesting "knative.dev/eventing/pkg/adapter/v2/test"
- "knative.dev/pkg/logging"
- pkgtesting "knative.dev/pkg/reconciler/testing"
-
- "github.com/go-kivik/kivik/v3/driver"
- "github.com/go-kivik/kivikmock/v3"
-)
-
-func TestNewAdapter(t *testing.T) {
- ce := kncetesting.NewTestClient()
-
- testCases := map[string]struct {
- opt envConfig
-
- wantNamespace string
- wantDatabase string
- }{
- "with source": {
- opt: envConfig{
- EventSource: "test-source",
- Database: "mydb",
- },
- wantDatabase: "mydb",
- },
- "with namespace": {
- opt: envConfig{
- EnvConfig: adapter.EnvConfig{
- Namespace: "test-ns",
- },
- EventSource: "test-source",
- Database: "mydb",
- },
- wantNamespace: "test-ns",
- wantDatabase: "mydb",
- },
- }
- for n, tc := range testCases {
- t.Run(n, func(t *testing.T) {
- ctx, _ := pkgtesting.SetupFakeContext(t)
- c, mock := kivikmock.NewT(t)
-
- mock.ExpectDB()
-
- a := newAdapter(ctx, &tc.opt, ce, c.DSN(), "kivikmock")
-
- got, ok := a.(*couchDbAdapter)
- if !ok {
- t.Errorf("expected NewAdapter to return a *couchDbAdapter, but did not")
- }
- if diff := cmp.Diff(tc.opt.EventSource, got.source); diff != "" {
- t.Errorf("unexpected source diff (-want, +got) = %v", diff)
- }
- if diff := cmp.Diff(tc.wantNamespace, got.namespace); diff != "" {
- t.Errorf("unexpected namespace diff (-want, +got) = %v", diff)
- }
- if diff := cmp.Diff(tc.wantDatabase, got.couchDB.Name()); diff != "" {
- t.Errorf("unexpected namespace diff (-want, +got) = %v", diff)
- }
- })
- }
-}
-
-type adapterTestClient struct {
- *kncetesting.TestCloudEventsClient
- cancel context.CancelFunc
-}
-
-var _ cloudevents.Client = (*adapterTestClient)(nil)
-
-func newAdapterTestClient(cancel context.CancelFunc) *adapterTestClient {
- return &adapterTestClient{
- kncetesting.NewTestClient(),
- cancel,
- }
-}
-
-func (c *adapterTestClient) Send(ctx context.Context, event cloudevents.Event) cloudevents.Result {
- retError := c.TestCloudEventsClient.Send(ctx, event)
- c.cancel()
- return retError
-}
-
-func TestReceiveEventPoll(t *testing.T) {
- testCases := map[string]struct {
- feed string
- }{
- "normal feed": {
- feed: "normal",
- },
- "continuous feed": {
- feed: "continuous",
- },
- }
-
- for n, tc := range testCases {
- t.Run(n, func(t *testing.T) {
-
- env := envConfig{
- EnvConfig: adapter.EnvConfig{
- Namespace: "default",
- },
- EventSource: "test-source",
- Database: "testdb",
- Feed: tc.feed,
- }
- ctx, _ := pkgtesting.SetupFakeContext(t)
- logger := zap.NewExample().Sugar()
- ctx = logging.WithLogger(ctx, logger)
-
- c, mock := kivikmock.NewT(t)
-
- mockDB := mock.NewDB()
- mock.ExpectDB().WithName("testdb").WillReturn(mockDB)
- mockDB.ExpectChanges().WillReturn(kivikmock.NewChanges().AddChange(&driver.Change{
- ID: "anid",
- Seq: "aseq",
- Changes: driver.ChangedRevs{"arev"},
- }))
-
- ctx, cancel := context.WithCancel(context.Background())
- ce := newAdapterTestClient(cancel)
-
- a := newAdapter(ctx, &env, ce, c.DSN(), "kivikmock").(*couchDbAdapter)
-
- done := make(chan struct{})
- go func() {
- err := a.Start(ctx)
- if err != nil {
- t.Errorf("expected no error, got %v", err)
- }
- done <- struct{}{}
- }()
- <-done
-
- validateSent(t, ce, `["arev"]`)
- })
- }
-}
-
-func validateSent(t *testing.T, ce *adapterTestClient, wantData string) {
- if got := len(ce.Sent()); got != 1 {
- t.Errorf("Expected 1 event to be sent, got %d", got)
- }
-
- if got := ce.Sent()[0].Data(); string(got) != wantData {
- t.Errorf("Expected %q event to be sent, got %q", wantData, string(got))
- }
-}
diff --git a/couchdb/source/pkg/apis/addtoscheme_serving_v1beta1.go b/couchdb/source/pkg/apis/addtoscheme_serving_v1beta1.go
deleted file mode 100644
index 581ddbac08..0000000000
--- a/couchdb/source/pkg/apis/addtoscheme_serving_v1beta1.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Copyright 2019 The Knative 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 apis
-
-import (
- servingv1beta1 "knative.dev/serving/pkg/apis/serving/v1beta1"
-)
-
-func init() {
- // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
- AddToSchemes = append(AddToSchemes, servingv1beta1.SchemeBuilder.AddToScheme)
-}
diff --git a/couchdb/source/pkg/apis/addtoscheme_sources_v1alpha1.go b/couchdb/source/pkg/apis/addtoscheme_sources_v1alpha1.go
deleted file mode 100644
index 93c104169c..0000000000
--- a/couchdb/source/pkg/apis/addtoscheme_sources_v1alpha1.go
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-Copyright 2019 The Knative 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 apis
-
-import "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-
-func init() {
- // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
- AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
-}
diff --git a/couchdb/source/pkg/apis/apis.go b/couchdb/source/pkg/apis/apis.go
deleted file mode 100644
index cf74318d24..0000000000
--- a/couchdb/source/pkg/apis/apis.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright 2019 The Knative 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 apis contains Kubernetes API groups.
-package apis
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// AddToSchemes may be used to add all resources defined in the project to a Scheme
-var AddToSchemes runtime.SchemeBuilder
-
-// AddToScheme adds all Resources to the Scheme
-func AddToScheme(s *runtime.Scheme) error {
- return AddToSchemes.AddToScheme(s)
-}
diff --git a/couchdb/source/pkg/apis/sources/group.go b/couchdb/source/pkg/apis/sources/group.go
deleted file mode 100644
index dacb4955e3..0000000000
--- a/couchdb/source/pkg/apis/sources/group.go
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright 2019 The Knative 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 sources contains sources API versions
-package sources
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults.go
deleted file mode 100644
index 3d1dce014e..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults.go
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "context"
-)
-
-func (c *CouchDbSource) SetDefaults(ctx context.Context) {
- c.Spec.SetDefaults(ctx)
-}
-
-func (cs *CouchDbSourceSpec) SetDefaults(ctx context.Context) {
- if cs.Feed == "" {
- cs.Feed = FeedContinuous
- }
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults_test.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults_test.go
deleted file mode 100644
index 241d0f1492..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_defaults_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "context"
- "testing"
-
- "github.com/google/go-cmp/cmp"
-)
-
-func TestCouchDbDefaults(t *testing.T) {
- testCases := map[string]struct {
- initial CouchDbSource
- expected CouchDbSource
- }{
- "nil spec": {
- initial: CouchDbSource{},
- expected: CouchDbSource{
- Spec: CouchDbSourceSpec{
- Feed: FeedContinuous,
- },
- },
- },
- "feed not set": {
- initial: CouchDbSource{
- Spec: CouchDbSourceSpec{},
- },
- expected: CouchDbSource{
- Spec: CouchDbSourceSpec{
-
- Feed: FeedContinuous,
- },
- },
- },
- }
- for n, tc := range testCases {
- t.Run(n, func(t *testing.T) {
- tc.initial.SetDefaults(context.TODO())
- if diff := cmp.Diff(tc.expected, tc.initial); diff != "" {
- t.Fatalf("Unexpected defaults (-want, +got): %s", diff)
- }
- })
- }
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle.go
deleted file mode 100644
index 3dce190542..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle.go
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- appsv1 "k8s.io/api/apps/v1"
- "knative.dev/eventing/pkg/apis/duck"
- "knative.dev/pkg/apis"
-)
-
-const (
- // CouchDbConditionReady has status True when the CouchDbSource is ready to send events.
- CouchDbConditionReady = apis.ConditionReady
-
- // CouchDbConditionSinkProvided has status True when the CouchDbSource has been configured with a sink target.
- CouchDbConditionSinkProvided apis.ConditionType = "SinkProvided"
-
- // CouchDbConditionDeployed has status True when the CouchDbSource has had it's deployment created.
- CouchDbConditionDeployed apis.ConditionType = "Deployed"
-)
-
-var CouchDbCondSet = apis.NewLivingConditionSet(
- CouchDbConditionSinkProvided,
- CouchDbConditionDeployed,
-)
-
-// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
-func (*CouchDbSource) GetConditionSet() apis.ConditionSet {
- return CouchDbCondSet
-}
-
-// GetCondition returns the condition currently associated with the given type, or nil.
-func (s *CouchDbSourceStatus) GetCondition(t apis.ConditionType) *apis.Condition {
- return CouchDbCondSet.Manage(s).GetCondition(t)
-}
-
-// InitializeConditions sets relevant unset conditions to Unknown state.
-func (s *CouchDbSourceStatus) InitializeConditions() {
- CouchDbCondSet.Manage(s).InitializeConditions()
-}
-
-// MarkSink sets the condition that the source has a sink configured.
-func (s *CouchDbSourceStatus) MarkSink(uri *apis.URL) {
- s.SinkURI = uri
- if !uri.IsEmpty() {
- CouchDbCondSet.Manage(s).MarkTrue(CouchDbConditionSinkProvided)
- } else {
- CouchDbCondSet.Manage(s).MarkUnknown(CouchDbConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.%s", "")
- }
-}
-
-// MarkNoSink sets the condition that the source does not have a sink configured.
-func (s *CouchDbSourceStatus) MarkNoSink(reason, messageFormat string, messageA ...interface{}) {
- CouchDbCondSet.Manage(s).MarkFalse(CouchDbConditionSinkProvided, reason, messageFormat, messageA...)
-}
-
-// PropagateDeploymentAvailability uses the availability of the provided Deployment to determine if
-// CouchDbConditionDeployed should be marked as true or false.
-func (s *CouchDbSourceStatus) PropagateDeploymentAvailability(d *appsv1.Deployment) {
- if duck.DeploymentIsAvailable(&d.Status, false) {
- CouchDbCondSet.Manage(s).MarkTrue(CouchDbConditionDeployed)
- } else {
- // I don't know how to propagate the status well, so just give the name of the Deployment
- // for now.
- CouchDbCondSet.Manage(s).MarkFalse(CouchDbConditionDeployed, "DeploymentUnavailable", "The Deployment '%s' is unavailable.", d.Name)
- }
-}
-
-// IsReady returns true if the resource is ready overall.
-func (s *CouchDbSourceStatus) IsReady() bool {
- return CouchDbCondSet.Manage(s).IsHappy()
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle_test.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle_test.go
deleted file mode 100644
index bc3231777a..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_lifecycle_test.go
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "testing"
-
- "github.com/google/go-cmp/cmp"
- "github.com/google/go-cmp/cmp/cmpopts"
- appsv1 "k8s.io/api/apps/v1"
- corev1 "k8s.io/api/core/v1"
- "knative.dev/pkg/apis"
- duckv1 "knative.dev/pkg/apis/duck/v1"
-)
-
-var (
- availableDeployment = &appsv1.Deployment{
- Status: appsv1.DeploymentStatus{
- Conditions: []appsv1.DeploymentCondition{
- {
- Type: appsv1.DeploymentAvailable,
- Status: corev1.ConditionTrue,
- },
- },
- },
- }
-
- condReady = apis.Condition{
- Type: CouchDbConditionReady,
- Status: corev1.ConditionTrue,
- }
-)
-
-func TestCouchDbSourceGetConditionSet(t *testing.T) {
- r := &CouchDbSource{}
-
- if got, want := r.GetConditionSet().GetTopLevelConditionType(), apis.ConditionReady; got != want {
- t.Errorf("GetTopLevelCondition=%v, want=%v", got, want)
- }
-}
-
-func TestCouchDbGetCondition(t *testing.T) {
- tests := []struct {
- name string
- cs *CouchDbSourceStatus
- condQuery apis.ConditionType
- want *apis.Condition
- }{{
- name: "single condition",
- cs: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{
- condReady,
- },
- },
- },
- },
- condQuery: apis.ConditionReady,
- want: &condReady,
- }, {
- name: "unknown condition",
- cs: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{
- condReady,
- },
- },
- },
- },
- condQuery: apis.ConditionType("foo"),
- want: nil,
- }, {
- name: "mark deployed",
- cs: func() *CouchDbSourceStatus {
- s := &CouchDbSourceStatus{}
- s.InitializeConditions()
- s.PropagateDeploymentAvailability(availableDeployment)
- return s
- }(),
- condQuery: CouchDbConditionReady,
- want: &apis.Condition{
- Type: CouchDbConditionReady,
- Status: corev1.ConditionUnknown,
- },
- }, {
- name: "mark sink and deployed",
- cs: func() *CouchDbSourceStatus {
- s := &CouchDbSourceStatus{}
- s.InitializeConditions()
- s.MarkSink(apis.HTTP("example"))
- s.PropagateDeploymentAvailability(availableDeployment)
- return s
- }(),
- condQuery: CouchDbConditionReady,
- want: &apis.Condition{
- Type: CouchDbConditionReady,
- Status: corev1.ConditionTrue,
- },
- }}
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- got := test.cs.GetCondition(test.condQuery)
- ignoreTime := cmpopts.IgnoreFields(apis.Condition{},
- "LastTransitionTime", "Severity")
- if diff := cmp.Diff(test.want, got, ignoreTime); diff != "" {
- t.Errorf("unexpected condition (-want, +got) = %v", diff)
- }
- })
- }
-}
-
-func TestCouchDbInitializeConditions(t *testing.T) {
- tests := []struct {
- name string
- cs *CouchDbSourceStatus
- want *CouchDbSourceStatus
- }{{
- name: "empty",
- cs: &CouchDbSourceStatus{},
- want: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionDeployed,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionReady,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionUnknown,
- }},
- },
- },
- },
- }, {
- name: "one false",
- cs: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionFalse,
- }},
- },
- },
- },
- want: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionDeployed,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionReady,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionFalse,
- }},
- },
- },
- },
- }, {
- name: "one true",
- cs: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionTrue,
- }},
- },
- },
- },
- want: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionDeployed,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionReady,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionTrue,
- }},
- },
- },
- },
- }, {
- name: "marksink",
- cs: func() *CouchDbSourceStatus {
- status := CouchDbSourceStatus{}
- status.MarkSink(apis.HTTP("sink"))
- return &status
- }(),
- want: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionDeployed,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionReady,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionTrue,
- }},
- },
- SinkURI: apis.HTTP("sink"),
- },
- },
- }, {
- name: "marknosink",
- cs: func() *CouchDbSourceStatus {
- status := CouchDbSourceStatus{}
- status.MarkNoSink("nothere", "")
- return &status
- }(),
- want: &CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{
- Status: duckv1.Status{
- Conditions: []apis.Condition{{
- Type: CouchDbConditionDeployed,
- Status: corev1.ConditionUnknown,
- }, {
- Type: CouchDbConditionReady,
- Status: corev1.ConditionFalse,
- }, {
- Type: CouchDbConditionSinkProvided,
- Status: corev1.ConditionFalse,
- }},
- },
- },
- },
- }}
-
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- test.cs.InitializeConditions()
- ignore := cmpopts.IgnoreFields(
- apis.Condition{},
- "LastTransitionTime", "Message", "Reason", "Severity")
- if diff := cmp.Diff(test.want, test.cs, ignore); diff != "" {
- t.Errorf("unexpected conditions (-want, +got) = %v", diff)
- }
- })
- }
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types.go
deleted file mode 100644
index b3e857246f..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "knative.dev/pkg/apis/duck"
- duckv1 "knative.dev/pkg/apis/duck/v1"
- "knative.dev/pkg/kmeta"
-)
-
-// +genclient
-// +genreconciler
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// CouchDbSource is the Schema for the githubsources API
-// +k8s:openapi-gen=true
-type CouchDbSource struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- Spec CouchDbSourceSpec `json:"spec,omitempty"`
- Status CouchDbSourceStatus `json:"status,omitempty"`
-}
-
-// Check that CouchDb source can be validated and can be defaulted.
-var _ runtime.Object = (*CouchDbSource)(nil)
-
-// Check that we can create OwnerReferences to a Configuration.
-var _ kmeta.OwnerRefable = (*CouchDbSource)(nil)
-
-// Check that the type conforms to the duck Knative Resource shape.
-var _ duckv1.KRShaped = (*CouchDbSource)(nil)
-
-// Check that CouchDbSource implements the Conditions duck type.
-var _ = duck.VerifyType(&CouchDbSource{}, &duckv1.Conditions{})
-
-// FeedType is the type of Feed
-type FeedType string
-
-var CouchDbSourceEventTypes = []string{
- CouchDbSourceUpdateEventType,
- CouchDbSourceDeleteEventType,
-}
-
-const (
- // CouchDbSourceUpdateEventType is the CouchDbSource CloudEvent type for update.
- CouchDbSourceUpdateEventType = "org.apache.couchdb.document.update"
-
- // CouchDbSourceDeleteEventType is the CouchDbSource CloudEvent type for deletion.
- CouchDbSourceDeleteEventType = "org.apache.couchdb.document.delete"
-
- // FeedNormal corresponds to the "normal" feed. The connection to the server
- // is closed after reporting changes.
- FeedNormal = FeedType("normal")
-
- // FeedContinuous corresponds to the "continuous" feed. The connection to the
- // server stays open after reporting changes.
- FeedContinuous = FeedType("continuous")
-)
-
-// CouchDbSourceSpec defines the desired state of CouchDbSource
-type CouchDbSourceSpec struct {
- // ServiceAccountName holds the name of the Kubernetes service account
- // as which the underlying K8s resources should be run. If unspecified
- // this will default to the "default" service account for the namespace
- // in which the CouchDbSource exists.
- // +optional
- ServiceAccountName string `json:"serviceAccountName,omitempty"`
-
- // CouchDbCredentials is the credential to use to access CouchDb.
- // Must be a secret. Only Name and Namespace are used.
- CouchDbCredentials corev1.ObjectReference `json:"credentials,omitempty"`
-
- // Feed changes how CouchDB sends the response.
- // More information: https://docs.couchdb.org/en/stable/api/database/changes.html#changes-feeds
- Feed FeedType `json:"feed"`
-
- // Database is the database to watch for changes
- Database string `json:"database"`
-
- // Sink is a reference to an object that will resolve to a domain name to use as the sink.
- // +optional
- Sink *duckv1.Destination `json:"sink,omitempty"`
-}
-
-// GetGroupVersionKind returns the GroupVersionKind.
-func (s *CouchDbSource) GetGroupVersionKind() schema.GroupVersionKind {
- return SchemeGroupVersion.WithKind("CouchDbSource")
-}
-
-// CouchDbSourceStatus defines the observed state of CouchDbSource
-type CouchDbSourceStatus struct {
- // inherits duck/v1 SourceStatus, which currently provides:
- // * ObservedGeneration - the 'Generation' of the Service that was last
- // processed by the controller.
- // * Conditions - the latest available observations of a resource's current
- // state.
- // * SinkURI - the current active sink URI that has been configured for the
- // Source.
- duckv1.SourceStatus `json:",inline"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// CouchDbSourceList contains a list of CouchDbSource
-type CouchDbSourceList struct {
- metav1.TypeMeta `json:",inline"`
- metav1.ListMeta `json:"metadata,omitempty"`
- Items []CouchDbSource `json:"items"`
-}
-
-// GetStatus retrieves the duck status for this resource. Implements the KRShaped interface.
-func (c *CouchDbSource) GetStatus() *duckv1.Status {
- return &c.Status.Status
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types_test.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types_test.go
deleted file mode 100644
index 7d131221bb..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_types_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "testing"
-
- "github.com/google/go-cmp/cmp"
- duckv1 "knative.dev/pkg/apis/duck/v1"
-)
-
-func TestGroupVersionKind(t *testing.T) {
- src := CouchDbSource{}
- gvk := src.GetGroupVersionKind()
-
- if gvk.Kind != "CouchDbSource" {
- t.Errorf("Should be CouchDbSource.")
- }
-}
-
-func TestCouchDbSourceGetStatus(t *testing.T) {
- status := &duckv1.Status{}
- config := CouchDbSource{
- Status: CouchDbSourceStatus{
- SourceStatus: duckv1.SourceStatus{Status: *status},
- },
- }
-
- if !cmp.Equal(config.GetStatus(), status) {
- t.Errorf("GetStatus did not retrieve status. Got=%v Want=%v", config.GetStatus(), status)
- }
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation.go
deleted file mode 100644
index 4f3bd63962..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "context"
-
- "knative.dev/pkg/apis"
-)
-
-func (c *CouchDbSource) Validate(ctx context.Context) *apis.FieldError {
- return c.Spec.Validate(ctx).ViaField("spec")
-}
-
-func (cs *CouchDbSourceSpec) Validate(ctx context.Context) *apis.FieldError {
- var errs *apis.FieldError
-
- // Validate sink
- if cs.Sink == nil {
- fe := apis.ErrMissingField("sink")
- errs = errs.Also(fe)
- } else if fe := cs.Sink.Validate(ctx); fe != nil {
- errs = errs.Also(fe.ViaField("sink"))
- }
- return errs
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation_test.go b/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation_test.go
deleted file mode 100644
index dcfba2ea6e..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/couchdbsource_validation_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "context"
- "testing"
-
- "github.com/google/go-cmp/cmp"
- "knative.dev/pkg/webhook/resourcesemantics"
-
- "knative.dev/pkg/apis"
-)
-
-func TestCouchDbSourceValidation(t *testing.T) {
- testCases := map[string]struct {
- cr resourcesemantics.GenericCRD
- want *apis.FieldError
- }{
- "missing sink": {
- cr: &CouchDbSource{
- Spec: CouchDbSourceSpec{},
- },
- want: func() *apis.FieldError {
- var errs *apis.FieldError
- fe := apis.ErrMissingField("spec.sink")
- errs = errs.Also(fe)
- return errs
- }(),
- },
- }
-
- for n, test := range testCases {
- t.Run(n, func(t *testing.T) {
- got := test.cr.Validate(context.Background())
- if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" {
- t.Errorf("%s: validate (-want, +got) = %v", n, diff)
- }
- })
- }
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/doc.go b/couchdb/source/pkg/apis/sources/v1alpha1/doc.go
deleted file mode 100644
index 1db31d2904..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1 contains API Schema definitions for the sources v1alpha1 API group
-// +k8s:openapi-gen=true
-// +k8s:deepcopy-gen=package,register
-// +k8s:conversion-gen=knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources
-// +k8s:defaulter-gen=TypeMeta
-// +groupName=sources.knative.dev
-package v1alpha1
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/register.go b/couchdb/source/pkg/apis/sources/v1alpha1/register.go
deleted file mode 100644
index ef91b63cfc..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/register.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright 2019 The Knative 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.
-*/
-
-// NOTE: Boilerplate only. Ignore this file.
-
-// Package v1alpha1 contains API Schema definitions for the sources v1alpha1 API group
-// +k8s:openapi-gen=true
-// +k8s:deepcopy-gen=package,register
-// +k8s:defaulter-gen=TypeMeta
-// +groupName=sources.knative.dev
-package v1alpha1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "knative.dev/eventing/pkg/apis/sources"
-)
-
-var (
- // SchemeGroupVersion is group version used to register these objects
- SchemeGroupVersion = schema.GroupVersion{Group: sources.GroupName, Version: "v1alpha1"}
-
- // SchemeBuilder is used to add go types to the GroupVersionKind scheme
- SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
- AddToScheme = SchemeBuilder.AddToScheme
-)
-
-// Kind takes an unqualified kind and returns back a Group qualified GroupKind.
-func Kind(kind string) schema.GroupKind {
- return SchemeGroupVersion.WithKind(kind).GroupKind()
-}
-
-// Resource takes an unqualified resource and returns a Group qualified GroupResource
-func Resource(resource string) schema.GroupResource {
- return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-// Adds the list of known types to Scheme.
-func addKnownTypes(scheme *runtime.Scheme) error {
- scheme.AddKnownTypes(SchemeGroupVersion,
- &CouchDbSource{},
- &CouchDbSourceList{},
- )
- metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
- return nil
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/register_test.go b/couchdb/source/pkg/apis/sources/v1alpha1/register_test.go
deleted file mode 100644
index eedaf194ed..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/register_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright 2019 The Knative 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 v1alpha1
-
-import (
- "testing"
-
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-func TestRegisterHelpers(t *testing.T) {
- if got, want := Kind("CouchDbSource"), "CouchDbSource.sources.knative.dev"; got.String() != want {
- t.Errorf("Kind(CouchDbSource) = %v, want %v", got.String(), want)
- }
-
- if got, want := Resource("CouchDbSource"), "CouchDbSource.sources.knative.dev"; got.String() != want {
- t.Errorf("Resource(CouchDbSource) = %v, want %v", got.String(), want)
- }
-
- if got, want := SchemeGroupVersion.String(), "sources.knative.dev/v1alpha1"; got != want {
- t.Errorf("SchemeGroupVersion() = %v, want %v", got, want)
- }
-
- scheme := runtime.NewScheme()
- if err := addKnownTypes(scheme); err != nil {
- t.Errorf("addKnownTypes() = %v", err)
- }
-}
-
-// TestKnownTypes makes sure that expected types get added.
-func TestKnownTypes(t *testing.T) {
- scheme := runtime.NewScheme()
- addKnownTypes(scheme)
- types := scheme.KnownTypes(SchemeGroupVersion)
-
- for _, name := range []string{
- "CouchDbSource",
- "CouchDbSourceList",
- } {
- if _, ok := types[name]; !ok {
- t.Errorf("Did not find %q as registered type", name)
- }
- }
-
-}
diff --git a/couchdb/source/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go b/couchdb/source/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go
deleted file mode 100644
index 759084e44b..0000000000
--- a/couchdb/source/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go
+++ /dev/null
@@ -1,126 +0,0 @@
-// +build !ignore_autogenerated
-
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by deepcopy-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- runtime "k8s.io/apimachinery/pkg/runtime"
- v1 "knative.dev/pkg/apis/duck/v1"
-)
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CouchDbSource) DeepCopyInto(out *CouchDbSource) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- in.Spec.DeepCopyInto(&out.Spec)
- in.Status.DeepCopyInto(&out.Status)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CouchDbSource.
-func (in *CouchDbSource) DeepCopy() *CouchDbSource {
- if in == nil {
- return nil
- }
- out := new(CouchDbSource)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *CouchDbSource) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CouchDbSourceList) DeepCopyInto(out *CouchDbSourceList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]CouchDbSource, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CouchDbSourceList.
-func (in *CouchDbSourceList) DeepCopy() *CouchDbSourceList {
- if in == nil {
- return nil
- }
- out := new(CouchDbSourceList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *CouchDbSourceList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CouchDbSourceSpec) DeepCopyInto(out *CouchDbSourceSpec) {
- *out = *in
- out.CouchDbCredentials = in.CouchDbCredentials
- if in.Sink != nil {
- in, out := &in.Sink, &out.Sink
- *out = new(v1.Destination)
- (*in).DeepCopyInto(*out)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CouchDbSourceSpec.
-func (in *CouchDbSourceSpec) DeepCopy() *CouchDbSourceSpec {
- if in == nil {
- return nil
- }
- out := new(CouchDbSourceSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CouchDbSourceStatus) DeepCopyInto(out *CouchDbSourceStatus) {
- *out = *in
- in.SourceStatus.DeepCopyInto(&out.SourceStatus)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CouchDbSourceStatus.
-func (in *CouchDbSourceStatus) DeepCopy() *CouchDbSourceStatus {
- if in == nil {
- return nil
- }
- out := new(CouchDbSourceStatus)
- in.DeepCopyInto(out)
- return out
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/clientset.go b/couchdb/source/pkg/client/clientset/versioned/clientset.go
deleted file mode 100644
index 401a53e4b1..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/clientset.go
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package versioned
-
-import (
- "fmt"
-
- discovery "k8s.io/client-go/discovery"
- rest "k8s.io/client-go/rest"
- flowcontrol "k8s.io/client-go/util/flowcontrol"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1"
-)
-
-type Interface interface {
- Discovery() discovery.DiscoveryInterface
- SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface
-}
-
-// Clientset contains the clients for groups. Each group has exactly one
-// version included in a Clientset.
-type Clientset struct {
- *discovery.DiscoveryClient
- sourcesV1alpha1 *sourcesv1alpha1.SourcesV1alpha1Client
-}
-
-// SourcesV1alpha1 retrieves the SourcesV1alpha1Client
-func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface {
- return c.sourcesV1alpha1
-}
-
-// Discovery retrieves the DiscoveryClient
-func (c *Clientset) Discovery() discovery.DiscoveryInterface {
- if c == nil {
- return nil
- }
- return c.DiscoveryClient
-}
-
-// NewForConfig creates a new Clientset for the given config.
-// If config's RateLimiter is not set and QPS and Burst are acceptable,
-// NewForConfig will generate a rate-limiter in configShallowCopy.
-func NewForConfig(c *rest.Config) (*Clientset, error) {
- configShallowCopy := *c
- if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
- if configShallowCopy.Burst <= 0 {
- return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
- }
- configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
- }
- var cs Clientset
- var err error
- cs.sourcesV1alpha1, err = sourcesv1alpha1.NewForConfig(&configShallowCopy)
- if err != nil {
- return nil, err
- }
-
- cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
- if err != nil {
- return nil, err
- }
- return &cs, nil
-}
-
-// NewForConfigOrDie creates a new Clientset for the given config and
-// panics if there is an error in the config.
-func NewForConfigOrDie(c *rest.Config) *Clientset {
- var cs Clientset
- cs.sourcesV1alpha1 = sourcesv1alpha1.NewForConfigOrDie(c)
-
- cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
- return &cs
-}
-
-// New creates a new Clientset for the given RESTClient.
-func New(c rest.Interface) *Clientset {
- var cs Clientset
- cs.sourcesV1alpha1 = sourcesv1alpha1.New(c)
-
- cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
- return &cs
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/doc.go b/couchdb/source/pkg/client/clientset/versioned/doc.go
deleted file mode 100644
index e48c2aa446..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// This package has the automatically generated clientset.
-package versioned
diff --git a/couchdb/source/pkg/client/clientset/versioned/fake/clientset_generated.go b/couchdb/source/pkg/client/clientset/versioned/fake/clientset_generated.go
deleted file mode 100644
index 2110f8dce6..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/fake/clientset_generated.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/watch"
- "k8s.io/client-go/discovery"
- fakediscovery "k8s.io/client-go/discovery/fake"
- "k8s.io/client-go/testing"
- clientset "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1"
- fakesourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake"
-)
-
-// NewSimpleClientset returns a clientset that will respond with the provided objects.
-// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
-// without applying any validations and/or defaults. It shouldn't be considered a replacement
-// for a real clientset and is mostly useful in simple unit tests.
-func NewSimpleClientset(objects ...runtime.Object) *Clientset {
- o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
- for _, obj := range objects {
- if err := o.Add(obj); err != nil {
- panic(err)
- }
- }
-
- cs := &Clientset{tracker: o}
- cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
- cs.AddReactor("*", "*", testing.ObjectReaction(o))
- cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
- gvr := action.GetResource()
- ns := action.GetNamespace()
- watch, err := o.Watch(gvr, ns)
- if err != nil {
- return false, nil, err
- }
- return true, watch, nil
- })
-
- return cs
-}
-
-// Clientset implements clientset.Interface. Meant to be embedded into a
-// struct to get a default implementation. This makes faking out just the method
-// you want to test easier.
-type Clientset struct {
- testing.Fake
- discovery *fakediscovery.FakeDiscovery
- tracker testing.ObjectTracker
-}
-
-func (c *Clientset) Discovery() discovery.DiscoveryInterface {
- return c.discovery
-}
-
-func (c *Clientset) Tracker() testing.ObjectTracker {
- return c.tracker
-}
-
-var _ clientset.Interface = &Clientset{}
-
-// SourcesV1alpha1 retrieves the SourcesV1alpha1Client
-func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface {
- return &fakesourcesv1alpha1.FakeSourcesV1alpha1{Fake: &c.Fake}
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/fake/doc.go b/couchdb/source/pkg/client/clientset/versioned/fake/doc.go
deleted file mode 100644
index 2c4903250c..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// This package has the automatically generated fake clientset.
-package fake
diff --git a/couchdb/source/pkg/client/clientset/versioned/fake/register.go b/couchdb/source/pkg/client/clientset/versioned/fake/register.go
deleted file mode 100644
index 3073efb5a3..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/fake/register.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- serializer "k8s.io/apimachinery/pkg/runtime/serializer"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-var scheme = runtime.NewScheme()
-var codecs = serializer.NewCodecFactory(scheme)
-var parameterCodec = runtime.NewParameterCodec(scheme)
-var localSchemeBuilder = runtime.SchemeBuilder{
- sourcesv1alpha1.AddToScheme,
-}
-
-// AddToScheme adds all types of this clientset into the given scheme. This allows composition
-// of clientsets, like in:
-//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
-//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
-//
-// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
-// correctly.
-var AddToScheme = localSchemeBuilder.AddToScheme
-
-func init() {
- v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
- utilruntime.Must(AddToScheme(scheme))
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/scheme/doc.go b/couchdb/source/pkg/client/clientset/versioned/scheme/doc.go
deleted file mode 100644
index 7acc2dcf25..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/scheme/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// This package contains the scheme of the automatically generated clientset.
-package scheme
diff --git a/couchdb/source/pkg/client/clientset/versioned/scheme/register.go b/couchdb/source/pkg/client/clientset/versioned/scheme/register.go
deleted file mode 100644
index 8c13cd9d83..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/scheme/register.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package scheme
-
-import (
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- serializer "k8s.io/apimachinery/pkg/runtime/serializer"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-var Scheme = runtime.NewScheme()
-var Codecs = serializer.NewCodecFactory(Scheme)
-var ParameterCodec = runtime.NewParameterCodec(Scheme)
-var localSchemeBuilder = runtime.SchemeBuilder{
- sourcesv1alpha1.AddToScheme,
-}
-
-// AddToScheme adds all types of this clientset into the given scheme. This allows composition
-// of clientsets, like in:
-//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
-//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
-//
-// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
-// correctly.
-var AddToScheme = localSchemeBuilder.AddToScheme
-
-func init() {
- v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
- utilruntime.Must(AddToScheme(Scheme))
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/couchdbsource.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/couchdbsource.go
deleted file mode 100644
index d92de0a2b9..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/couchdbsource.go
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- scheme "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/scheme"
-)
-
-// CouchDbSourcesGetter has a method to return a CouchDbSourceInterface.
-// A group's client should implement this interface.
-type CouchDbSourcesGetter interface {
- CouchDbSources(namespace string) CouchDbSourceInterface
-}
-
-// CouchDbSourceInterface has methods to work with CouchDbSource resources.
-type CouchDbSourceInterface interface {
- Create(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.CreateOptions) (*v1alpha1.CouchDbSource, error)
- Update(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (*v1alpha1.CouchDbSource, error)
- UpdateStatus(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (*v1alpha1.CouchDbSource, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.CouchDbSource, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.CouchDbSourceList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CouchDbSource, err error)
- CouchDbSourceExpansion
-}
-
-// couchDbSources implements CouchDbSourceInterface
-type couchDbSources struct {
- client rest.Interface
- ns string
-}
-
-// newCouchDbSources returns a CouchDbSources
-func newCouchDbSources(c *SourcesV1alpha1Client, namespace string) *couchDbSources {
- return &couchDbSources{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the couchDbSource, and returns the corresponding couchDbSource object, and an error if there is any.
-func (c *couchDbSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CouchDbSource, err error) {
- result = &v1alpha1.CouchDbSource{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("couchdbsources").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of CouchDbSources that match those selectors.
-func (c *couchDbSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CouchDbSourceList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.CouchDbSourceList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("couchdbsources").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested couchDbSources.
-func (c *couchDbSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("couchdbsources").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a couchDbSource and creates it. Returns the server's representation of the couchDbSource, and an error, if there is any.
-func (c *couchDbSources) Create(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.CreateOptions) (result *v1alpha1.CouchDbSource, err error) {
- result = &v1alpha1.CouchDbSource{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("couchdbsources").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(couchDbSource).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a couchDbSource and updates it. Returns the server's representation of the couchDbSource, and an error, if there is any.
-func (c *couchDbSources) Update(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (result *v1alpha1.CouchDbSource, err error) {
- result = &v1alpha1.CouchDbSource{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("couchdbsources").
- Name(couchDbSource.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(couchDbSource).
- Do(ctx).
- Into(result)
- return
-}
-
-// UpdateStatus was generated because the type contains a Status member.
-// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
-func (c *couchDbSources) UpdateStatus(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (result *v1alpha1.CouchDbSource, err error) {
- result = &v1alpha1.CouchDbSource{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("couchdbsources").
- Name(couchDbSource.Name).
- SubResource("status").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(couchDbSource).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the couchDbSource and deletes it. Returns an error if one occurs.
-func (c *couchDbSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("couchdbsources").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *couchDbSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("couchdbsources").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched couchDbSource.
-func (c *couchDbSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CouchDbSource, err error) {
- result = &v1alpha1.CouchDbSource{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("couchdbsources").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go
deleted file mode 100644
index 41e872fe9a..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// This package has the automatically generated typed clients.
-package v1alpha1
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/doc.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/doc.go
deleted file mode 100644
index c7f6e65cab..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-// Package fake has the automatically generated clients.
-package fake
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_couchdbsource.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_couchdbsource.go
deleted file mode 100644
index bf58940808..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_couchdbsource.go
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-// FakeCouchDbSources implements CouchDbSourceInterface
-type FakeCouchDbSources struct {
- Fake *FakeSourcesV1alpha1
- ns string
-}
-
-var couchdbsourcesResource = schema.GroupVersionResource{Group: "sources.knative.dev", Version: "v1alpha1", Resource: "couchdbsources"}
-
-var couchdbsourcesKind = schema.GroupVersionKind{Group: "sources.knative.dev", Version: "v1alpha1", Kind: "CouchDbSource"}
-
-// Get takes name of the couchDbSource, and returns the corresponding couchDbSource object, and an error if there is any.
-func (c *FakeCouchDbSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.CouchDbSource, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(couchdbsourcesResource, c.ns, name), &v1alpha1.CouchDbSource{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.CouchDbSource), err
-}
-
-// List takes label and field selectors, and returns the list of CouchDbSources that match those selectors.
-func (c *FakeCouchDbSources) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CouchDbSourceList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(couchdbsourcesResource, couchdbsourcesKind, c.ns, opts), &v1alpha1.CouchDbSourceList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.CouchDbSourceList{ListMeta: obj.(*v1alpha1.CouchDbSourceList).ListMeta}
- for _, item := range obj.(*v1alpha1.CouchDbSourceList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested couchDbSources.
-func (c *FakeCouchDbSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(couchdbsourcesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a couchDbSource and creates it. Returns the server's representation of the couchDbSource, and an error, if there is any.
-func (c *FakeCouchDbSources) Create(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.CreateOptions) (result *v1alpha1.CouchDbSource, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(couchdbsourcesResource, c.ns, couchDbSource), &v1alpha1.CouchDbSource{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.CouchDbSource), err
-}
-
-// Update takes the representation of a couchDbSource and updates it. Returns the server's representation of the couchDbSource, and an error, if there is any.
-func (c *FakeCouchDbSources) Update(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (result *v1alpha1.CouchDbSource, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(couchdbsourcesResource, c.ns, couchDbSource), &v1alpha1.CouchDbSource{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.CouchDbSource), err
-}
-
-// UpdateStatus was generated because the type contains a Status member.
-// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
-func (c *FakeCouchDbSources) UpdateStatus(ctx context.Context, couchDbSource *v1alpha1.CouchDbSource, opts v1.UpdateOptions) (*v1alpha1.CouchDbSource, error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateSubresourceAction(couchdbsourcesResource, "status", c.ns, couchDbSource), &v1alpha1.CouchDbSource{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.CouchDbSource), err
-}
-
-// Delete takes name of the couchDbSource and deletes it. Returns an error if one occurs.
-func (c *FakeCouchDbSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(couchdbsourcesResource, c.ns, name), &v1alpha1.CouchDbSource{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeCouchDbSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(couchdbsourcesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.CouchDbSourceList{})
- return err
-}
-
-// Patch applies the patch and returns the patched couchDbSource.
-func (c *FakeCouchDbSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CouchDbSource, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(couchdbsourcesResource, c.ns, name, pt, data, subresources...), &v1alpha1.CouchDbSource{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.CouchDbSource), err
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go
deleted file mode 100644
index e8dded8f90..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/fake/fake_sources_client.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- rest "k8s.io/client-go/rest"
- testing "k8s.io/client-go/testing"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1"
-)
-
-type FakeSourcesV1alpha1 struct {
- *testing.Fake
-}
-
-func (c *FakeSourcesV1alpha1) CouchDbSources(namespace string) v1alpha1.CouchDbSourceInterface {
- return &FakeCouchDbSources{c, namespace}
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *FakeSourcesV1alpha1) RESTClient() rest.Interface {
- var ret *rest.RESTClient
- return ret
-}
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go
deleted file mode 100644
index 3b71c6cc77..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-type CouchDbSourceExpansion interface{}
diff --git a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go b/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go
deleted file mode 100644
index 7cd68501cc..0000000000
--- a/couchdb/source/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- rest "k8s.io/client-go/rest"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/scheme"
-)
-
-type SourcesV1alpha1Interface interface {
- RESTClient() rest.Interface
- CouchDbSourcesGetter
-}
-
-// SourcesV1alpha1Client is used to interact with features provided by the sources.knative.dev group.
-type SourcesV1alpha1Client struct {
- restClient rest.Interface
-}
-
-func (c *SourcesV1alpha1Client) CouchDbSources(namespace string) CouchDbSourceInterface {
- return newCouchDbSources(c, namespace)
-}
-
-// NewForConfig creates a new SourcesV1alpha1Client for the given config.
-func NewForConfig(c *rest.Config) (*SourcesV1alpha1Client, error) {
- config := *c
- if err := setConfigDefaults(&config); err != nil {
- return nil, err
- }
- client, err := rest.RESTClientFor(&config)
- if err != nil {
- return nil, err
- }
- return &SourcesV1alpha1Client{client}, nil
-}
-
-// NewForConfigOrDie creates a new SourcesV1alpha1Client for the given config and
-// panics if there is an error in the config.
-func NewForConfigOrDie(c *rest.Config) *SourcesV1alpha1Client {
- client, err := NewForConfig(c)
- if err != nil {
- panic(err)
- }
- return client
-}
-
-// New creates a new SourcesV1alpha1Client for the given RESTClient.
-func New(c rest.Interface) *SourcesV1alpha1Client {
- return &SourcesV1alpha1Client{c}
-}
-
-func setConfigDefaults(config *rest.Config) error {
- gv := v1alpha1.SchemeGroupVersion
- config.GroupVersion = &gv
- config.APIPath = "/apis"
- config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
-
- if config.UserAgent == "" {
- config.UserAgent = rest.DefaultKubernetesUserAgent()
- }
-
- return nil
-}
-
-// RESTClient returns a RESTClient that is used to communicate
-// with API server by this client implementation.
-func (c *SourcesV1alpha1Client) RESTClient() rest.Interface {
- if c == nil {
- return nil
- }
- return c.restClient
-}
diff --git a/couchdb/source/pkg/client/informers/externalversions/factory.go b/couchdb/source/pkg/client/informers/externalversions/factory.go
deleted file mode 100644
index 480c25498f..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/factory.go
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package externalversions
-
-import (
- reflect "reflect"
- sync "sync"
- time "time"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- cache "k8s.io/client-go/tools/cache"
- versioned "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
- internalinterfaces "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/internalinterfaces"
- sources "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/sources"
-)
-
-// SharedInformerOption defines the functional option type for SharedInformerFactory.
-type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory
-
-type sharedInformerFactory struct {
- client versioned.Interface
- namespace string
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- lock sync.Mutex
- defaultResync time.Duration
- customResync map[reflect.Type]time.Duration
-
- informers map[reflect.Type]cache.SharedIndexInformer
- // startedInformers is used for tracking which informers have been started.
- // This allows Start() to be called multiple times safely.
- startedInformers map[reflect.Type]bool
-}
-
-// WithCustomResyncConfig sets a custom resync period for the specified informer types.
-func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption {
- return func(factory *sharedInformerFactory) *sharedInformerFactory {
- for k, v := range resyncConfig {
- factory.customResync[reflect.TypeOf(k)] = v
- }
- return factory
- }
-}
-
-// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
-func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption {
- return func(factory *sharedInformerFactory) *sharedInformerFactory {
- factory.tweakListOptions = tweakListOptions
- return factory
- }
-}
-
-// WithNamespace limits the SharedInformerFactory to the specified namespace.
-func WithNamespace(namespace string) SharedInformerOption {
- return func(factory *sharedInformerFactory) *sharedInformerFactory {
- factory.namespace = namespace
- return factory
- }
-}
-
-// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
-func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
- return NewSharedInformerFactoryWithOptions(client, defaultResync)
-}
-
-// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
-// Listers obtained via this SharedInformerFactory will be subject to the same filters
-// as specified here.
-// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
-func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
- return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
-}
-
-// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
-func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory {
- factory := &sharedInformerFactory{
- client: client,
- namespace: v1.NamespaceAll,
- defaultResync: defaultResync,
- informers: make(map[reflect.Type]cache.SharedIndexInformer),
- startedInformers: make(map[reflect.Type]bool),
- customResync: make(map[reflect.Type]time.Duration),
- }
-
- // Apply all options
- for _, opt := range options {
- factory = opt(factory)
- }
-
- return factory
-}
-
-// Start initializes all requested informers.
-func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- for informerType, informer := range f.informers {
- if !f.startedInformers[informerType] {
- go informer.Run(stopCh)
- f.startedInformers[informerType] = true
- }
- }
-}
-
-// WaitForCacheSync waits for all started informers' cache were synced.
-func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
- informers := func() map[reflect.Type]cache.SharedIndexInformer {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- informers := map[reflect.Type]cache.SharedIndexInformer{}
- for informerType, informer := range f.informers {
- if f.startedInformers[informerType] {
- informers[informerType] = informer
- }
- }
- return informers
- }()
-
- res := map[reflect.Type]bool{}
- for informType, informer := range informers {
- res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
- }
- return res
-}
-
-// InternalInformerFor returns the SharedIndexInformer for obj using an internal
-// client.
-func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
- f.lock.Lock()
- defer f.lock.Unlock()
-
- informerType := reflect.TypeOf(obj)
- informer, exists := f.informers[informerType]
- if exists {
- return informer
- }
-
- resyncPeriod, exists := f.customResync[informerType]
- if !exists {
- resyncPeriod = f.defaultResync
- }
-
- informer = newFunc(f.client, resyncPeriod)
- f.informers[informerType] = informer
-
- return informer
-}
-
-// SharedInformerFactory provides shared informers for resources in all known
-// API group versions.
-type SharedInformerFactory interface {
- internalinterfaces.SharedInformerFactory
- ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
- WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
-
- Sources() sources.Interface
-}
-
-func (f *sharedInformerFactory) Sources() sources.Interface {
- return sources.New(f, f.namespace, f.tweakListOptions)
-}
diff --git a/couchdb/source/pkg/client/informers/externalversions/generic.go b/couchdb/source/pkg/client/informers/externalversions/generic.go
deleted file mode 100644
index c66dbfe02c..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/generic.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package externalversions
-
-import (
- "fmt"
-
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- cache "k8s.io/client-go/tools/cache"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
-// sharedInformers based on type
-type GenericInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() cache.GenericLister
-}
-
-type genericInformer struct {
- informer cache.SharedIndexInformer
- resource schema.GroupResource
-}
-
-// Informer returns the SharedIndexInformer.
-func (f *genericInformer) Informer() cache.SharedIndexInformer {
- return f.informer
-}
-
-// Lister returns the GenericLister.
-func (f *genericInformer) Lister() cache.GenericLister {
- return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
-}
-
-// ForResource gives generic access to a shared informer of the matching type
-// TODO extend this to unknown resources with a client pool
-func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
- switch resource {
- // Group=sources.knative.dev, Version=v1alpha1
- case v1alpha1.SchemeGroupVersion.WithResource("couchdbsources"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Sources().V1alpha1().CouchDbSources().Informer()}, nil
-
- }
-
- return nil, fmt.Errorf("no informer found for %v", resource)
-}
diff --git a/couchdb/source/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/couchdb/source/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
deleted file mode 100644
index b491742e06..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalinterfaces
-
-import (
- time "time"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- cache "k8s.io/client-go/tools/cache"
- versioned "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
-)
-
-// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
-type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
-
-// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
-type SharedInformerFactory interface {
- Start(stopCh <-chan struct{})
- InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
-}
-
-// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
-type TweakListOptionsFunc func(*v1.ListOptions)
diff --git a/couchdb/source/pkg/client/informers/externalversions/sources/interface.go b/couchdb/source/pkg/client/informers/externalversions/sources/interface.go
deleted file mode 100644
index 1c2cde2c9a..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/sources/interface.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package sources
-
-import (
- internalinterfaces "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1"
-)
-
-// Interface provides access to each of this group's versions.
-type Interface interface {
- // V1alpha1 provides access to shared informers for resources in V1alpha1.
- V1alpha1() v1alpha1.Interface
-}
-
-type group struct {
- factory internalinterfaces.SharedInformerFactory
- namespace string
- tweakListOptions internalinterfaces.TweakListOptionsFunc
-}
-
-// New returns a new Interface.
-func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
- return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
-}
-
-// V1alpha1 returns a new v1alpha1.Interface.
-func (g *group) V1alpha1() v1alpha1.Interface {
- return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
-}
diff --git a/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/couchdbsource.go b/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/couchdbsource.go
deleted file mode 100644
index b6545d5664..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/couchdbsource.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- versioned "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
- internalinterfaces "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/listers/sources/v1alpha1"
-)
-
-// CouchDbSourceInformer provides access to a shared informer and lister for
-// CouchDbSources.
-type CouchDbSourceInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.CouchDbSourceLister
-}
-
-type couchDbSourceInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewCouchDbSourceInformer constructs a new informer for CouchDbSource type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewCouchDbSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredCouchDbSourceInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredCouchDbSourceInformer constructs a new informer for CouchDbSource type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredCouchDbSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.SourcesV1alpha1().CouchDbSources(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.SourcesV1alpha1().CouchDbSources(namespace).Watch(context.TODO(), options)
- },
- },
- &sourcesv1alpha1.CouchDbSource{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *couchDbSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredCouchDbSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *couchDbSourceInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&sourcesv1alpha1.CouchDbSource{}, f.defaultInformer)
-}
-
-func (f *couchDbSourceInformer) Lister() v1alpha1.CouchDbSourceLister {
- return v1alpha1.NewCouchDbSourceLister(f.Informer().GetIndexer())
-}
diff --git a/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/interface.go b/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/interface.go
deleted file mode 100644
index 4b460320ed..0000000000
--- a/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1/interface.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- internalinterfaces "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/internalinterfaces"
-)
-
-// Interface provides access to all the informers in this group version.
-type Interface interface {
- // CouchDbSources returns a CouchDbSourceInformer.
- CouchDbSources() CouchDbSourceInformer
-}
-
-type version struct {
- factory internalinterfaces.SharedInformerFactory
- namespace string
- tweakListOptions internalinterfaces.TweakListOptionsFunc
-}
-
-// New returns a new Interface.
-func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
- return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
-}
-
-// CouchDbSources returns a CouchDbSourceInformer.
-func (v *version) CouchDbSources() CouchDbSourceInformer {
- return &couchDbSourceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
diff --git a/couchdb/source/pkg/client/injection/client/client.go b/couchdb/source/pkg/client/injection/client/client.go
deleted file mode 100644
index 2c4d93b71a..0000000000
--- a/couchdb/source/pkg/client/injection/client/client.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package client
-
-import (
- context "context"
-
- rest "k8s.io/client-go/rest"
- versioned "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
- injection "knative.dev/pkg/injection"
- logging "knative.dev/pkg/logging"
-)
-
-func init() {
- injection.Default.RegisterClient(withClient)
-}
-
-// Key is used as the key for associating information with a context.Context.
-type Key struct{}
-
-func withClient(ctx context.Context, cfg *rest.Config) context.Context {
- return context.WithValue(ctx, Key{}, versioned.NewForConfigOrDie(cfg))
-}
-
-// Get extracts the versioned.Interface client from the context.
-func Get(ctx context.Context) versioned.Interface {
- untyped := ctx.Value(Key{})
- if untyped == nil {
- logging.FromContext(ctx).Panic(
- "Unable to fetch knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned.Interface from context.")
- }
- return untyped.(versioned.Interface)
-}
diff --git a/couchdb/source/pkg/client/injection/client/fake/fake.go b/couchdb/source/pkg/client/injection/client/fake/fake.go
deleted file mode 100644
index 3e0ee1750a..0000000000
--- a/couchdb/source/pkg/client/injection/client/fake/fake.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- runtime "k8s.io/apimachinery/pkg/runtime"
- rest "k8s.io/client-go/rest"
- fake "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/fake"
- client "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client"
- injection "knative.dev/pkg/injection"
- logging "knative.dev/pkg/logging"
-)
-
-func init() {
- injection.Fake.RegisterClient(withClient)
-}
-
-func withClient(ctx context.Context, cfg *rest.Config) context.Context {
- ctx, _ = With(ctx)
- return ctx
-}
-
-func With(ctx context.Context, objects ...runtime.Object) (context.Context, *fake.Clientset) {
- cs := fake.NewSimpleClientset(objects...)
- return context.WithValue(ctx, client.Key{}, cs), cs
-}
-
-// Get extracts the Kubernetes client from the context.
-func Get(ctx context.Context) *fake.Clientset {
- untyped := ctx.Value(client.Key{})
- if untyped == nil {
- logging.FromContext(ctx).Panic(
- "Unable to fetch knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/fake.Clientset from context.")
- }
- return untyped.(*fake.Clientset)
-}
diff --git a/couchdb/source/pkg/client/injection/informers/factory/factory.go b/couchdb/source/pkg/client/injection/informers/factory/factory.go
deleted file mode 100644
index 6c1fa03f60..0000000000
--- a/couchdb/source/pkg/client/injection/informers/factory/factory.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package factory
-
-import (
- context "context"
-
- externalversions "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions"
- client "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
- logging "knative.dev/pkg/logging"
-)
-
-func init() {
- injection.Default.RegisterInformerFactory(withInformerFactory)
-}
-
-// Key is used as the key for associating information with a context.Context.
-type Key struct{}
-
-func withInformerFactory(ctx context.Context) context.Context {
- c := client.Get(ctx)
- opts := make([]externalversions.SharedInformerOption, 0, 1)
- if injection.HasNamespaceScope(ctx) {
- opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx)))
- }
- return context.WithValue(ctx, Key{},
- externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...))
-}
-
-// Get extracts the InformerFactory from the context.
-func Get(ctx context.Context) externalversions.SharedInformerFactory {
- untyped := ctx.Value(Key{})
- if untyped == nil {
- logging.FromContext(ctx).Panic(
- "Unable to fetch knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions.SharedInformerFactory from context.")
- }
- return untyped.(externalversions.SharedInformerFactory)
-}
diff --git a/couchdb/source/pkg/client/injection/informers/factory/fake/fake.go b/couchdb/source/pkg/client/injection/informers/factory/fake/fake.go
deleted file mode 100644
index cfc4288e38..0000000000
--- a/couchdb/source/pkg/client/injection/informers/factory/fake/fake.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- externalversions "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions"
- fake "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client/fake"
- factory "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/factory"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
-)
-
-var Get = factory.Get
-
-func init() {
- injection.Fake.RegisterInformerFactory(withInformerFactory)
-}
-
-func withInformerFactory(ctx context.Context) context.Context {
- c := fake.Get(ctx)
- opts := make([]externalversions.SharedInformerOption, 0, 1)
- if injection.HasNamespaceScope(ctx) {
- opts = append(opts, externalversions.WithNamespace(injection.GetNamespaceScope(ctx)))
- }
- return context.WithValue(ctx, factory.Key{},
- externalversions.NewSharedInformerFactoryWithOptions(c, controller.GetResyncPeriod(ctx), opts...))
-}
diff --git a/couchdb/source/pkg/client/injection/informers/sources/factory/fake/fake.go b/couchdb/source/pkg/client/injection/informers/sources/factory/fake/fake.go
deleted file mode 100644
index b3e9c2e0ce..0000000000
--- a/couchdb/source/pkg/client/injection/informers/sources/factory/fake/fake.go
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-Copyright 2019 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- externalversions "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions"
- fake "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client/fake"
- factory "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/sources/factory"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
-)
-
-var Get = factory.Get
-
-func init() {
- injection.Fake.RegisterInformerFactory(withInformerFactory)
-}
-
-func withInformerFactory(ctx context.Context) context.Context {
- c := fake.Get(ctx)
- return context.WithValue(ctx, factory.Key{},
- externalversions.NewSharedInformerFactory(c, controller.GetResyncPeriod(ctx)))
-}
diff --git a/couchdb/source/pkg/client/injection/informers/sources/factory/sourcesfactory.go b/couchdb/source/pkg/client/injection/informers/sources/factory/sourcesfactory.go
deleted file mode 100644
index b4410fff6e..0000000000
--- a/couchdb/source/pkg/client/injection/informers/sources/factory/sourcesfactory.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright 2019 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package sourcesfactory
-
-import (
- "context"
-
- externalversions "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions"
- client "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
- logging "knative.dev/pkg/logging"
-)
-
-func init() {
- injection.Default.RegisterInformerFactory(withInformerFactory)
-}
-
-// Key is used as the key for associating information with a context.Context.
-type Key struct{}
-
-func withInformerFactory(ctx context.Context) context.Context {
- c := client.Get(ctx)
- return context.WithValue(ctx, Key{},
- externalversions.NewSharedInformerFactory(c, controller.GetResyncPeriod(ctx)))
-}
-
-// Get extracts the InformerFactory from the context.
-func Get(ctx context.Context) externalversions.SharedInformerFactory {
- untyped := ctx.Value(Key{})
- if untyped == nil {
- logging.FromContext(ctx).Fatalf(
- "Unable to fetch %T from context.", (externalversions.SharedInformerFactory)(nil))
- }
- return untyped.(externalversions.SharedInformerFactory)
-}
diff --git a/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/couchdbsource.go b/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/couchdbsource.go
deleted file mode 100644
index 38c16dec56..0000000000
--- a/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/couchdbsource.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- context "context"
-
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1"
- factory "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/factory"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
- logging "knative.dev/pkg/logging"
-)
-
-func init() {
- injection.Default.RegisterInformer(withInformer)
-}
-
-// Key is used for associating the Informer inside the context.Context.
-type Key struct{}
-
-func withInformer(ctx context.Context) (context.Context, controller.Informer) {
- f := factory.Get(ctx)
- inf := f.Sources().V1alpha1().CouchDbSources()
- return context.WithValue(ctx, Key{}, inf), inf.Informer()
-}
-
-// Get extracts the typed informer from the context.
-func Get(ctx context.Context) v1alpha1.CouchDbSourceInformer {
- untyped := ctx.Value(Key{})
- if untyped == nil {
- logging.FromContext(ctx).Panic(
- "Unable to fetch knative.dev/eventing-contrib/couchdb/source/pkg/client/informers/externalversions/sources/v1alpha1.CouchDbSourceInformer from context.")
- }
- return untyped.(v1alpha1.CouchDbSourceInformer)
-}
diff --git a/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/fake/fake.go b/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/fake/fake.go
deleted file mode 100644
index 3a50061d13..0000000000
--- a/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource/fake/fake.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package fake
-
-import (
- context "context"
-
- fake "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/factory/fake"
- couchdbsource "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource"
- controller "knative.dev/pkg/controller"
- injection "knative.dev/pkg/injection"
-)
-
-var Get = couchdbsource.Get
-
-func init() {
- injection.Fake.RegisterInformer(withInformer)
-}
-
-func withInformer(ctx context.Context) (context.Context, controller.Informer) {
- f := fake.Get(ctx)
- inf := f.Sources().V1alpha1().CouchDbSources()
- return context.WithValue(ctx, couchdbsource.Key{}, inf), inf.Informer()
-}
diff --git a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/controller.go b/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/controller.go
deleted file mode 100644
index ff5a723d03..0000000000
--- a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/controller.go
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- context "context"
- fmt "fmt"
- reflect "reflect"
- strings "strings"
-
- corev1 "k8s.io/api/core/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- scheme "k8s.io/client-go/kubernetes/scheme"
- v1 "k8s.io/client-go/kubernetes/typed/core/v1"
- record "k8s.io/client-go/tools/record"
- versionedscheme "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned/scheme"
- client "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/client"
- couchdbsource "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource"
- kubeclient "knative.dev/pkg/client/injection/kube/client"
- controller "knative.dev/pkg/controller"
- logging "knative.dev/pkg/logging"
- reconciler "knative.dev/pkg/reconciler"
-)
-
-const (
- defaultControllerAgentName = "couchdbsource-controller"
- defaultFinalizerName = "couchdbsources.sources.knative.dev"
-)
-
-// NewImpl returns a controller.Impl that handles queuing and feeding work from
-// the queue through an implementation of controller.Reconciler, delegating to
-// the provided Interface and optional Finalizer methods. OptionsFn is used to return
-// controller.Options to be used but the internal reconciler.
-func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsFn) *controller.Impl {
- logger := logging.FromContext(ctx)
-
- // Check the options function input. It should be 0 or 1.
- if len(optionsFns) > 1 {
- logger.Fatalf("up to one options function is supported, found %d", len(optionsFns))
- }
-
- couchdbsourceInformer := couchdbsource.Get(ctx)
-
- lister := couchdbsourceInformer.Lister()
-
- rec := &reconcilerImpl{
- LeaderAwareFuncs: reconciler.LeaderAwareFuncs{
- PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error {
- all, err := lister.List(labels.Everything())
- if err != nil {
- return err
- }
- for _, elt := range all {
- // TODO: Consider letting users specify a filter in options.
- enq(bkt, types.NamespacedName{
- Namespace: elt.GetNamespace(),
- Name: elt.GetName(),
- })
- }
- return nil
- },
- },
- Client: client.Get(ctx),
- Lister: lister,
- reconciler: r,
- finalizerName: defaultFinalizerName,
- }
-
- t := reflect.TypeOf(r).Elem()
- queueName := fmt.Sprintf("%s.%s", strings.ReplaceAll(t.PkgPath(), "/", "-"), t.Name())
-
- impl := controller.NewImpl(rec, logger, queueName)
- agentName := defaultControllerAgentName
-
- // Pass impl to the options. Save any optional results.
- for _, fn := range optionsFns {
- opts := fn(impl)
- if opts.ConfigStore != nil {
- rec.configStore = opts.ConfigStore
- }
- if opts.FinalizerName != "" {
- rec.finalizerName = opts.FinalizerName
- }
- if opts.AgentName != "" {
- agentName = opts.AgentName
- }
- if opts.SkipStatusUpdates {
- rec.skipStatusUpdates = true
- }
- }
-
- rec.Recorder = createRecorder(ctx, agentName)
-
- return impl
-}
-
-func createRecorder(ctx context.Context, agentName string) record.EventRecorder {
- logger := logging.FromContext(ctx)
-
- recorder := controller.GetEventRecorder(ctx)
- if recorder == nil {
- // Create event broadcaster
- logger.Debug("Creating event broadcaster")
- eventBroadcaster := record.NewBroadcaster()
- watches := []watch.Interface{
- eventBroadcaster.StartLogging(logger.Named("event-broadcaster").Infof),
- eventBroadcaster.StartRecordingToSink(
- &v1.EventSinkImpl{Interface: kubeclient.Get(ctx).CoreV1().Events("")}),
- }
- recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: agentName})
- go func() {
- <-ctx.Done()
- for _, w := range watches {
- w.Stop()
- }
- }()
- }
-
- return recorder
-}
-
-func init() {
- versionedscheme.AddToScheme(scheme.Scheme)
-}
diff --git a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/reconciler.go b/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/reconciler.go
deleted file mode 100644
index c5727715d0..0000000000
--- a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/reconciler.go
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- context "context"
- json "encoding/json"
- fmt "fmt"
- reflect "reflect"
-
- zap "go.uber.org/zap"
- v1 "k8s.io/api/core/v1"
- equality "k8s.io/apimachinery/pkg/api/equality"
- errors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- types "k8s.io/apimachinery/pkg/types"
- sets "k8s.io/apimachinery/pkg/util/sets"
- record "k8s.io/client-go/tools/record"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- versioned "knative.dev/eventing-contrib/couchdb/source/pkg/client/clientset/versioned"
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/client/listers/sources/v1alpha1"
- controller "knative.dev/pkg/controller"
- kmp "knative.dev/pkg/kmp"
- logging "knative.dev/pkg/logging"
- reconciler "knative.dev/pkg/reconciler"
-)
-
-// Interface defines the strongly typed interfaces to be implemented by a
-// controller reconciling v1alpha1.CouchDbSource.
-type Interface interface {
- // ReconcileKind implements custom logic to reconcile v1alpha1.CouchDbSource. Any changes
- // to the objects .Status or .Finalizers will be propagated to the stored
- // object. It is recommended that implementors do not call any update calls
- // for the Kind inside of ReconcileKind, it is the responsibility of the calling
- // controller to propagate those properties. The resource passed to ReconcileKind
- // will always have an empty deletion timestamp.
- ReconcileKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event
-}
-
-// Finalizer defines the strongly typed interfaces to be implemented by a
-// controller finalizing v1alpha1.CouchDbSource.
-type Finalizer interface {
- // FinalizeKind implements custom logic to finalize v1alpha1.CouchDbSource. Any changes
- // to the objects .Status or .Finalizers will be ignored. Returning a nil or
- // Normal type reconciler.Event will allow the finalizer to be deleted on
- // the resource. The resource passed to FinalizeKind will always have a set
- // deletion timestamp.
- FinalizeKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event
-}
-
-// ReadOnlyInterface defines the strongly typed interfaces to be implemented by a
-// controller reconciling v1alpha1.CouchDbSource if they want to process resources for which
-// they are not the leader.
-type ReadOnlyInterface interface {
- // ObserveKind implements logic to observe v1alpha1.CouchDbSource.
- // This method should not write to the API.
- ObserveKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event
-}
-
-// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
-// controller finalizing v1alpha1.CouchDbSource if they want to process tombstoned resources
-// even when they are not the leader. Due to the nature of how finalizers are handled
-// there are no guarantees that this will be called.
-type ReadOnlyFinalizer interface {
- // ObserveFinalizeKind implements custom logic to observe the final state of v1alpha1.CouchDbSource.
- // This method should not write to the API.
- ObserveFinalizeKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event
-}
-
-type doReconcile func(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event
-
-// reconcilerImpl implements controller.Reconciler for v1alpha1.CouchDbSource resources.
-type reconcilerImpl struct {
- // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware
- reconciler.LeaderAwareFuncs
-
- // Client is used to write back status updates.
- Client versioned.Interface
-
- // Listers index properties about resources
- Lister sourcesv1alpha1.CouchDbSourceLister
-
- // Recorder is an event recorder for recording Event resources to the
- // Kubernetes API.
- Recorder record.EventRecorder
-
- // configStore allows for decorating a context with config maps.
- // +optional
- configStore reconciler.ConfigStore
-
- // reconciler is the implementation of the business logic of the resource.
- reconciler Interface
-
- // finalizerName is the name of the finalizer to reconcile.
- finalizerName string
-
- // skipStatusUpdates configures whether or not this reconciler automatically updates
- // the status of the reconciled resource.
- skipStatusUpdates bool
-}
-
-// Check that our Reconciler implements controller.Reconciler
-var _ controller.Reconciler = (*reconcilerImpl)(nil)
-
-// Check that our generated Reconciler is always LeaderAware.
-var _ reconciler.LeaderAware = (*reconcilerImpl)(nil)
-
-func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client versioned.Interface, lister sourcesv1alpha1.CouchDbSourceLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler {
- // Check the options function input. It should be 0 or 1.
- if len(options) > 1 {
- logger.Fatalf("up to one options struct is supported, found %d", len(options))
- }
-
- // Fail fast when users inadvertently implement the other LeaderAware interface.
- // For the typed reconcilers, Promote shouldn't take any arguments.
- if _, ok := r.(reconciler.LeaderAware); ok {
- logger.Fatalf("%T implements the incorrect LeaderAware interface. Promote() should not take an argument as genreconciler handles the enqueuing automatically.", r)
- }
- // TODO: Consider validating when folks implement ReadOnlyFinalizer, but not Finalizer.
-
- rec := &reconcilerImpl{
- LeaderAwareFuncs: reconciler.LeaderAwareFuncs{
- PromoteFunc: func(bkt reconciler.Bucket, enq func(reconciler.Bucket, types.NamespacedName)) error {
- all, err := lister.List(labels.Everything())
- if err != nil {
- return err
- }
- for _, elt := range all {
- // TODO: Consider letting users specify a filter in options.
- enq(bkt, types.NamespacedName{
- Namespace: elt.GetNamespace(),
- Name: elt.GetName(),
- })
- }
- return nil
- },
- },
- Client: client,
- Lister: lister,
- Recorder: recorder,
- reconciler: r,
- finalizerName: defaultFinalizerName,
- }
-
- for _, opts := range options {
- if opts.ConfigStore != nil {
- rec.configStore = opts.ConfigStore
- }
- if opts.FinalizerName != "" {
- rec.finalizerName = opts.FinalizerName
- }
- if opts.SkipStatusUpdates {
- rec.skipStatusUpdates = true
- }
- }
-
- return rec
-}
-
-// Reconcile implements controller.Reconciler
-func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error {
- logger := logging.FromContext(ctx)
-
- // Initialize the reconciler state. This will convert the namespace/name
- // string into a distinct namespace and name, determin if this instance of
- // the reconciler is the leader, and any additional interfaces implemented
- // by the reconciler. Returns an error is the resource key is invalid.
- s, err := newState(key, r)
- if err != nil {
- logger.Errorf("invalid resource key: %s", key)
- return nil
- }
-
- // If we are not the leader, and we don't implement either ReadOnly
- // observer interfaces, then take a fast-path out.
- if s.isNotLeaderNorObserver() {
- return nil
- }
-
- // If configStore is set, attach the frozen configuration to the context.
- if r.configStore != nil {
- ctx = r.configStore.ToContext(ctx)
- }
-
- // Add the recorder to context.
- ctx = controller.WithEventRecorder(ctx, r.Recorder)
-
- // Get the resource with this namespace/name.
-
- getter := r.Lister.CouchDbSources(s.namespace)
-
- original, err := getter.Get(s.name)
-
- if errors.IsNotFound(err) {
- // The resource may no longer exist, in which case we stop processing.
- logger.Debugf("resource %q no longer exists", key)
- return nil
- } else if err != nil {
- return err
- }
-
- // Don't modify the informers copy.
- resource := original.DeepCopy()
-
- var reconcileEvent reconciler.Event
-
- name, do := s.reconcileMethodFor(resource)
- // Append the target method to the logger.
- logger = logger.With(zap.String("targetMethod", name))
- switch name {
- case reconciler.DoReconcileKind:
- // Append the target method to the logger.
- logger = logger.With(zap.String("targetMethod", "ReconcileKind"))
-
- // Set and update the finalizer on resource if r.reconciler
- // implements Finalizer.
- if resource, err = r.setFinalizerIfFinalizer(ctx, resource); err != nil {
- return fmt.Errorf("failed to set finalizers: %w", err)
- }
-
- if !r.skipStatusUpdates {
- reconciler.PreProcessReconcile(ctx, resource)
- }
-
- // Reconcile this copy of the resource and then write back any status
- // updates regardless of whether the reconciliation errored out.
- reconcileEvent = do(ctx, resource)
-
- if !r.skipStatusUpdates {
- reconciler.PostProcessReconcile(ctx, resource, original)
- }
-
- case reconciler.DoFinalizeKind:
- // For finalizing reconcilers, if this resource being marked for deletion
- // and reconciled cleanly (nil or normal event), remove the finalizer.
- reconcileEvent = do(ctx, resource)
-
- if resource, err = r.clearFinalizer(ctx, resource, reconcileEvent); err != nil {
- return fmt.Errorf("failed to clear finalizers: %w", err)
- }
-
- case reconciler.DoObserveKind, reconciler.DoObserveFinalizeKind:
- // Observe any changes to this resource, since we are not the leader.
- reconcileEvent = do(ctx, resource)
-
- }
-
- // Synchronize the status.
- switch {
- case r.skipStatusUpdates:
- // This reconciler implementation is configured to skip resource updates.
- // This may mean this reconciler does not observe spec, but reconciles external changes.
- case equality.Semantic.DeepEqual(original.Status, resource.Status):
- // If we didn't change anything then don't call updateStatus.
- // This is important because the copy we loaded from the injectionInformer's
- // cache may be stale and we don't want to overwrite a prior update
- // to status with this stale state.
- case !s.isLeader:
- // High-availability reconcilers may have many replicas watching the resource, but only
- // the elected leader is expected to write modifications.
- logger.Warn("Saw status changes when we aren't the leader!")
- default:
- if err = r.updateStatus(ctx, original, resource); err != nil {
- logger.Warnw("Failed to update resource status", zap.Error(err))
- r.Recorder.Eventf(resource, v1.EventTypeWarning, "UpdateFailed",
- "Failed to update status for %q: %v", resource.Name, err)
- return err
- }
- }
-
- // Report the reconciler event, if any.
- if reconcileEvent != nil {
- var event *reconciler.ReconcilerEvent
- if reconciler.EventAs(reconcileEvent, &event) {
- logger.Infow("Returned an event", zap.Any("event", reconcileEvent))
- r.Recorder.Eventf(resource, event.EventType, event.Reason, event.Format, event.Args...)
-
- // the event was wrapped inside an error, consider the reconciliation as failed
- if _, isEvent := reconcileEvent.(*reconciler.ReconcilerEvent); !isEvent {
- return reconcileEvent
- }
- return nil
- }
-
- logger.Errorw("Returned an error", zap.Error(reconcileEvent))
- r.Recorder.Event(resource, v1.EventTypeWarning, "InternalError", reconcileEvent.Error())
- return reconcileEvent
- }
-
- return nil
-}
-
-func (r *reconcilerImpl) updateStatus(ctx context.Context, existing *v1alpha1.CouchDbSource, desired *v1alpha1.CouchDbSource) error {
- existing = existing.DeepCopy()
- return reconciler.RetryUpdateConflicts(func(attempts int) (err error) {
- // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API.
- if attempts > 0 {
-
- getter := r.Client.SourcesV1alpha1().CouchDbSources(desired.Namespace)
-
- existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
- }
-
- // If there's nothing to update, just return.
- if reflect.DeepEqual(existing.Status, desired.Status) {
- return nil
- }
-
- if diff, err := kmp.SafeDiff(existing.Status, desired.Status); err == nil && diff != "" {
- logging.FromContext(ctx).Debugf("Updating status with: %s", diff)
- }
-
- existing.Status = desired.Status
-
- updater := r.Client.SourcesV1alpha1().CouchDbSources(existing.Namespace)
-
- _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{})
- return err
- })
-}
-
-// updateFinalizersFiltered will update the Finalizers of the resource.
-// TODO: this method could be generic and sync all finalizers. For now it only
-// updates defaultFinalizerName or its override.
-func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.CouchDbSource) (*v1alpha1.CouchDbSource, error) {
-
- getter := r.Lister.CouchDbSources(resource.Namespace)
-
- actual, err := getter.Get(resource.Name)
- if err != nil {
- return resource, err
- }
-
- // Don't modify the informers copy.
- existing := actual.DeepCopy()
-
- var finalizers []string
-
- // If there's nothing to update, just return.
- existingFinalizers := sets.NewString(existing.Finalizers...)
- desiredFinalizers := sets.NewString(resource.Finalizers...)
-
- if desiredFinalizers.Has(r.finalizerName) {
- if existingFinalizers.Has(r.finalizerName) {
- // Nothing to do.
- return resource, nil
- }
- // Add the finalizer.
- finalizers = append(existing.Finalizers, r.finalizerName)
- } else {
- if !existingFinalizers.Has(r.finalizerName) {
- // Nothing to do.
- return resource, nil
- }
- // Remove the finalizer.
- existingFinalizers.Delete(r.finalizerName)
- finalizers = existingFinalizers.List()
- }
-
- mergePatch := map[string]interface{}{
- "metadata": map[string]interface{}{
- "finalizers": finalizers,
- "resourceVersion": existing.ResourceVersion,
- },
- }
-
- patch, err := json.Marshal(mergePatch)
- if err != nil {
- return resource, err
- }
-
- patcher := r.Client.SourcesV1alpha1().CouchDbSources(resource.Namespace)
-
- resourceName := resource.Name
- resource, err = patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{})
- if err != nil {
- r.Recorder.Eventf(resource, v1.EventTypeWarning, "FinalizerUpdateFailed",
- "Failed to update finalizers for %q: %v", resourceName, err)
- } else {
- r.Recorder.Eventf(resource, v1.EventTypeNormal, "FinalizerUpdate",
- "Updated %q finalizers", resource.GetName())
- }
- return resource, err
-}
-
-func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1alpha1.CouchDbSource) (*v1alpha1.CouchDbSource, error) {
- if _, ok := r.reconciler.(Finalizer); !ok {
- return resource, nil
- }
-
- finalizers := sets.NewString(resource.Finalizers...)
-
- // If this resource is not being deleted, mark the finalizer.
- if resource.GetDeletionTimestamp().IsZero() {
- finalizers.Insert(r.finalizerName)
- }
-
- resource.Finalizers = finalizers.List()
-
- // Synchronize the finalizers filtered by r.finalizerName.
- return r.updateFinalizersFiltered(ctx, resource)
-}
-
-func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1.CouchDbSource, reconcileEvent reconciler.Event) (*v1alpha1.CouchDbSource, error) {
- if _, ok := r.reconciler.(Finalizer); !ok {
- return resource, nil
- }
- if resource.GetDeletionTimestamp().IsZero() {
- return resource, nil
- }
-
- finalizers := sets.NewString(resource.Finalizers...)
-
- if reconcileEvent != nil {
- var event *reconciler.ReconcilerEvent
- if reconciler.EventAs(reconcileEvent, &event) {
- if event.EventType == v1.EventTypeNormal {
- finalizers.Delete(r.finalizerName)
- }
- }
- } else {
- finalizers.Delete(r.finalizerName)
- }
-
- resource.Finalizers = finalizers.List()
-
- // Synchronize the finalizers filtered by r.finalizerName.
- return r.updateFinalizersFiltered(ctx, resource)
-}
diff --git a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/state.go b/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/state.go
deleted file mode 100644
index a2ddb93aab..0000000000
--- a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/state.go
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- fmt "fmt"
-
- types "k8s.io/apimachinery/pkg/types"
- cache "k8s.io/client-go/tools/cache"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- reconciler "knative.dev/pkg/reconciler"
-)
-
-// state is used to track the state of a reconciler in a single run.
-type state struct {
- // Key is the original reconciliation key from the queue.
- key string
- // Namespace is the namespace split from the reconciliation key.
- namespace string
- // Namespace is the name split from the reconciliation key.
- name string
- // reconciler is the reconciler.
- reconciler Interface
- // rof is the read only interface cast of the reconciler.
- roi ReadOnlyInterface
- // IsROI (Read Only Interface) the reconciler only observes reconciliation.
- isROI bool
- // rof is the read only finalizer cast of the reconciler.
- rof ReadOnlyFinalizer
- // IsROF (Read Only Finalizer) the reconciler only observes finalize.
- isROF bool
- // IsLeader the instance of the reconciler is the elected leader.
- isLeader bool
-}
-
-func newState(key string, r *reconcilerImpl) (*state, error) {
- // Convert the namespace/name string into a distinct namespace and name
- namespace, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return nil, fmt.Errorf("invalid resource key: %s", key)
- }
-
- roi, isROI := r.reconciler.(ReadOnlyInterface)
- rof, isROF := r.reconciler.(ReadOnlyFinalizer)
-
- isLeader := r.IsLeaderFor(types.NamespacedName{
- Namespace: namespace,
- Name: name,
- })
-
- return &state{
- key: key,
- namespace: namespace,
- name: name,
- reconciler: r.reconciler,
- roi: roi,
- isROI: isROI,
- rof: rof,
- isROF: isROF,
- isLeader: isLeader,
- }, nil
-}
-
-// isNotLeaderNorObserver checks to see if this reconciler with the current
-// state is enabled to do any work or not.
-// isNotLeaderNorObserver returns true when there is no work possible for the
-// reconciler.
-func (s *state) isNotLeaderNorObserver() bool {
- if !s.isLeader && !s.isROI && !s.isROF {
- // If we are not the leader, and we don't implement either ReadOnly
- // interface, then take a fast-path out.
- return true
- }
- return false
-}
-
-func (s *state) reconcileMethodFor(o *v1alpha1.CouchDbSource) (string, doReconcile) {
- if o.GetDeletionTimestamp().IsZero() {
- if s.isLeader {
- return reconciler.DoReconcileKind, s.reconciler.ReconcileKind
- } else if s.isROI {
- return reconciler.DoObserveKind, s.roi.ObserveKind
- }
- } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok {
- return reconciler.DoFinalizeKind, fin.FinalizeKind
- } else if !s.isLeader && s.isROF {
- return reconciler.DoObserveFinalizeKind, s.rof.ObserveFinalizeKind
- }
- return "unknown", nil
-}
diff --git a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/controller.go b/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/controller.go
deleted file mode 100644
index 5d3b40da25..0000000000
--- a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/controller.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- context "context"
-
- couchdbsource "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource"
- v1alpha1couchdbsource "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource"
- configmap "knative.dev/pkg/configmap"
- controller "knative.dev/pkg/controller"
- logging "knative.dev/pkg/logging"
-)
-
-// TODO: PLEASE COPY AND MODIFY THIS FILE AS A STARTING POINT
-
-// NewController creates a Reconciler for CouchDbSource and returns the result of NewImpl.
-func NewController(
- ctx context.Context,
- cmw configmap.Watcher,
-) *controller.Impl {
- logger := logging.FromContext(ctx)
-
- couchdbsourceInformer := couchdbsource.Get(ctx)
-
- // TODO: setup additional informers here.
-
- r := &Reconciler{}
- impl := v1alpha1couchdbsource.NewImpl(ctx, r)
-
- logger.Info("Setting up event handlers.")
-
- couchdbsourceInformer.Informer().AddEventHandler(controller.HandleAll(impl.Enqueue))
-
- // TODO: add additional informer event handlers here.
-
- return impl
-}
diff --git a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/reconciler.go b/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/reconciler.go
deleted file mode 100644
index 00dd6e56fd..0000000000
--- a/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource/stub/reconciler.go
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by injection-gen. DO NOT EDIT.
-
-package couchdbsource
-
-import (
- context "context"
-
- v1 "k8s.io/api/core/v1"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- couchdbsource "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource"
- reconciler "knative.dev/pkg/reconciler"
-)
-
-// TODO: PLEASE COPY AND MODIFY THIS FILE AS A STARTING POINT
-
-// newReconciledNormal makes a new reconciler event with event type Normal, and
-// reason CouchDbSourceReconciled.
-func newReconciledNormal(namespace, name string) reconciler.Event {
- return reconciler.NewEvent(v1.EventTypeNormal, "CouchDbSourceReconciled", "CouchDbSource reconciled: \"%s/%s\"", namespace, name)
-}
-
-// Reconciler implements controller.Reconciler for CouchDbSource resources.
-type Reconciler struct {
- // TODO: add additional requirements here.
-}
-
-// Check that our Reconciler implements Interface
-var _ couchdbsource.Interface = (*Reconciler)(nil)
-
-// Optionally check that our Reconciler implements Finalizer
-//var _ couchdbsource.Finalizer = (*Reconciler)(nil)
-
-// Optionally check that our Reconciler implements ReadOnlyInterface
-// Implement this to observe resources even when we are not the leader.
-//var _ couchdbsource.ReadOnlyInterface = (*Reconciler)(nil)
-
-// Optionally check that our Reconciler implements ReadOnlyFinalizer
-// Implement this to observe tombstoned resources even when we are not
-// the leader (best effort).
-//var _ couchdbsource.ReadOnlyFinalizer = (*Reconciler)(nil)
-
-// ReconcileKind implements Interface.ReconcileKind.
-func (r *Reconciler) ReconcileKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event {
- // TODO: use this if the resource implements InitializeConditions.
- // o.Status.InitializeConditions()
-
- // TODO: add custom reconciliation logic here.
-
- // TODO: use this if the object has .status.ObservedGeneration.
- // o.Status.ObservedGeneration = o.Generation
- return newReconciledNormal(o.Namespace, o.Name)
-}
-
-// Optionally, use FinalizeKind to add finalizers. FinalizeKind will be called
-// when the resource is deleted.
-//func (r *Reconciler) FinalizeKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event {
-// // TODO: add custom finalization logic here.
-// return nil
-//}
-
-// Optionally, use ObserveKind to observe the resource when we are not the leader.
-// func (r *Reconciler) ObserveKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event {
-// // TODO: add custom observation logic here.
-// return nil
-// }
-
-// Optionally, use ObserveFinalizeKind to observe resources being finalized when we are no the leader.
-//func (r *Reconciler) ObserveFinalizeKind(ctx context.Context, o *v1alpha1.CouchDbSource) reconciler.Event {
-// // TODO: add custom observation logic here.
-// return nil
-//}
diff --git a/couchdb/source/pkg/client/listers/sources/v1alpha1/couchdbsource.go b/couchdb/source/pkg/client/listers/sources/v1alpha1/couchdbsource.go
deleted file mode 100644
index bc530a1c8b..0000000000
--- a/couchdb/source/pkg/client/listers/sources/v1alpha1/couchdbsource.go
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-// CouchDbSourceLister helps list CouchDbSources.
-type CouchDbSourceLister interface {
- // List lists all CouchDbSources in the indexer.
- List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error)
- // CouchDbSources returns an object that can list and get CouchDbSources.
- CouchDbSources(namespace string) CouchDbSourceNamespaceLister
- CouchDbSourceListerExpansion
-}
-
-// couchDbSourceLister implements the CouchDbSourceLister interface.
-type couchDbSourceLister struct {
- indexer cache.Indexer
-}
-
-// NewCouchDbSourceLister returns a new CouchDbSourceLister.
-func NewCouchDbSourceLister(indexer cache.Indexer) CouchDbSourceLister {
- return &couchDbSourceLister{indexer: indexer}
-}
-
-// List lists all CouchDbSources in the indexer.
-func (s *couchDbSourceLister) List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.CouchDbSource))
- })
- return ret, err
-}
-
-// CouchDbSources returns an object that can list and get CouchDbSources.
-func (s *couchDbSourceLister) CouchDbSources(namespace string) CouchDbSourceNamespaceLister {
- return couchDbSourceNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// CouchDbSourceNamespaceLister helps list and get CouchDbSources.
-type CouchDbSourceNamespaceLister interface {
- // List lists all CouchDbSources in the indexer for a given namespace.
- List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error)
- // Get retrieves the CouchDbSource from the indexer for a given namespace and name.
- Get(name string) (*v1alpha1.CouchDbSource, error)
- CouchDbSourceNamespaceListerExpansion
-}
-
-// couchDbSourceNamespaceLister implements the CouchDbSourceNamespaceLister
-// interface.
-type couchDbSourceNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all CouchDbSources in the indexer for a given namespace.
-func (s couchDbSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.CouchDbSource))
- })
- return ret, err
-}
-
-// Get retrieves the CouchDbSource from the indexer for a given namespace and name.
-func (s couchDbSourceNamespaceLister) Get(name string) (*v1alpha1.CouchDbSource, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("couchdbsource"), name)
- }
- return obj.(*v1alpha1.CouchDbSource), nil
-}
diff --git a/couchdb/source/pkg/client/listers/sources/v1alpha1/expansion_generated.go b/couchdb/source/pkg/client/listers/sources/v1alpha1/expansion_generated.go
deleted file mode 100644
index af95717177..0000000000
--- a/couchdb/source/pkg/client/listers/sources/v1alpha1/expansion_generated.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-// CouchDbSourceListerExpansion allows custom methods to be added to
-// CouchDbSourceLister.
-type CouchDbSourceListerExpansion interface{}
-
-// CouchDbSourceNamespaceListerExpansion allows custom methods to be added to
-// CouchDbSourceNamespaceLister.
-type CouchDbSourceNamespaceListerExpansion interface{}
diff --git a/couchdb/source/pkg/client/listers/v1alpha1/internalversion/couchdbsource.go b/couchdb/source/pkg/client/listers/v1alpha1/internalversion/couchdbsource.go
deleted file mode 100644
index f87d4953d0..0000000000
--- a/couchdb/source/pkg/client/listers/v1alpha1/internalversion/couchdbsource.go
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
- v1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-// CouchDbSourceLister helps list CouchDbSources.
-type CouchDbSourceLister interface {
- // List lists all CouchDbSources in the indexer.
- List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error)
- // CouchDbSources returns an object that can list and get CouchDbSources.
- CouchDbSources(namespace string) CouchDbSourceNamespaceLister
- CouchDbSourceListerExpansion
-}
-
-// couchDbSourceLister implements the CouchDbSourceLister interface.
-type couchDbSourceLister struct {
- indexer cache.Indexer
-}
-
-// NewCouchDbSourceLister returns a new CouchDbSourceLister.
-func NewCouchDbSourceLister(indexer cache.Indexer) CouchDbSourceLister {
- return &couchDbSourceLister{indexer: indexer}
-}
-
-// List lists all CouchDbSources in the indexer.
-func (s *couchDbSourceLister) List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.CouchDbSource))
- })
- return ret, err
-}
-
-// CouchDbSources returns an object that can list and get CouchDbSources.
-func (s *couchDbSourceLister) CouchDbSources(namespace string) CouchDbSourceNamespaceLister {
- return couchDbSourceNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// CouchDbSourceNamespaceLister helps list and get CouchDbSources.
-type CouchDbSourceNamespaceLister interface {
- // List lists all CouchDbSources in the indexer for a given namespace.
- List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error)
- // Get retrieves the CouchDbSource from the indexer for a given namespace and name.
- Get(name string) (*v1alpha1.CouchDbSource, error)
- CouchDbSourceNamespaceListerExpansion
-}
-
-// couchDbSourceNamespaceLister implements the CouchDbSourceNamespaceLister
-// interface.
-type couchDbSourceNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all CouchDbSources in the indexer for a given namespace.
-func (s couchDbSourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CouchDbSource, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.CouchDbSource))
- })
- return ret, err
-}
-
-// Get retrieves the CouchDbSource from the indexer for a given namespace and name.
-func (s couchDbSourceNamespaceLister) Get(name string) (*v1alpha1.CouchDbSource, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("couchdbsource"), name)
- }
- return obj.(*v1alpha1.CouchDbSource), nil
-}
diff --git a/couchdb/source/pkg/client/listers/v1alpha1/internalversion/expansion_generated.go b/couchdb/source/pkg/client/listers/v1alpha1/internalversion/expansion_generated.go
deleted file mode 100644
index 6752f0b64b..0000000000
--- a/couchdb/source/pkg/client/listers/v1alpha1/internalversion/expansion_generated.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2020 The Knative 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.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-// CouchDbSourceListerExpansion allows custom methods to be added to
-// CouchDbSourceLister.
-type CouchDbSourceListerExpansion interface{}
-
-// CouchDbSourceNamespaceListerExpansion allows custom methods to be added to
-// CouchDbSourceNamespaceLister.
-type CouchDbSourceNamespaceListerExpansion interface{}
diff --git a/couchdb/source/pkg/reconciler/controller.go b/couchdb/source/pkg/reconciler/controller.go
deleted file mode 100644
index cf0c9179af..0000000000
--- a/couchdb/source/pkg/reconciler/controller.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2019 The Knative 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 reconciler
-
-import (
- "context"
- "os"
-
- "k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/tools/cache"
- "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- kubeclient "knative.dev/pkg/client/injection/kube/client"
- deploymentinformer "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment"
- "knative.dev/pkg/configmap"
- "knative.dev/pkg/controller"
- "knative.dev/pkg/logging"
- "knative.dev/pkg/resolver"
-
- sourcesv1alpha1 "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- couchdbinformer "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/informers/sources/v1alpha1/couchdbsource"
- cdbreconciler "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource"
-)
-
-const (
- // ReconcilerName is the name of the reconciler
- ReconcilerName = "CouchDbSource"
-)
-
-func init() {
- sourcesv1alpha1.AddToScheme(scheme.Scheme)
-}
-
-// NewController initializes the controller and is called by the generated code
-// Registers event handlers to enqueue events
-func NewController(
- ctx context.Context,
- cmw configmap.Watcher,
-) *controller.Impl {
- deploymentInformer := deploymentinformer.Get(ctx)
- couchdbSourceInformer := couchdbinformer.Get(ctx)
-
- raImage, defined := os.LookupEnv(raImageEnvVar)
- if !defined {
- logging.FromContext(ctx).Errorf("required environment variable %q not defined", raImageEnvVar)
- return nil
- }
-
- r := &Reconciler{
- receiveAdapterImage: raImage,
- kubeClientSet: kubeclient.Get(ctx),
- deploymentLister: deploymentInformer.Lister(),
- }
- impl := cdbreconciler.NewImpl(ctx, r)
- r.sinkResolver = resolver.NewURIResolver(ctx, impl.EnqueueKey)
-
- logging.FromContext(ctx).Info("Setting up event handlers")
- couchdbSourceInformer.Informer().AddEventHandler(controller.HandleAll(impl.Enqueue))
-
- deploymentInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
- FilterFunc: controller.FilterControllerGK(v1alpha1.Kind("CouchDbSource")),
- Handler: controller.HandleAll(impl.EnqueueControllerOf),
- })
-
- return impl
-}
diff --git a/couchdb/source/pkg/reconciler/couchdbsource.go b/couchdb/source/pkg/reconciler/couchdbsource.go
deleted file mode 100644
index f36465e21a..0000000000
--- a/couchdb/source/pkg/reconciler/couchdbsource.go
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-Copyright 2019 The Knative 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 reconciler
-
-import (
- "context"
- "fmt"
- "net/url"
-
- "knative.dev/pkg/controller"
-
- "k8s.io/client-go/kubernetes"
-
- "go.uber.org/zap"
- appsv1 "k8s.io/api/apps/v1"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/api/equality"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- appsv1listers "k8s.io/client-go/listers/apps/v1"
- cdbreconciler "knative.dev/eventing-contrib/couchdb/source/pkg/client/injection/reconciler/sources/v1alpha1/couchdbsource"
- "knative.dev/pkg/apis"
- duckv1 "knative.dev/pkg/apis/duck/v1"
- "knative.dev/pkg/logging"
- pkgreconciler "knative.dev/pkg/reconciler"
- "knative.dev/pkg/resolver"
-
- "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- "knative.dev/eventing-contrib/couchdb/source/pkg/reconciler/resources"
-)
-
-const (
- // Name of the corev1.Events emitted from the reconciliation process
- couchdbsourceDeploymentCreated = "CouchDbSourceDeploymentCreated"
- couchdbsourceDeploymentUpdated = "CouchDbSourceDeploymentUpdated"
-
- // raImageEnvVar is the name of the environment variable that contains the receive adapter's
- // image. It must be defined.
- raImageEnvVar = "COUCHDB_RA_IMAGE"
-)
-
-// Reconciler reconciles a CouchDbSource object
-type Reconciler struct {
- receiveAdapterImage string
-
- // Clients
- kubeClientSet kubernetes.Interface
-
- // listers index properties about resources
-
- deploymentLister appsv1listers.DeploymentLister
-
- sinkResolver *resolver.URIResolver
-}
-
-var _ cdbreconciler.Interface = (*Reconciler)(nil)
-
-func (r *Reconciler) ReconcileKind(ctx context.Context, source *v1alpha1.CouchDbSource) pkgreconciler.Event {
- source.Status.InitializeConditions()
-
- if source.Spec.Sink == nil {
- source.Status.MarkNoSink("SinkMissing", "")
- return fmt.Errorf("spec.sink missing")
- }
-
- dest := source.Spec.Sink.DeepCopy()
- if dest.Ref != nil {
- // To call URIFromDestination(), dest.Ref must have a Namespace. If there is
- // no Namespace defined in dest.Ref, we will use the Namespace of the source
- // as the Namespace of dest.Ref.
- if dest.Ref.Namespace == "" {
- dest.Ref.Namespace = source.GetNamespace()
- }
- }
-
- sinkURI, err := r.sinkResolver.URIFromDestinationV1(ctx, *dest, source)
- if err != nil {
- source.Status.MarkNoSink("NotFound", "")
- return fmt.Errorf("getting sink URI: %v", err)
- }
-
- source.Status.MarkSink(sinkURI)
-
- ra, err := r.createReceiveAdapter(ctx, source, sinkURI)
- if err != nil {
- logging.FromContext(ctx).Errorw("Unable to create the receive adapter", zap.Error(err))
- return err
- }
- // Update source status// Update source status
- source.Status.PropagateDeploymentAvailability(ra)
-
- ceSource, err := r.makeEventSource(ctx, source)
- if err != nil {
- logging.FromContext(ctx).Errorw("Unable to create the CloudEvents source", zap.Error(err))
- return err
- }
-
- source.Status.CloudEventAttributes = r.createCloudEventAttributes(ceSource)
- return nil
-}
-
-func (r *Reconciler) createReceiveAdapter(ctx context.Context, src *v1alpha1.CouchDbSource, sinkURI *apis.URL) (*appsv1.Deployment, error) {
- eventSource, err := r.makeEventSource(ctx, src)
- if err != nil {
- return nil, err
- }
- logging.FromContext(ctx).Debugw("event source", zap.Any("source", eventSource))
-
- adapterArgs := resources.ReceiveAdapterArgs{
- EventSource: eventSource,
- Image: r.receiveAdapterImage,
- Source: src,
- Labels: resources.Labels(src.Name),
- SinkURI: sinkURI.String(),
- }
- expected := resources.MakeReceiveAdapter(&adapterArgs)
-
- ra, err := r.kubeClientSet.AppsV1().Deployments(src.Namespace).Get(ctx, expected.Name, metav1.GetOptions{})
- if apierrors.IsNotFound(err) {
- ra, err = r.kubeClientSet.AppsV1().Deployments(src.Namespace).Create(ctx, expected, metav1.CreateOptions{})
- controller.GetEventRecorder(ctx).Eventf(src, corev1.EventTypeNormal, couchdbsourceDeploymentCreated, "Deployment created, error: %v", err)
- return ra, err
- } else if err != nil {
- return nil, fmt.Errorf("error getting receive adapter: %v", err)
- } else if !metav1.IsControlledBy(ra, src) {
- return nil, fmt.Errorf("deployment %q is not owned by CouchDbSource %q", ra.Name, src.Name)
- } else if r.podSpecChanged(ra.Spec.Template.Spec, expected.Spec.Template.Spec) {
- ra.Spec.Template.Spec = expected.Spec.Template.Spec
- if ra, err = r.kubeClientSet.AppsV1().Deployments(src.Namespace).Update(ctx, ra, metav1.UpdateOptions{}); err != nil {
- return ra, err
- }
- controller.GetEventRecorder(ctx).Eventf(src, corev1.EventTypeNormal, couchdbsourceDeploymentUpdated, "Deployment updated")
- return ra, nil
- } else {
- logging.FromContext(ctx).Debugw("Reusing existing receive adapter", zap.Any("receiveAdapter", ra))
- }
- return ra, nil
-}
-
-func (r *Reconciler) podSpecChanged(oldPodSpec corev1.PodSpec, newPodSpec corev1.PodSpec) bool {
- if !equality.Semantic.DeepDerivative(newPodSpec, oldPodSpec) {
- return true
- }
- if len(oldPodSpec.Containers) != len(newPodSpec.Containers) {
- return true
- }
- for i := range newPodSpec.Containers {
- if !equality.Semantic.DeepEqual(newPodSpec.Containers[i].Env, oldPodSpec.Containers[i].Env) {
- return true
- }
- }
- return false
-}
-
-// MakeEventSource computes the Cloud Event source attribute for the given source
-func (r *Reconciler) makeEventSource(ctx context.Context, src *v1alpha1.CouchDbSource) (string, error) {
- namespace := src.Spec.CouchDbCredentials.Namespace
- if namespace == "" {
- namespace = src.Namespace
- }
-
- secret, err := r.kubeClientSet.CoreV1().Secrets(namespace).Get(ctx, src.Spec.CouchDbCredentials.Name, metav1.GetOptions{})
- if err != nil {
- logging.FromContext(ctx).Errorw("Unable to read CouchDB credentials secret", zap.Error(err))
- return "", err
- }
- rawurl, ok := secret.Data["url"]
- if !ok {
- logging.FromContext(ctx).Errorw("Unable to get CouchDB url field", zap.Any("secretName", secret.Name), zap.Any("secretNamespace", secret.Namespace))
- return "", err
- }
-
- url, err := url.Parse(string(rawurl))
- if err != nil {
- return "", err
- }
-
- return fmt.Sprintf("%s/%s", url.Hostname(), src.Spec.Database), nil
-}
-
-func (r *Reconciler) createCloudEventAttributes(ceSource string) []duckv1.CloudEventAttributes {
- ceAttributes := make([]duckv1.CloudEventAttributes, 0, len(v1alpha1.CouchDbSourceEventTypes))
- for _, couchDbSourceEventType := range v1alpha1.CouchDbSourceEventTypes {
- ceAttributes = append(ceAttributes, duckv1.CloudEventAttributes{
- Type: couchDbSourceEventType,
- Source: ceSource,
- })
- }
- return ceAttributes
-}
diff --git a/couchdb/source/pkg/reconciler/resources/labels.go b/couchdb/source/pkg/reconciler/resources/labels.go
deleted file mode 100644
index 8394fccba4..0000000000
--- a/couchdb/source/pkg/reconciler/resources/labels.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright 2019 The Knative 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 resources
-
-const (
- // controllerAgentName is the string used by this controller to identify
- // itself when creating events.
- controllerAgentName = "couchdb-source-controller"
-)
-
-func Labels(name string) map[string]string {
- return map[string]string{
- "knative-eventing-source": controllerAgentName,
- "knative-eventing-source-name": name,
- }
-}
diff --git a/couchdb/source/pkg/reconciler/resources/receive_adapter.go b/couchdb/source/pkg/reconciler/resources/receive_adapter.go
deleted file mode 100644
index 23ed0b96be..0000000000
--- a/couchdb/source/pkg/reconciler/resources/receive_adapter.go
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-Copyright 2019 The Knative 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 resources
-
-import (
- "fmt"
-
- v1 "k8s.io/api/apps/v1"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "knative.dev/eventing/pkg/utils"
- "knative.dev/pkg/kmeta"
-
- "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
-)
-
-// ReceiveAdapterArgs are the arguments needed to create a CouchDB Receive Adapter.
-// Every field is required.
-type ReceiveAdapterArgs struct {
- EventSource string
- Image string
- Source *v1alpha1.CouchDbSource
- Labels map[string]string
- SinkURI string
-}
-
-// MakeReceiveAdapter generates (but does not insert into K8s) the Receive Adapter Deployment for
-// CouchDB sources.
-func MakeReceiveAdapter(args *ReceiveAdapterArgs) *v1.Deployment {
- replicas := int32(1)
- return &v1.Deployment{
- ObjectMeta: metav1.ObjectMeta{
- Namespace: args.Source.Namespace,
- Name: utils.GenerateFixedName(args.Source, fmt.Sprintf("couchdbsource-%s", args.Source.Name)),
- Labels: args.Labels,
- OwnerReferences: []metav1.OwnerReference{
- *kmeta.NewControllerRef(args.Source),
- },
- },
- Spec: v1.DeploymentSpec{
- Selector: &metav1.LabelSelector{
- MatchLabels: args.Labels,
- },
- Replicas: &replicas,
- Template: corev1.PodTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
-
- Labels: args.Labels,
- },
- Spec: corev1.PodSpec{
- ServiceAccountName: args.Source.Spec.ServiceAccountName,
- Containers: []corev1.Container{
- {
- Name: "receive-adapter",
- Image: args.Image,
- Env: makeEnv(args.EventSource, args.SinkURI, &args.Source.Spec),
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "couchdb-credentials",
- MountPath: "/etc/couchdb-credentials",
- ReadOnly: true,
- },
- },
- },
- },
- Volumes: []corev1.Volume{
- {
- Name: "couchdb-credentials",
- VolumeSource: corev1.VolumeSource{
- Secret: &corev1.SecretVolumeSource{
- SecretName: args.Source.Spec.CouchDbCredentials.Name,
- },
- },
- },
- },
- },
- },
- },
- }
-}
-
-func makeEnv(eventSource, sinkURI string, spec *v1alpha1.CouchDbSourceSpec) []corev1.EnvVar {
- return []corev1.EnvVar{{
- Name: "K_SINK",
- Value: sinkURI,
- }, {
- Name: "EVENT_SOURCE",
- Value: eventSource,
- }, {
- Name: "COUCHDB_CREDENTIALS",
- Value: "/etc/couchdb-credentials",
- }, {
- Name: "COUCHDB_DATABASE",
- Value: spec.Database,
- }, {
- Name: "COUCHDB_FEED",
- Value: string(spec.Feed),
- }, {
- Name: "NAMESPACE",
- ValueFrom: &corev1.EnvVarSource{
- FieldRef: &corev1.ObjectFieldSelector{
- FieldPath: "metadata.namespace",
- },
- },
- }, {
- Name: "METRICS_DOMAIN",
- Value: "knative.dev/eventing",
- }, {
- Name: "K_METRICS_CONFIG",
- Value: "",
- }, {
- Name: "K_LOGGING_CONFIG",
- Value: "",
- }}
-}
diff --git a/couchdb/source/pkg/reconciler/resources/receive_adapter_test.go b/couchdb/source/pkg/reconciler/resources/receive_adapter_test.go
deleted file mode 100644
index 818cd096a6..0000000000
--- a/couchdb/source/pkg/reconciler/resources/receive_adapter_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-Copyright 2019 The Knative 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 resources
-
-import (
- "fmt"
- "testing"
-
- "github.com/google/go-cmp/cmp"
- v1 "k8s.io/api/apps/v1"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "knative.dev/eventing-contrib/couchdb/source/pkg/apis/sources/v1alpha1"
- _ "knative.dev/pkg/metrics/testing"
-)
-
-func TestMakeReceiveAdapter(t *testing.T) {
- name := "source-name"
- src := &v1alpha1.CouchDbSource{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- Namespace: "source-namespace",
- UID: "1234",
- },
- Spec: v1alpha1.CouchDbSourceSpec{
- ServiceAccountName: "source-svc-acct",
- Database: "mydb",
- Feed: v1alpha1.FeedContinuous,
- },
- }
-
- got := MakeReceiveAdapter(&ReceiveAdapterArgs{
- Image: "test-image",
- Source: src,
- Labels: map[string]string{
- "test-key1": "test-value1",
- "test-key2": "test-value2",
- },
- SinkURI: "sink-uri",
- })
-
- one := int32(1)
- trueValue := true
-
- want := &v1.Deployment{
- ObjectMeta: metav1.ObjectMeta{
- Namespace: "source-namespace",
- Name: fmt.Sprintf("couchdbsource-%s-1234", name),
- Labels: map[string]string{
- "test-key1": "test-value1",
- "test-key2": "test-value2",
- },
- OwnerReferences: []metav1.OwnerReference{
- {
- APIVersion: "sources.knative.dev/v1alpha1",
- Kind: "CouchDbSource",
- Name: name,
- UID: "1234",
- Controller: &trueValue,
- BlockOwnerDeletion: &trueValue,
- },
- },
- },
- Spec: v1.DeploymentSpec{
- Selector: &metav1.LabelSelector{
- MatchLabels: map[string]string{
- "test-key1": "test-value1",
- "test-key2": "test-value2",
- },
- },
- Replicas: &one,
- Template: corev1.PodTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-key1": "test-value1",
- "test-key2": "test-value2",
- },
- },
- Spec: corev1.PodSpec{
- ServiceAccountName: "source-svc-acct",
- Containers: []corev1.Container{
- {
- Name: "receive-adapter",
- Image: "test-image",
- Env: []corev1.EnvVar{
- {
- Name: "K_SINK",
- Value: "sink-uri",
- }, {
- Name: "EVENT_SOURCE",
- Value: "",
- }, {
- Name: "COUCHDB_CREDENTIALS",
- Value: "/etc/couchdb-credentials",
- }, {
- Name: "COUCHDB_DATABASE",
- Value: "mydb",
- }, {
- Name: "COUCHDB_FEED",
- Value: "continuous",
- }, {
- Name: "NAMESPACE",
- ValueFrom: &corev1.EnvVarSource{
- FieldRef: &corev1.ObjectFieldSelector{
- FieldPath: "metadata.namespace",
- },
- },
- }, {
- Name: "METRICS_DOMAIN",
- Value: "knative.dev/eventing",
- }, {
- Name: "K_METRICS_CONFIG",
- Value: "",
- }, {
- Name: "K_LOGGING_CONFIG",
- Value: "",
- },
- },
- VolumeMounts: []corev1.VolumeMount{
- {
- Name: "couchdb-credentials",
- MountPath: "/etc/couchdb-credentials",
- ReadOnly: true,
- },
- },
- },
- },
- Volumes: []corev1.Volume{{
- Name: "couchdb-credentials",
- VolumeSource: corev1.VolumeSource{
- Secret: &corev1.SecretVolumeSource{}}}},
- },
- },
- },
- }
-
- if diff := cmp.Diff(want, got); diff != "" {
- t.Errorf("unexpected deploy (-want, +got) = %v", diff)
- }
-}
diff --git a/go.mod b/go.mod
index 864edb951d..50562791d4 100644
--- a/go.mod
+++ b/go.mod
@@ -8,27 +8,20 @@ require (
github.com/cloudevents/sdk-go/protocol/stan/v2 v2.2.0
github.com/cloudevents/sdk-go/v2 v2.2.0
github.com/davecgh/go-spew v1.1.1
- github.com/flimzy/diff v0.1.7 // indirect
- github.com/go-kivik/couchdb/v3 v3.0.4
- github.com/go-kivik/kivik/v3 v3.0.2
- github.com/go-kivik/kivikmock/v3 v3.0.0
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.1
github.com/google/uuid v1.1.1
github.com/gorilla/websocket v1.4.2
github.com/kelseyhightower/envconfig v1.4.0
github.com/nats-io/stan.go v0.6.0
- github.com/otiai10/copy v1.2.0 // indirect
github.com/pkg/errors v0.9.1
github.com/robfig/cron v1.2.0
github.com/slinkydeveloper/loadastic v0.0.0-20191203132749-9afe5a010a57
github.com/stretchr/testify v1.6.0
github.com/xanzy/go-gitlab v0.32.0
- gitlab.com/flimzy/testy v0.2.1 // indirect
go.opencensus.io v0.22.5-0.20200716030834-3456e1d174b2
go.opentelemetry.io/otel v0.4.2 // indirect
go.uber.org/zap v1.15.0
- golang.org/x/net v0.0.0-20200822124328-c89045814202
gopkg.in/go-playground/webhooks.v5 v5.13.0
k8s.io/api v0.18.8
k8s.io/apimachinery v0.18.8
diff --git a/go.sum b/go.sum
index 55ab77dab6..3f18baa908 100644
--- a/go.sum
+++ b/go.sum
@@ -1,6 +1,5 @@
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
-bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
cloud.google.com/go v0.25.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.30.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
@@ -377,11 +376,6 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
-github.com/flimzy/diff v0.1.5/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/diff v0.1.6/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/diff v0.1.7 h1:DRbd+lN3lY1xVuQrfqvDNsqBwA6RMbClMs6tS5sqWWk=
-github.com/flimzy/diff v0.1.7/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/testy v0.1.17-0.20190521133342-95b386c3ece6/go.mod h1:3szguN8NXqgq9bt9Gu8TQVj698PJWmyx/VY1frwwKrM=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
@@ -415,18 +409,6 @@ github.com/go-ini/ini v1.46.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I
github.com/go-ini/ini v1.55.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-kivik/couchdb/v3 v3.0.0/go.mod h1:eTGmiw9fnA30gdqQCgH3vNrW+glhl+48RbvZga8/wLk=
-github.com/go-kivik/couchdb/v3 v3.0.4 h1:Kd0sPY4XFa3GahOGlJjMvemIvr/Wsr0AAUXDrCd73Qw=
-github.com/go-kivik/couchdb/v3 v3.0.4/go.mod h1:/1NTM+9Qh9TzDfdDwLGAz2deSERXQDZ5Sy6d1WL3a6E=
-github.com/go-kivik/kivik/v3 v3.0.0/go.mod h1:7tmQDvkta/pcijpUjLMsQ9HJUELiKD5zm6jQ3Gb9cxE=
-github.com/go-kivik/kivik/v3 v3.0.1/go.mod h1:7tmQDvkta/pcijpUjLMsQ9HJUELiKD5zm6jQ3Gb9cxE=
-github.com/go-kivik/kivik/v3 v3.0.2 h1:+tKWFJTAGlUjK1DQhn2rEGQvroYLTUCAO6/Kk8K4uQQ=
-github.com/go-kivik/kivik/v3 v3.0.2/go.mod h1:chqVuHKAU9j2C7qL0cAH2FCO26oL+0B4aIBeCRMnLa8=
-github.com/go-kivik/kivikmock/v3 v3.0.0 h1:k4L/LPgvyAP4xi+MZ676tsDSqOJfWNymTbZWpQfb630=
-github.com/go-kivik/kivikmock/v3 v3.0.0/go.mod h1:P6g9RBT2clg6CCDkVeQ8I0MlIB6wX0mGhL9P2ZgcKAE=
-github.com/go-kivik/kiviktest/v3 v3.0.0/go.mod h1:pLjkg/F61+X4Ks1BpbrTgbChjdPcINX2HysR8i7AfBM=
-github.com/go-kivik/kiviktest/v3 v3.0.2 h1:+n90Nopbrzf/tqoXu4xqAMXk1+191vLrvakBdiz7r3Y=
-github.com/go-kivik/kiviktest/v3 v3.0.2/go.mod h1:sqsz3M2sJxTxAUdOj+2SU21y4phcpYc0FJIn+hbf1D0=
github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
@@ -668,11 +650,8 @@ github.com/googleapis/gnostic v0.3.1 h1:WeAefnSUHlBb0iJKwxFDZdbfGwkd7xRNuV+IpXMJ
github.com/googleapis/gnostic v0.3.1/go.mod h1:on+2t9HRStVgn95RSsFWFz+6Q0Snyqv1awfrALZdbtU=
github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg=
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
-github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5 h1:On5cS+huOk7mqad9QjklHw+BMGKykSmu6QG32X+C77o=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904=
github.com/goreleaser/nfpm v1.2.1/go.mod h1:TtWrABZozuLOttX2uDlYyECfQX7x5XYkVxhjYcR6G9w=
github.com/goreleaser/nfpm v1.3.0/go.mod h1:w0p7Kc9TAUgWMyrub63ex3M2Mgw88M4GZXoTq5UCb40=
@@ -1031,23 +1010,12 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
github.com/openzipkin/zipkin-go v0.2.0/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
-github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc=
github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc=
github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
-github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=
-github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95 h1:+OLn68pqasWca0z5ryit9KGfp3sUsW4Lqg32iRMJyzs=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4=
-github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
-github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
-github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw=
-github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M=
github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
-github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc=
-github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -1300,11 +1268,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
-gitlab.com/flimzy/testy v0.0.0-20190816103046-aca1ef5ffe7e/go.mod h1:MQwjgAyueIbBZv+qSYAMs6LaZwsJysPs0BK/niv9JiI=
-gitlab.com/flimzy/testy v0.0.2/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
-gitlab.com/flimzy/testy v0.0.3/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
-gitlab.com/flimzy/testy v0.2.1 h1:qg6z6kyFFt7g70WhSPT4zROUOh+C6PQPfcdyDDOesAM=
-gitlab.com/flimzy/testy v0.2.1/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
go.etcd.io/bbolt v1.3.1-etcd.7/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
diff --git a/hack/release.sh b/hack/release.sh
index 94c9b65dac..352c11a134 100755
--- a/hack/release.sh
+++ b/hack/release.sh
@@ -27,7 +27,6 @@ COMPONENTS=(
["appender.yaml"]="config/tools/appender"
["awssqs.yaml"]="awssqs/config"
["camel.yaml"]="camel/source/config"
- ["couchdb.yaml"]="couchdb/source/config"
["event-display.yaml"]="config/tools/event-display"
["gitlab.yaml"]="gitlab/config"
["kafka-source.yaml"]="kafka/source/config"
diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh
index 8b2fa8fdb9..9c7c1e305b 100755
--- a/hack/update-codegen.sh
+++ b/hack/update-codegen.sh
@@ -36,7 +36,7 @@ chmod +x ${CODEGEN_PKG}/generate-groups.sh
chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh
# Just Sources
-API_DIRS_SOURCES=(couchdb/source/pkg prometheus/pkg)
+API_DIRS_SOURCES=(prometheus/pkg)
for DIR in "${API_DIRS_SOURCES[@]}"; do
# generate the code with:
@@ -140,7 +140,6 @@ ${GOPATH}/bin/deepcopy-gen \
-O zz_generated.deepcopy \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt \
-i knative.dev/eventing-contrib/prometheus/pkg/apis \
- -i knative.dev/eventing-contrib/couchdb/source/pkg/apis \
-i knative.dev/eventing-contrib/gitlab/pkg/apis
# Make sure our dependencies are up-to-date
diff --git a/third_party/VENDOR-LICENSE/github.com/go-kivik/couchdb/v3/LICENSE.md b/third_party/VENDOR-LICENSE/github.com/go-kivik/couchdb/v3/LICENSE.md
deleted file mode 100644
index 0a2865e549..0000000000
--- a/third_party/VENDOR-LICENSE/github.com/go-kivik/couchdb/v3/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2017 Jonathan Hall
-
-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/third_party/VENDOR-LICENSE/github.com/go-kivik/kivik/v3/LICENSE.md b/third_party/VENDOR-LICENSE/github.com/go-kivik/kivik/v3/LICENSE.md
deleted file mode 100644
index 0a2865e549..0000000000
--- a/third_party/VENDOR-LICENSE/github.com/go-kivik/kivik/v3/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2017 Jonathan Hall
-
-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/vendor/github.com/go-kivik/couchdb/v3/.gitignore b/vendor/github.com/go-kivik/couchdb/v3/.gitignore
deleted file mode 100644
index a3204f676e..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Gopkg.lock
-vendor/
-*~
diff --git a/vendor/github.com/go-kivik/couchdb/v3/.gitlab-ci.yml b/vendor/github.com/go-kivik/couchdb/v3/.gitlab-ci.yml
deleted file mode 100644
index 6a52befe0c..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/.gitlab-ci.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-stages:
- - test
-
-variables:
- SRCDIR: /go/src/github.com/go-kivik/couchdb
- GO111MODULE: "on"
-
-.test: &test_template
- stage: test
- services:
- - name: couchdb:1.7.2
- alias: couch17
- - name: couchdb:2.2.0
- alias: couch22
- - name: apache/couchdb:2.3.1
- alias: couch23
- - name: apache/couchdb:3.0.0
- alias: couch30
- variables:
- COUCHDB_USER: admin
- COUCHDB_PASSWORD: abc123
- KIVIK_TEST_DSN_COUCH17: http://admin:abc123@couch17:5984/
- KIVIK_TEST_DSN_COUCH22: http://admin:abc123@couch22:5984/
- KIVIK_TEST_DSN_COUCH23: http://admin:abc123@couch23:5984/
- KIVIK_TEST_DSN_COUCH30: http://admin:abc123@couch30:5984/
- before_script:
- - ./script/complete_couch1.sh ${KIVIK_TEST_DSN_COUCH17}
- - ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH22}
- - ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH23}
- - ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH30}
- script:
- - go mod download
- - ./script/test_version.sh
- - go test -race -tags=livetest ./...
-
-.nomod: &nomod_template
- <<: *test_template
- script:
- - mkdir -p /go/src
- - ln -s /builds /go/src/github.com
- - cd ${SRCDIR}
- - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- - dep ensure && dep status
- - ./script/test_version.sh
- - go test -race -tags=livetest ./...
-
-lint:
- stage: test
- image: golang:1.14
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
- - golangci-lint run ./...
-
-coverage:
- stage: test
- image: golang:1.14
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - ./script/coverage.sh
-
-go-1.11:
- <<: *test_template
- stage: test
- image: golang:1.11
-
-go-1.12:
- <<: *test_template
- stage: test
- image: golang:1.12
-
-go-1.13:
- <<: *test_template
- stage: test
- image: golang:1.13
-
-go-1.14:
- <<: *test_template
- stage: test
- image: golang:1.14
-
-go-rc:
- <<: *test_template
- stage: test
- image: golang:rc
- allow_failure: true
diff --git a/vendor/github.com/go-kivik/couchdb/v3/.golangci.toml b/vendor/github.com/go-kivik/couchdb/v3/.golangci.toml
deleted file mode 100644
index 2949d722af..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/.golangci.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[output]
-format = "colored-line-number"
-
-[linters]
-enable = [
- "interfacer", "gocyclo", "unconvert", "goimports", "unused", "varcheck",
- "vetshadow", "misspell", "nakedret", "errcheck", "golint", "ineffassign",
- "deadcode", "goconst", "vet", "unparam", "gofmt"
-]
diff --git a/vendor/github.com/go-kivik/couchdb/v3/LICENSE.md b/vendor/github.com/go-kivik/couchdb/v3/LICENSE.md
deleted file mode 100644
index 0a2865e549..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2017 Jonathan Hall
-
-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/vendor/github.com/go-kivik/couchdb/v3/README.md b/vendor/github.com/go-kivik/couchdb/v3/README.md
deleted file mode 100644
index 970c7ba5e5..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-[](https://travis-ci.org/go-kivik/couchdb) [](https://codecov.io/gh/go-kivik/couchdb) [](http://godoc.org/github.com/go-kivik/couchdb)
-
-# Kivik CouchDB
-
-CouchDB driver for [Kivik](https://github.com/go-kivik/kivik).
-
-## Usage
-
-This package provides an implementation of the
-[`github.com/go-kivik/kivik/v3/driver`](http://godoc.org/github.com/go-kivik/kivik/driver)
-interface. You must import the driver and can then use the full
-[`Kivik`](http://godoc.org/github.com/go-kivik/kivik) API. Please consult the
-[Kivik wiki](https://github.com/go-kivik/kivik/wiki) for complete documentation
-and coding examples.
-
-```go
-package main
-
-import (
- "context"
-
- kivik "github.com/go-kivik/kivik/v3"
- _ "github.com/go-kivik/couchdb/v3" // The CouchDB driver
-)
-
-func main() {
- client, err := kivik.New(context.TODO(), "couch", "")
- // ...
-}
-```
-
-## License
-
-This software is released under the terms of the Apache 2.0 license. See
-LICENCE.md, or read the [full license](http://www.apache.org/licenses/LICENSE-2.0).
diff --git a/vendor/github.com/go-kivik/couchdb/v3/attachments.go b/vendor/github.com/go-kivik/couchdb/v3/attachments.go
deleted file mode 100644
index 6ae95cdfd4..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/attachments.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package couchdb
-
-import (
- "context"
- "errors"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-func (d *db) PutAttachment(ctx context.Context, docID, rev string, att *driver.Attachment, options map[string]interface{}) (newRev string, err error) {
- if docID == "" {
- return "", missingArg("docID")
- }
- if att == nil {
- return "", missingArg("att")
- }
- if att.Filename == "" {
- return "", missingArg("att.Filename")
- }
- if att.ContentType == "" {
- return "", missingArg("att.ContentType")
- }
- if att.Content == nil {
- return "", missingArg("att.Content")
- }
-
- fullCommit, err := fullCommit(options)
- if err != nil {
- return "", err
- }
-
- query, err := optionsToParams(options)
- if err != nil {
- return "", err
- }
- if rev != "" {
- query.Set("rev", rev)
- }
- var response struct {
- Rev string `json:"rev"`
- }
- opts := &chttp.Options{
- Body: att.Content,
- ContentType: att.ContentType,
- FullCommit: fullCommit,
- Query: query,
- }
- _, err = d.Client.DoJSON(ctx, http.MethodPut, d.path(chttp.EncodeDocID(docID)+"/"+att.Filename), opts, &response)
- if err != nil {
- return "", err
- }
- return response.Rev, nil
-}
-
-func (d *db) GetAttachmentMeta(ctx context.Context, docID, filename string, options map[string]interface{}) (*driver.Attachment, error) {
- resp, err := d.fetchAttachment(ctx, http.MethodHead, docID, filename, options)
- if err != nil {
- return nil, err
- }
- att, err := decodeAttachment(resp)
- return att, err
-}
-
-func (d *db) GetAttachment(ctx context.Context, docID, filename string, options map[string]interface{}) (*driver.Attachment, error) {
- resp, err := d.fetchAttachment(ctx, http.MethodGet, docID, filename, options)
- if err != nil {
- return nil, err
- }
- return decodeAttachment(resp)
-}
-
-func (d *db) fetchAttachment(ctx context.Context, method, docID, filename string, options map[string]interface{}) (*http.Response, error) {
- if method == "" {
- return nil, errors.New("method required")
- }
- if docID == "" {
- return nil, missingArg("docID")
- }
- if filename == "" {
- return nil, missingArg("filename")
- }
-
- inm, err := ifNoneMatch(options)
- if err != nil {
- return nil, err
- }
-
- query, err := optionsToParams(options)
- if err != nil {
- return nil, err
- }
- opts := &chttp.Options{
- IfNoneMatch: inm,
- Query: query,
- }
- resp, err := d.Client.DoReq(ctx, method, d.path(chttp.EncodeDocID(docID)+"/"+filename), opts)
- if err != nil {
- return nil, err
- }
- return resp, chttp.ResponseError(resp)
-}
-
-func decodeAttachment(resp *http.Response) (*driver.Attachment, error) {
- cType, err := getContentType(resp)
- if err != nil {
- return nil, err
- }
- digest, err := getDigest(resp)
- if err != nil {
- return nil, err
- }
-
- return &driver.Attachment{
- ContentType: cType,
- Digest: digest,
- Size: resp.ContentLength,
- Content: resp.Body,
- }, nil
-}
-
-func getContentType(resp *http.Response) (string, error) {
- ctype := resp.Header.Get("Content-Type")
- if _, ok := resp.Header["Content-Type"]; !ok {
- return "", &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: errors.New("no Content-Type in response")}
- }
- return ctype, nil
-}
-
-func getDigest(resp *http.Response) (string, error) {
- etag, ok := chttp.ETag(resp)
- if !ok {
- return "", &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: errors.New("ETag header not found")}
- }
- return etag, nil
-}
-
-func (d *db) DeleteAttachment(ctx context.Context, docID, rev, filename string, options map[string]interface{}) (newRev string, err error) {
- if docID == "" {
- return "", missingArg("docID")
- }
- if rev == "" {
- return "", missingArg("rev")
- }
- if filename == "" {
- return "", missingArg("filename")
- }
-
- fullCommit, err := fullCommit(options)
- if err != nil {
- return "", err
- }
-
- query, err := optionsToParams(options)
- if err != nil {
- return "", err
- }
- query.Set("rev", rev)
- var response struct {
- Rev string `json:"rev"`
- }
-
- opts := &chttp.Options{
- FullCommit: fullCommit,
- Query: query,
- }
- _, err = d.Client.DoJSON(ctx, http.MethodDelete, d.path(chttp.EncodeDocID(docID)+"/"+filename), opts, &response)
- if err != nil {
- return "", err
- }
- return response.Rev, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/auth.go b/vendor/github.com/go-kivik/couchdb/v3/auth.go
deleted file mode 100644
index 1505ec2243..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/auth.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package couchdb
-
-import (
- "context"
- "errors"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-func (c *client) Authenticate(ctx context.Context, a interface{}) error {
- if auth, ok := a.(chttp.Authenticator); ok {
- return auth.Authenticate(c.Client)
- }
- if auth, ok := a.(Authenticator); ok {
- return auth.auth(ctx, c)
- }
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: errors.New("kivik: invalid authenticator")}
-}
-
-// Authenticator is a CouchDB authenticator. Direct use of the Authenticator
-// interface is for advanced usage. Typically, it is sufficient to provide
-// a username and password in the connecting DSN to perform authentication.
-// Only use one of these provided authenticators if you have specific, special
-// needs.
-type Authenticator interface {
- auth(context.Context, *client) error
-}
-
-type xportAuth struct {
- http.RoundTripper
-}
-
-var _ Authenticator = &xportAuth{}
-
-func (a *xportAuth) auth(_ context.Context, c *client) error {
- if c.Client.Client.Transport != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: errors.New("kivik: HTTP client transport already set")}
- }
- c.Client.Client.Transport = a.RoundTripper
- return nil
-}
-
-// SetTransport returns an authenticator that can be used to set a client
-// connection's HTTP Transport. This can be used to control proxies, TLS
-// configuration, keep-alives, compression, etc.
-//
-// Example:
-//
-// setXport := couchdb.SetTransport(&http.Transport{
-// // .. custom config
-// })
-// client, _ := kivik.New( ... )
-// client.Authenticate(setXport)
-func SetTransport(t http.RoundTripper) Authenticator {
- return &xportAuth{t}
-}
-
-type authFunc func(context.Context, *client) error
-
-func (a authFunc) auth(ctx context.Context, c *client) error {
- return a(ctx, c)
-}
-
-// BasicAuth provides support for HTTP Basic authentication.
-func BasicAuth(user, password string) Authenticator {
- auth := chttp.BasicAuth{Username: user, Password: password}
- return authFunc(func(ctx context.Context, c *client) error {
- return auth.Authenticate(c.Client)
- })
-}
-
-// CookieAuth provides support for CouchDB cookie-based authentication.
-func CookieAuth(user, password string) Authenticator {
- auth := chttp.CookieAuth{Username: user, Password: password}
- return authFunc(func(ctx context.Context, c *client) error {
- return auth.Authenticate(c.Client)
- })
-}
-
-// ProxyAuth provides support for Proxy authentication.
-//
-// The `secret` argument represents the `couch_httpd_auth/secret` value
-// configured on the CouchDB server. See https://docs.couchdb.org/en/stable/config/auth.html#couch_httpd_auth/secret
-// If `secret` is the empty string, the X-Auth-CouchDB-Token header will not be
-// set, to support disabling the `proxy_use_secret` server setting. See https://docs.couchdb.org/en/stable/config/auth.html#couch_httpd_auth/proxy_use_secret
-//
-// The optional `headers` map may be passed to use non-standard header names.
-// For instance, to use `X-User` in place of the `X-Auth-CouchDB-Username`
-// header, pass a value of {"X-Auth-CouchDB-UserName": "X-User"}.
-// The relevant headers are X-Auth-CouchDB-UserName, X-Auth-CouchDB-Roles, and
-// X-Auth-CouchDB-Token.
-//
-// See https://docs.couchdb.org/en/stable/api/server/authn.html?highlight=proxy%20auth#proxy-authentication
-func ProxyAuth(user, secret string, roles []string, headers ...map[string]string) Authenticator {
- headerOverrides := http.Header{}
- for _, h := range headers {
- for k, v := range h {
- headerOverrides.Set(k, v)
- }
- }
- auth := chttp.ProxyAuth{Username: user, Secret: secret, Roles: roles, Headers: headerOverrides}
- return authFunc(func(ctx context.Context, c *client) error {
- return auth.Authenticate(c.Client)
- })
-}
-
-type rawCookie struct {
- cookie *http.Cookie
- next http.RoundTripper
-}
-
-var _ Authenticator = &rawCookie{}
-var _ http.RoundTripper = &rawCookie{}
-
-func (a *rawCookie) auth(_ context.Context, c *client) error {
- if c.Client.Client.Transport != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: errors.New("kivik: HTTP client transport already set")}
- }
- a.next = c.Client.Client.Transport
- if a.next == nil {
- a.next = http.DefaultTransport
- }
- c.Client.Client.Transport = a
- return nil
-}
-
-func (a *rawCookie) RoundTrip(r *http.Request) (*http.Response, error) {
- r.AddCookie(a.cookie)
- return a.next.RoundTrip(r)
-}
-
-// SetCookie adds cookie to all outbound requests. This is useful when using
-// kivik as a proxy.
-func SetCookie(cookie *http.Cookie) Authenticator {
- return &rawCookie{cookie: cookie}
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/bulk.go b/vendor/github.com/go-kivik/couchdb/v3/bulk.go
deleted file mode 100644
index 8081cd1169..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/bulk.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "errors"
- "io"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type bulkResults struct {
- body io.ReadCloser
- dec *json.Decoder
-}
-
-var _ driver.BulkResults = &bulkResults{}
-
-func newBulkResults(body io.ReadCloser) (*bulkResults, error) {
- dec := json.NewDecoder(body)
- // Consume the opening '[' char
- if err := consumeDelim(dec, json.Delim('[')); err != nil {
- return nil, err
- }
- return &bulkResults{
- body: body,
- dec: dec,
- }, nil
-}
-
-func (r *bulkResults) Next(update *driver.BulkResult) error {
- if !r.dec.More() {
- if err := consumeDelim(r.dec, json.Delim(']')); err != nil {
- return err
- }
- return io.EOF
- }
- var updateResult struct {
- ID string `json:"id"`
- Rev string `json:"rev"`
- Error string `json:"error"`
- Reason string `json:"reason"`
- }
- if err := r.dec.Decode(&updateResult); err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- update.ID = updateResult.ID
- update.Rev = updateResult.Rev
- update.Error = nil
- if updateResult.Error != "" {
- var status int
- switch updateResult.Error {
- case "conflict":
- status = http.StatusConflict
- default:
- status = http.StatusInternalServerError
- }
- update.Error = &kivik.Error{HTTPStatus: status, FromServer: true, Err: errors.New(updateResult.Reason)}
- }
- return nil
-}
-
-func (r *bulkResults) Close() error {
- return r.body.Close()
-}
-
-func (d *db) BulkDocs(ctx context.Context, docs []interface{}, options map[string]interface{}) (driver.BulkResults, error) {
- if options == nil {
- options = make(map[string]interface{})
- }
- fullCommit, err := fullCommit(options)
- if err != nil {
- return nil, err
- }
- options["docs"] = docs
- opts := &chttp.Options{
- GetBody: chttp.BodyEncoder(options),
- FullCommit: fullCommit,
- }
- resp, err := d.Client.DoReq(ctx, http.MethodPost, d.path("_bulk_docs"), opts)
- if err != nil {
- return nil, err
- }
- switch resp.StatusCode {
- case http.StatusCreated:
- // Nothing to do
- case http.StatusExpectationFailed:
- err = &chttp.HTTPError{
- Response: resp,
- Reason: "one or more document was rejected",
- }
- default:
- // All other errors can consume the response body and return immediately
- if e := chttp.ResponseError(resp); e != nil {
- return nil, e
- }
- }
- results, bulkErr := newBulkResults(resp.Body)
- if bulkErr != nil {
- return nil, bulkErr
- }
- return results, err
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/bulkget.go b/vendor/github.com/go-kivik/couchdb/v3/bulkget.go
deleted file mode 100644
index 5c9fb8c456..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/bulkget.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-func (d *db) BulkGet(ctx context.Context, docs []driver.BulkGetReference, opts map[string]interface{}) (driver.Rows, error) {
- query, err := optionsToParams(opts)
- if err != nil {
- return nil, err
- }
- body := map[string]interface{}{
- "docs": docs,
- }
- options := &chttp.Options{
- Query: query,
- GetBody: chttp.BodyEncoder(body),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- resp, err := d.Client.DoReq(ctx, http.MethodPost, d.path("_bulk_get"), options)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- return newBulkGetRows(ctx, resp.Body), nil
-}
-
-// BulkGetError represents an error for a single document returned by a
-// GetBulk call.
-type BulkGetError struct {
- ID string `json:"id"`
- Rev string `json:"rev"`
- Err string `json:"error"`
- Reason string `json:"reason"`
-}
-
-var _ error = &BulkGetError{}
-
-func (e *BulkGetError) Error() string {
- return fmt.Sprintf("%s: %s", e.Err, e.Reason)
-}
-
-type bulkResultDoc struct {
- Doc json.RawMessage `json:"ok,omitempty"`
- Error *BulkGetError `json:"error,omitempty"`
-}
-
-type bulkResult struct {
- ID string `json:"id"`
- Docs []bulkResultDoc `json:"docs"`
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/changes.go b/vendor/github.com/go-kivik/couchdb/v3/changes.go
deleted file mode 100644
index 8b6c0c99a6..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/changes.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Changes returns the changes stream for the database.
-func (d *db) Changes(ctx context.Context, opts map[string]interface{}) (driver.Changes, error) {
- key := "results"
- if f, ok := opts["feed"]; ok {
- if f == "eventsource" {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: errors.New("kivik: eventsource feed not supported, use 'continuous'")}
- }
- if f == "continuous" {
- key = ""
- }
- }
- query, err := optionsToParams(opts)
- if err != nil {
- return nil, err
- }
- options := &chttp.Options{
- Query: query,
- }
- resp, err := d.Client.DoReq(ctx, http.MethodGet, d.path("_changes"), options)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- etag, _ := chttp.ETag(resp)
- return newChangesRows(ctx, key, resp.Body, etag), nil
-}
-
-type continuousChangesParser struct{}
-
-func (p *continuousChangesParser) parseMeta(i interface{}, dec *json.Decoder, key string) error {
- meta := i.(*changesMeta)
- return meta.parseMeta(key, dec)
-}
-
-func (p *continuousChangesParser) decodeItem(i interface{}, dec *json.Decoder) error {
- row := i.(*driver.Change)
- ch := &change{Change: row}
- if err := dec.Decode(ch); err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- ch.Change.Seq = string(ch.Seq)
- return nil
-}
-
-type changesMeta struct {
- lastSeq sequenceID
- pending int64
-}
-
-// parseMeta parses result metadata
-func (m *changesMeta) parseMeta(key string, dec *json.Decoder) error {
- switch key {
- case "last_seq":
- return dec.Decode(&m.lastSeq)
- case "pending":
- return dec.Decode(&m.pending)
- }
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Unexpected key: %s", key)}
-}
-
-type changesRows struct {
- *iter
- *changesMeta
- etag string
-}
-
-func newChangesRows(ctx context.Context, key string, r io.ReadCloser, etag string) *changesRows {
- var meta *changesMeta
- if key != "" {
- meta = &changesMeta{}
- }
- return &changesRows{
- iter: newIter(ctx, meta, key, r, &continuousChangesParser{}),
- etag: etag,
- }
-}
-
-var _ driver.Changes = &changesRows{}
-
-type change struct {
- *driver.Change
- Seq sequenceID `json:"seq"`
-}
-
-func (r *changesRows) Next(row *driver.Change) error {
- row.Deleted = false
- return r.iter.next(row)
-}
-
-// LastSeq returns the last sequence ID.
-func (r *changesRows) LastSeq() string {
- return string(r.lastSeq)
-}
-
-// Pending returns the pending count.
-func (r *changesRows) Pending() int64 {
- return r.pending
-}
-
-// ETag returns the unquoted ETag header for the CouchDB response, if any.
-func (r *changesRows) ETag() string {
- return r.etag
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/auth.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/auth.go
deleted file mode 100644
index d69c5a82f9..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/auth.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package chttp
-
-import (
- "net/http/cookiejar"
-
- "golang.org/x/net/publicsuffix"
-)
-
-// Authenticator is an interface that provides authentication to a server.
-type Authenticator interface {
- Authenticate(*Client) error
-}
-
-func (a *CookieAuth) setCookieJar() {
- // If a jar is already set, just use it
- if a.client.Jar != nil {
- return
- }
- // cookiejar.New never returns an error
- jar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
- a.client.Jar = jar
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/basicauth.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/basicauth.go
deleted file mode 100644
index ab58a7d840..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/basicauth.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package chttp
-
-import (
- "net/http"
-)
-
-// BasicAuth provides HTTP Basic Auth for a client.
-type BasicAuth struct {
- Username string
- Password string
-
- // transport stores the original transport that is overridden by this auth
- // mechanism
- transport http.RoundTripper
-}
-
-var _ Authenticator = &BasicAuth{}
-
-// RoundTrip fulfills the http.RoundTripper interface. It sets HTTP Basic Auth
-// on outbound requests.
-func (a *BasicAuth) RoundTrip(req *http.Request) (*http.Response, error) {
- req.SetBasicAuth(a.Username, a.Password)
- return a.transport.RoundTrip(req)
-}
-
-// Authenticate sets HTTP Basic Auth headers for the client.
-func (a *BasicAuth) Authenticate(c *Client) error {
- a.transport = c.Transport
- if a.transport == nil {
- a.transport = http.DefaultTransport
- }
- c.Transport = a
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/chttp.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/chttp.go
deleted file mode 100644
index 04e9da742d..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/chttp.go
+++ /dev/null
@@ -1,476 +0,0 @@
-// Package chttp provides a minimal HTTP driver backend for communicating with
-// CouchDB servers.
-package chttp
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net"
- "net/http"
- "net/url"
- "os"
- "regexp"
- "runtime"
- "strings"
- "sync"
- "syscall"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-const (
- typeJSON = "application/json"
-)
-
-// The default UserAgent values
-const (
- UserAgent = "Kivik chttp"
- Version = "3.0.4"
-)
-
-// Client represents a client connection. It embeds an *http.Client
-type Client struct {
- // UserAgents is appended to set the User-Agent header. Typically it should
- // contain pairs of product name and version.
- UserAgents []string
-
- *http.Client
-
- rawDSN string
- dsn *url.URL
- auth Authenticator
- authMU sync.Mutex
-}
-
-// New returns a connection to a remote CouchDB server. If credentials are
-// included in the URL, requests will be authenticated using Cookie Auth. To
-// use HTTP BasicAuth or some other authentication mechanism, do not specify
-// credentials in the URL, and instead call the Auth() method later.
-func New(dsn string) (*Client, error) {
- return NewWithClient(&http.Client{}, dsn)
-}
-
-// NewWithClient works the same as New(), but allows providing a custom
-// *http.Client for all network connections.
-func NewWithClient(client *http.Client, dsn string) (*Client, error) {
- dsnURL, err := parseDSN(dsn)
- if err != nil {
- return nil, err
- }
- user := dsnURL.User
- dsnURL.User = nil
- c := &Client{
- Client: client,
- dsn: dsnURL,
- rawDSN: dsn,
- }
- if user != nil {
- password, _ := user.Password()
- err := c.Auth(&CookieAuth{
- Username: user.Username(),
- Password: password,
- })
- if err != nil {
- return nil, err
- }
- }
- return c, nil
-}
-
-func parseDSN(dsn string) (*url.URL, error) {
- if dsn == "" {
- return nil, &curlError{
- httpStatus: http.StatusBadRequest,
- curlStatus: ExitFailedToInitialize,
- error: errors.New("no URL specified"),
- }
- }
- if !strings.HasPrefix(dsn, "http://") && !strings.HasPrefix(dsn, "https://") {
- dsn = "http://" + dsn
- }
- dsnURL, err := url.Parse(dsn)
- if err != nil {
- return nil, fullError(http.StatusBadRequest, ExitStatusURLMalformed, err)
- }
- if dsnURL.Path == "" {
- dsnURL.Path = "/"
- }
- return dsnURL, nil
-}
-
-// DSN returns the unparsed DSN used to connect.
-func (c *Client) DSN() string {
- return c.rawDSN
-}
-
-// Auth authenticates using the provided Authenticator.
-func (c *Client) Auth(a Authenticator) error {
- if c.auth != nil {
- return errors.New("auth already set")
- }
- if err := a.Authenticate(c); err != nil {
- return err
- }
- c.auth = a
- return nil
-}
-
-// Options are optional parameters which may be sent with a request.
-type Options struct {
- // Accept sets the request's Accept header. Defaults to "application/json".
- // To specify any, use "*/*".
- Accept string
-
- // ContentType sets the requests's Content-Type header. Defaults to "application/json".
- ContentType string
-
- // ContentLength, if set, sets the ContentLength of the request
- ContentLength int64
-
- // Body sets the body of the request.
- Body io.ReadCloser
-
- // GetBody is a function to set the body, and can be used on retries. If
- // set, Body is ignored.
- GetBody func() (io.ReadCloser, error)
-
- // JSON is an arbitrary data type which is marshaled to the request's body.
- // It an error to set both Body and JSON on the same request. When this is
- // set, ContentType is unconditionally set to 'application/json'. Note that
- // for large JSON payloads, it can be beneficial to do your own JSON stream
- // encoding, so that the request can be live on the wire during JSON
- // encoding.
- JSON interface{}
-
- // FullCommit adds the X-Couch-Full-Commit: true header to requests
- FullCommit bool
-
- // IfNoneMatch adds the If-None-Match header. The value will be quoted if
- // it is not already.
- IfNoneMatch string
-
- // Query is appended to the exiting url, if present. If the passed url
- // already contains query parameters, the values in Query are appended.
- // No merging takes place.
- Query url.Values
-
- // Header is a list of default headers to be set on the request.
- Header http.Header
-}
-
-// Response represents a response from a CouchDB server.
-type Response struct {
- *http.Response
-
- // ContentType is the base content type, parsed from the response headers.
- ContentType string
-}
-
-// DecodeJSON unmarshals the response body into i. This method consumes and
-// closes the response body.
-func DecodeJSON(r *http.Response, i interface{}) error {
- defer r.Body.Close() // nolint: errcheck
- if err := json.NewDecoder(r.Body).Decode(i); err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- return nil
-}
-
-// DoJSON combines DoReq() and, ResponseError(), and (*Response).DecodeJSON(), and
-// closes the response body.
-func (c *Client) DoJSON(ctx context.Context, method, path string, opts *Options, i interface{}) (*http.Response, error) {
- res, err := c.DoReq(ctx, method, path, opts)
- if err != nil {
- return res, err
- }
- if err = ResponseError(res); err != nil {
- return res, err
- }
- err = DecodeJSON(res, i)
- return res, err
-}
-
-// NewRequest returns a new *http.Request to the CouchDB server, and the
-// specified path. The host, schema, etc, of the specified path are ignored.
-func (c *Client) NewRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error) {
- fullPath := path
- if cPath := strings.TrimSuffix(c.dsn.Path, "/"); cPath != "" {
- fullPath = cPath + "/" + strings.TrimPrefix(path, "/")
- }
- reqPath, err := url.Parse(fullPath)
- if err != nil {
- return nil, fullError(http.StatusBadRequest, ExitStatusURLMalformed, err)
- }
- u := *c.dsn // Make a copy
- u.Path = reqPath.Path
- u.RawQuery = reqPath.RawQuery
- req, err := http.NewRequest(method, u.String(), body)
- if err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- req.Header.Add("User-Agent", c.userAgent())
- return req.WithContext(ctx), nil
-}
-
-// DoReq does an HTTP request. An error is returned only if there was an error
-// processing the request. In particular, an error status code, such as 400
-// or 500, does _not_ cause an error to be returned.
-func (c *Client) DoReq(ctx context.Context, method, path string, opts *Options) (*http.Response, error) {
- if method == "" {
- return nil, errors.New("chttp: method required")
- }
- var body io.Reader
- if opts != nil {
- if opts.GetBody != nil {
- var err error
- opts.Body, err = opts.GetBody()
- if err != nil {
- return nil, err
- }
- }
- if opts.Body != nil {
- body = opts.Body
- defer opts.Body.Close() // nolint: errcheck
- }
- }
- req, err := c.NewRequest(ctx, method, path, body)
- if err != nil {
- return nil, err
- }
- fixPath(req, path)
- setHeaders(req, opts)
- setQuery(req, opts)
- if opts != nil {
- req.GetBody = opts.GetBody
- }
-
- trace := ContextClientTrace(ctx)
- if trace != nil {
- trace.httpRequest(req)
- trace.httpRequestBody(req)
- }
-
- response, err := c.Do(req)
- if trace != nil {
- trace.httpResponse(response)
- trace.httpResponseBody(response)
- }
- return response, netError(err)
-}
-
-func netError(err error) error {
- if err == nil {
- return nil
- }
- if urlErr, ok := err.(*url.Error); ok {
- // If this error was generated by EncodeBody, it may have an emedded
- // status code (!= 500), which we should honor.
- status := kivik.StatusCode(urlErr.Err)
- if status == http.StatusInternalServerError {
- status = http.StatusBadGateway
- }
- return fullError(status, curlStatus(err), err)
- }
- if status := kivik.StatusCode(err); status != http.StatusInternalServerError {
- return err
- }
- return fullError(http.StatusBadGateway, ExitUnknownFailure, err)
-}
-
-var tooManyRecirectsRE = regexp.MustCompile(`stopped after \d+ redirect`)
-
-func curlStatus(err error) int {
- if urlErr, ok := err.(*url.Error); ok {
- // Timeout error
- if urlErr.Timeout() {
- return ExitOperationTimeout
- }
- // Host lookup failure
- if opErr, ok := urlErr.Err.(*net.OpError); ok {
- if _, ok := opErr.Err.(*net.DNSError); ok {
- return ExitHostNotResolved
- }
- if scErr, ok := opErr.Err.(*os.SyscallError); ok {
- if errno, ok := scErr.Err.(syscall.Errno); ok {
- if errno == syscall.ECONNREFUSED {
- return ExitFailedToConnect
- }
- }
- }
- }
-
- if tooManyRecirectsRE.MatchString(urlErr.Err.Error()) {
- return ExitTooManyRedirects
- }
- }
- return 0
-}
-
-// fixPath sets the request's URL.RawPath to work with escaped characters in
-// paths.
-func fixPath(req *http.Request, path string) {
- // Remove any query parameters
- parts := strings.SplitN(path, "?", 2)
- req.URL.RawPath = "/" + strings.TrimPrefix(parts[0], "/")
-}
-
-// BodyEncoder returns a function which returns the encoded body. It is meant
-// to be used as a http.Request.GetBody value.
-func BodyEncoder(i interface{}) func() (io.ReadCloser, error) {
- return func() (io.ReadCloser, error) {
- return EncodeBody(i), nil
- }
-}
-
-// EncodeBody JSON encodes i to an io.ReadCloser. If an encoding error
-// occurs, it will be returned on the next read.
-func EncodeBody(i interface{}) io.ReadCloser {
- done := make(chan struct{})
- r, w := io.Pipe()
- go func() {
- defer close(done)
- var err error
- switch t := i.(type) {
- case []byte:
- _, err = w.Write(t)
- case json.RawMessage: // Only needed for Go 1.7
- _, err = w.Write(t)
- case string:
- _, err = w.Write([]byte(t))
- default:
- err = json.NewEncoder(w).Encode(i)
- switch err.(type) {
- case *json.MarshalerError, *json.UnsupportedTypeError, *json.UnsupportedValueError:
- err = &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- }
- _ = w.CloseWithError(err)
- }()
- return &ebReader{
- ReadCloser: r,
- done: done,
- }
-}
-
-type ebReader struct {
- io.ReadCloser
- done <-chan struct{}
-}
-
-var _ io.ReadCloser = &ebReader{}
-
-func (r *ebReader) Close() error {
- err := r.ReadCloser.Close()
- <-r.done
- return err
-}
-
-func setHeaders(req *http.Request, opts *Options) {
- accept := typeJSON
- contentType := typeJSON
- if opts != nil {
- if opts.Accept != "" {
- accept = opts.Accept
- }
- if opts.ContentType != "" {
- contentType = opts.ContentType
- }
- if opts.FullCommit {
- req.Header.Add("X-Couch-Full-Commit", "true")
- }
- if opts.IfNoneMatch != "" {
- inm := "\"" + strings.Trim(opts.IfNoneMatch, "\"") + "\""
- req.Header.Set("If-None-Match", inm)
- }
- if opts.ContentLength != 0 {
- req.ContentLength = opts.ContentLength
- }
- for k, v := range opts.Header {
- if _, ok := req.Header[k]; !ok {
- req.Header[k] = v
- }
- }
- }
- req.Header.Add("Accept", accept)
- req.Header.Add("Content-Type", contentType)
-}
-
-func setQuery(req *http.Request, opts *Options) {
- if opts == nil || len(opts.Query) == 0 {
- return
- }
- if req.URL.RawQuery == "" {
- req.URL.RawQuery = opts.Query.Encode()
- return
- }
- req.URL.RawQuery = strings.Join([]string{req.URL.RawQuery, opts.Query.Encode()}, "&")
-}
-
-// DoError is the same as DoReq(), followed by checking the response error. This
-// method is meant for cases where the only information you need from the
-// response is the status code. It unconditionally closes the response body.
-func (c *Client) DoError(ctx context.Context, method, path string, opts *Options) (*http.Response, error) {
- res, err := c.DoReq(ctx, method, path, opts)
- if err != nil {
- return res, err
- }
- if res.Body != nil {
- defer res.Body.Close() // nolint: errcheck
- }
- err = ResponseError(res)
- return res, err
-}
-
-// ETag returns the unquoted ETag value, and a bool indicating whether it was
-// found.
-func ETag(resp *http.Response) (string, bool) {
- if resp == nil {
- return "", false
- }
- etag, ok := resp.Header["Etag"]
- if !ok {
- etag, ok = resp.Header["ETag"] // nolint: staticcheck
- }
- if !ok {
- return "", false
- }
- return strings.Trim(etag[0], `"`), ok
-}
-
-// GetRev extracts the revision from the response's Etag header
-func GetRev(resp *http.Response) (rev string, err error) {
- if err = ResponseError(resp); err != nil {
- return "", err
- }
- rev, ok := ETag(resp)
- if !ok {
- return "", errors.New("no ETag header found")
- }
- return rev, nil
-}
-
-type exitStatuser interface {
- ExitStatus() int
-}
-
-// ExitStatus returns the curl exit status embedded in the error, or 1 (unknown
-// error), if there was no specified exit status. If err is nil, ExitStatus
-// returns 0.
-func ExitStatus(err error) int {
- if err == nil {
- return 0
- }
- if statuser, ok := err.(exitStatuser); ok { // nolint: misspell
- return statuser.ExitStatus()
- }
- return 0
-}
-
-func (c *Client) userAgent() string {
- ua := fmt.Sprintf("%s/%s (Language=%s; Platform=%s/%s)",
- UserAgent, Version, runtime.Version(), runtime.GOARCH, runtime.GOOS)
- return strings.Join(append([]string{ua}, c.UserAgents...), " ")
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/constants.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/constants.go
deleted file mode 100644
index b56077d34f..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/constants.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package chttp
-
-// Standard headers used by CouchDB.
-const (
- HeaderDestination = "Destination"
- HeaderIdempotencyKey = "X-Idempotency-Key"
-)
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/cookieauth.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/cookieauth.go
deleted file mode 100644
index bc87cac07b..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/cookieauth.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package chttp
-
-import (
- "context"
- "net/http"
- "time"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-// CookieAuth provides CouchDB Cookie auth services as described at
-// http://docs.couchdb.org/en/2.0.0/api/server/authn.html#cookie-authentication
-//
-// CookieAuth stores authentication state after use, so should not be re-used.
-type CookieAuth struct {
- Username string `json:"name"`
- Password string `json:"password"`
-
- client *Client
- // transport stores the original transport that is overridden by this auth
- // mechanism
- transport http.RoundTripper
-}
-
-var _ Authenticator = &CookieAuth{}
-
-// Authenticate initiates a session with the CouchDB server.
-func (a *CookieAuth) Authenticate(c *Client) error {
- a.client = c
- a.setCookieJar()
- a.transport = c.Transport
- if a.transport == nil {
- a.transport = http.DefaultTransport
- }
- c.Transport = a
- return nil
-}
-
-// shouldAuth returns true if there is no cookie set, or if it has expired.
-func (a *CookieAuth) shouldAuth(req *http.Request) bool {
- if _, err := req.Cookie(kivik.SessionCookieName); err == nil {
- return false
- }
- cookie := a.Cookie()
- if cookie == nil {
- return true
- }
- if !cookie.Expires.IsZero() {
- return cookie.Expires.Before(time.Now())
- }
- // If we get here, it means the server did not include an expiry time in
- // the session cookie. Some CouchDB configurations do this, but rather than
- // re-authenticating for every request, we'll let the session expire. A
- // future change might be to make a client-configurable option to set the
- // re-authentication timeout.
- return false
-}
-
-// Cookie returns the current session cookie if found, or nil if not.
-func (a *CookieAuth) Cookie() *http.Cookie {
- if a.client == nil {
- return nil
- }
- for _, cookie := range a.client.Jar.Cookies(a.client.dsn) {
- if cookie.Name == kivik.SessionCookieName {
- return cookie
- }
- }
- return nil
-}
-
-var authInProgress = &struct{ name string }{"in progress"}
-
-// RoundTrip fulfills the http.RoundTripper interface. It sets
-// (re-)authenticates when the cookie has expired or is not yet set.
-func (a *CookieAuth) RoundTrip(req *http.Request) (*http.Response, error) {
- if err := a.authenticate(req); err != nil {
- return nil, err
- }
- return a.transport.RoundTrip(req)
-}
-
-func (a *CookieAuth) authenticate(req *http.Request) error {
- ctx := req.Context()
- if inProg, _ := ctx.Value(authInProgress).(bool); inProg {
- return nil
- }
- if !a.shouldAuth(req) {
- return nil
- }
- a.client.authMU.Lock()
- defer a.client.authMU.Unlock()
- if c := a.Cookie(); c != nil {
- // In case another simultaneous process authenticated successfully first
- req.AddCookie(c)
- return nil
- }
- ctx = context.WithValue(ctx, authInProgress, true)
- opts := &Options{
- GetBody: BodyEncoder(a),
- Header: http.Header{
- HeaderIdempotencyKey: []string{},
- },
- }
- if _, err := a.client.DoError(ctx, http.MethodPost, "/_session", opts); err != nil {
- return err
- }
- if c := a.Cookie(); c != nil {
- req.AddCookie(c)
- }
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/encode.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/encode.go
deleted file mode 100644
index 481a325b84..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/encode.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package chttp
-
-import (
- "net/url"
- "strings"
-)
-
-const (
- prefixDesign = "_design/"
- prefixLocal = "_local/"
-)
-
-// EncodeDocID encodes a document ID according to CouchDB's path encoding rules.
-//
-// In particular:
-// - '_design/' and '_local/' prefixes are unaltered.
-// - The rest of the docID is Query-URL encoded (despite being part of the path)
-func EncodeDocID(docID string) string {
- for _, prefix := range []string{prefixDesign, prefixLocal} {
- if strings.HasPrefix(docID, prefix) {
- return prefix + url.QueryEscape(strings.TrimPrefix(docID, prefix))
- }
- }
- return url.QueryEscape(docID)
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/errors.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/errors.go
deleted file mode 100644
index 49e6a346f8..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/errors.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package chttp
-
-import (
- "encoding/json"
- "fmt"
- "mime"
- "net/http"
-)
-
-// HTTPError is an error that represents an HTTP transport error.
-type HTTPError struct {
- // Response is the HTTP response received by the client. Typically the
- // response body has already been consumed, but the response and request
- // headers and other metadata will typically be in tact for debugging
- // purposes.
- Response *http.Response `json:"-"`
-
- // Reason is the server-supplied error reason.
- Reason string `json:"reason"`
-
- exitStatus int
-}
-
-func (e *HTTPError) Error() string {
- if e.Reason == "" {
- return http.StatusText(e.StatusCode())
- }
- if statusText := http.StatusText(e.StatusCode()); statusText != "" {
- return fmt.Sprintf("%s: %s", statusText, e.Reason)
- }
- return e.Reason
-}
-
-// StatusCode returns the embedded status code.
-func (e *HTTPError) StatusCode() int {
- return e.Response.StatusCode
-}
-
-// ExitStatus returns the embedded exit status.
-func (e *HTTPError) ExitStatus() int {
- return e.exitStatus
-}
-
-// Format implements fmt.Formatter
-func (e *HTTPError) Format(f fmt.State, c rune) {
- formatError(e, f, c)
-}
-
-// FormatError satisfies the Go 1.13 errors.Formatter interface
-// (golang.org/x/xerrors.Formatter for older versions of Go).
-func (e *HTTPError) FormatError(p printer) error {
- p.Print(e.Error())
- if p.Detail() {
- p.Printf("REQUEST: %s %s (%d bytes)", e.Response.Request.Method, e.Response.Request.URL.String(), e.Response.Request.ContentLength)
- p.Printf("\nRESPONSE: %d / %s (%d bytes)\n", e.Response.StatusCode, http.StatusText(e.Response.StatusCode), e.Response.ContentLength)
- }
- return nil
-}
-
-// ResponseError returns an error from an *http.Response.
-func ResponseError(resp *http.Response) error {
- if resp.StatusCode < 400 {
- return nil
- }
- if resp.Body != nil {
- defer resp.Body.Close() // nolint: errcheck
- }
- httpErr := &HTTPError{
- Response: resp,
- exitStatus: ExitNotRetrieved,
- }
- if resp.Request.Method != "HEAD" && resp.ContentLength != 0 {
- if ct, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type")); ct == typeJSON {
- _ = json.NewDecoder(resp.Body).Decode(httpErr)
- }
- }
- return httpErr
-}
-
-type curlError struct {
- curlStatus int
- httpStatus int
- error
-}
-
-func (e *curlError) ExitStatus() int {
- return e.curlStatus
-}
-
-func (e *curlError) StatusCode() int {
- return e.httpStatus
-}
-
-func fullError(httpStatus, curlStatus int, err error) error {
- return &curlError{
- curlStatus: curlStatus,
- httpStatus: httpStatus,
- error: err,
- }
-}
-
-func (e *curlError) Cause() error {
- return e.error
-}
-
-func (e *curlError) Unwrap() error {
- return e.error
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/exitstatus.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/exitstatus.go
deleted file mode 100644
index 44aa28df82..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/exitstatus.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package chttp
-
-// Exit statuses, borrowed from Curl. Not all Curl statuses are represented here.
-const (
- // Exited with an unknown failure.
- ExitUnknownFailure = 1
- // Failed to initialize.
- ExitFailedToInitialize = 2
- // URL malformed. The syntax was not correct.
- ExitStatusURLMalformed = 3
- // The given remote host was not resolved.
- ExitHostNotResolved = 6
- // Failed to connect to host.
- ExitFailedToConnect = 7
- // Weird server reply. The server sent data kouch couldn't parse.
- ExitWeirdReply = 8
- // The requested url was not found or returned another error with the HTTP error code being 400 or above.
- ExitNotRetrieved = 22
- // Write error. Kouch couldn't write data to a local filesystem or similar.
- ExitWriteError = 23
- // Read error. Various reading problems.
- ExitReadError = 26
- // The specified time-out period was reached according to the conditions.
- ExitOperationTimeout = 28
- // Internal post request generation error.
- ExitPostError = 34
- // When following redirects, curl hit the maximum amount.
- ExitTooManyRedirects = 47
-
-/*
-5 Couldn't resolve proxy. The given proxy host could not be resolved.
-18 Partial file. Only a part of the file was transferred.
-27 Out of memory. A memory allocation request failed.
-33 HTTP range error. The range "command" didn't work.
-35 SSL connect error. The SSL handshaking failed.
-37 FILE couldn't read file. Failed to open the file. Permissions?
-43 Internal error. A function was called with a bad parameter.
-45 Interface error. A specified outgoing interface could not be used.
-51 The peer's SSL certificate or SSH MD5 fingerprint was not OK.
-52 The server didn't reply anything, which here is considered an error.
-53 SSL crypto engine not found.
-54 Cannot set SSL crypto engine as default.
-55 Failed sending network data.
-56 Failure in receiving network data.
-58 Problem with the local certificate.
-59 Couldn't use specified SSL cipher.
-60 Peer certificate cannot be authenticated with known CA certificates.
-61 Unrecognized transfer encoding.
-63 Maximum file size exceeded.
-65 Sending the data requires a rewind that failed.
-66 Failed to initialise SSL Engine.
-67 The user name, password, or similar was not accepted and curl failed to log in.
-75 Character conversion failed.
-76 Character conversion functions required.
-77 Problem with reading the SSL CA cert (path? access rights?).
-78 The resource referenced in the URL does not exist.
-80 Failed to shut down the SSL connection.
-82 Could not load CRL file, missing or wrong format (added in 7.19.0).
-83 Issuer check failed (added in 7.19.0).
-89 No connection available, the session will be queued
-90 SSL public key does not matched pinned public key
-*/
-)
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/proxyauth.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/proxyauth.go
deleted file mode 100644
index 5f5b389158..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/proxyauth.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package chttp
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "encoding/hex"
- "net/http"
- "strings"
-)
-
-type ProxyAuth struct {
- Username string
- Secret string
- Roles []string
- Headers http.Header
-
- transport http.RoundTripper
- token string
-}
-
-var _ Authenticator = &ProxyAuth{}
-
-func (a *ProxyAuth) header(header string) string {
- if h := a.Headers.Get(header); h != "" {
- return http.CanonicalHeaderKey(h)
- }
- return header
-}
-
-func (a *ProxyAuth) genToken() string {
- if a.Secret == "" {
- return ""
- }
- if a.token != "" {
- return a.token
- }
- // Generate auth token
- // https://docs.couchdb.org/en/stable/config/auth.html#couch_httpd_auth/x_auth_token
- h := hmac.New(sha1.New, []byte(a.Secret))
- _, _ = h.Write([]byte(a.Username))
- a.token = hex.EncodeToString(h.Sum(nil))
- return a.token
-}
-
-func (a *ProxyAuth) RoundTrip(req *http.Request) (*http.Response, error) {
- if token := a.genToken(); token != "" {
- req.Header.Set(a.header("X-Auth-CouchDB-Token"), token)
- }
-
- req.Header.Set(a.header("X-Auth-CouchDB-UserName"), a.Username)
- req.Header.Set(a.header("X-Auth-CouchDB-Roles"), strings.Join(a.Roles, ","))
-
- return a.transport.RoundTrip(req)
-}
-
-func (a *ProxyAuth) Authenticate(c *Client) error {
- a.transport = c.Transport
- if a.transport == nil {
- a.transport = http.DefaultTransport
- }
- c.Transport = a
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/trace.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/trace.go
deleted file mode 100644
index 39a9b20ba9..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/trace.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package chttp
-
-import (
- "bytes"
- "context"
- "io"
- "io/ioutil"
- "net/http"
-)
-
-var clientTraceContextKey = &struct{ name string }{"client trace"}
-
-// ContextClientTrace returns the ClientTrace associated with the
-// provided context. If none, it returns nil.
-func ContextClientTrace(ctx context.Context) *ClientTrace {
- trace, _ := ctx.Value(clientTraceContextKey).(*ClientTrace)
- return trace
-}
-
-// ClientTrace is a set of hooks to run at various stages of an outgoing
-// HTTP request. Any particular hook may be nil. Functions may be
-// called concurrently from different goroutines and some may be called
-// after the request has completed or failed.
-type ClientTrace struct {
- // HTTPResponse returns a cloe of the *http.Response received from the
- // server, with the body set to nil. If you need the body, use the more
- // expensive HTTPResponseBody.
- HTTPResponse func(*http.Response)
-
- // HTTPResponseBody returns a clone of the *http.Response received from the
- // server, with the body cloned. This can be expensive for responses
- // with large bodies.
- HTTPResponseBody func(*http.Response)
-
- // HTTPRequest returns a clone of the *http.Request sent to the server, with
- // the body set to nil. If you need the body, use the more expensive
- // HTTPRequestBody.
- HTTPRequest func(*http.Request)
-
- // HTTPRequestBody returns a clone of the *http.Request sent to the server,
- // with the body cloned, if it is set. This can be expensive for requests
- // with large bodies.
- HTTPRequestBody func(*http.Request)
-}
-
-// WithClientTrace returns a new context based on the provided parent
-// ctx. HTTP client requests made with the returned context will use
-// the provided trace hooks, in addition to any previous hooks
-// registered with ctx. Any hooks defined in the provided trace will
-// be called first.
-func WithClientTrace(ctx context.Context, trace *ClientTrace) context.Context {
- if trace == nil {
- panic("nil trace")
- }
- return context.WithValue(ctx, clientTraceContextKey, trace)
-}
-
-func (t *ClientTrace) httpResponse(r *http.Response) {
- if t.HTTPResponse == nil || r == nil {
- return
- }
- clone := new(http.Response)
- *clone = *r
- clone.Body = nil
- t.HTTPResponse(clone)
-}
-
-func (t *ClientTrace) httpResponseBody(r *http.Response) {
- if t.HTTPResponseBody == nil || r == nil {
- return
- }
- clone := new(http.Response)
- *clone = *r
- rBody := r.Body
- body, readErr := ioutil.ReadAll(rBody)
- closeErr := rBody.Close()
- r.Body = newReplay(body, readErr, closeErr)
- clone.Body = newReplay(body, readErr, closeErr)
- t.HTTPResponseBody(clone)
-}
-
-func (t *ClientTrace) httpRequest(r *http.Request) {
- if t.HTTPRequest == nil {
- return
- }
- clone := new(http.Request)
- *clone = *r
- clone.Body = nil
- t.HTTPRequest(clone)
-}
-
-func (t *ClientTrace) httpRequestBody(r *http.Request) {
- if t.HTTPRequestBody == nil {
- return
- }
- clone := new(http.Request)
- *clone = *r
- if r.Body != nil {
- rBody := r.Body
- body, readErr := ioutil.ReadAll(rBody)
- closeErr := rBody.Close()
- r.Body = newReplay(body, readErr, closeErr)
- clone.Body = newReplay(body, readErr, closeErr)
- }
- t.HTTPRequestBody(clone)
-}
-
-func newReplay(body []byte, readErr, closeErr error) io.ReadCloser {
- if readErr == nil && closeErr == nil {
- return ioutil.NopCloser(bytes.NewReader(body))
- }
- return &replayReadCloser{
- Reader: ioutil.NopCloser(bytes.NewReader(body)),
- readErr: readErr,
- closeErr: closeErr,
- }
-}
-
-// replayReadCloser replays read and close errors
-type replayReadCloser struct {
- io.Reader
- readErr error
- closeErr error
-}
-
-func (r *replayReadCloser) Read(p []byte) (int, error) {
- c, err := r.Reader.Read(p)
- if err == io.EOF && r.readErr != nil {
- err = r.readErr
- }
- return c, err
-}
-
-func (r *replayReadCloser) Close() error {
- return r.closeErr
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_13.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_13.go
deleted file mode 100644
index e98f2bd8db..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_13.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build 1.13
-
-package chttp
-
-type printer = errors.Printer
-
-var formatError = errors.FormatError
diff --git a/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_pre13.go b/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_pre13.go
deleted file mode 100644
index 72e41abf23..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/chttp/xerrors_pre13.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !1.13
-
-package chttp
-
-import (
- "golang.org/x/xerrors"
-)
-
-type printer = xerrors.Printer
-
-var formatError = xerrors.FormatError
diff --git a/vendor/github.com/go-kivik/couchdb/v3/client.go b/vendor/github.com/go-kivik/couchdb/v3/client.go
deleted file mode 100644
index 15c8416411..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/client.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "io"
- "net/http"
- "strings"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-func (c *client) AllDBs(ctx context.Context, opts map[string]interface{}) ([]string, error) {
- query, err := optionsToParams(opts)
- if err != nil {
- return nil, err
- }
- var allDBs []string
- _, err = c.DoJSON(ctx, http.MethodGet, "/_all_dbs", &chttp.Options{Query: query}, &allDBs)
- return allDBs, err
-}
-
-func (c *client) DBExists(ctx context.Context, dbName string, _ map[string]interface{}) (bool, error) {
- if dbName == "" {
- return false, missingArg("dbName")
- }
- _, err := c.DoError(ctx, http.MethodHead, dbName, nil)
- if kivik.StatusCode(err) == http.StatusNotFound {
- return false, nil
- }
- return err == nil, err
-}
-
-func (c *client) CreateDB(ctx context.Context, dbName string, opts map[string]interface{}) error {
- if dbName == "" {
- return missingArg("dbName")
- }
- query, err := optionsToParams(opts)
- if err != nil {
- return err
- }
- _, err = c.DoError(ctx, http.MethodPut, dbName, &chttp.Options{Query: query})
- return err
-}
-
-func (c *client) DestroyDB(ctx context.Context, dbName string, _ map[string]interface{}) error {
- if dbName == "" {
- return missingArg("dbName")
- }
- _, err := c.DoError(ctx, http.MethodDelete, dbName, nil)
- return err
-}
-
-func (c *client) DBUpdates(ctx context.Context) (updates driver.DBUpdates, err error) {
- resp, err := c.DoReq(ctx, http.MethodGet, "/_db_updates?feed=continuous&since=now", nil)
- if err != nil {
- return nil, err
- }
- if err := chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- return newUpdates(ctx, resp.Body), nil
-}
-
-type couchUpdates struct {
- *iter
-}
-
-var _ driver.DBUpdates = &couchUpdates{}
-
-type updatesParser struct{}
-
-var _ parser = &updatesParser{}
-
-func (p *updatesParser) decodeItem(i interface{}, dec *json.Decoder) error {
- return dec.Decode(i)
-}
-
-func newUpdates(ctx context.Context, body io.ReadCloser) *couchUpdates {
- return &couchUpdates{
- iter: newIter(ctx, nil, "", body, &updatesParser{}),
- }
-}
-
-func (u *couchUpdates) Next(update *driver.DBUpdate) error {
- return u.iter.next(update)
-}
-
-// Ping queries the /_up endpoint, and returns true if there are no errors, or
-// if a 400 (Bad Request) is returned, and the Server: header indicates a server
-// version prior to 2.x.
-func (c *client) Ping(ctx context.Context) (bool, error) {
- resp, err := c.DoError(ctx, http.MethodHead, "/_up", nil)
- if kivik.StatusCode(err) == http.StatusBadRequest {
- return strings.HasPrefix(resp.Header.Get("Server"), "CouchDB/1."), nil
- }
- if kivik.StatusCode(err) == http.StatusNotFound {
- return false, nil
- }
- return err == nil, err
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/cluster.go b/vendor/github.com/go-kivik/couchdb/v3/cluster.go
deleted file mode 100644
index 6da542eeac..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/cluster.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package couchdb
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
-)
-
-func (c *client) ClusterStatus(ctx context.Context, opts map[string]interface{}) (string, error) {
- var result struct {
- State string `json:"state"`
- }
- query, err := optionsToParams(opts)
- if err != nil {
- return "", err
- }
- _, err = c.DoJSON(ctx, http.MethodGet, "/_cluster_setup", &chttp.Options{Query: query}, &result)
- return result.State, err
-}
-
-func (c *client) ClusterSetup(ctx context.Context, action interface{}) error {
- options := &chttp.Options{
- Body: chttp.EncodeBody(action),
- }
- _, err := c.DoError(ctx, http.MethodPost, "/_cluster_setup", options)
- return err
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/codecov.yml b/vendor/github.com/go-kivik/couchdb/v3/codecov.yml
deleted file mode 100644
index b8a66592a9..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/codecov.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-ignore:
- - "test/.*"
diff --git a/vendor/github.com/go-kivik/couchdb/v3/config.go b/vendor/github.com/go-kivik/couchdb/v3/config.go
deleted file mode 100644
index a014368f30..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/config.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package couchdb
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "io/ioutil"
- "net/http"
- "strings"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Couch1ConfigNode can be passed to any of the Config-related methods as the
-// node name, to query the /_config endpoint in a CouchDB 1.x-compatible way.
-const Couch1ConfigNode = ""
-
-var _ driver.Configer = &client{}
-
-func configURL(node string, parts ...string) string {
- var components []string
- if node == Couch1ConfigNode {
- components = append(make([]string, 0, len(parts)+1),
- "_config")
- } else {
- components = append(make([]string, 0, len(parts)+3),
- "_node", node, "_config",
- )
- }
- components = append(components, parts...)
- return "/" + strings.Join(components, "/")
-}
-
-func (c *client) Config(ctx context.Context, node string) (driver.Config, error) {
- cf := driver.Config{}
- _, err := c.Client.DoJSON(ctx, http.MethodGet, configURL(node), nil, &cf)
- return cf, err
-}
-
-func (c *client) ConfigSection(ctx context.Context, node, section string) (driver.ConfigSection, error) {
- sec := driver.ConfigSection{}
- _, err := c.Client.DoJSON(ctx, http.MethodGet, configURL(node, section), nil, &sec)
- return sec, err
-}
-
-func (c *client) ConfigValue(ctx context.Context, node, section, key string) (string, error) {
- var value string
- _, err := c.Client.DoJSON(ctx, http.MethodGet, configURL(node, section, key), nil, &value)
- return value, err
-}
-
-func (c *client) SetConfigValue(ctx context.Context, node, section, key, value string) (string, error) {
- body, _ := json.Marshal(value) // Strings never cause JSON marshaling errors
- var old string
- opts := &chttp.Options{
- Body: ioutil.NopCloser(bytes.NewReader(body)),
- }
- _, err := c.Client.DoJSON(ctx, http.MethodPut, configURL(node, section, key), opts, &old)
- return old, err
-}
-
-func (c *client) DeleteConfigKey(ctx context.Context, node, section, key string) (string, error) {
- var value string
- _, err := c.Client.DoJSON(ctx, http.MethodDelete, configURL(node, section, key), nil, &value)
- return value, err
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/constants.go b/vendor/github.com/go-kivik/couchdb/v3/constants.go
deleted file mode 100644
index 776faf62e7..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/constants.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package couchdb
-
-// Version is the current version of this package.
-const Version = "3.0.4"
-
-const (
- // OptionFullCommit is the option key used to set the `X-Couch-Full-Commit`
- // header in the request when set to true.
- //
- // Example:
- //
- // db.Put(ctx, "doc_id", doc, kivik.Options{couchdb.OptionFullCommit: true})
- OptionFullCommit = "X-Couch-Full-Commit"
-
- // OptionIfNoneMatch is an option key to set the If-None-Match header on
- // the request.
- //
- // Example:
- //
- // row, err := db.Get(ctx, "doc_id", kivik.Options{couchdb.OptionIfNoneMatch: "1-xxx"})
- OptionIfNoneMatch = "If-None-Match"
-
- // NoMultipartPut instructs the Put() method not to use CouchDB's
- // multipart/related upload capabilities. This only affects PUT requests that
- // also include attachments.
- NoMultipartPut = "kivik:no-multipart-put"
-
- // NoMultipartGet instructs the Get() method not to use CouchDB's ability to
- // download attachments with the multipart/related media type. This only
- // affects GET requests that request attachments.
- NoMultipartGet = "kivik:no-multipart-get"
-)
-
-const (
- typeJSON = "application/json"
- typeMPRelated = "multipart/related"
-)
diff --git a/vendor/github.com/go-kivik/couchdb/v3/couchdb.go b/vendor/github.com/go-kivik/couchdb/v3/couchdb.go
deleted file mode 100644
index 7e6c3d0588..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/couchdb.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package couchdb
-
-import (
- "context"
- "fmt"
- "net/http"
- "sync"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Couch represents the parent driver instance.
-type Couch struct {
- // If provided, UserAgent is appended to the User-Agent header on all
- // outbound requests.
- UserAgent string
-
- // If provided, HTTPClient will be used for requests to the CouchDB server.
- HTTPClient *http.Client
-}
-
-var _ driver.Driver = &Couch{}
-
-func init() {
- kivik.Register("couch", &Couch{})
-}
-
-// Known vendor strings
-const (
- VendorCouchDB = "The Apache Software Foundation"
- VendorCloudant = "IBM Cloudant"
-)
-
-type client struct {
- *chttp.Client
-
- // schedulerDetected will be set once the scheduler has been detected.
- // It should only be accessed through the schedulerSupported() method.
- schedulerDetected *bool
- sdMU sync.Mutex
-}
-
-var _ driver.Client = &client{}
-var _ driver.DBUpdater = &client{}
-
-// NewClient establishes a new connection to a CouchDB server instance. If
-// auth credentials are included in the URL, they are used to authenticate using
-// CookieAuth (or BasicAuth if compiled with GopherJS). If you wish to use a
-// different auth mechanism, do not specify credentials here, and instead call
-// Authenticate() later.
-func (d *Couch) NewClient(dsn string) (driver.Client, error) {
- httpClient := d.HTTPClient
- if httpClient == nil {
- httpClient = &http.Client{}
- }
- chttpClient, err := chttp.NewWithClient(httpClient, dsn)
- if err != nil {
- return nil, err
- }
- chttpClient.UserAgents = []string{
- fmt.Sprintf("Kivik/%s", kivik.KivikVersion),
- fmt.Sprintf("Kivik CouchDB driver/%s", Version),
- }
- if d.UserAgent != "" {
- chttpClient.UserAgents = append(chttpClient.UserAgents, d.UserAgent)
- }
- return &client{
- Client: chttpClient,
- }, nil
-}
-
-func (c *client) DB(_ context.Context, dbName string, _ map[string]interface{}) (driver.DB, error) {
- if dbName == "" {
- return nil, missingArg("dbName")
- }
- return &db{
- client: c,
- dbName: dbName,
- }, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/db.go b/vendor/github.com/go-kivik/couchdb/v3/db.go
deleted file mode 100644
index b946715903..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/db.go
+++ /dev/null
@@ -1,883 +0,0 @@
-package couchdb
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "mime"
- "mime/multipart"
- "net/http"
- "net/textproto"
- "net/url"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type db struct {
- *client
- dbName string
-}
-
-var _ driver.DB = &db{}
-var _ driver.MetaGetter = &db{}
-var _ driver.AttachmentMetaGetter = &db{}
-
-func (d *db) path(path string) string {
- url, err := url.Parse(d.dbName + "/" + strings.TrimPrefix(path, "/"))
- if err != nil {
- panic("THIS IS A BUG: d.path failed: " + err.Error())
- }
- return url.String()
-}
-
-func optionsToParams(opts ...map[string]interface{}) (url.Values, error) {
- params := url.Values{}
- for _, optsSet := range opts {
- if err := encodeKeys(optsSet); err != nil {
- return nil, err
- }
- for key, i := range optsSet {
- var values []string
- switch v := i.(type) {
- case string:
- values = []string{v}
- case []string:
- values = v
- case bool:
- values = []string{fmt.Sprintf("%t", v)}
- case int, uint, uint8, uint16, uint32, uint64, int8, int16, int32, int64:
- values = []string{fmt.Sprintf("%d", v)}
- default:
- return nil, &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: fmt.Errorf("kivik: invalid type %T for options", i)}
- }
- for _, value := range values {
- params.Add(key, value)
- }
- }
- }
- return params, nil
-}
-
-// rowsQuery performs a query that returns a rows iterator.
-func (d *db) rowsQuery(ctx context.Context, path string, opts map[string]interface{}) (driver.Rows, error) {
- keys := opts["keys"]
- delete(opts, "keys")
- query, err := optionsToParams(opts)
- if err != nil {
- return nil, err
- }
- options := &chttp.Options{Query: query}
- method := http.MethodGet
- if keys != nil {
- method = http.MethodPost
- options.GetBody = chttp.BodyEncoder(map[string]interface{}{
- "keys": keys,
- })
- options.Header = http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- }
- }
- resp, err := d.Client.DoReq(ctx, method, d.path(path), options)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- return newRows(ctx, resp.Body), nil
-}
-
-// AllDocs returns all of the documents in the database.
-func (d *db) AllDocs(ctx context.Context, opts map[string]interface{}) (driver.Rows, error) {
- return d.rowsQuery(ctx, "_all_docs", opts)
-}
-
-// DesignDocs returns all of the documents in the database.
-func (d *db) DesignDocs(ctx context.Context, opts map[string]interface{}) (driver.Rows, error) {
- return d.rowsQuery(ctx, "_design_docs", opts)
-}
-
-// LocalDocs returns all of the documents in the database.
-func (d *db) LocalDocs(ctx context.Context, opts map[string]interface{}) (driver.Rows, error) {
- return d.rowsQuery(ctx, "_local_docs", opts)
-}
-
-// Query queries a view.
-func (d *db) Query(ctx context.Context, ddoc, view string, opts map[string]interface{}) (driver.Rows, error) {
- return d.rowsQuery(ctx, fmt.Sprintf("_design/%s/_view/%s", chttp.EncodeDocID(ddoc), chttp.EncodeDocID(view)), opts)
-}
-
-// Get fetches the requested document.
-func (d *db) Get(ctx context.Context, docID string, options map[string]interface{}) (*driver.Document, error) {
- resp, rev, err := d.get(ctx, http.MethodGet, docID, options)
- if err != nil {
- return nil, err
- }
- ct, params, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
- if err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- switch ct {
- case typeJSON:
- return &driver.Document{
- Rev: rev,
- ContentLength: resp.ContentLength,
- Body: resp.Body,
- }, nil
- case typeMPRelated:
- boundary := strings.Trim(params["boundary"], "\"")
- if boundary == "" {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: errors.New("kivik: boundary missing for multipart/related response")}
- }
- mpReader := multipart.NewReader(resp.Body, boundary)
- body, err := mpReader.NextPart()
- if err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- length := int64(-1)
- if cl, e := strconv.ParseInt(body.Header.Get("Content-Length"), 10, 64); e == nil {
- length = cl
- }
-
- // TODO: Use a TeeReader here, to avoid slurping the entire body into memory at once
- content, err := ioutil.ReadAll(body)
- if err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- var metaDoc struct {
- Attachments map[string]attMeta `json:"_attachments"`
- }
- if err := json.Unmarshal(content, &metaDoc); err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
-
- return &driver.Document{
- ContentLength: length,
- Rev: rev,
- Body: ioutil.NopCloser(bytes.NewBuffer(content)),
- Attachments: &multipartAttachments{
- content: resp.Body,
- mpReader: mpReader,
- meta: metaDoc.Attachments,
- },
- }, nil
- default:
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("kivik: invalid content type in response: %s", ct)}
- }
-}
-
-type attMeta struct {
- ContentType string `json:"content_type"`
- Size *int64 `json:"length"`
- Follows bool `json:"follows"`
-}
-
-type multipartAttachments struct {
- content io.ReadCloser
- mpReader *multipart.Reader
- meta map[string]attMeta
-}
-
-var _ driver.Attachments = &multipartAttachments{}
-
-func (a *multipartAttachments) Next(att *driver.Attachment) error {
- part, err := a.mpReader.NextPart()
- switch err {
- case io.EOF:
- return err
- case nil:
- // fall through
- default:
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
-
- disp, dispositionParams, err := mime.ParseMediaType(part.Header.Get("Content-Disposition"))
- if err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Content-Disposition: %s", err)}
- }
- if disp != "attachment" {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Unexpected Content-Disposition: %s", disp)}
- }
- filename := dispositionParams["filename"]
-
- meta := a.meta[filename]
- if !meta.Follows {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("File '%s' not in manifest", filename)}
- }
-
- size := int64(-1)
- if meta.Size != nil {
- size = *meta.Size
- } else if cl, e := strconv.ParseInt(part.Header.Get("Content-Length"), 10, 64); e == nil {
- size = cl
- }
-
- var cType string
- if ctHeader, ok := part.Header["Content-Type"]; ok {
- cType, _, err = mime.ParseMediaType(ctHeader[0])
- if err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- } else {
- cType = meta.ContentType
- }
-
- *att = driver.Attachment{
- Filename: filename,
- Size: size,
- ContentType: cType,
- Content: part,
- ContentEncoding: part.Header.Get("Content-Encoding"),
- }
- return nil
-}
-
-func (a *multipartAttachments) Close() error {
- return a.content.Close()
-}
-
-// Rev returns the most current rev of the requested document.
-func (d *db) GetMeta(ctx context.Context, docID string, options map[string]interface{}) (size int64, rev string, err error) {
- resp, rev, err := d.get(ctx, http.MethodHead, docID, options)
- if err != nil {
- return 0, "", err
- }
- return resp.ContentLength, rev, err
-}
-
-func (d *db) get(ctx context.Context, method string, docID string, options map[string]interface{}) (*http.Response, string, error) {
- if docID == "" {
- return nil, "", missingArg("docID")
- }
-
- inm, err := ifNoneMatch(options)
- if err != nil {
- return nil, "", err
- }
-
- params, err := optionsToParams(options)
- if err != nil {
- return nil, "", err
- }
- opts := &chttp.Options{
- Accept: typeMPRelated + "," + typeJSON,
- IfNoneMatch: inm,
- Query: params,
- }
- if _, ok := options[NoMultipartGet]; ok {
- opts.Accept = typeJSON
- }
- resp, err := d.Client.DoReq(ctx, method, d.path(chttp.EncodeDocID(docID)), opts)
- if err != nil {
- return nil, "", err
- }
- if respErr := chttp.ResponseError(resp); respErr != nil {
- return nil, "", respErr
- }
- rev, err := chttp.GetRev(resp)
- return resp, rev, err
-}
-
-func (d *db) CreateDoc(ctx context.Context, doc interface{}, options map[string]interface{}) (docID, rev string, err error) {
- result := struct {
- ID string `json:"id"`
- Rev string `json:"rev"`
- }{}
-
- fullCommit, err := fullCommit(options)
- if err != nil {
- return "", "", err
- }
-
- path := d.dbName
- if len(options) > 0 {
- params, e := optionsToParams(options)
- if e != nil {
- return "", "", e
- }
- path += "?" + params.Encode()
- }
-
- opts := &chttp.Options{
- Body: chttp.EncodeBody(doc),
- FullCommit: fullCommit,
- }
- _, err = d.Client.DoJSON(ctx, http.MethodPost, path, opts, &result)
- return result.ID, result.Rev, err
-}
-
-func putOpts(doc interface{}, options map[string]interface{}) (*chttp.Options, error) {
- fullCommit, err := fullCommit(options)
- if err != nil {
- return nil, err
- }
- params, err := optionsToParams(options)
- if err != nil {
- return nil, err
- }
- if _, ok := options[NoMultipartPut]; !ok {
- if atts, ok := extractAttachments(doc); ok {
- boundary, size, multipartBody, e := newMultipartAttachments(chttp.EncodeBody(doc), atts)
- if e != nil {
- return nil, e
- }
- return &chttp.Options{
- Body: multipartBody,
- FullCommit: fullCommit,
- Query: params,
- ContentLength: size,
- ContentType: fmt.Sprintf(typeMPRelated+"; boundary=%q", boundary),
- }, nil
- }
- }
- return &chttp.Options{
- Body: chttp.EncodeBody(doc),
- FullCommit: fullCommit,
- Query: params,
- }, nil
-}
-
-func (d *db) Put(ctx context.Context, docID string, doc interface{}, options map[string]interface{}) (rev string, err error) {
- if docID == "" {
- return "", missingArg("docID")
- }
- opts, err := putOpts(doc, options)
- if err != nil {
- return "", err
- }
- var result struct {
- ID string `json:"id"`
- Rev string `json:"rev"`
- }
- _, err = d.Client.DoJSON(ctx, http.MethodPut, d.path(chttp.EncodeDocID(docID)), opts, &result)
- if err != nil {
- return "", err
- }
- return result.Rev, nil
-}
-
-const attachmentsKey = "_attachments"
-
-func extractAttachments(doc interface{}) (*kivik.Attachments, bool) {
- if doc == nil {
- return nil, false
- }
- v := reflect.ValueOf(doc)
- if v.Type().Kind() == reflect.Ptr {
- return extractAttachments(v.Elem().Interface())
- }
- if stdMap, ok := doc.(map[string]interface{}); ok {
- return interfaceToAttachments(stdMap[attachmentsKey])
- }
- if v.Kind() != reflect.Struct {
- return nil, false
- }
- for i := 0; i < v.NumField(); i++ {
- if v.Type().Field(i).Tag.Get("json") == attachmentsKey {
- return interfaceToAttachments(v.Field(i).Interface())
- }
- }
- return nil, false
-}
-
-func interfaceToAttachments(i interface{}) (*kivik.Attachments, bool) {
- switch t := i.(type) {
- case kivik.Attachments:
- atts := make(kivik.Attachments, len(t))
- for k, v := range t {
- atts[k] = v
- delete(t, k)
- }
- return &atts, true
- case *kivik.Attachments:
- atts := new(kivik.Attachments)
- *atts = *t
- *t = nil
- return atts, true
- }
- return nil, false
-}
-
-// newMultipartAttachments reads a json stream on in, and produces a
-// multipart/related output suitable for a PUT request.
-func newMultipartAttachments(in io.ReadCloser, att *kivik.Attachments) (boundary string, size int64, content io.ReadCloser, err error) {
- tmp, err := ioutil.TempFile("", "kivik-multipart-*")
- if err != nil {
- return "", 0, nil, err
- }
- body := multipart.NewWriter(tmp)
- w := sync.WaitGroup{}
- w.Add(1)
- go func() {
- err = createMultipart(body, in, att)
- e := in.Close()
- if err == nil {
- err = e
- }
- w.Done()
- }()
- w.Wait()
- if e := tmp.Sync(); err == nil {
- err = e
- }
- if info, e := tmp.Stat(); e == nil {
- size = info.Size()
- } else {
- if err == nil {
- err = e
- }
- }
- if _, e := tmp.Seek(0, 0); e != nil && err == nil {
- err = e
- }
- return body.Boundary(),
- size,
- tmp,
- err
-}
-
-func createMultipart(w *multipart.Writer, r io.ReadCloser, atts *kivik.Attachments) error {
- doc, err := w.CreatePart(textproto.MIMEHeader{
- "Content-Type": {typeJSON},
- })
- if err != nil {
- return err
- }
- attJSON := replaceAttachments(r, atts)
- if _, e := io.Copy(doc, attJSON); e != nil {
- return e
- }
-
- // Sort the filenames to ensure order consistent with json.Marshal's ordering
- // of the stubs in the body
- filenames := make([]string, 0, len(*atts))
- for filename := range *atts {
- filenames = append(filenames, filename)
- }
- sort.Strings(filenames)
-
- for _, filename := range filenames {
- att := (*atts)[filename]
- file, err := w.CreatePart(textproto.MIMEHeader{
- // "Content-Type": {att.ContentType},
- // "Content-Disposition": {fmt.Sprintf(`attachment; filename=%q`, filename)},
- // "Content-Length": {strconv.FormatInt(att.Size, 10)},
- })
- if err != nil {
- return err
- }
- if _, err := io.Copy(file, att.Content); err != nil {
- return err
- }
- _ = att.Content.Close()
- }
-
- return w.Close()
-}
-
-type lener interface {
- Len() int
-}
-
-type stater interface {
- Stat() (os.FileInfo, error)
-}
-
-// attachmentSize determines the size of the `in` stream by reading the entire
-// stream first. This method is a no-op if att.Size is already > , and sets the Size
-// parameter accordingly. If Size is already set, this function does nothing.
-// It attempts the following methods:
-//
-// 1. Calls `Len()`, if implemented by `in` (i.e. `*bytes.Buffer`)
-// 2. Calls `Stat()`, if implemented by `in` (i.e. `*os.File`) then returns
-// the file's size
-// 3. Read the entire stream to determine the size, and replace att.Content
-// to be replayed.
-func attachmentSize(att *kivik.Attachment) error {
- if att.Size > 0 {
- return nil
- }
- size, r, err := readerSize(att.Content)
- if err != nil {
- return err
- }
- rc, ok := r.(io.ReadCloser)
- if !ok {
- rc = ioutil.NopCloser(r)
- }
-
- att.Content = rc
- att.Size = size
- return nil
-}
-
-func readerSize(in io.Reader) (int64, io.Reader, error) {
- if ln, ok := in.(lener); ok {
- return int64(ln.Len()), in, nil
- }
- if st, ok := in.(stater); ok {
- info, err := st.Stat()
- if err != nil {
- return 0, nil, err
- }
- return info.Size(), in, nil
- }
- content, err := ioutil.ReadAll(in)
- if err != nil {
- return 0, nil, err
- }
- buf := bytes.NewBuffer(content)
- return int64(buf.Len()), ioutil.NopCloser(buf), nil
-}
-
-// NewAttachment is a convenience function, which sets the size of the attachment
-// based on content. This is intended for creating attachments to be uploaded
-// using multipart/related capabilities of Put(). The attachment size will be
-// set to the first of the following found:
-//
-// 1. `size`, if present. Only the first value is considered
-// 2. content.Len(), if implemented (i.e. *bytes.Buffer)
-// 3. content.Stat().Size(), if implemented (i.e. *os.File)
-// 4. Read the entire content into memory, to determine the size. This can
-// use a lot of memory for large attachments. Please use a file, or
-// specify the size directly instead.
-func NewAttachment(filename, contentType string, content io.Reader, size ...int64) (*kivik.Attachment, error) {
- var filesize int64
- if len(size) > 0 {
- filesize = size[0]
- } else {
- var err error
- filesize, content, err = readerSize(content)
- if err != nil {
- return nil, err
- }
- }
- rc, ok := content.(io.ReadCloser)
- if !ok {
- rc = ioutil.NopCloser(content)
- }
- return &kivik.Attachment{
- Filename: filename,
- ContentType: contentType,
- Content: rc,
- Size: filesize,
- }, nil
-}
-
-// replaceAttachments reads a json stream on in, looking for the _attachments
-// key, then replaces its value with the marshaled version of att.
-func replaceAttachments(in io.ReadCloser, atts *kivik.Attachments) io.ReadCloser {
- r, w := io.Pipe()
- go func() {
- stubs, err := attachmentStubs(atts)
- if err != nil {
- _ = w.CloseWithError(err)
- _ = in.Close()
- return
- }
- err = copyWithAttachmentStubs(w, in, stubs)
- e := in.Close()
- if err == nil {
- err = e
- }
- _ = w.CloseWithError(err)
- }()
- return r
-}
-
-type stub struct {
- ContentType string `json:"content_type"`
- Size int64 `json:"length"`
-}
-
-func (s *stub) MarshalJSON() ([]byte, error) {
- type attJSON struct {
- stub
- Follows bool `json:"follows"`
- }
- att := attJSON{
- stub: *s,
- Follows: true,
- }
- return json.Marshal(att)
-}
-
-func attachmentStubs(atts *kivik.Attachments) (map[string]*stub, error) {
- if atts == nil {
- return nil, nil
- }
- result := make(map[string]*stub, len(*atts))
- for filename, att := range *atts {
- if err := attachmentSize(att); err != nil {
- return nil, err
- }
- result[filename] = &stub{
- ContentType: att.ContentType,
- Size: att.Size,
- }
- }
- return result, nil
-}
-
-// copyWithAttachmentStubs copies r to w, replacing the _attachment value with the
-// marshaled version of atts.
-func copyWithAttachmentStubs(w io.Writer, r io.Reader, atts map[string]*stub) error {
- dec := json.NewDecoder(r)
- t, err := dec.Token()
- if err == nil {
- if t != json.Delim('{') {
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: fmt.Errorf("expected '{', found '%v'", t)}
- }
- }
- if err != nil {
- if err != io.EOF {
- return err
- }
- }
- if _, err := fmt.Fprintf(w, "%v", t); err != nil {
- return err
- }
- first := true
- for {
- t, err := dec.Token()
- if err == io.EOF {
- break
- }
- if err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- switch tp := t.(type) {
- case string:
- if !first {
- if _, e := w.Write([]byte(",")); e != nil {
- return e
- }
- }
- first = false
- if _, e := fmt.Fprintf(w, `"%s":`, tp); e != nil {
- return e
- }
- var val json.RawMessage
- if e := dec.Decode(&val); e != nil {
- return e
- }
- if tp == attachmentsKey {
- if e := json.NewEncoder(w).Encode(atts); e != nil {
- return e
- }
- // Once we're here, we can just stream the rest of the input
- // unaltered.
- if _, e := io.Copy(w, dec.Buffered()); e != nil {
- return e
- }
- _, e := io.Copy(w, r)
- return e
- }
- if _, e := w.Write(val); e != nil {
- return e
- }
- case json.Delim:
- if tp != json.Delim('}') {
- return fmt.Errorf("expected '}', found '%v'", t)
- }
- if _, err := fmt.Fprintf(w, "%v", t); err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func (d *db) Delete(ctx context.Context, docID, rev string, options map[string]interface{}) (string, error) {
- if docID == "" {
- return "", missingArg("docID")
- }
- if rev == "" {
- return "", missingArg("rev")
- }
-
- fullCommit, err := fullCommit(options)
- if err != nil {
- return "", err
- }
-
- query, err := optionsToParams(options)
- if err != nil {
- return "", err
- }
- query.Add("rev", rev)
- opts := &chttp.Options{
- FullCommit: fullCommit,
- Query: query,
- }
- resp, err := d.Client.DoReq(ctx, http.MethodDelete, d.path(chttp.EncodeDocID(docID)), opts)
- if err != nil {
- return "", err
- }
- defer resp.Body.Close() // nolint: errcheck
- return chttp.GetRev(resp)
-}
-
-func (d *db) Flush(ctx context.Context) error {
- opts := &chttp.Options{
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- _, err := d.Client.DoError(ctx, http.MethodPost, d.path("/_ensure_full_commit"), opts)
- return err
-}
-
-func (d *db) Compact(ctx context.Context) error {
- opts := &chttp.Options{
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- res, err := d.Client.DoReq(ctx, http.MethodPost, d.path("/_compact"), opts)
- if err != nil {
- return err
- }
- return chttp.ResponseError(res)
-}
-
-func (d *db) CompactView(ctx context.Context, ddocID string) error {
- if ddocID == "" {
- return missingArg("ddocID")
- }
- opts := &chttp.Options{
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- res, err := d.Client.DoReq(ctx, http.MethodPost, d.path("/_compact/"+ddocID), opts)
- if err != nil {
- return err
- }
- return chttp.ResponseError(res)
-}
-
-func (d *db) ViewCleanup(ctx context.Context) error {
- opts := &chttp.Options{
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- res, err := d.Client.DoReq(ctx, http.MethodPost, d.path("/_view_cleanup"), opts)
- if err != nil {
- return err
- }
- return chttp.ResponseError(res)
-}
-
-func (d *db) Security(ctx context.Context) (*driver.Security, error) {
- var sec *driver.Security
- _, err := d.Client.DoJSON(ctx, http.MethodGet, d.path("/_security"), nil, &sec)
- return sec, err
-}
-
-func (d *db) SetSecurity(ctx context.Context, security *driver.Security) error {
- opts := &chttp.Options{
- GetBody: chttp.BodyEncoder(security),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- res, err := d.Client.DoReq(ctx, http.MethodPut, d.path("/_security"), opts)
- if err != nil {
- return err
- }
- defer res.Body.Close() // nolint: errcheck
- return chttp.ResponseError(res)
-}
-
-func (d *db) Copy(ctx context.Context, targetID, sourceID string, options map[string]interface{}) (targetRev string, err error) {
- if sourceID == "" {
- return "", missingArg("sourceID")
- }
- if targetID == "" {
- return "", missingArg("targetID")
- }
- fullCommit, err := fullCommit(options)
- if err != nil {
- return "", err
- }
- params, err := optionsToParams(options)
- if err != nil {
- return "", err
- }
- opts := &chttp.Options{
- FullCommit: fullCommit,
- Query: params,
- Header: http.Header{
- chttp.HeaderDestination: []string{targetID},
- },
- }
- resp, err := d.Client.DoReq(ctx, "COPY", d.path(chttp.EncodeDocID(sourceID)), opts)
- if err != nil {
- return "", err
- }
- defer resp.Body.Close() // nolint: errcheck
- return chttp.GetRev(resp)
-}
-
-func (d *db) Purge(ctx context.Context, docMap map[string][]string) (*driver.PurgeResult, error) {
- result := &driver.PurgeResult{}
- options := &chttp.Options{
- GetBody: chttp.BodyEncoder(docMap),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- _, err := d.Client.DoJSON(ctx, http.MethodPost, d.path("_purge"), options, &result)
- return result, err
-}
-
-var _ driver.RevsDiffer = &db{}
-
-func (d *db) RevsDiff(ctx context.Context, revMap interface{}) (driver.Rows, error) {
- options := &chttp.Options{
- GetBody: chttp.BodyEncoder(revMap),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- resp, err := d.Client.DoReq(ctx, http.MethodPost, d.path("_revs_diff"), options)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- return newRevsDiffRows(ctx, resp.Body), nil
-}
-
-type revsDiffParser struct{}
-
-func (p *revsDiffParser) decodeItem(i interface{}, dec *json.Decoder) error {
- t, err := dec.Token()
- if err != nil {
- return err
- }
- row := i.(*driver.Row)
- row.ID = t.(string)
- return dec.Decode(&row.Value)
-}
-
-func newRevsDiffRows(ctx context.Context, in io.ReadCloser) driver.Rows {
- iter := newIter(ctx, nil, "", in, &revsDiffParser{})
- iter.objMode = true
- return &rows{iter: iter}
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/dbstats.go b/vendor/github.com/go-kivik/couchdb/v3/dbstats.go
deleted file mode 100644
index 74e945ac4c..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/dbstats.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package couchdb
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type dbStats struct {
- driver.DBStats
- Sizes struct {
- File int64 `json:"file"`
- External int64 `json:"external"`
- Active int64 `json:"active"`
- } `json:"sizes"`
- UpdateSeq json.RawMessage `json:"update_seq"` // nolint: govet
- rawBody json.RawMessage
-}
-
-func (s *dbStats) UnmarshalJSON(p []byte) error {
- type dbStatsClone dbStats
- c := dbStatsClone(*s)
- if err := json.Unmarshal(p, &c); err != nil {
- return err
- }
- *s = dbStats(c)
- s.rawBody = p
- return nil
-}
-
-func (s *dbStats) driverStats() *driver.DBStats {
- stats := &s.DBStats
- if s.Sizes.File > 0 {
- stats.DiskSize = s.Sizes.File
- }
- if s.Sizes.External > 0 {
- stats.ExternalSize = s.Sizes.External
- }
- if s.Sizes.Active > 0 {
- stats.ActiveSize = s.Sizes.Active
- }
- stats.UpdateSeq = string(bytes.Trim(s.UpdateSeq, `"`))
- stats.RawResponse = s.rawBody
- return stats
-}
-
-func (d *db) Stats(ctx context.Context) (*driver.DBStats, error) {
- result := dbStats{}
- if _, err := d.Client.DoJSON(ctx, http.MethodGet, d.dbName, nil, &result); err != nil {
- return nil, err
- }
- return result.driverStats(), nil
-}
-
-type dbsInfoRequest struct {
- Keys []string `json:"keys"`
-}
-
-type dbsInfoResponse struct {
- Key string `json:"key"`
- DBInfo dbStats `json:"info"`
- Error string `json:"error"`
-}
-
-func (c *client) DBsStats(ctx context.Context, dbnames []string) ([]*driver.DBStats, error) {
- opts := &chttp.Options{
- GetBody: chttp.BodyEncoder(dbsInfoRequest{Keys: dbnames}),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- result := []dbsInfoResponse{}
- _, err := c.DoJSON(context.Background(), http.MethodPost, "/_dbs_info", opts, &result)
- if err != nil {
- return nil, err
- }
- stats := make([]*driver.DBStats, len(result))
- for i := range result {
- if result[i].Error == "" {
- stats[i] = result[i].DBInfo.driverStats()
- }
- }
- return stats, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/doc.go b/vendor/github.com/go-kivik/couchdb/v3/doc.go
deleted file mode 100644
index 04d533c45e..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/doc.go
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Package couchdb is a driver for connecting with a CouchDB server over HTTP.
-
-General Usage
-
-Use the `couch` driver name when using this driver. The DSN should be a full
-URL, likely with login credentials:
-
- import (
- kivik "github.com/go-kivik/kivik/v3"
- _ "github.com/go-kivik/couchdb/v3" // The CouchDB driver
- )
-
- client, err := kivik.New("couch", "http://username:password@127.0.0.1:5984/")
-
-Options
-
-The CouchDB driver generally interprets kivik.Options keys and values as URL
-query parameters. Values of the following types will be converted to their
-appropriate string representation when URL-encoded:
-
- - bool
- - string
- - []string
- - int, uint, uint8, uint16, uint32, uint64, int8, int16, int32, int64
-
-Passing any other type will return an error.
-
-The only exceptions to the above rule are:
-
- - the special option keys defined by the package constants `OptionFullCommit`
- and `OptionIfNoneMatch`. These options set the appropriate HTTP request
- headers rather than setting a URL parameter.
- - the `keys` key, when passed to a view query, will result in a POST query
- being done, rather than a GET, to accommodate an arbitrary number of keys.
- - the 'NoMultipartPut' option is interpreted by the Kivik CouchDB driver to
- disable multipart/related PUT uploads of attachments.
- - the 'NoMultipartGet' option is interpreted by the Kivik CouchDB driver to
- disable multipart/related GET downloads of attachments.
-
-Authentication
-
-The CouchDB driver supports a number of authentication methods. For most uses,
-you don't need to worry about authentication at all--just include authentication
-credentials in your connection DSN:
-
- client, _ := kivik.New("couch", "http://user:password@localhost:5984/")
-
-This will use Cookie authentication by default.
-
-To use one of the explicit authentication mechanisms, you'll need to use kivik's
-Authenticate method. For example:
-
- client, _ := kivik.New("couch", "http://localhost:5984/")
- err := client.Authenticate(ctx, couchdb.BasicAuth("bob", "abc123"))
-
-Multipart PUT
-
-Normally, to include an attachment in a CouchDB document, it must be base-64
-encoded, which leads to increased network traffic and higher CPU load. CouchDB
-also supports the option to upload multiple attachments in a single request
-using the 'multipart/related' content type. See
-http://docs.couchdb.org/en/stable/api/document/common.html#creating-multiple-attachments
-
-As an experimental feature, this is now supported by the Kivik CouchDB driver as
-well. To take advantage of this capability, the `doc` argument to the Put()
-method must be either:
-
- - a map of type `map[string]interface{}`, with a key called `_attachments',
- and value of type `kivik.Attachments` or `*kivik.Attachments`
- - a struct, with a field having the tag `json:"_attachment"`, and the field
- having the type `kivik.Attachments` or `*kivik.Attachments`.
-
-With this in place, the CouchDB driver will switch to `multipart/related` mode,
-sending each attachment in binary format, rather than base-64 encoding it.
-
-To function properly, each attachment must have an accurate Size value. If the
-Size value is unset, the entirely attachment may be read to determine its size,
-prior to sending it over the network, leading to delays and unnecessary I/O and
-CPU usage. The simplest way to ensure efficiency is to use the NewAttachment()
-method, provided by this package. See the documentation on that method for
-proper usage.
-
-Example:
-
- file, _ := os.Open("/path/to/photo.jpg")
- atts := &kivik.Attachments{
- "photo.jpg": NewAttachment("photo.jpg", "image/jpeg", file),
- }
- doc := map[string]interface{}{
- "_id": "user123",
- "_attachments": atts,
- }
- rev, err := db.Put(ctx, "user123", doc)
-
-To disable the `multipart/related` capabilities entirely, you may pass the
-`NoMultipartPut` option, with any value. This will fallback to the default of
-inline base-64 encoding the attachments. Example:
-
- rev, err := db.Put(ctx, "user123", doc", kivik.Options{couchdb.NoMultipartPut: "xxx"})
-
-If you find yourself wanting to disable this feature, due to bugs or performance,
-please consider filing a bug report against Kivik as well, so we can look for a
-solution that will allow using this optimization.
-*/
-package couchdb
diff --git a/vendor/github.com/go-kivik/couchdb/v3/errors.go b/vendor/github.com/go-kivik/couchdb/v3/errors.go
deleted file mode 100644
index 96f13ac7d5..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/errors.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package couchdb
-
-import (
- "fmt"
- "net/http"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-func missingArg(arg string) error {
- return &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: fmt.Errorf("kivik: %s required", arg)}
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/find.go b/vendor/github.com/go-kivik/couchdb/v3/find.go
deleted file mode 100644
index 5c5d8a37d5..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/find.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "net/http"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-func (d *db) CreateIndex(ctx context.Context, ddoc, name string, index interface{}) error {
- indexObj, err := deJSONify(index)
- if err != nil {
- return err
- }
- parameters := struct {
- Index interface{} `json:"index"`
- Ddoc string `json:"ddoc,omitempty"`
- Name string `json:"name,omitempty"`
- }{
- Index: indexObj,
- Ddoc: ddoc,
- Name: name,
- }
- opts := &chttp.Options{
- Body: chttp.EncodeBody(parameters),
- }
- _, err = d.Client.DoError(ctx, http.MethodPost, d.path("_index"), opts)
- return err
-}
-
-func (d *db) GetIndexes(ctx context.Context) ([]driver.Index, error) {
- var result struct {
- Indexes []driver.Index `json:"indexes"`
- }
- _, err := d.Client.DoJSON(ctx, http.MethodGet, d.path("_index"), nil, &result)
- return result.Indexes, err
-}
-
-func (d *db) DeleteIndex(ctx context.Context, ddoc, name string) error {
- if ddoc == "" {
- return missingArg("ddoc")
- }
- if name == "" {
- return missingArg("name")
- }
- path := fmt.Sprintf("_index/%s/json/%s", ddoc, name)
- _, err := d.Client.DoError(ctx, http.MethodDelete, d.path(path), nil)
- return err
-}
-
-func (d *db) Find(ctx context.Context, query interface{}) (driver.Rows, error) {
- opts := &chttp.Options{
- GetBody: chttp.BodyEncoder(query),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- resp, err := d.Client.DoReq(ctx, http.MethodPost, d.path("_find"), opts)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- return newFindRows(ctx, resp.Body), nil
-}
-
-type queryPlan struct {
- DBName string `json:"dbname"`
- Index map[string]interface{} `json:"index"`
- Selector map[string]interface{} `json:"selector"`
- Options map[string]interface{} `json:"opts"`
- Limit int64 `json:"limit"`
- Skip int64 `json:"skip"`
- Fields fields `json:"fields"`
- Range map[string]interface{} `json:"range"`
-}
-
-type fields []interface{}
-
-func (f *fields) UnmarshalJSON(data []byte) error {
- if string(data) == `"all_fields"` {
- return nil
- }
- var i []interface{}
- if err := json.Unmarshal(data, &i); err != nil {
- return err
- }
- newFields := make([]interface{}, len(i))
- copy(newFields, i)
- *f = newFields
- return nil
-}
-
-func (d *db) Explain(ctx context.Context, query interface{}) (*driver.QueryPlan, error) {
- opts := &chttp.Options{
- GetBody: chttp.BodyEncoder(query),
- Header: http.Header{
- chttp.HeaderIdempotencyKey: []string{},
- },
- }
- var plan queryPlan
- if _, err := d.Client.DoJSON(ctx, http.MethodPost, d.path("_explain"), opts, &plan); err != nil {
- return nil, err
- }
- return &driver.QueryPlan{
- DBName: plan.DBName,
- Index: plan.Index,
- Selector: plan.Selector,
- Options: plan.Options,
- Limit: plan.Limit,
- Skip: plan.Skip,
- Fields: plan.Fields,
- Range: plan.Range,
- }, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/go.mod b/vendor/github.com/go-kivik/couchdb/v3/go.mod
deleted file mode 100644
index 992d440d60..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/go.mod
+++ /dev/null
@@ -1,13 +0,0 @@
-module github.com/go-kivik/couchdb/v3
-
-go 1.13
-
-require (
- github.com/go-kivik/kivik/v3 v3.0.2
- github.com/go-kivik/kiviktest/v3 v3.0.2
- github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5
- github.com/pkg/errors v0.9.1
- gitlab.com/flimzy/testy v0.0.3
- golang.org/x/net v0.0.0-20200202094626-16171245cfb2
- golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
-)
diff --git a/vendor/github.com/go-kivik/couchdb/v3/go.sum b/vendor/github.com/go-kivik/couchdb/v3/go.sum
deleted file mode 100644
index 552d135b5a..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/go.sum
+++ /dev/null
@@ -1,38 +0,0 @@
-bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/flimzy/diff v0.1.5 h1:QfOwp+TuGCeWWFxFtXqCdepnz0SeaImgNfMm6vWz3y8=
-github.com/flimzy/diff v0.1.5/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/testy v0.1.17-0.20190521133342-95b386c3ece6 h1:uw6StVCll2vXdHJMAiKvhfAwcwBYD6d9dgWOIdHMku8=
-github.com/flimzy/testy v0.1.17-0.20190521133342-95b386c3ece6/go.mod h1:3szguN8NXqgq9bt9Gu8TQVj698PJWmyx/VY1frwwKrM=
-github.com/go-kivik/kivik/v3 v3.0.1/go.mod h1:7tmQDvkta/pcijpUjLMsQ9HJUELiKD5zm6jQ3Gb9cxE=
-github.com/go-kivik/kivik/v3 v3.0.2 h1:+tKWFJTAGlUjK1DQhn2rEGQvroYLTUCAO6/Kk8K4uQQ=
-github.com/go-kivik/kivik/v3 v3.0.2/go.mod h1:chqVuHKAU9j2C7qL0cAH2FCO26oL+0B4aIBeCRMnLa8=
-github.com/go-kivik/kiviktest/v3 v3.0.2 h1:+n90Nopbrzf/tqoXu4xqAMXk1+191vLrvakBdiz7r3Y=
-github.com/go-kivik/kiviktest/v3 v3.0.2/go.mod h1:sqsz3M2sJxTxAUdOj+2SU21y4phcpYc0FJIn+hbf1D0=
-github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5 h1:On5cS+huOk7mqad9QjklHw+BMGKykSmu6QG32X+C77o=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc=
-github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
-github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4=
-github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M=
-github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
-github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
-github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
-github.com/pkg/errors v0.9.1/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=
-gitlab.com/flimzy/testy v0.0.3 h1:UkCz4aDa52cUX6uwvuVrwlTFZC1AesU5W6grDUcVFlg=
-gitlab.com/flimzy/testy v0.0.3/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
-golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/vendor/github.com/go-kivik/couchdb/v3/iter.go b/vendor/github.com/go-kivik/couchdb/v3/iter.go
deleted file mode 100644
index 03795ef5f8..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/iter.go
+++ /dev/null
@@ -1,278 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net/http"
- "sync"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-type parser interface {
- decodeItem(interface{}, *json.Decoder) error
-}
-
-type metaParser interface {
- parseMeta(interface{}, *json.Decoder, string) error
-}
-
-type cancelableReadCloser struct {
- ctx context.Context
- rc io.ReadCloser
- cancel func()
-
- mu sync.RWMutex
- closed bool
- err error
-}
-
-var _ io.ReadCloser = &cancelableReadCloser{}
-
-func newCancelableReadCloser(ctx context.Context, rc io.ReadCloser) io.ReadCloser {
- ctx, cancel := context.WithCancel(ctx)
- return &cancelableReadCloser{
- ctx: ctx,
- rc: rc,
- cancel: cancel,
- }
-}
-
-func (r *cancelableReadCloser) readErr() error {
- r.mu.RLock()
- if !r.closed {
- r.mu.RUnlock()
- return nil
- }
- err := r.err
- r.mu.RUnlock()
- if err == nil {
- err = errors.New("iterator closed")
- }
- return err
-}
-
-func (r *cancelableReadCloser) Read(p []byte) (int, error) {
- if err := r.readErr(); err != nil {
- return 0, err
- }
- var c int
- var err error
- done := make(chan struct{})
- go func() {
- c, err = r.rc.Read(p)
- close(done)
- }()
- select {
- case <-r.ctx.Done():
- var err error
- if err = r.readErr(); err == nil {
- err = r.ctx.Err()
- }
- return 0, r.close(err)
- case <-done:
- if err != nil {
- e := r.close(err)
- return c, e
- }
- return c, nil
- }
-}
-
-func (r *cancelableReadCloser) close(err error) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if !r.closed {
- r.cancel()
- r.closed = true
- e := r.rc.Close()
- if err == nil {
- err = e
- }
- r.err = err
- }
- return r.err
-}
-
-func (r *cancelableReadCloser) Close() error {
- err := r.close(nil)
- if err == io.EOF {
- return nil
- }
- return err
-}
-
-type iter struct {
- meta interface{}
- expectedKey string
- body io.ReadCloser
- parser parser
-
- // objMode enables reading one object at a time, with the ID treated as the
- // docid. This was added for the _revs_diff endpoint.
- objMode bool
-
- dec *json.Decoder
- mu sync.RWMutex
- closed bool
-}
-
-func newIter(ctx context.Context, meta interface{}, expectedKey string, body io.ReadCloser, parser parser) *iter {
- return &iter{
- meta: meta,
- expectedKey: expectedKey,
- body: newCancelableReadCloser(ctx, body),
- parser: parser,
- }
-}
-
-func (i *iter) next(row interface{}) error {
- i.mu.RLock()
- if i.closed {
- i.mu.RUnlock()
- return io.EOF
- }
- i.mu.RUnlock()
- if i.dec == nil {
- // We haven't begun yet
- i.dec = json.NewDecoder(i.body)
- if err := i.begin(); err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- }
-
- err := i.nextRow(row)
- if err != nil {
- if err == io.EOF {
- if e := i.finish(); e != nil {
- err = e
- }
- return err
- }
- }
- return err
-}
-
-// begin parses the top-level of the result object; until rows
-func (i *iter) begin() error {
- if i.expectedKey == "" && !i.objMode {
- return nil
- }
- // consume the first '{'
- if err := consumeDelim(i.dec, json.Delim('{')); err != nil {
- return err
- }
- if i.objMode {
- return nil
- }
- for {
- t, err := i.dec.Token()
- if err != nil {
- // I can't find a test case to trigger this, so it remains uncovered.
- return err
- }
- key, ok := t.(string)
- if !ok {
- // The JSON parser should never permit this
- return fmt.Errorf("Unexpected token: (%T) %v", t, t)
- }
- if key == i.expectedKey {
- // Consume the first '['
- return consumeDelim(i.dec, json.Delim('['))
- }
- if err := i.parseMeta(key); err != nil {
- return err
- }
- }
-}
-
-func (i *iter) parseMeta(key string) error {
- if i.meta == nil {
- return nil
- }
- if mp, ok := i.parser.(metaParser); ok {
- return mp.parseMeta(i.meta, i.dec, key)
- }
- return nil
-}
-
-func (i *iter) finish() (err error) {
- defer func() {
- e2 := i.Close()
- if err == nil {
- err = e2
- }
- }()
- if i.expectedKey == "" && !i.objMode {
- _, err := i.dec.Token()
- if err != nil && err != io.EOF {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- return nil
- }
- if i.objMode {
- err := consumeDelim(i.dec, json.Delim('}'))
- if err != nil && err != io.EOF {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- return nil
- }
- if err := consumeDelim(i.dec, json.Delim(']')); err != nil {
- return err
- }
- for {
- t, err := i.dec.Token()
- if err != nil {
- return err
- }
- switch v := t.(type) {
- case json.Delim:
- if v != json.Delim('}') {
- // This should never happen, as the JSON parser should prevent it.
- return fmt.Errorf("Unexpected JSON delimiter: %c", v)
- }
- case string:
- if err := i.parseMeta(v); err != nil {
- return err
- }
- default:
- // This should never happen, as the JSON parser would never get
- // this far.
- return fmt.Errorf("Unexpected JSON token: (%T) '%s'", t, t)
- }
- }
-}
-
-func (i *iter) nextRow(row interface{}) error {
- if !i.dec.More() {
- return io.EOF
- }
- return i.parser.decodeItem(row, i.dec)
-}
-
-func (i *iter) Close() error {
- i.mu.Lock()
- i.closed = true
- i.mu.Unlock()
- return i.body.Close()
-}
-
-// consumeDelim consumes the expected delimiter from the stream, or returns an
-// error if an unexpected token was found.
-func consumeDelim(dec *json.Decoder, expectedDelim json.Delim) error {
- t, err := dec.Token()
- if err != nil {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- d, ok := t.(json.Delim)
- if !ok {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Unexpected token %T: %v", t, t)}
- }
- if d != expectedDelim {
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Unexpected JSON delimiter: %c", d)}
- }
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/json.go b/vendor/github.com/go-kivik/couchdb/v3/json.go
deleted file mode 100644
index e25377be58..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/json.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package couchdb
-
-import (
- "encoding/json"
- "net/http"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-// encodeKey encodes a key to a view query, or similar, to be passed to CouchDB.
-func encodeKey(i interface{}) (string, error) {
- if raw, ok := i.(json.RawMessage); ok {
- return string(raw), nil
- }
- raw, err := json.Marshal(i)
- if err != nil {
- err = &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- return string(raw), err
-}
-
-var jsonKeys = []string{"endkey", "end_key", "key", "startkey", "start_key", "keys", "doc_ids"}
-
-func encodeKeys(opts map[string]interface{}) error {
- for _, key := range jsonKeys {
- if v, ok := opts[key]; ok {
- new, err := encodeKey(v)
- if err != nil {
- return err
- }
- opts[key] = new
- }
- }
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/options.go b/vendor/github.com/go-kivik/couchdb/v3/options.go
deleted file mode 100644
index 4ec3340235..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/options.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package couchdb
-
-import (
- "fmt"
- "net/http"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-func fullCommit(opts map[string]interface{}) (bool, error) {
- fc, ok := opts[OptionFullCommit]
- if !ok {
- return false, nil
- }
- fcBool, ok := fc.(bool)
- if !ok {
- return false, &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: fmt.Errorf("kivik: option '%s' must be bool, not %T", OptionFullCommit, fc)}
- }
- delete(opts, OptionFullCommit)
- return fcBool, nil
-}
-
-func ifNoneMatch(opts map[string]interface{}) (string, error) {
- inm, ok := opts[OptionIfNoneMatch]
- if !ok {
- return "", nil
- }
- inmString, ok := inm.(string)
- if !ok {
- return "", &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: fmt.Errorf("kivik: option '%s' must be string, not %T", OptionIfNoneMatch, inm)}
- }
- delete(opts, OptionIfNoneMatch)
- if inmString[0] != '"' {
- return `"` + inmString + `"`, nil
- }
- return inmString, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/replication.go b/vendor/github.com/go-kivik/couchdb/v3/replication.go
deleted file mode 100644
index 8ae09f01e5..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/replication.go
+++ /dev/null
@@ -1,319 +0,0 @@
-package couchdb
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type replicationError struct {
- status int
- reason string
-}
-
-func (re *replicationError) Error() string {
- return re.reason
-}
-
-func (re *replicationError) StatusCode() int {
- return re.status
-}
-
-func (re *replicationError) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &re.reason); err != nil {
- return err
- }
- switch (strings.SplitN(re.reason, ":", 2))[0] {
- case "db_not_found":
- re.status = http.StatusNotFound
- case "timeout":
- re.status = http.StatusRequestTimeout
- case "unauthorized":
- re.status = http.StatusUnauthorized
- default:
- re.status = http.StatusInternalServerError
- }
- return nil
-}
-
-type replicationStateTime time.Time
-
-func (t *replicationStateTime) UnmarshalJSON(data []byte) error {
- input := string(bytes.Trim(data, `"`))
- if ts, err := time.Parse(time.RFC3339, input); err == nil {
- *t = replicationStateTime(ts)
- return nil
- }
- // Fallback for really old versions of CouchDB
- if seconds, err := strconv.ParseInt(input, 10, 64); err == nil {
- epochTime := replicationStateTime(time.Unix(seconds, 0).UTC())
- *t = epochTime
- return nil
- }
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("kivik: '%s' does not appear to be a valid timestamp", string(data))}
-}
-
-type replication struct {
- docID string
- replicationID string
- source string
- target string
- startTime time.Time
- endTime time.Time
- state string
- err error
-
- // mu protects the above values
- mu sync.RWMutex
-
- *db
-}
-
-var _ driver.Replication = &replication{}
-
-func (c *client) fetchReplication(ctx context.Context, docID string) *replication {
- rep := c.newReplication(docID)
- rep.db = &db{client: c, dbName: "_replicator"}
- // Do an update to get the initial state, but don't fail if there's an error
- // at this stage, because we successfully created the replication doc.
- _ = rep.updateMain(ctx)
- return rep
-}
-
-func (c *client) newReplication(docID string) *replication {
- return &replication{
- docID: docID,
- db: &db{
- client: c,
- dbName: "_replicator",
- },
- }
-}
-
-func (r *replication) readLock() func() {
- r.mu.RLock()
- return r.mu.RUnlock
-}
-
-func (r *replication) ReplicationID() string { defer r.readLock()(); return r.replicationID }
-func (r *replication) Source() string { defer r.readLock()(); return r.source }
-func (r *replication) Target() string { defer r.readLock()(); return r.target }
-func (r *replication) StartTime() time.Time { defer r.readLock()(); return r.startTime }
-func (r *replication) EndTime() time.Time { defer r.readLock()(); return r.endTime }
-func (r *replication) State() string { defer r.readLock()(); return r.state }
-func (r *replication) Err() error { defer r.readLock()(); return r.err }
-
-func (r *replication) Update(ctx context.Context, state *driver.ReplicationInfo) error {
- if err := r.updateMain(ctx); err != nil {
- return err
- }
- if r.State() == "complete" {
- state.Progress = 100
- return nil
- }
- info, err := r.updateActiveTasks(ctx)
- if err != nil {
- if kivik.StatusCode(err) == http.StatusNotFound {
- // not listed in _active_tasks (because the replication is done, or
- // hasn't yet started), but this isn't an error
- return nil
- }
- return err
- }
- state.DocWriteFailures = info.DocWriteFailures
- state.DocsRead = info.DocsRead
- state.DocsWritten = info.DocsWritten
- // state.progress = info.Progress
- return nil
-}
-
-type activeTask struct {
- Type string `json:"type"`
- ReplicationID string `json:"replication_id"`
- DocsWritten int64 `json:"docs_written"`
- DocsRead int64 `json:"docs_read"`
- DocWriteFailures int64 `json:"doc_write_failures"`
-}
-
-func (r *replication) updateActiveTasks(ctx context.Context) (*activeTask, error) {
- resp, err := r.client.DoReq(ctx, http.MethodGet, "/_active_tasks", nil)
- if err != nil {
- return nil, err
- }
- if err = chttp.ResponseError(resp); err != nil {
- return nil, err
- }
- defer func() { _ = resp.Body.Close() }()
- var tasks []*activeTask
- if err = json.NewDecoder(resp.Body).Decode(&tasks); err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: err}
- }
- for _, task := range tasks {
- if task.Type != "replication" {
- continue
- }
- repIDparts := strings.SplitN(task.ReplicationID, "+", 2)
- if repIDparts[0] != r.replicationID {
- continue
- }
- return task, nil
- }
- return nil, &kivik.Error{HTTPStatus: http.StatusNotFound, Err: errors.New("task not found")}
-}
-
-// updateMain updates the "main" fields: those stored directly in r.
-func (r *replication) updateMain(ctx context.Context) error {
- doc, err := r.getReplicatorDoc(ctx)
- if err != nil {
- return err
- }
- r.setFromReplicatorDoc(doc)
- return nil
-}
-
-func (r *replication) getReplicatorDoc(ctx context.Context) (*replicatorDoc, error) {
- row, err := r.db.Get(ctx, r.docID, nil)
- if err != nil {
- return nil, err
- }
- var doc replicatorDoc
- err = json.NewDecoder(row.Body).Decode(&doc)
- return &doc, err
-}
-
-func (r *replication) setFromReplicatorDoc(doc *replicatorDoc) {
- r.mu.Lock()
- defer r.mu.Unlock()
- switch kivik.ReplicationState(doc.State) {
- case kivik.ReplicationStarted:
- r.startTime = time.Time(doc.StateTime)
- case kivik.ReplicationError, kivik.ReplicationComplete:
- r.endTime = time.Time(doc.StateTime)
- }
- r.state = doc.State
- if doc.Error != nil {
- r.err = doc.Error
- } else {
- r.err = nil
- }
- if r.source == "" {
- r.source = doc.Source
- }
- if r.target == "" {
- r.target = doc.Target
- }
- if r.replicationID == "" {
- r.replicationID = doc.ReplicationID
- }
-}
-
-func (r *replication) Delete(ctx context.Context) error {
- _, rev, err := r.GetMeta(ctx, r.docID, nil)
- if err != nil {
- return err
- }
- _, err = r.db.Delete(ctx, r.docID, rev, nil)
- return err
-}
-
-type replicatorDoc struct {
- DocID string `json:"_id"`
- ReplicationID string `json:"_replication_id"`
- Source string `json:"source"`
- Target string `json:"target"`
- State string `json:"_replication_state"`
- StateTime replicationStateTime `json:"_replication_state_time"`
- Error *replicationError `json:"_replication_state_reason,omitempty"`
-}
-
-func (c *client) GetReplications(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error) {
- scheduler, err := c.schedulerSupported(ctx)
- if err != nil {
- return nil, err
- }
- if scheduler {
- return c.getReplicationsFromScheduler(ctx, options)
- }
- return c.legacyGetReplications(ctx, options)
-}
-
-func (c *client) legacyGetReplications(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error) {
- if options == nil {
- options = map[string]interface{}{}
- }
- delete(options, "conflicts")
- delete(options, "update_seq")
- options["include_docs"] = true
- params, err := optionsToParams(options)
- if err != nil {
- return nil, err
- }
- var result struct {
- Rows []struct {
- Doc replicatorDoc `json:"doc"`
- } `json:"rows"`
- }
- path := "/_replicator/_all_docs?" + params.Encode()
- if _, err = c.DoJSON(ctx, http.MethodGet, path, nil, &result); err != nil {
- return nil, err
- }
- reps := make([]driver.Replication, 0, len(result.Rows))
- for _, row := range result.Rows {
- if row.Doc.DocID == "_design/_replicator" {
- continue
- }
- rep := c.newReplication(row.Doc.DocID)
- rep.setFromReplicatorDoc(&row.Doc)
- reps = append(reps, rep)
- }
- return reps, nil
-}
-
-func (c *client) Replicate(ctx context.Context, targetDSN, sourceDSN string, options map[string]interface{}) (driver.Replication, error) {
- if options == nil {
- options = make(map[string]interface{})
- }
- // Allow overriding source and target with options, i.e. for auth options
- if _, ok := options["source"]; !ok {
- options["source"] = sourceDSN
- }
- if _, ok := options["target"]; !ok {
- options["target"] = targetDSN
- }
- if t := options["target"]; t == "" {
- return nil, missingArg("targetDSN")
- }
- if s := options["source"]; s == "" {
- return nil, missingArg("sourceDSN")
- }
-
- scheduler, err := c.schedulerSupported(ctx)
- if err != nil {
- return nil, err
- }
- opts := &chttp.Options{
- Body: chttp.EncodeBody(options),
- }
-
- var repStub struct {
- ID string `json:"id"`
- }
- if _, e := c.Client.DoJSON(ctx, http.MethodPost, "/_replicator", opts, &repStub); e != nil {
- return nil, e
- }
- if scheduler {
- return c.fetchSchedulerReplication(ctx, repStub.ID)
- }
- return c.fetchReplication(ctx, repStub.ID), nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/rows.go b/vendor/github.com/go-kivik/couchdb/v3/rows.go
deleted file mode 100644
index 74779613e9..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/rows.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "io"
- "net/http"
-
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type rowsMeta struct {
- offset int64
- totalRows int64
- updateSeq sequenceID
- warning string
- bookmark string
-}
-
-type rows struct {
- *iter
- *rowsMeta
-}
-
-var _ driver.Rows = &rows{}
-
-type rowsMetaParser struct{}
-
-func (p *rowsMetaParser) parseMeta(i interface{}, dec *json.Decoder, key string) error {
- meta := i.(*rowsMeta)
- return meta.parseMeta(key, dec)
-}
-
-type rowParser struct {
- rowsMetaParser
-}
-
-var _ parser = &rowParser{}
-
-func (p *rowParser) decodeItem(i interface{}, dec *json.Decoder) error {
- return dec.Decode(i)
-}
-
-func newRows(ctx context.Context, in io.ReadCloser) driver.Rows {
- meta := &rowsMeta{}
- return &rows{
- iter: newIter(ctx, meta, "rows", in, &rowParser{}),
- rowsMeta: meta,
- }
-}
-
-type findParser struct {
- rowsMetaParser
-}
-
-var _ parser = &findParser{}
-
-func (p *findParser) decodeItem(i interface{}, dec *json.Decoder) error {
- row := i.(*driver.Row)
- return dec.Decode(&row.Doc)
-}
-
-func newFindRows(ctx context.Context, in io.ReadCloser) driver.Rows {
- meta := &rowsMeta{}
- return &rows{
- iter: newIter(ctx, meta, "docs", in, &findParser{}),
- rowsMeta: meta,
- }
-}
-
-type bulkParser struct {
- rowsMetaParser
-}
-
-var _ parser = &bulkParser{}
-
-func (p *bulkParser) decodeItem(i interface{}, dec *json.Decoder) error {
- row := i.(*driver.Row)
- var result bulkResult
- if err := dec.Decode(&result); err != nil {
- return err
- }
- row.ID = result.ID
- row.Doc = result.Docs[0].Doc
- row.Error = nil
- if err := result.Docs[0].Error; err != nil {
- row.Error = err
- }
- return nil
-}
-
-func newBulkGetRows(ctx context.Context, in io.ReadCloser) driver.Rows {
- meta := &rowsMeta{}
- return &rows{
- iter: newIter(ctx, meta, "results", in, &bulkParser{}),
- rowsMeta: meta,
- }
-}
-
-func (r *rows) Offset() int64 {
- return r.offset
-}
-
-func (r *rows) TotalRows() int64 {
- return r.totalRows
-}
-
-func (r *rows) Warning() string {
- return r.warning
-}
-
-func (r *rows) Bookmark() string {
- return r.bookmark
-}
-
-func (r *rows) UpdateSeq() string {
- return string(r.updateSeq)
-}
-
-func (r *rows) Next(row *driver.Row) error {
- row.Error = nil
- return r.iter.next(row)
-}
-
-// parseMeta parses result metadata
-func (r *rowsMeta) parseMeta(key string, dec *json.Decoder) error {
- switch key {
- case "update_seq":
- return dec.Decode(&r.updateSeq)
- case "offset":
- return dec.Decode(&r.offset)
- case "total_rows":
- return dec.Decode(&r.totalRows)
- case "warning":
- return dec.Decode(&r.warning)
- case "bookmark":
- return dec.Decode(&r.bookmark)
- }
- return &kivik.Error{HTTPStatus: http.StatusBadGateway, Err: fmt.Errorf("Unexpected key: %s", key)}
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/scheduler.go b/vendor/github.com/go-kivik/couchdb/v3/scheduler.go
deleted file mode 100644
index 9f41fbf25c..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/scheduler.go
+++ /dev/null
@@ -1,235 +0,0 @@
-package couchdb
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "fmt"
- "net/http"
- "time"
-
- "github.com/go-kivik/couchdb/v3/chttp"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type schedulerDoc struct {
- Database string `json:"database"`
- DocID string `json:"doc_id"`
- ReplicationID string `json:"id"`
- Source string `json:"source"`
- Target string `json:"target"`
- StartTime time.Time `json:"start_time"`
- LastUpdated time.Time `json:"last_updated"`
- State string `json:"state"`
- Info repInfo `json:"info"`
-}
-
-type repInfo struct {
- Error error
- DocsRead int64 `json:"docs_read"`
- DocsWritten int64 `json:"docs_written"`
- DocWriteFailures int64 `json:"doc_write_failures"`
- Pending int64 `json:"changes_pending"`
-}
-
-func (i *repInfo) UnmarshalJSON(data []byte) error {
- switch {
- case string(data) == "null":
- return nil
- case bytes.HasPrefix(data, []byte(`{"error":`)):
- var e struct {
- Error *replicationError `json:"error"`
- }
- if err := json.Unmarshal(data, &e); err != nil {
- return err
- }
- i.Error = e.Error
- case data[0] == '{':
- type repInfoClone repInfo
- var x repInfoClone
- if err := json.Unmarshal(data, &x); err != nil {
- return err
- }
- *i = repInfo(x)
- default:
- var e replicationError
- if err := json.Unmarshal(data, &e); err != nil {
- return err
- }
- i.Error = &e
- }
- return nil
-}
-
-type schedulerReplication struct {
- docID string
- database string
- replicationID string
- source string
- target string
- startTime time.Time
- lastUpdated time.Time
- state string
- info repInfo
-
- *db
-}
-
-var _ driver.Replication = &schedulerReplication{}
-
-func (c *client) schedulerSupported(ctx context.Context) (bool, error) {
- c.sdMU.Lock()
- defer c.sdMU.Unlock()
- if c.schedulerDetected != nil {
- return *c.schedulerDetected, nil
- }
- resp, err := c.DoReq(ctx, http.MethodHead, "_scheduler/jobs", nil)
- if err != nil {
- return false, err
- }
- var supported bool
- switch resp.StatusCode {
- case http.StatusBadRequest:
- // 1.6.x, 1.7.x
- supported = false
- case http.StatusNotFound:
- // 2.0.x
- supported = false
- case http.StatusOK, http.StatusUnauthorized:
- // 2.1.x +
- supported = true
- default:
- // Assume not supported
- supported = false
- }
- c.schedulerDetected = &supported
- return supported, nil
-}
-
-func (c *client) newSchedulerReplication(doc *schedulerDoc) *schedulerReplication {
- rep := &schedulerReplication{
- db: &db{
- client: c,
- dbName: doc.Database,
- },
- }
- rep.setFromDoc(doc)
- return rep
-}
-
-func (r *schedulerReplication) setFromDoc(doc *schedulerDoc) {
- if r.source == "" {
- r.docID = doc.DocID
- r.database = doc.Database
- r.replicationID = doc.ReplicationID
- r.source = doc.Source
- r.target = doc.Target
- r.startTime = doc.StartTime
- }
- r.lastUpdated = doc.LastUpdated
- r.state = doc.State
- r.info = doc.Info
-}
-
-func (c *client) fetchSchedulerReplication(ctx context.Context, docID string) (*schedulerReplication, error) {
- rep := &schedulerReplication{
- docID: docID,
- database: "_replicator",
- db: &db{
- client: c,
- dbName: "_replicator",
- },
- }
- for rep.source == "" {
- if err := rep.update(ctx); err != nil {
- return rep, err
- }
- time.Sleep(100 * time.Millisecond)
- }
- return rep, nil
-}
-
-func (r *schedulerReplication) StartTime() time.Time { return r.startTime }
-func (r *schedulerReplication) EndTime() time.Time {
- if r.state == "failed" || r.state == "completed" {
- return r.lastUpdated
- }
- return time.Time{}
-}
-func (r *schedulerReplication) Err() error { return r.info.Error }
-func (r *schedulerReplication) ReplicationID() string { return r.replicationID }
-func (r *schedulerReplication) Source() string { return r.source }
-func (r *schedulerReplication) Target() string { return r.target }
-func (r *schedulerReplication) State() string { return r.state }
-
-func (r *schedulerReplication) Update(ctx context.Context, rep *driver.ReplicationInfo) error {
- if err := r.update(ctx); err != nil {
- return err
- }
- rep.DocWriteFailures = r.info.DocWriteFailures
- rep.DocsRead = r.info.DocsRead
- rep.DocsWritten = r.info.DocsWritten
- return nil
-}
-
-func (r *schedulerReplication) Delete(ctx context.Context) error {
- _, rev, err := r.GetMeta(ctx, r.docID, nil)
- if err != nil {
- return err
- }
- _, err = r.db.Delete(ctx, r.docID, rev, nil)
- return err
-}
-
-// isBug1000 detects a race condition bug in CouchDB 2.1.x so the attempt can
-// be retried. See https://github.com/apache/couchdb/issues/1000
-func isBug1000(err error) bool {
- if err == nil {
- return false
- }
- cerr, ok := err.(*chttp.HTTPError)
- if !ok {
- // should never happen
- return false
- }
- if cerr.Response.StatusCode != http.StatusInternalServerError {
- return false
- }
- return cerr.Reason == "function_clause"
-}
-
-func (r *schedulerReplication) update(ctx context.Context) error {
- path := fmt.Sprintf("/_scheduler/docs/%s/%s", r.database, chttp.EncodeDocID(r.docID))
- var doc schedulerDoc
- if _, err := r.db.Client.DoJSON(ctx, http.MethodGet, path, nil, &doc); err != nil {
- if isBug1000(err) {
- return r.update(ctx)
- }
- return err
- }
- r.setFromDoc(&doc)
- return nil
-}
-
-func (c *client) getReplicationsFromScheduler(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error) {
- params, err := optionsToParams(options)
- if err != nil {
- return nil, err
- }
- var result struct {
- Docs []schedulerDoc `json:"docs"`
- }
- path := "/_scheduler/docs"
- if params != nil {
- path = path + "?" + params.Encode()
- }
- if _, err = c.DoJSON(ctx, http.MethodGet, path, nil, &result); err != nil {
- return nil, err
- }
- reps := make([]driver.Replication, 0, len(result.Docs))
- for _, row := range result.Docs {
- rep := c.newSchedulerReplication(&row)
- reps = append(reps, rep)
- }
- return reps, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/seqid.go b/vendor/github.com/go-kivik/couchdb/v3/seqid.go
deleted file mode 100644
index 189285ed4f..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/seqid.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package couchdb
-
-import "bytes"
-
-// sequenceID is a CouchDB update sequence ID. This is just a string, but has
-// a special JSON unmarshaler to work with both CouchDB 2.0.0 (which uses
-// normal) strings for sequence IDs, and earlier versions (which use integers)
-type sequenceID string
-
-// UnmarshalJSON satisfies the json.Unmarshaler interface.
-func (id *sequenceID) UnmarshalJSON(data []byte) error {
- sid := sequenceID(bytes.Trim(data, `""`))
- *id = sid
- return nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/session.go b/vendor/github.com/go-kivik/couchdb/v3/session.go
deleted file mode 100644
index 6ccb9d75a6..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/session.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type session struct {
- Data json.RawMessage
- Info authInfo `json:"info"`
- UserCtx userContext `json:"userCtx"`
-}
-
-type authInfo struct {
- AuthenticationMethod string `json:"authenticated"`
- AuthenticationDB string `json:"authentiation_db"`
- AuthenticationHandlers []string `json:"authentication_handlers"`
-}
-
-type userContext struct {
- Name string `json:"name"`
- Roles []string `json:"roles"`
-}
-
-func (s *session) UnmarshalJSON(data []byte) error {
- type alias session
- var a alias
- if err := json.Unmarshal(data, &a); err != nil {
- return err
- }
- *s = session(a)
- s.Data = data
- return nil
-}
-
-func (c *client) Session(ctx context.Context) (*driver.Session, error) {
- s := &session{}
- _, err := c.DoJSON(ctx, http.MethodGet, "/_session", nil, s)
- return &driver.Session{
- RawResponse: s.Data,
- Name: s.UserCtx.Name,
- Roles: s.UserCtx.Roles,
- AuthenticationMethod: s.Info.AuthenticationMethod,
- AuthenticationDB: s.Info.AuthenticationDB,
- AuthenticationHandlers: s.Info.AuthenticationHandlers,
- }, err
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/util.go b/vendor/github.com/go-kivik/couchdb/v3/util.go
deleted file mode 100644
index e7a672bfea..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/util.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package couchdb
-
-import (
- "encoding/json"
- "net/http"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-// deJSONify unmarshals a string, []byte, or json.RawMessage. All other types
-// are returned as-is.
-func deJSONify(i interface{}) (interface{}, error) {
- var data []byte
- switch t := i.(type) {
- case string:
- data = []byte(t)
- case []byte:
- data = t
- case json.RawMessage:
- data = []byte(t)
- default:
- return i, nil
- }
- var x interface{}
- if err := json.Unmarshal(data, &x); err != nil {
- return nil, &kivik.Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- return x, nil
-}
diff --git a/vendor/github.com/go-kivik/couchdb/v3/version.go b/vendor/github.com/go-kivik/couchdb/v3/version.go
deleted file mode 100644
index d29b139c47..0000000000
--- a/vendor/github.com/go-kivik/couchdb/v3/version.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package couchdb
-
-import (
- "context"
- "encoding/json"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Version returns the server's version info.
-func (c *client) Version(ctx context.Context) (*driver.Version, error) {
- i := &info{}
- _, err := c.DoJSON(ctx, http.MethodGet, "/", nil, i)
- return &driver.Version{
- Version: i.Version,
- Vendor: i.Vendor.Name,
- Features: i.Features,
- RawResponse: i.Data,
- }, err
-}
-
-type info struct {
- Data json.RawMessage
- Version string `json:"version"`
- Features []string `json:"features"`
- Vendor struct {
- Name string `json:"name"`
- } `json:"vendor"`
-}
-
-func (i *info) UnmarshalJSON(data []byte) error {
- type alias info
- var a alias
- if err := json.Unmarshal(data, &a); err != nil {
- return err
- }
- i.Data = data
- i.Version = a.Version
- i.Vendor = a.Vendor
- i.Features = a.Features
- return nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/.codecov.yml b/vendor/github.com/go-kivik/kivik/v3/.codecov.yml
deleted file mode 100644
index 52cd7a4178..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/.codecov.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-ignore:
- - test/**/*
diff --git a/vendor/github.com/go-kivik/kivik/v3/.gitignore b/vendor/github.com/go-kivik/kivik/v3/.gitignore
deleted file mode 100644
index a918b00d84..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-test/pouch__all_dbs__/
-vendor
-test.*
-Gopkg.lock
-node_modules
-coverage.txt
diff --git a/vendor/github.com/go-kivik/kivik/v3/.gitlab-ci.yml b/vendor/github.com/go-kivik/kivik/v3/.gitlab-ci.yml
deleted file mode 100644
index eb0260862e..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/.gitlab-ci.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-stages:
- - test
-
-variables:
- GO111MODULE: "on"
- COUCHDB_USER: admin
- COUCHDB_PASSWORD: abc123
- KIVIK_TEST_DSN_COUCH23: http://admin:abc123@couch23:5984/
- KIVIK_TEST_DSN_COUCH30: http://admin:abc123@couch30:5984/
-
-.test: &test_template
- stage: test
- services:
- - name: apache/couchdb:2.3.1
- alias: couch23
- - name: apache/couchdb:3.0.0
- alias: couch30
- before_script:
- - ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH23}
- - ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH30}
- script:
- - go mod download
- - ./script/test_version.sh
- - go test -race -tags=livetest ./...
-
-lint:
- stage: test
- image: golang:1.14
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
- - golangci-lint run ./...
-
-coverage:
- stage: test
- image: golang:1.14
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - ./script/coverage.sh
-
-go-1.11:
- <<: *test_template
- image: golang:1.11
-
-go-1.12:
- <<: *test_template
- image: golang:1.12
-
-go-1.13:
- <<: *test_template
- image: golang:1.13
-
-go-1.14:
- <<: *test_template
- image: golang:1.14
-
-gopherjs-1.12:
- <<: *test_template
- image: golang:1.14
- variables:
- SRCDIR: /go/src/github.com/go-kivik/kivik/v3
- script:
- - go get golang.org/dl/go1.12.16
- - go1.12.16 download
- - mkdir -p ${SRCDIR}
- - mv ${CI_PROJECT_DIR}/* ${SRCDIR}
- - cd ${SRCDIR}
- - go mod vendor
- - curl -sL https://deb.nodesource.com/setup_12.x | bash -
- - apt-get update -qq && apt-get install -y nodejs
- - npm install
- - GO111MODULE=off go get -u github.com/gopherjs/gopherjs
- - npm install source-map-support
- - |
- (
- cd $GOPATH/src/github.com/gopherjs/gopherjs/node-syscall/
- npm install --global node-gyp
- node-gyp rebuild
- mkdir -p ~/.node_libraries/
- cp build/Release/syscall.node ~/.node_libraries/syscall.node
- )
- - GOPHERJS_GOROOT="$(go1.12.16 env GOROOT)" gopherjs test ./...
-
-go-rc:
- <<: *test_template
- image: golang:rc
- allow_failure: true
diff --git a/vendor/github.com/go-kivik/kivik/v3/.golangci.toml b/vendor/github.com/go-kivik/kivik/v3/.golangci.toml
deleted file mode 100644
index ac86333a7c..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/.golangci.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[output]
-format = "colored-line-number"
-
-[linters]
-enable = [
- "interfacer", "gocyclo", "unconvert", "goimports", "unused", "varcheck",
- "vetshadow", "misspell", "nakedret", "errcheck", "golint", "ineffassign",
- "deadcode", "goconst", "vet", "unparam", "gofmt"
-]
-
-[issues]
-exclude-use-default = false
\ No newline at end of file
diff --git a/vendor/github.com/go-kivik/kivik/v3/CONTRIBUTING.md b/vendor/github.com/go-kivik/kivik/v3/CONTRIBUTING.md
deleted file mode 100644
index fa05cdd859..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/CONTRIBUTING.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Contributing
-
-Kivik is an open source project, and contributions are always welcome.
-
-Contributing to Kivik involves very little formal procedure. Anyone is
-encouraged to file bug reports, feature requests, or submit PRs. PRs are not
-guaranteed to be accepted, but they are guaranteed to be reviewed and discussed.
-For any large-scale change, opening an issue to discuss the change prior to
-submitting a PR is probably appropriate, to avoid possibly wasting time on an
-implementation that may not be accepted.
-
-## Licensing
-
-Kivik is licensed under the Apache license, version 2.0. All code contributions
-to this project are therefore also contributed under the same license. **If you
-are uncomfortable with, or unable to comply with this** (perhaps due to legal
-limitations imposed by your employer), **DO NOT SUBMIT CODE**! You are still
-welcome to participate in bug reports and discussions.
diff --git a/vendor/github.com/go-kivik/kivik/v3/Gopkg.toml b/vendor/github.com/go-kivik/kivik/v3/Gopkg.toml
deleted file mode 100644
index b7db26b3ca..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/Gopkg.toml
+++ /dev/null
@@ -1,50 +0,0 @@
-# Gopkg.toml example
-#
-# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-#
-# [prune]
-# non-go = false
-# go-tests = true
-# unused-packages = true
-
-ignored = [
- "github.com/gopherjs/gopherjs",
- "github.com/gopherjs/jsbuiltin",
-]
-
-[[constraint]]
- name = "github.com/flimzy/diff"
- version = "0.1.5"
-
-[[constraint]]
- branch = "master"
- name = "github.com/flimzy/testy"
-
-[[constraint]]
- name = "github.com/pkg/errors"
- version = "0.8.0"
-
-[[constraint]]
- branch = "master"
- name = "golang.org/x/xerrors"
-
-[prune]
- go-tests = true
- unused-packages = true
diff --git a/vendor/github.com/go-kivik/kivik/v3/ISSUE_TEMPLATE.md b/vendor/github.com/go-kivik/kivik/v3/ISSUE_TEMPLATE.md
deleted file mode 100644
index a6650972da..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,11 +0,0 @@
-## Bug Report Checklist (remove this template if submitting a feature request)
-
-1. Which version of Kivik are you using?
-
-2. Which version of Go are you using? (Output of `go version`) -- Kivik 1.x aims to support all versions of Go from 1.7. The master branch aims to support Go 1.8 and later.
-
-3. What did you do? (Include your code if possible)
-
-4. What did you expect to see?
-
-5. What did you see instead?
diff --git a/vendor/github.com/go-kivik/kivik/v3/LICENSE.md b/vendor/github.com/go-kivik/kivik/v3/LICENSE.md
deleted file mode 100644
index 0a2865e549..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2017 Jonathan Hall
-
-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/vendor/github.com/go-kivik/kivik/v3/Makefile b/vendor/github.com/go-kivik/kivik/v3/Makefile
deleted file mode 100644
index 5e4b673e37..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-test: linter test-standard test-gopherjs
-
-clean: clean-cache
- rm -f serve/files.go
-
-clean-cache:
- rm -rf ${GOPATH}/pkg/*_js
-
-linter: clean
- # ./travis/test.sh linter
-
-test-standard: generate
- ./travis/test.sh standard
-
-test-gopherjs: generate clean-cache
- ./travis/test.sh gopherjs
-
-generate:
- go generate $$(go list ./... | grep -v /vendor/)
diff --git a/vendor/github.com/go-kivik/kivik/v3/README.md b/vendor/github.com/go-kivik/kivik/v3/README.md
deleted file mode 100644
index 62f632e937..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/README.md
+++ /dev/null
@@ -1,177 +0,0 @@
-[](https://gitlab.com/go-kivik/kivik/pipelines) [](https://codecov.io/gh/go-kivik/kivik) [](https://goreportcard.com/report/github.com/go-kivik/kivik) [](http://godoc.org/github.com/go-kivik/kivik) [](http://kivik.io)
-
-# Kivik
-
-Package kivik provides a common interface to CouchDB or CouchDB-like databases.
-
-The kivik package must be used in conjunction with a database driver.
-
-The kivik driver system is modeled after the standard library's [sql](https://golang.org/pkg/database/sql/)
-and [sql/driver](https://golang.org/pkg/database/sql/driver/) packages, although
-the client API is completely different due to the different database models
-implemented by SQL and NoSQL databases such as CouchDB.
-
-# Versions
-
-You are browsing the **stable v3** branch of Kivik. For the latest changes, you
-may be interested in the [development branch](https://github.com/go-kivik/kivik).
-
-Example configuration for common dependency managers follow.
-
-## Go Modules
-
-Kivik 3.x and later depends on Go modules, which requires Go 1.11 or later. If
-your project does not use modules, and you are unable to switch, you may use
-[Kivik 2.x](https://github.com/go-kivik/kivik/tree/v2).
-
-# Installation
-
-Install Kivik as you normally would for any Go package:
-
- go get -u github.com/go-kivik/kivik/v3
- go get -u github.com/go-kivik/couchdb/v3
-
-This will install the main Kivik package and the CouchDB database driver. See
-the [list of Kivik database drivers](https://github.com/go-kivik/kivik/wiki/Kivik-database-drivers)
-for a complete list of available drivers.
-
-# Example Usage
-
-Please consult the the [package documentation](https://godoc.org/github.com/go-kivik/kivik)
-for all available API methods, and a complete usage documentation. And for
-additional usage examples, [consult the wiki](https://github.com/go-kivik/kivik/wiki/Usage-Examples).
-
-```go
-package main
-
-import (
- "context"
- "fmt"
-
- kivik "github.com/go-kivik/kivik/v3"
- _ "github.com/go-kivik/couchdb/v3" // The CouchDB driver
-)
-
-func main() {
- client, err := kivik.New("couch", "http://localhost:5984/")
- if err != nil {
- panic(err)
- }
-
- db, err := client.DB(context.TODO(), "animals")
- if err != nil {
- panic(err)
- }
-
- doc := map[string]interface{}{
- "_id": "cow",
- "feet": 4,
- "greeting": "moo",
- }
-
- rev, err := db.Put(context.TODO(), "cow", doc)
- if err != nil {
- panic(err)
- }
- fmt.Printf("Cow inserted with revision %s\n", rev)
-}
-```
-
-# Frequently Asked Questions
-
-Nobody has ever asked me any of these questions, so they're probably better called
-"Never Asked Questions" or possibly "Imagined Questions."
-
-## Why another CouchDB client API?
-
-Read the [design goals](https://github.com/go-kivik/kivik/wiki/Design-goals) for
-the general design goals.
-
-Specifically, I was motivated to write Kivik for a few reasons:
-
-1. I was unhappy with any of the existing CouchDB drivers for Go. The [best
-one](https://github.com/fjl/go-couchdb) had a number of shortcomings:
-
- - It is no longer actively developed.
- - It [doesn't have an open source license](https://github.com/fjl/go-couchdb/issues/15).
- - It doesn't support iterating over result sets, forcing one to load all
- results of a query into memory at once.
- - It [doesn't support CouchDB 2.0](https://github.com/fjl/go-couchdb/issues/14)
- sequence IDs or MongoDB-style queries.
- - It doesn't natively support CookieAuth (it does allow a generic Auth method
- which could be used to do this, but I think it's appropriate to put directly
- in the library).
-
-2. I wanted a single client API that worked with both CouchDB and
-[PouchDB](https://pouchdb.com/). I had previously written
-[go-pouchdb](https://github.com/flimzy/go-pouchdb), a GopherJS wrapper around
-the PouchDB library with a public API modeled after `fjl/go-couchdb`, but I
-still wanted a unified driver infrastructure.
-
-3. I want an unambiguous, open source license. This software is released under
-the Apache 2.0 license. See the included LICENSE.md file for details.
-
-4. I wanted the ability to mock CouchDB connections for testing. This is possible
-with the `sql` / `sql/driver` approach by implementing a mock driver, but was
-not possible with any existing CouchDB client libraries. This library makes that
-possible for CouchDB apps, too.
-
-5. I wanted a simple, mock CouchDB server I could use for testing. It doesn't
-need to be efficient, or support all CouchDB servers, but it should be enough
-to test the basic functionality of a PouchDB app, for instance. Kivik aims to
-do this with the `kivik serve` command, in the near future.
-
-6. I wanted a toolkit that would make it easy to build a proxy to sit in front
-of CouchDB to handle custom authentication or other logic that CouchDB cannot
-support natively. Kivik aims to accomplish this in the future.
-
-## What are Kivik's requirements?
-
-Kivik's test suite is automatically run on Linux for every pull request, but
-should work on all supported Go architectures. If you find it not working for
-your OS/architecture, please submit a bug report.
-
-Below are the compatibility targets for specific runtime and database versions.
-If you discover a bug affecting any of these supported environments, please let
-me know by submitting a bug report via GitHub.
-
-- **Go** Kivik 3.x aims for full compatibility with all stable releases of Go
- from 1.9. For Go 1.7 or 1.8 you can use [Kivik 1.x](https://github.com/go-kivik/kivik/tree/v1)
-- **CouchDB** The Kivik 3.x CouchDB driver aims for compatibility with all
- stable releases of CouchDB from 1.6.1.
-- **GopherJS** GopherJS always requires the latest stable version of Go, so
- building Kivik with GopherJS has this same requirement.
-- **PouchDB** The Kivik 3.x PouchDB driver aims for compatibility with all
- stable releases of PouchDB from 6.0.0.
-
-## What is the development status?
-
-Kivik 3.x is considered production-ready and comes with a complete client API
-client and backend drivers for CouchDB and PouchDB.
-
-Future goals are to flesh out the Memory driver, which will make automated
-testing without a real CouchDB server easier. Then I will work on completing
-the 'serve' mode.
-
-You can see a complete overview of the current status on the
-[Compatibility chart](https://github.com/go-kivik/kivik/blob/master/doc/COMPATIBILITY.md)
-
-## Why the name "Kivik"?
-
-[Kivik](http://www.ikea.com/us/en/catalog/categories/series/18329/) is a line
-of sofas (couches) from IKEA. And in the spirit of IKEA, and build-your-own
-furniture, Kivik aims to allow you to "build your own" CouchDB client, server,
-and proxy applications.
-
-## What license is Kivik released under?
-
-This software is released under the terms of the Apache 2.0 license. See
-LICENCE.md, or read the [full license](http://www.apache.org/licenses/LICENSE-2.0).
-
-## What projects currently use Kivik?
-
-If your project uses Kivik, and you'd like to be added to this list, create an
-issue or submit a pull request.
-
-- [Cayley](https://github.com/cayleygraph/cayley) is an open-source graph
- database. It uses Kivik for the CouchDB and PouchDB storage backends.
diff --git a/vendor/github.com/go-kivik/kivik/v3/attachments.go b/vendor/github.com/go-kivik/kivik/v3/attachments.go
deleted file mode 100644
index 197d799e04..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/attachments.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package kivik
-
-import (
- "bytes"
- "encoding/json"
- "io"
- "io/ioutil"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Attachments is a collection of one or more file attachments.
-type Attachments map[string]*Attachment
-
-// Get fetches the requested attachment, or returns nil if it does not exist.
-func (a *Attachments) Get(filename string) *Attachment {
- return map[string]*Attachment(*a)[filename]
-}
-
-// Set sets the attachment associated with filename in the collection,
-// replacing it if it already existed.
-func (a *Attachments) Set(filename string, att *Attachment) {
- map[string]*Attachment(*a)[filename] = att
-}
-
-// Delete removes the specified file from the collection.
-func (a *Attachments) Delete(filename string) {
- delete(map[string]*Attachment(*a), filename)
-}
-
-// Attachment represents a file attachment on a CouchDB document.
-type Attachment struct {
- // Filename is the name of the attachment.
- Filename string `json:"-"`
-
- // ContentType is the MIME type of the attachment contents.
- ContentType string `json:"content_type"`
-
- // Stub will be true if the data structure only represents file metadata,
- // and contains no actual content. Stub will be true when returned by the
- // GetAttachmentMeta function, or when included in a document without the
- // 'include_docs' option.
- Stub bool `json:"stub"`
-
- // Follows will be true when reading attachments in multipart/related
- // format.
- Follows bool `json:"follows"`
-
- // Content represents the attachment's content.
- //
- // Kivik will always return a non-nil Content, even for 0-byte attachments
- // or when Stub is true. It is the caller's responsibility to close
- // Content.
- Content io.ReadCloser `json:"-"`
-
- // Size records the uncompressed size of the attachment. The value -1
- // indicates that the length is unknown. Unless Stub is true, values >= 0
- // indicate that the given number of bytes may be read from Content.
- Size int64 `json:"length"`
-
- // Used compression codec, if any. Will be the empty string if the
- // attachment is uncompressed.
- ContentEncoding string `json:"encoding"`
-
- // EncodedLength records the compressed attachment size in bytes. Only
- // meaningful when ContentEncoding is defined.
- EncodedLength int64 `json:"encoded_length"`
-
- // RevPos is the revision number when attachment was added.
- RevPos int64 `json:"revpos"`
-
- // Digest is the content hash digest.
- Digest string `json:"digest"`
-}
-
-// bufCloser wraps a *bytes.Buffer to create an io.ReadCloser
-type bufCloser struct {
- *bytes.Buffer
-}
-
-var _ io.ReadCloser = &bufCloser{}
-
-func (b *bufCloser) Close() error { return nil }
-
-// validate returns an error if the attachment is invalid.
-func (a *Attachment) validate() error {
- if a.Filename == "" {
- return missingArg("filename")
- }
- return nil
-}
-
-// MarshalJSON satisfies the json.Marshaler interface.
-func (a *Attachment) MarshalJSON() ([]byte, error) {
- type jsonAttachment struct {
- ContentType string `json:"content_type"`
- Stub *bool `json:"stub,omitempty"`
- Follows *bool `json:"follows,omitempty"`
- Size int64 `json:"length,omitempty"`
- RevPos int64 `json:"revpos,omitempty"`
- Data []byte `json:"data,omitempty"`
- Digest string `json:"digest,omitempty"`
- }
- att := &jsonAttachment{
- ContentType: a.ContentType,
- Size: a.Size,
- RevPos: a.RevPos,
- Digest: a.Digest,
- }
- switch {
- case a.Stub:
- att.Stub = &a.Stub
- case a.Follows:
- att.Follows = &a.Follows
- default:
- defer a.Content.Close() // nolint: errcheck
- data, err := ioutil.ReadAll(a.Content)
- if err != nil {
- return nil, err
- }
- att.Data = data
- }
- return json.Marshal(att)
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for an Attachment.
-func (a *Attachment) UnmarshalJSON(data []byte) error {
- type clone Attachment
- type jsonAtt struct {
- clone
- Data []byte `json:"data"`
- }
- var att jsonAtt
- if err := json.Unmarshal(data, &att); err != nil {
- return err
- }
- *a = Attachment(att.clone)
- if att.Data != nil {
- a.Content = ioutil.NopCloser(bytes.NewReader(att.Data))
- } else {
- a.Content = nilContent
- }
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for a collection of
-// Attachments.
-func (a *Attachments) UnmarshalJSON(data []byte) error {
- atts := make(map[string]*Attachment)
- if err := json.Unmarshal(data, &atts); err != nil {
- return err
- }
- for filename, att := range atts {
- att.Filename = filename
- }
- *a = atts
- return nil
-}
-
-// AttachmentsIterator is an experimental way to read streamed attachments from
-// a multi-part Get request.
-type AttachmentsIterator struct {
- atti driver.Attachments
-}
-
-// Next returns the next attachment in the stream. io.EOF will be
-// returned when there are no more attachments.
-func (i *AttachmentsIterator) Next() (*Attachment, error) {
- att := new(driver.Attachment)
- if err := i.atti.Next(att); err != nil {
- return nil, err
- }
- katt := Attachment(*att)
- return &katt, nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/bulk.go b/vendor/github.com/go-kivik/kivik/v3/bulk.go
deleted file mode 100644
index b5eebc5afa..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/bulk.go
+++ /dev/null
@@ -1,155 +0,0 @@
-package kivik
-
-import (
- "context"
- "errors"
- "io"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// BulkResults is an iterator over the results of a BulkDocs query.
-type BulkResults struct {
- *iter
- bulki driver.BulkResults
-}
-
-// Next returns the next BulkResult from the feed. If an error occurs, it will
-// be returned and the feed closed. io.EOF will be returned when there are no
-// more results.
-func (r *BulkResults) Next() bool {
- return r.iter.Next()
-}
-
-// Err returns the error, if any, that was encountered during iteration. Err
-// may be called after an explicit or implicit Close.
-func (r *BulkResults) Err() error {
- return r.iter.Err()
-}
-
-// Close closes the feed. Any unread updates will still be accessible via
-// Next().
-func (r *BulkResults) Close() error {
- return r.iter.Close()
-}
-
-type bulkIterator struct{ driver.BulkResults }
-
-var _ iterator = &bulkIterator{}
-
-func (r *bulkIterator) Next(i interface{}) error {
- return r.BulkResults.Next(i.(*driver.BulkResult))
-}
-
-func newBulkResults(ctx context.Context, bulki driver.BulkResults) *BulkResults {
- return &BulkResults{
- iter: newIterator(ctx, &bulkIterator{bulki}, &driver.BulkResult{}),
- bulki: bulki,
- }
-}
-
-// ID returns the document ID name for the current result.
-func (r *BulkResults) ID() string {
- runlock, err := r.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return r.curVal.(*driver.BulkResult).ID
-}
-
-// Rev returns the revision of the current curResult.
-func (r *BulkResults) Rev() string {
- runlock, err := r.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return r.curVal.(*driver.BulkResult).Rev
-}
-
-// UpdateErr returns the error associated with the current result, or nil
-// if none. Do not confuse this with Err, which returns an error for the
-// iterator itself.
-func (r *BulkResults) UpdateErr() error {
- runlock, err := r.rlock()
- if err != nil {
- return nil
- }
- defer runlock()
- return r.curVal.(*driver.BulkResult).Error
-}
-
-// BulkDocs allows you to create and update multiple documents at the same time
-// within a single request. This function returns an iterator over the results
-// of the bulk operation.
-// See http://docs.couchdb.org/en/2.0.0/api/database/bulk-api.html#db-bulk-docs
-//
-// As with Put, each individual document may be a JSON-marshable object, or a
-// raw JSON string in a []byte, json.RawMessage, or io.Reader.
-func (db *DB) BulkDocs(ctx context.Context, docs []interface{}, options ...Options) (*BulkResults, error) {
- docsi, err := docsInterfaceSlice(docs)
- if err != nil {
- return nil, err
- }
- if len(docsi) == 0 {
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Err: errors.New("kivik: no documents provided")}
- }
- opts := mergeOptions(options...)
- if bulkDocer, ok := db.driverDB.(driver.BulkDocer); ok {
- bulki, err := bulkDocer.BulkDocs(ctx, docsi, opts)
- if err != nil {
- return nil, err
- }
- return newBulkResults(ctx, bulki), nil
- }
- var results []driver.BulkResult
- for _, doc := range docsi {
- var err error
- var id, rev string
- if docID, ok := extractDocID(doc); ok {
- id = docID
- rev, err = db.Put(ctx, id, doc, opts)
- } else {
- id, rev, err = db.CreateDoc(ctx, doc, opts)
- }
- results = append(results, driver.BulkResult{
- ID: id,
- Rev: rev,
- Error: err,
- })
- }
- return newBulkResults(ctx, &emulatedBulkResults{results}), nil
-}
-
-type emulatedBulkResults struct {
- results []driver.BulkResult
-}
-
-var _ driver.BulkResults = &emulatedBulkResults{}
-
-func (r *emulatedBulkResults) Close() error {
- r.results = nil
- return nil
-}
-
-func (r *emulatedBulkResults) Next(res *driver.BulkResult) error {
- if len(r.results) == 0 {
- return io.EOF
- }
- *res = r.results[0]
- r.results = r.results[1:]
- return nil
-}
-
-func docsInterfaceSlice(docsi []interface{}) ([]interface{}, error) {
- for i, doc := range docsi {
- x, err := normalizeFromJSON(doc)
- if err != nil {
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- docsi[i] = x
- }
- return docsi, nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/changes.go b/vendor/github.com/go-kivik/kivik/v3/changes.go
deleted file mode 100644
index 0bfe081c55..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/changes.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package kivik
-
-import (
- "context"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Changes is an iterator over the database changes feed.
-type Changes struct {
- *iter
- changesi driver.Changes
-}
-
-// Next prepares the next result value for reading. It returns true on success
-// or false if there are no more results, due to an error or the changes feed
-// having been closed. Err should be consulted to determine any error.
-func (c *Changes) Next() bool {
- return c.iter.Next()
-}
-
-// Err returns the error, if any, that was encountered during iteration. Err may
-// be called after an explicit or implicit Close.
-func (c *Changes) Err() error {
- return c.iter.Err()
-}
-
-// Close closes the Changes feed, preventing further enumeration, and freeing
-// any resources (such as the http request body) of the underlying query. If
-// Next is called and there are no further results, Changes is closed
-// automatically and it will suffice to check the result of Err. Close is
-// idempotent and does not affect the result of Err.
-func (c *Changes) Close() error {
- return c.iter.Close()
-}
-
-type changesIterator struct{ driver.Changes }
-
-var _ iterator = &changesIterator{}
-
-func (c *changesIterator) Next(i interface{}) error { return c.Changes.Next(i.(*driver.Change)) }
-
-func newChanges(ctx context.Context, changesi driver.Changes) *Changes {
- return &Changes{
- iter: newIterator(ctx, &changesIterator{changesi}, &driver.Change{}),
- changesi: changesi,
- }
-}
-
-// Changes returns a list of changed revs.
-func (c *Changes) Changes() []string {
- return c.curVal.(*driver.Change).Changes
-}
-
-// Deleted returns true if the change relates to a deleted document.
-func (c *Changes) Deleted() bool {
- return c.curVal.(*driver.Change).Deleted
-}
-
-// ID returns the ID of the current result.
-func (c *Changes) ID() string {
- return c.curVal.(*driver.Change).ID
-}
-
-// ScanDoc works the same as ScanValue, but on the doc field of the result. It
-// is only valid for results that include documents.
-func (c *Changes) ScanDoc(dest interface{}) error {
- runlock, err := c.rlock()
- if err != nil {
- return err
- }
- defer runlock()
- return scan(dest, c.curVal.(*driver.Change).Doc)
-}
-
-// Changes returns an iterator over the real-time changes feed. The feed remains
-// open until explicitly closed, or an error is encountered.
-// See http://couchdb.readthedocs.io/en/latest/api/database/changes.html#get--db-_changes
-func (db *DB) Changes(ctx context.Context, options ...Options) (*Changes, error) {
- changesi, err := db.driverDB.Changes(ctx, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newChanges(ctx, changesi), nil
-}
-
-// Seq returns the Seq of the current result.
-func (c *Changes) Seq() string {
- return c.curVal.(*driver.Change).Seq
-}
-
-// LastSeq returns the last update sequence id present in the change set,
-// if returned by the server. This value is only guaranteed to be set after
-// all changes have been enumerated through by Next, thus should only be
-// read after processing all changes in a change set. Calling Close before
-// enumerating will render this value unreliable.
-func (c *Changes) LastSeq() string {
- return c.changesi.LastSeq()
-}
-
-// Pending returns the count of remaining items in the change feed. This
-// value is only guaranteed to be set after all changes have been
-// enumerated through by Next, thus should only be read after processing all
-// changes in a change set. Calling Close before enumerating will render
-// this value unreliable.
-func (c *Changes) Pending() int64 {
- return c.changesi.Pending()
-}
-
-// ETag returns the unquoted ETag header, if any. Unlike LastSeq and Pending,
-// because this value is returned in the response header (for standard CouchDB
-// operation) anyway, it can be read immediately, before iteration even begins.
-func (c *Changes) ETag() string {
- return c.changesi.ETag()
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/cluster.go b/vendor/github.com/go-kivik/kivik/v3/cluster.go
deleted file mode 100644
index 3422f0dc89..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/cluster.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var clusterNotImplemented = &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support cluster operations"}
-
-// ClusterStatus returns the current cluster status.
-//
-// See http://docs.couchdb.org/en/stable/api/server/common.html#cluster-setup
-func (c *Client) ClusterStatus(ctx context.Context, options ...Options) (string, error) {
- cluster, ok := c.driverClient.(driver.Cluster)
- if !ok {
- return "", clusterNotImplemented
- }
- return cluster.ClusterStatus(ctx, mergeOptions(options...))
-}
-
-// ClusterSetup performs the requested cluster action. action should be
-// an object understood by the driver. For the CouchDB driver, this means an
-// object which is marshalable to a JSON object of the expected format.
-//
-// See http://docs.couchdb.org/en/stable/api/server/common.html#post--_cluster_setup
-func (c *Client) ClusterSetup(ctx context.Context, action interface{}) error {
- cluster, ok := c.driverClient.(driver.Cluster)
- if !ok {
- return clusterNotImplemented
- }
- return cluster.ClusterSetup(ctx, action)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/codecov.yml b/vendor/github.com/go-kivik/kivik/v3/codecov.yml
deleted file mode 100644
index aea8ff245e..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/codecov.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-ignore:
-- "test"
-- "mock"
diff --git a/vendor/github.com/go-kivik/kivik/v3/config.go b/vendor/github.com/go-kivik/kivik/v3/config.go
deleted file mode 100644
index 8c91fd7438..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/config.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Config represents all the config sections.
-//
-// Note that the Config struct, and all of the config-related methods are
-// considered experimental, and may change in the future.
-type Config map[string]ConfigSection
-
-// ConfigSection represents all key/value pairs for a section of configuration.
-type ConfigSection map[string]string
-
-var configNotImplemented = &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support Config interface"}
-
-// Config returns the entire server config, for the specified node.
-//
-// See http://docs.couchdb.org/en/stable/api/server/configuration.html#get--_node-node-name-_config
-func (c *Client) Config(ctx context.Context, node string) (Config, error) {
- if configer, ok := c.driverClient.(driver.Configer); ok {
- driverCf, err := configer.Config(ctx, node)
- if err != nil {
- return nil, err
- }
- cf := Config{}
- for k, v := range driverCf {
- cf[k] = ConfigSection(v)
- }
- return cf, nil
- }
- return nil, configNotImplemented
-}
-
-// ConfigSection returns the requested section of the server config for the
-// specified node.
-//
-// See http://docs.couchdb.org/en/stable/api/server/configuration.html#node-node-name-config-section
-func (c *Client) ConfigSection(ctx context.Context, node, section string) (ConfigSection, error) {
- if configer, ok := c.driverClient.(driver.Configer); ok {
- sec, err := configer.ConfigSection(ctx, node, section)
- return ConfigSection(sec), err
- }
- return nil, configNotImplemented
-}
-
-// ConfigValue returns a single config value for the specified node.
-//
-// See http://docs.couchdb.org/en/stable/api/server/configuration.html#get--_node-node-name-_config-section-key
-func (c *Client) ConfigValue(ctx context.Context, node, section, key string) (string, error) {
- if configer, ok := c.driverClient.(driver.Configer); ok {
- return configer.ConfigValue(ctx, node, section, key)
- }
- return "", configNotImplemented
-}
-
-// SetConfigValue sets the server's config value on the specified node, creating
-// the key if it doesn't exist. It returns the old value.
-//
-// See http://docs.couchdb.org/en/stable/api/server/configuration.html#put--_node-node-name-_config-section-key
-func (c *Client) SetConfigValue(ctx context.Context, node, section, key, value string) (string, error) {
- if configer, ok := c.driverClient.(driver.Configer); ok {
- return configer.SetConfigValue(ctx, node, section, key, value)
- }
- return "", configNotImplemented
-}
-
-// DeleteConfigKey deletes the configuration key and associated value from the
-// specified node. It returns the old value.
-//
-// See http://docs.couchdb.org/en/stable/api/server/configuration.html#delete--_node-node-name-_config-section-key
-func (c *Client) DeleteConfigKey(ctx context.Context, node, section, key string) (string, error) {
- if configer, ok := c.driverClient.(driver.Configer); ok {
- return configer.DeleteConfigKey(ctx, node, section, key)
- }
- return "", configNotImplemented
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/constants.go b/vendor/github.com/go-kivik/kivik/v3/constants.go
deleted file mode 100644
index fc962f0f57..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/constants.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package kivik
-
-const (
- // KivikVersion is the version of the Kivik library.
- KivikVersion = "3.0.0"
- // KivikVendor is the vendor string reported by this library.
- KivikVendor = "Kivik"
-)
-
-// SessionCookieName is the name of the CouchDB session cookie.
-const SessionCookieName = "AuthSession"
-
-// UserPrefix is the mandatory CouchDB user prefix.
-// See http://docs.couchdb.org/en/2.0.0/intro/security.html#org-couchdb-user
-const UserPrefix = "org.couchdb.user:"
-
-// EndKeySuffix is a high Unicode character (0xfff0) useful for appending to an
-// endkey argument, when doing a ranged search, as described here:
-// http://couchdb.readthedocs.io/en/latest/ddocs/views/collation.html#string-ranges
-//
-// Example, to return all results with keys beginning with "foo":
-//
-// rows, err := db.Query(context.TODO(), "ddoc", "view", map[string]interface{}{
-// "startkey": "foo",
-// "endkey": "foo" + kivik.EndKeySuffix,
-// })
-const EndKeySuffix = string(0xfff0)
diff --git a/vendor/github.com/go-kivik/kivik/v3/db.go b/vendor/github.com/go-kivik/kivik/v3/db.go
deleted file mode 100644
index e0c814b734..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/db.go
+++ /dev/null
@@ -1,688 +0,0 @@
-package kivik
-
-import (
- "context"
- "encoding/json"
- "errors"
- "io"
- "io/ioutil"
- "net/http"
- "reflect"
- "strings"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// DB is a handle to a specific database.
-type DB struct {
- client *Client
- name string
- driverDB driver.DB
- err error
-}
-
-// Client returns the Client used to connect to the database.
-func (db *DB) Client() *Client {
- return db.client
-}
-
-// Name returns the database name as passed when creating the DB connection.
-func (db *DB) Name() string {
- return db.name
-}
-
-// Err returns the error, if any, that occurred while connecting to or creating
-// the database. This error will be deferred until the next call, normally, so
-// using this method is only ever necessary if you need to directly check the
-// error status, and intend to do nothing else with the DB object.
-func (db *DB) Err() error {
- return db.err
-}
-
-// AllDocs returns a list of all documents in the database.
-func (db *DB) AllDocs(ctx context.Context, options ...Options) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- rowsi, err := db.driverDB.AllDocs(ctx, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
-}
-
-// DesignDocs returns a list of all documents in the database.
-func (db *DB) DesignDocs(ctx context.Context, options ...Options) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- ddocer, ok := db.driverDB.(driver.DesignDocer)
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Err: errors.New("kivik: design doc view not supported by driver")}
- }
- rowsi, err := ddocer.DesignDocs(ctx, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
-}
-
-// LocalDocs returns a list of all documents in the database.
-func (db *DB) LocalDocs(ctx context.Context, options ...Options) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- ldocer, ok := db.driverDB.(driver.LocalDocer)
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Err: errors.New("kivik: local doc view not supported by driver")}
- }
- rowsi, err := ldocer.LocalDocs(ctx, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
-}
-
-// Query executes the specified view function from the specified design
-// document. ddoc and view may or may not be be prefixed with '_design/'
-// and '_view/' respectively. No other
-func (db *DB) Query(ctx context.Context, ddoc, view string, options ...Options) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- ddoc = strings.TrimPrefix(ddoc, "_design/")
- view = strings.TrimPrefix(view, "_view/")
- rowsi, err := db.driverDB.Query(ctx, ddoc, view, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
-}
-
-// Row contains the result of calling Get for a single document. For most uses,
-// it is sufficient just to call the ScanDoc method. For more advanced uses, the
-// fields may be accessed directly.
-type Row struct {
- // ContentLength records the size of the JSON representation of the document
- // as requestd. The value -1 indicates that the length is unknown. Values
- // >= 0 indicate that the given number of bytes may be read from Body.
- ContentLength int64
-
- // Rev is the revision ID of the returned document.
- Rev string
-
- // Body represents the document's content.
- //
- // Kivik will always return a non-nil Body, except when Err is non-nil. The
- // ScanDoc method will close Body. When not using ScanDoc, it is the
- // caller's responsibility to close Body
- Body io.ReadCloser
-
- // Err contains any error that occurred while fetching the document. It is
- // typically returned by ScanDoc.
- Err error
-
- // Attachments is experimental
- Attachments *AttachmentsIterator
-}
-
-// ScanDoc unmarshals the data from the fetched row into dest. It is an
-// intelligent wrapper around json.Unmarshal which also handles
-// multipart/related responses. When done, the underlying reader is closed.
-func (r *Row) ScanDoc(dest interface{}) error {
- if r.Err != nil {
- return r.Err
- }
- if reflect.TypeOf(dest).Kind() != reflect.Ptr {
- return errNonPtr
- }
- defer r.Body.Close() // nolint: errcheck
- if err := json.NewDecoder(r.Body).Decode(dest); err != nil {
- return err
- }
- return nil
-}
-
-// Get fetches the requested document. Any errors are deferred until the
-// row.ScanDoc call.
-func (db *DB) Get(ctx context.Context, docID string, options ...Options) *Row {
- if db.err != nil {
- return &Row{Err: db.err}
- }
- doc, err := db.driverDB.Get(ctx, docID, mergeOptions(options...))
- if err != nil {
- return &Row{Err: err}
- }
- row := &Row{
- ContentLength: doc.ContentLength,
- Rev: doc.Rev,
- Body: doc.Body,
- }
- if doc.Attachments != nil {
- row.Attachments = &AttachmentsIterator{atti: doc.Attachments}
- }
- return row
-}
-
-// GetMeta returns the size and rev of the specified document. GetMeta accepts
-// the same options as the Get method.
-func (db *DB) GetMeta(ctx context.Context, docID string, options ...Options) (size int64, rev string, err error) {
- if db.err != nil {
- return 0, "", db.err
- }
- opts := mergeOptions(options...)
- if r, ok := db.driverDB.(driver.MetaGetter); ok {
- return r.GetMeta(ctx, docID, opts)
- }
- row := db.Get(ctx, docID, opts)
- if row.Err != nil {
- return 0, "", row.Err
- }
- if row.Rev != "" {
- _ = row.Body.Close()
- return row.ContentLength, row.Rev, nil
- }
- var doc struct {
- Rev string `json:"_rev"`
- }
- // These last two lines cannot be combined for GopherJS due to a bug.
- // See https://github.com/gopherjs/gopherjs/issues/608
- err = row.ScanDoc(&doc)
- return row.ContentLength, doc.Rev, err
-}
-
-// CreateDoc creates a new doc with an auto-generated unique ID. The generated
-// docID and new rev are returned.
-func (db *DB) CreateDoc(ctx context.Context, doc interface{}, options ...Options) (docID, rev string, err error) {
- if db.err != nil {
- return "", "", db.err
- }
- return db.driverDB.CreateDoc(ctx, doc, mergeOptions(options...))
-}
-
-// normalizeFromJSON unmarshals a []byte, json.RawMessage or io.Reader to a
-// map[string]interface{}, or passed through any other types.
-func normalizeFromJSON(i interface{}) (interface{}, error) {
- var body []byte
- switch t := i.(type) {
- case []byte:
- body = t
- case json.RawMessage:
- body = t
- default:
- r, ok := i.(io.Reader)
- if !ok {
- return i, nil
- }
- var err error
- body, err = ioutil.ReadAll(r)
- if err != nil {
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- }
- var x map[string]interface{}
- if err := json.Unmarshal(body, &x); err != nil {
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Err: err}
- }
- return x, nil
-}
-
-func extractDocID(i interface{}) (string, bool) {
- if i == nil {
- return "", false
- }
- var id string
- var ok bool
- switch t := i.(type) {
- case map[string]interface{}:
- id, ok = t["_id"].(string)
- case map[string]string:
- id, ok = t["_id"]
- default:
- data, err := json.Marshal(i)
- if err != nil {
- return "", false
- }
- var result struct {
- ID string `json:"_id"`
- }
- if err := json.Unmarshal(data, &result); err != nil {
- return "", false
- }
- id = result.ID
- ok = result.ID != ""
- }
- if !ok {
- return "", false
- }
- return id, true
-}
-
-// Put creates a new doc or updates an existing one, with the specified docID.
-// If the document already exists, the current revision must be included in doc,
-// with JSON key '_rev', otherwise a conflict will occur. The new rev is
-// returned.
-//
-// doc may be one of:
-//
-// - An object to be marshaled to JSON. The resulting JSON structure must
-// conform to CouchDB standards.
-// - A []byte value, containing a valid JSON document
-// - A json.RawMessage value containing a valid JSON document
-// - An io.Reader, from which a valid JSON document may be read.
-func (db *DB) Put(ctx context.Context, docID string, doc interface{}, options ...Options) (rev string, err error) {
- if db.err != nil {
- return "", db.err
- }
- if docID == "" {
- return "", missingArg("docID")
- }
- i, err := normalizeFromJSON(doc)
- if err != nil {
- return "", err
- }
- return db.driverDB.Put(ctx, docID, i, mergeOptions(options...))
-}
-
-// Delete marks the specified document as deleted.
-func (db *DB) Delete(ctx context.Context, docID, rev string, options ...Options) (newRev string, err error) {
- if db.err != nil {
- return "", db.err
- }
- if docID == "" {
- return "", missingArg("docID")
- }
- return db.driverDB.Delete(ctx, docID, rev, mergeOptions(options...))
-}
-
-// Flush requests a flush of disk cache to disk or other permanent storage.
-//
-// See http://docs.couchdb.org/en/2.0.0/api/database/compact.html#db-ensure-full-commit
-func (db *DB) Flush(ctx context.Context) error {
- if db.err != nil {
- return db.err
- }
- if flusher, ok := db.driverDB.(driver.Flusher); ok {
- return flusher.Flush(ctx)
- }
- return &Error{HTTPStatus: http.StatusNotImplemented, Err: errors.New("kivik: flush not supported by driver")}
-}
-
-// DBStats contains database statistics..
-type DBStats struct {
- // Name is the name of the database.
- Name string `json:"db_name"`
- // CompactRunning is true if the database is currently being compacted.
- CompactRunning bool `json:"compact_running"`
- // DocCount is the number of documents are currently stored in the database.
- DocCount int64 `json:"doc_count"`
- // DeletedCount is a count of documents which have been deleted from the
- // database.
- DeletedCount int64 `json:"doc_del_count"`
- // UpdateSeq is the current update sequence for the database.
- UpdateSeq string `json:"update_seq"`
- // DiskSize is the number of bytes used on-disk to store the database.
- DiskSize int64 `json:"disk_size"`
- // ActiveSize is the number of bytes used on-disk to store active documents.
- // If this number is lower than DiskSize, then compaction would free disk
- // space.
- ActiveSize int64 `json:"data_size"`
- // ExternalSize is the size of the documents in the database, as represented
- // as JSON, before compression.
- ExternalSize int64 `json:"-"`
- // Cluster reports the cluster replication configuration variables.
- Cluster *ClusterConfig `json:"cluster,omitempty"`
- // RawResponse is the raw response body returned by the server, useful if
- // you need additional backend-specific information.
- //
- // For the format of this document, see
- // http://docs.couchdb.org/en/2.1.1/api/database/common.html#get--db
- RawResponse json.RawMessage `json:"-"`
-}
-
-// ClusterConfig contains the cluster configuration for the database.
-type ClusterConfig struct {
- Replicas int `json:"n"`
- Shards int `json:"q"`
- ReadQuorum int `json:"r"`
- WriteQuorum int `json:"w"`
-}
-
-// Stats returns database statistics.
-func (db *DB) Stats(ctx context.Context) (*DBStats, error) {
- if db.err != nil {
- return nil, db.err
- }
- i, err := db.driverDB.Stats(ctx)
- if err != nil {
- return nil, err
- }
- return driverStats2kivikStats(i), nil
-}
-
-func driverStats2kivikStats(i *driver.DBStats) *DBStats {
- var cluster *ClusterConfig
- if i.Cluster != nil {
- c := ClusterConfig(*i.Cluster)
- cluster = &c
- }
- return &DBStats{
- Name: i.Name,
- CompactRunning: i.CompactRunning,
- DocCount: i.DocCount,
- DeletedCount: i.DeletedCount,
- UpdateSeq: i.UpdateSeq,
- DiskSize: i.DiskSize,
- ActiveSize: i.ActiveSize,
- ExternalSize: i.ExternalSize,
- Cluster: cluster,
- RawResponse: i.RawResponse,
- }
-}
-
-// Compact begins compaction of the database. Check the CompactRunning field
-// returned by Info() to see if the compaction has completed.
-// See http://docs.couchdb.org/en/2.0.0/api/database/compact.html#db-compact
-//
-// This method may return immediately, or may wait for the compaction to
-// complete before returning, depending on the backend implementation. In
-// particular, CouchDB triggers the compaction and returns immediately, whereas
-// PouchDB waits until compaction has completed, before returning.
-func (db *DB) Compact(ctx context.Context) error {
- if db.err != nil {
- return db.err
- }
- return db.driverDB.Compact(ctx)
-}
-
-// CompactView compats the view indexes associated with the specified design
-// document.
-// See http://docs.couchdb.org/en/2.0.0/api/database/compact.html#db-compact-design-doc
-//
-// This method may return immediately, or may wait for the compaction to
-// complete before returning, depending on the backend implementation. In
-// particular, CouchDB triggers the compaction and returns immediately, whereas
-// PouchDB waits until compaction has completed, before returning.
-func (db *DB) CompactView(ctx context.Context, ddocID string) error {
- return db.driverDB.CompactView(ctx, ddocID)
-}
-
-// ViewCleanup removes view index files that are no longer required as a result
-// of changed views within design documents.
-// See http://docs.couchdb.org/en/2.0.0/api/database/compact.html#db-view-cleanup
-func (db *DB) ViewCleanup(ctx context.Context) error {
- if db.err != nil {
- return db.err
- }
- return db.driverDB.ViewCleanup(ctx)
-}
-
-// Security returns the database's security document.
-// See http://couchdb.readthedocs.io/en/latest/api/database/security.html#get--db-_security
-func (db *DB) Security(ctx context.Context) (*Security, error) {
- if db.err != nil {
- return nil, db.err
- }
- s, err := db.driverDB.Security(ctx)
- if err != nil {
- return nil, err
- }
- return &Security{
- Admins: Members(s.Admins),
- Members: Members(s.Members),
- }, err
-}
-
-// SetSecurity sets the database's security document.
-// See http://couchdb.readthedocs.io/en/latest/api/database/security.html#put--db-_security
-func (db *DB) SetSecurity(ctx context.Context, security *Security) error {
- if db.err != nil {
- return db.err
- }
- if security == nil {
- return missingArg("security")
- }
- sec := &driver.Security{
- Admins: driver.Members(security.Admins),
- Members: driver.Members(security.Members),
- }
- return db.driverDB.SetSecurity(ctx, sec)
-}
-
-// Copy copies the source document to a new document with an ID of targetID. If
-// the database backend does not support COPY directly, the operation will be
-// emulated with a Get followed by Put. The target will be an exact copy of the
-// source, with only the ID and revision changed.
-//
-// See http://docs.couchdb.org/en/2.0.0/api/document/common.html#copy--db-docid
-func (db *DB) Copy(ctx context.Context, targetID, sourceID string, options ...Options) (targetRev string, err error) {
- if db.err != nil {
- return "", db.err
- }
- if targetID == "" {
- return "", missingArg("targetID")
- }
- if sourceID == "" {
- return "", missingArg("sourceID")
- }
- opts := mergeOptions(options...)
- if copier, ok := db.driverDB.(driver.Copier); ok {
- return copier.Copy(ctx, targetID, sourceID, opts)
- }
- var doc map[string]interface{}
- if err = db.Get(ctx, sourceID, opts).ScanDoc(&doc); err != nil {
- return "", err
- }
- delete(doc, "_rev")
- doc["_id"] = targetID
- delete(opts, "rev") // rev has a completely different meaning for Copy and Put
- return db.Put(ctx, targetID, doc, opts)
-}
-
-// PutAttachment uploads the supplied content as an attachment to the specified
-// document.
-func (db *DB) PutAttachment(ctx context.Context, docID, rev string, att *Attachment, options ...Options) (newRev string, err error) {
- if db.err != nil {
- return "", db.err
- }
- if docID == "" {
- return "", missingArg("docID")
- }
- if e := att.validate(); e != nil {
- return "", e
- }
- a := driver.Attachment(*att)
- return db.driverDB.PutAttachment(ctx, docID, rev, &a, mergeOptions(options...))
-}
-
-// GetAttachment returns a file attachment associated with the document.
-func (db *DB) GetAttachment(ctx context.Context, docID, filename string, options ...Options) (*Attachment, error) {
- if db.err != nil {
- return nil, db.err
- }
- if docID == "" {
- return nil, missingArg("docID")
- }
- if filename == "" {
- return nil, missingArg("filename")
- }
- att, err := db.driverDB.GetAttachment(ctx, docID, filename, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- a := Attachment(*att)
- return &a, nil
-}
-
-type nilContentReader struct{}
-
-var _ io.ReadCloser = &nilContentReader{}
-
-func (c nilContentReader) Read(_ []byte) (int, error) { return 0, io.EOF }
-func (c nilContentReader) Close() error { return nil }
-
-var nilContent = nilContentReader{}
-
-// GetAttachmentMeta returns meta data about an attachment. The attachment
-// content returned will be empty.
-func (db *DB) GetAttachmentMeta(ctx context.Context, docID, filename string, options ...Options) (*Attachment, error) {
- if db.err != nil {
- return nil, db.err
- }
- if docID == "" {
- return nil, missingArg("docID")
- }
- if filename == "" {
- return nil, missingArg("filename")
- }
- var att *Attachment
- if metaer, ok := db.driverDB.(driver.AttachmentMetaGetter); ok {
- a, err := metaer.GetAttachmentMeta(ctx, docID, filename, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- att = new(Attachment)
- *att = Attachment(*a)
- } else {
- var err error
- att, err = db.GetAttachment(ctx, docID, filename, options...)
- if err != nil {
- return nil, err
- }
- }
- if att.Content != nil {
- _ = att.Content.Close() // Ensure this is closed
- }
- att.Content = nilContent
- return att, nil
-}
-
-// DeleteAttachment deletes an attachment from a document, returning the
-// document's new revision.
-func (db *DB) DeleteAttachment(ctx context.Context, docID, rev, filename string, options ...Options) (newRev string, err error) {
- if db.err != nil {
- return "", db.err
- }
- if docID == "" {
- return "", missingArg("docID")
- }
- if filename == "" {
- return "", missingArg("filename")
- }
- return db.driverDB.DeleteAttachment(ctx, docID, rev, filename, mergeOptions(options...))
-}
-
-// PurgeResult is the result of a purge request.
-type PurgeResult struct {
- // Seq is the purge sequence number.
- Seq int64 `json:"purge_seq"`
- // Purged is a map of document ids to revisions, indicated the
- // document/revision pairs that were successfully purged.
- Purged map[string][]string `json:"purged"`
-}
-
-// Purge permanently removes the reference to deleted documents from the
-// database. Normal deletion only marks the document with the key/value pair
-// `_deleted=true`, to ensure proper replication of deleted documents. By
-// using Purge, the document can be completely removed. But note that this
-// operation is not replication safe, so great care must be taken when using
-// Purge, and this should only be used as a last resort.
-//
-// Purge expects as input a map with document ID as key, and slice of
-// revisions as value.
-func (db *DB) Purge(ctx context.Context, docRevMap map[string][]string) (*PurgeResult, error) {
- if db.err != nil {
- return nil, db.err
- }
- if purger, ok := db.driverDB.(driver.Purger); ok {
- res, err := purger.Purge(ctx, docRevMap)
- if err != nil {
- return nil, err
- }
- r := PurgeResult(*res)
- return &r, nil
- }
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: purge not supported by driver"}
-}
-
-// BulkGetReference is a reference to a document given in a BulkGet query.
-type BulkGetReference struct {
- ID string `json:"id"`
- Rev string `json:"rev,omitempty"`
- AttsSince string `json:"atts_since,omitempty"`
-}
-
-// BulkGet can be called to query several documents in bulk. It is well suited
-// for fetching a specific revision of documents, as replicators do for example,
-// or for getting revision history.
-//
-// See http://docs.couchdb.org/en/stable/api/database/bulk-api.html#db-bulk-get
-func (db *DB) BulkGet(ctx context.Context, docs []BulkGetReference, options ...Options) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- bulkGetter, ok := db.driverDB.(driver.BulkGetter)
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: bulk get not supported by driver"}
- }
- refs := make([]driver.BulkGetReference, len(docs))
- for i, ref := range docs {
- refs[i] = driver.BulkGetReference(ref)
- }
- rowsi, err := bulkGetter.BulkGet(ctx, refs, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
-}
-
-// Close cleans up any resources used by the DB. The default CouchDB driver
-// does not use this, the default PouchDB driver does.
-func (db *DB) Close(ctx context.Context) error {
- if db.err != nil {
- return db.err
- }
- if closer, ok := db.driverDB.(driver.DBCloser); ok {
- return closer.Close(ctx)
- }
- return nil
-}
-
-// RevDiff represents a rev diff for a single document, as returned by the
-// RevsDiff method.
-type RevDiff struct {
- Missing []string `json:"missing,omitempty"`
- PossibleAncestors []string `json:"possible_ancestors,omitempty"`
-}
-
-// Diffs is a collection of RevDiffs as returned by RevsDiff. The map key is
-// the document ID.
-type Diffs map[string]RevDiff
-
-// RevsDiff the subset of document/revision IDs that do not correspond to
-// revisions stored in the database. This is used by the replication protocol,
-// and is normally never needed otherwise. revMap must marshal to the expected
-// format.
-//
-// Use ID() to return the current document ID, and ScanValue to access the full
-// JSON value, which should be of the JSON format:
-//
-// {
-// "missing": ["rev1",...],
-// "possible_ancestors": ["revA",...]
-// }
-//
-// See http://docs.couchdb.org/en/stable/api/database/misc.html#db-revs-diff
-func (db *DB) RevsDiff(ctx context.Context, revMap interface{}) (*Rows, error) {
- if db.err != nil {
- return nil, db.err
- }
- if rd, ok := db.driverDB.(driver.RevsDiffer); ok {
- rowsi, err := rd.RevsDiff(ctx, revMap)
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
- }
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: _revs_diff not supported by driver"}
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/doc.go b/vendor/github.com/go-kivik/kivik/v3/doc.go
deleted file mode 100644
index cb2a6e41ff..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/doc.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Package kivik provides a generic interface to CouchDB or CouchDB-like databases.
-//
-// The kivik package must be used in conjunction with a database driver. See
-// https://github.com/go-kivik/kivik/wiki/Kivik-database-drivers for a list.
-//
-// The kivik driver system is modeled after the standard library's sql and
-// sql/driver packages, although the client API is completely different due to
-// the different database models implemented by SQL and NoSQL databases such as
-// CouchDB.
-package kivik // import "github.com/go-kivik/kivik/v3"
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/bulkget.go b/vendor/github.com/go-kivik/kivik/v3/driver/bulkget.go
deleted file mode 100644
index ebdc37b4c3..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/bulkget.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package driver
-
-import "context"
-
-// BulkGetReference is a reference to a document given in a BulkGet query.
-type BulkGetReference struct {
- ID string `json:"id"`
- Rev string `json:"rev,omitempty"`
- AttsSince string `json:"atts_since,omitempty"`
-}
-
-// BulkGetter is an optional interface which may be implemented by a driver to
-// support bulk get operations.
-type BulkGetter interface {
- // BulkGet uses the _bulk_get interface to fetch multiple documents in a single query.
- BulkGet(ctx context.Context, docs []BulkGetReference, options map[string]interface{}) (Rows, error)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/changes.go b/vendor/github.com/go-kivik/kivik/v3/driver/changes.go
deleted file mode 100644
index 10d923059a..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/changes.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package driver
-
-import "encoding/json"
-
-// Changes is an iterator of the database changes feed.
-type Changes interface {
- // Next is called to populate *Change with the next value in the changes
- // feed.
- //
- // Next should return io.EOF when the changes feed is closed by request.
- Next(*Change) error
- // Close closes the changes feed iterator.
- Close() error
- // LastSeq returns the last change update sequence.
- LastSeq() string
- // Pending returns the count of remaining items in the feed
- Pending() int64
- // ETag returns the unquoted ETag header, if present.
- ETag() string
-}
-
-// Change represents the changes to a single document.
-type Change struct {
- // ID is the document ID to which the change relates.
- ID string `json:"id"`
- // Seq is the update sequence for the changes feed.
- Seq string `json:"seq"`
- // Deleted is set to true for the changes feed, if the document has been
- // deleted.
- Deleted bool `json:"deleted"`
- // Changes represents a list of document leaf revisions for the /_changes
- // endpoint.
- Changes ChangedRevs `json:"changes"`
- // Doc is the raw, un-decoded JSON document. This is only populated when
- // include_docs=true is set.
- Doc json.RawMessage `json:"doc"`
-}
-
-// ChangedRevs represents a "changes" field of a result in the /_changes stream.
-type ChangedRevs []string
-
-// UnmarshalJSON satisfies the json.Unmarshaler interface
-func (c *ChangedRevs) UnmarshalJSON(data []byte) error {
- var changes []struct {
- Rev string `json:"rev"`
- }
- if err := json.Unmarshal(data, &changes); err != nil {
- return err
- }
- revs := ChangedRevs(make([]string, len(changes)))
- for i, change := range changes {
- revs[i] = change.Rev
- }
- *c = revs
- return nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/config.go b/vendor/github.com/go-kivik/kivik/v3/driver/config.go
deleted file mode 100644
index 0a33bf4537..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/config.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package driver
-
-import "context"
-
-// Config represents all the config sections.
-type Config map[string]ConfigSection
-
-// ConfigSection represents all key/value pairs for a section of configuration.
-type ConfigSection map[string]string
-
-// Configer is an optional interface that may be implemented by a Client to
-// allow access to reading and setting server configuration.
-type Configer interface {
- Config(ctx context.Context, node string) (Config, error)
- ConfigSection(ctx context.Context, node, section string) (ConfigSection, error)
- ConfigValue(ctx context.Context, node, section, key string) (string, error)
- SetConfigValue(ctx context.Context, node, section, key, value string) (string, error)
- DeleteConfigKey(ctx context.Context, node, section, key string) (string, error)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/doc.go b/vendor/github.com/go-kivik/kivik/v3/driver/doc.go
deleted file mode 100644
index 19c45bca3c..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/doc.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Package driver defines interfaces to be implemented by database drivers as
-// used by package kivik.
-//
-// Most code should use package kivik.
-package driver // import "github.com/go-kivik/kivik/v3/driver"
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/driver.go b/vendor/github.com/go-kivik/kivik/v3/driver/driver.go
deleted file mode 100644
index da56597d61..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/driver.go
+++ /dev/null
@@ -1,410 +0,0 @@
-package driver
-
-import (
- "context"
- "encoding/json"
- "io"
- "time"
-)
-
-// Driver is the interface that must be implemented by a database driver.
-type Driver interface {
- // NewClient returns a connection handle to the database. The name is in a
- // driver-specific format.
- NewClient(name string) (Client, error)
-}
-
-// Version represents a server version response.
-type Version struct {
- // Version is the version number reported by the server or backend.
- Version string
- // Vendor is the vendor string reported by the server or backend.
- Vendor string
- // Features is a list of enabled, optional features. This was added in
- // CouchDB 2.1.0, and can be expected to be empty for older versions.
- Features []string
- // RawResponse is the raw response body as returned by the server.
- RawResponse json.RawMessage
-}
-
-// Client is a connection to a database server.
-type Client interface {
- // Version returns the server implementation's details.
- Version(ctx context.Context) (*Version, error)
- // AllDBs returns a list of all existing database names.
- AllDBs(ctx context.Context, options map[string]interface{}) ([]string, error)
- // DBExists returns true if the database exists.
- DBExists(ctx context.Context, dbName string, options map[string]interface{}) (bool, error)
- // CreateDB creates the requested DB. The dbName is validated as a valid
- // CouchDB database name prior to calling this function, so the driver can
- // assume a valid name.
- CreateDB(ctx context.Context, dbName string, options map[string]interface{}) error
- // DestroyDB deletes the requested DB.
- DestroyDB(ctx context.Context, dbName string, options map[string]interface{}) error
- // DB returns a handleto the requested database
- DB(ctx context.Context, dbName string, options map[string]interface{}) (DB, error)
-}
-
-// DBsStatser is an optional interface, added to support CouchDB 2.2.0's
-// /_dbs_info endpoint. If this is not supported, or if this method returns
-// status 404, Kivik will fall back to calling the method of issuing a
-// GET /{db} for each database requested.
-type DBsStatser interface {
- // DBsStats returns database statistical information for each database
- // named in dbNames. The returned values should be in the same order as
- // the requested database names, and any missing databases should return
- // a nil *DBStats value.
- DBsStats(ctx context.Context, dbNames []string) ([]*DBStats, error)
-}
-
-// Replication represents a _replicator document.
-type Replication interface {
- // The following methods are called just once, when the Replication is first
- // returned from Replicate() or GetReplications().
- ReplicationID() string
- Source() string
- Target() string
- StartTime() time.Time
- EndTime() time.Time
- State() string
- Err() error
-
- // These methods may be triggered by user actions.
-
- // Delete deletes a replication, which cancels it if it is running.
- Delete(context.Context) error
- // Update fetches the latest replication state from the server.
- Update(context.Context, *ReplicationInfo) error
-}
-
-// ReplicationInfo represents a snap-shot state of a replication, as provided
-// by the _active_tasks endpoint.
-type ReplicationInfo struct {
- DocWriteFailures int64
- DocsRead int64
- DocsWritten int64
- Progress float64
-}
-
-// ClientReplicator is an optional interface that may be implemented by a Client
-// that supports replication between two database.
-type ClientReplicator interface {
- // Replicate initiates a replication.
- Replicate(ctx context.Context, targetDSN, sourceDSN string, options map[string]interface{}) (Replication, error)
- // GetReplications returns a list of replicatoins (i.e. all docs in the
- // _replicator database)
- GetReplications(ctx context.Context, options map[string]interface{}) ([]Replication, error)
-}
-
-// Authenticator is an optional interface that may be implemented by a Client
-// that supports authenitcated connections.
-type Authenticator interface {
- // Authenticate attempts to authenticate the client using an authenticator.
- // If the authenticator is not known to the client, an error should be
- // returned.
- Authenticate(ctx context.Context, authenticator interface{}) error
-}
-
-// DBStats contains database statistics.
-type DBStats struct {
- Name string `json:"db_name"`
- CompactRunning bool `json:"compact_running"`
- DocCount int64 `json:"doc_count"`
- DeletedCount int64 `json:"doc_del_count"`
- UpdateSeq string `json:"update_seq"`
- DiskSize int64 `json:"disk_size"`
- ActiveSize int64 `json:"data_size"`
- ExternalSize int64 `json:"-"`
- Cluster *ClusterStats `json:"cluster,omitempty"`
- RawResponse json.RawMessage `json:"-"`
-}
-
-// ClusterStats contains the cluster configuration for the database.
-type ClusterStats struct {
- Replicas int `json:"n"`
- Shards int `json:"q"`
- ReadQuorum int `json:"r"`
- WriteQuorum int `json:"w"`
-}
-
-// Members represents the members of a database security document.
-type Members struct {
- Names []string `json:"names,omitempty"`
- Roles []string `json:"roles,omitempty"`
-}
-
-// Security represents a database security document.
-type Security struct {
- Admins Members `json:"admins"`
- Members Members `json:"members"`
-}
-
-// DB is a database handle.
-type DB interface {
- // AllDocs returns all of the documents in the database, subject to the
- // options provided.
- AllDocs(ctx context.Context, options map[string]interface{}) (Rows, error)
- // Get fetches the requested document from the database, and returns the
- // content length (or -1 if unknown), and an io.ReadCloser to access the
- // raw JSON content.
- Get(ctx context.Context, docID string, options map[string]interface{}) (*Document, error)
- // CreateDoc creates a new doc, with a server-generated ID.
- CreateDoc(ctx context.Context, doc interface{}, options map[string]interface{}) (docID, rev string, err error)
- // Put writes the document in the database.
- Put(ctx context.Context, docID string, doc interface{}, options map[string]interface{}) (rev string, err error)
- // Delete marks the specified document as deleted.
- Delete(ctx context.Context, docID, rev string, options map[string]interface{}) (newRev string, err error)
- // Stats returns database statistics.
- Stats(ctx context.Context) (*DBStats, error)
- // Compact initiates compaction of the database.
- Compact(ctx context.Context) error
- // CompactView initiates compaction of the view.
- CompactView(ctx context.Context, ddocID string) error
- // ViewCleanup cleans up stale view files.
- ViewCleanup(ctx context.Context) error
- // Security returns the database's security document.
- Security(ctx context.Context) (*Security, error)
- // SetSecurity sets the database's security document.
- SetSecurity(ctx context.Context, security *Security) error
- // Changes returns a Rows iterator for the changes feed. In continuous mode,
- // the iterator will continue indefinitely, until Close is called.
- Changes(ctx context.Context, options map[string]interface{}) (Changes, error)
- // PutAttachment uploads an attachment to the specified document, returning
- // the new revision.
- PutAttachment(ctx context.Context, docID, rev string, att *Attachment, options map[string]interface{}) (newRev string, err error)
- // GetAttachment fetches an attachment for the associated document ID.
- GetAttachment(ctx context.Context, docID, filename string, options map[string]interface{}) (*Attachment, error)
- // DeleteAttachment deletes an attachment from a document, returning the
- // document's new revision.
- DeleteAttachment(ctx context.Context, docID, rev, filename string, options map[string]interface{}) (newRev string, err error)
- // Query performs a query against a view, subject to the options provided.
- // ddoc will be the design doc name without the '_design/' previx.
- // view will be the view name without the '_view/' prefix.
- Query(ctx context.Context, ddoc, view string, options map[string]interface{}) (Rows, error)
-}
-
-// Document represents a single document returned by Get
-type Document struct {
- // ContentLength is the size of the document response in bytes.
- ContentLength int64
-
- // Rev is the revision number returned
- Rev string
-
- // Body contains the respons body, either in raw JSON or multipart/related
- // format.
- Body io.ReadCloser
-
- // Attachments will be nil except when attachments=true.
- Attachments Attachments
-}
-
-// Attachments is an iterator over the attachments included in a document when
-// Get is called with `include_docs=true`.
-type Attachments interface {
- // Next is called to pupulate att with the next attachment in the result
- // set.
- //
- // Next should return io.EOF when there are no more attachments.
- Next(att *Attachment) error
-
- // Close closes the Attachments iterator
- Close() error
-}
-
-// Purger is an optional interface which may be implemented by a DB to support
-// document purging.
-type Purger interface {
- // Purge permanently removes the references to deleted documents from the
- // database.
- Purge(ctx context.Context, docRevMap map[string][]string) (*PurgeResult, error)
-}
-
-// PurgeResult is the result of a purge request.
-type PurgeResult struct {
- Seq int64 `json:"purge_seq"`
- Purged map[string][]string `json:"purged"`
-}
-
-// BulkDocer is an optional interface which may be implemented by a DB to
-// support bulk insert/update operations. For any driver that does not support
-// the BulkDocer interface, the Put or CreateDoc methods will be called for each
-// document to emulate the same functionality, with options passed through
-// unaltered.
-type BulkDocer interface {
- // BulkDocs alls bulk create, update and/or delete operations. It returns an
- // iterator over the results.
- BulkDocs(ctx context.Context, docs []interface{}, options map[string]interface{}) (BulkResults, error)
-}
-
-// Finder is an optional interface which may be implemented by a DB. The Finder
-// interface provides access to the new (in CouchDB 2.0) MongoDB-style query
-// interface.
-type Finder interface {
- // Find executes a query using the new /_find interface. If query is a
- // string, []byte, or json.RawMessage, it should be treated as a raw JSON
- // payload. Any other type should be marshaled to JSON.
- Find(ctx context.Context, query interface{}) (Rows, error)
- // CreateIndex creates an index if it doesn't already exist. If the index
- // already exists, it should do nothing. ddoc and name may be empty, in
- // which case they should be provided by the backend. If index is a string,
- // []byte, or json.RawMessage, it should be treated as a raw JSON payload.
- // Any other type should be marshaled to JSON.
- CreateIndex(ctx context.Context, ddoc, name string, index interface{}) error
- // GetIndexes returns a list of all indexes in the database.
- GetIndexes(ctx context.Context) ([]Index, error)
- // Delete deletes the requested index.
- DeleteIndex(ctx context.Context, ddoc, name string) error
- // Explain returns the query plan for a given query. Explain takes the same
- // arguments as Find.
- Explain(ctx context.Context, query interface{}) (*QueryPlan, error)
-}
-
-// QueryPlan is the response of an Explain query.
-type QueryPlan struct {
- DBName string `json:"dbname"`
- Index map[string]interface{} `json:"index"`
- Selector map[string]interface{} `json:"selector"`
- Options map[string]interface{} `json:"opts"`
- Limit int64 `json:"limit"`
- Skip int64 `json:"skip"`
-
- // Fields is the list of fields to be returned in the result set, or
- // an empty list if all fields are to be returned.
- Fields []interface{} `json:"fields"`
- Range map[string]interface{} `json:"range"`
-}
-
-// Index is a MonboDB-style index definition.
-type Index struct {
- DesignDoc string `json:"ddoc,omitempty"`
- Name string `json:"name"`
- Type string `json:"type"`
- Definition interface{} `json:"def"`
-}
-
-// Attachment represents a file attachment to a document.
-type Attachment struct {
- Filename string `json:"-"`
- ContentType string `json:"content_type"`
- Stub bool `json:"stub"`
- Follows bool `json:"follows"`
- Content io.ReadCloser `json:"-"`
- Size int64 `json:"length"`
- ContentEncoding string `json:"encoding"`
- EncodedLength int64 `json:"encoded_length"`
- RevPos int64 `json:"revpos"`
- Digest string `json:"digest"`
-}
-
-// AttachmentMetaGetter is an optional interface which may be satisfied by a
-// DB. If satisfied, it may be used to fetch meta data about an attachment. If
-// not satisfied, GetAttachment will be used instead.
-type AttachmentMetaGetter interface {
- // GetAttachmentMetaOpts returns meta information about an attachment.
- GetAttachmentMeta(ctx context.Context, docID, filename string, options map[string]interface{}) (*Attachment, error)
-}
-
-// BulkResult is the result of a single doc update in a BulkDocs request.
-type BulkResult struct {
- ID string `json:"id"`
- Rev string `json:"rev"`
- Error error
-}
-
-// BulkResults is an iterator over the results for a BulkDocs call.
-type BulkResults interface {
- // Next is called to populate *BulkResult with the values of the next bulk
- // result in the set.
- //
- // Next should return io.EOF when there are no more results.
- Next(*BulkResult) error
- // Close closes the bulk results iterator.
- Close() error
-}
-
-// MetaGetter is an optional interface that may be implemented by a DB. If not
-// implemented, the Get method will be used to emulate the functionality, with
-// options passed through unaltered.
-type MetaGetter interface {
- // GetMeta returns the document size and revision of the requested document.
- // GetMeta should accept the same options as the Get method.
- GetMeta(ctx context.Context, docID string, options map[string]interface{}) (size int64, rev string, err error)
-}
-
-// Flusher is an optional interface that may be implemented by a DB that can
-// force a flush of the database backend file(s) to disk or other permanent
-// storage.
-type Flusher interface {
- // Flush requests a flush of disk cache to disk or other permanent storage.
- //
- // See http://docs.couchdb.org/en/2.0.0/api/database/compact.html#db-ensure-full-commit
- Flush(ctx context.Context) error
-}
-
-// Copier is an optional interface that may be implemented by a DB.
-//
-// If a DB does implement Copier, Copy() functions will use it. If a DB does
-// not implement the Copier interface, the functionality will be emulated by
-// calling Get followed by Put, with options passed through unaltered, except
-// that the 'rev' option will be removed for the Put call.
-type Copier interface {
- Copy(ctx context.Context, targetID, sourceID string, options map[string]interface{}) (targetRev string, err error)
-}
-
-// DesignDocer is an optional interface that may be implemented by a DB.
-type DesignDocer interface {
- // DesignDocs returns all of the design documents in the database, subject
- // to the options provided.
- DesignDocs(ctx context.Context, options map[string]interface{}) (Rows, error)
-}
-
-// LocalDocer is an optional interface that may be implemented by a DB.
-type LocalDocer interface {
- // LocalDocs returns all of the local documents in the database, subject to
- // the options provided.
- LocalDocs(ctx context.Context, options map[string]interface{}) (Rows, error)
-}
-
-// Pinger is an optional interface that may be implemented by a Client. When
-// not implemented, Kivik will call Version instead, to determine if the
-// database is usable.
-type Pinger interface {
- // Ping returns true if the database is online and available for requests.
- Ping(ctx context.Context) (bool, error)
-}
-
-// Cluster is an optional interface that may be implemented by a Client to
-// support CouchDB cluster configuration operations.
-type Cluster interface {
- // ClusterStatus returns the current cluster status.
- ClusterStatus(ctx context.Context, options map[string]interface{}) (string, error)
- // ClusterSetup performs the action specified by action.
- ClusterSetup(ctx context.Context, action interface{}) error
-}
-
-// ClientCloser is an optional interface that may be implemented by a Client
-// to clean up resources when a Client is no longer needed.
-type ClientCloser interface {
- Close(ctx context.Context) error
-}
-
-// DBCloser is an optional interface that may be implemented by a DB to clean
-// up resources when a DB is no longer needed.
-type DBCloser interface {
- Close(ctx context.Context) error
-}
-
-// RevDiff represents a rev diff for a single document, as returned by the
-// RevsDiff method.
-type RevDiff struct {
- Missing []string `json:"missing,omitempty"`
- PossibleAncestors []string `json:"possible_ancestors,omitempty"`
-}
-
-// RevsDiffer is an optional interface that may be implemented by a DB.
-type RevsDiffer interface {
- // RevsDiff returns a Rows iterator, which should populate the ID and Value
- // fields, and nothing else.
- RevsDiff(ctx context.Context, revMap interface{}) (Rows, error)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/rows.go b/vendor/github.com/go-kivik/kivik/v3/driver/rows.go
deleted file mode 100644
index c9ce303d4c..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/rows.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package driver
-
-import (
- "encoding/json"
-)
-
-// Row is a generic view result row.
-type Row struct {
- // ID is the document ID of the result.
- ID string `json:"id"`
- // Key is the view key of the result. For built-in views, this is the same
- // as ID.
- Key json.RawMessage `json:"key"`
- // Value is the raw, un-decoded JSON value. For most built-in views (such as
- // /_all_docs), this is `{"rev":"X-xxx"}`.
- Value json.RawMessage `json:"value"`
- // Doc is the raw, un-decoded JSON document. This is only populated by views
- // which return docs, such as /_all_docs?include_docs=true.
- Doc json.RawMessage `json:"doc"`
- // Error represents the error for any row not fetched. Usually just
- // 'not_found'.
- Error error `json:"-"`
-}
-
-// Rows is an iterator over a view's results.
-type Rows interface {
- // Next is called to populate row with the next row in the result set.
- //
- // Next should return io.EOF when there are no more rows.
- Next(row *Row) error
- // Close closes the rows iterator.
- Close() error
- // UpdateSeq is the update sequence of the database, if requested in the
- // result set.
- UpdateSeq() string
- // Offset is the offset where the result set starts.
- Offset() int64
- // TotalRows is the number of documents in the database/view.
- TotalRows() int64
-}
-
-// RowsWarner is an optional interface that may be implemented by a Rows, which
-// allows a rows iterator to return a non-fatal warning. This is intended for
-// use by the /_find endpoint, which generates warnings when indexes don't
-// exist.
-type RowsWarner interface {
- // Warning returns the warning generated by the query, if any.
- Warning() string
-}
-
-// Bookmarker is an optional interface that may be implemented by a Rows for
-// returning a paging bookmark.
-type Bookmarker interface {
- // Bookmark returns an opaque bookmark string used for paging, added to
- // the /_find endpoint in CouchDB 2.1.1. See the CouchDB documentation for
- // usage: http://docs.couchdb.org/en/2.1.1/api/database/find.html#pagination
- Bookmark() string
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/session.go b/vendor/github.com/go-kivik/kivik/v3/driver/session.go
deleted file mode 100644
index 4e73f23b79..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/session.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package driver
-
-import (
- "context"
- "encoding/json"
-)
-
-// Session is a copy of kivik.Session
-type Session struct {
- // Name is the name of the authenticated user.
- Name string
- // Roles is a list of roles the user belongs to.
- Roles []string
- // AuthenticationMethod is the authentication method that was used for this
- // session.
- AuthenticationMethod string
- // AuthenticationDB is the user database against which authentication was
- // performed.
- AuthenticationDB string
- // AuthenticationHandlers is a list of authentication handlers configured on
- // the server.
- AuthenticationHandlers []string
- // RawResponse is the raw JSON response sent by the server, useful for
- // custom backends which may provide additional fields.
- RawResponse json.RawMessage
-}
-
-// Sessioner is an optional interface that a Client may satisfy to provide
-// access to the authenticated session information.
-type Sessioner interface {
- // Session returns information about the authenticated user.
- Session(ctx context.Context) (*Session, error)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/driver/updates.go b/vendor/github.com/go-kivik/kivik/v3/driver/updates.go
deleted file mode 100644
index 44aa92c815..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/driver/updates.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package driver
-
-import "context"
-
-// DBUpdate represents a database update event.
-type DBUpdate struct {
- DBName string `json:"db_name"`
- Type string `json:"type"`
- Seq string `json:"seq"`
-}
-
-// DBUpdates is a DBUpdates iterator.
-type DBUpdates interface {
- // Next is called to populate DBUpdate with the values of the next update in
- // the feed.
- //
- // Next should return io.EOF when the feed is closed normally.
- Next(*DBUpdate) error
- // Close closes the iterator.
- Close() error
-}
-
-// DBUpdater is an optional interface that may be implemented by a Client to
-// provide access to the DB Updates feed.
-type DBUpdater interface {
- // DBUpdates must return a DBUpdate iterator. The context, or the iterator's
- // Close method, may be used to close the iterator.
- DBUpdates(context.Context) (DBUpdates, error)
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/errors.go b/vendor/github.com/go-kivik/kivik/v3/errors.go
deleted file mode 100644
index 723b63bb5c..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/errors.go
+++ /dev/null
@@ -1,152 +0,0 @@
-package kivik
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- "golang.org/x/xerrors"
-)
-
-// Error represents an error returned by Kivik.
-//
-// This type definition is not guaranteed to remain stable, or even exported.
-// When examining errors programatically, you should rely instead on the
-// StatusCode() function in this package, rather than on directly observing
-// the fields of this type.
-type Error struct {
- // HTTPStatus is the HTTP status code associated with this error. Normally
- // this is the actual HTTP status returned by the server, but in some cases
- // it may be generated by Kivik directly. Check the FromServer value if
- // the distinction matters to you.
- HTTPStatus int
-
- // FromServer is set to true if the error was returned by the server.
- // This field is deprecated and will soon be removed.
- FromServer bool
-
- // Message is the error message.
- Message string
-
- // Err is the originating error, if any.
- Err error
-}
-
-var _ error = &Error{}
-var _ statusCoder = &Error{}
-var _ causer = &Error{}
-
-func (e *Error) Error() string {
- if e.Err == nil {
- return e.msg()
- }
- if e.Message == "" {
- return e.Err.Error()
- }
- return e.Message + ": " + e.Err.Error()
-}
-
-// StatusCode returns the HTTP status code associated with the error, or 500
-// (internal server error), if none.
-func (e *Error) StatusCode() int {
- if e.HTTPStatus == 0 {
- return http.StatusInternalServerError
- }
- return e.HTTPStatus
-}
-
-// Cause satisfies the github.com/pkg/errors.causer interface by returning e.Err.
-func (e *Error) Cause() error {
- return e.Err
-}
-
-// Unwrap satisfies the Go 1.13 errors.Wrapper interface
-// (golang.org/x/xerrors.Unwrap for older versions of Go).
-func (e *Error) Unwrap() error {
- return e.Err
-}
-
-// Format implements fmt.Formatter
-func (e *Error) Format(f fmt.State, c rune) {
- parts := make([]string, 0, 3)
- if e.Message != "" {
- parts = append(parts, e.Message)
- }
- switch c {
- case 'v':
- if f.Flag('+') {
- var prefix string
- if e.FromServer {
- prefix = "server responded with"
- } else {
- prefix = "kivik generated"
- }
- parts = append(parts, fmt.Sprintf("%s %d / %s", prefix, e.HTTPStatus, http.StatusText(e.HTTPStatus)))
- }
- }
- if e.Err != nil {
- parts = append(parts, e.Err.Error())
- }
- _, _ = fmt.Fprint(f, strings.Join(parts, ": "))
-}
-
-func (e *Error) msg() string {
- switch e.Message {
- case "":
- return http.StatusText(e.StatusCode())
- default:
- return e.Message
- }
-}
-
-type statusCoder interface {
- StatusCode() int
-}
-
-type causer interface {
- Cause() error
-}
-
-// StatusCode returns the HTTP status code embedded in the error, or 500
-// (internal server error), if there was no specified status code. If err is
-// nil, StatusCode returns 0. This provides a convenient way to determine the
-// precise nature of a Kivik-returned error.
-//
-// For example, to panic for all but NotFound errors:
-//
-// err := db.Get(context.TODO(), "docID").ScanDoc(&doc)
-// if kivik.StatusCode(err) == kivik.StatusNotFound {
-// return
-// }
-// if err != nil {
-// panic(err)
-// }
-//
-// This method uses the statusCoder interface, which is not exported by this
-// package, but is considered part of the stable public API. Driver
-// implementations are expected to return errors which conform to this
-// interface.
-//
-// type statusCoder interface {
-// StatusCode() (httpStatusCode int)
-// }
-func StatusCode(err error) int {
- if err == nil {
- return 0
- }
- var coder statusCoder
- for {
- if xerrors.As(err, &coder) {
- return coder.StatusCode()
- }
- if uw := xerrors.Unwrap(err); uw != nil {
- err = uw
- continue
- }
- if c, ok := err.(causer); ok {
- err = c.Cause()
- continue
- }
- return http.StatusInternalServerError
- }
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/find.go b/vendor/github.com/go-kivik/kivik/v3/find.go
deleted file mode 100644
index 125ced7577..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/find.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var findNotImplemented = &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support Find interface"}
-
-// Find executes a query using the new /_find interface. The query must be
-// JSON-marshalable to a valid query.
-// See http://docs.couchdb.org/en/2.0.0/api/database/find.html#db-find
-func (db *DB) Find(ctx context.Context, query interface{}) (*Rows, error) {
- if finder, ok := db.driverDB.(driver.Finder); ok {
- rowsi, err := finder.Find(ctx, query)
- if err != nil {
- return nil, err
- }
- return newRows(ctx, rowsi), nil
- }
- return nil, findNotImplemented
-}
-
-// CreateIndex creates an index if it doesn't already exist. ddoc and name may
-// be empty, in which case they will be auto-generated. index must be a valid
-// index object, as described here:
-// http://docs.couchdb.org/en/stable/api/database/find.html#db-index
-func (db *DB) CreateIndex(ctx context.Context, ddoc, name string, index interface{}) error {
- if finder, ok := db.driverDB.(driver.Finder); ok {
- return finder.CreateIndex(ctx, ddoc, name, index)
- }
- return findNotImplemented
-}
-
-// DeleteIndex deletes the requested index.
-func (db *DB) DeleteIndex(ctx context.Context, ddoc, name string) error {
- if finder, ok := db.driverDB.(driver.Finder); ok {
- return finder.DeleteIndex(ctx, ddoc, name)
- }
- return findNotImplemented
-}
-
-// Index is a MonboDB-style index definition.
-type Index struct {
- DesignDoc string `json:"ddoc,omitempty"`
- Name string `json:"name"`
- Type string `json:"type"`
- Definition interface{} `json:"def"`
-}
-
-// GetIndexes returns the indexes defined on the current database.
-func (db *DB) GetIndexes(ctx context.Context) ([]Index, error) {
- if finder, ok := db.driverDB.(driver.Finder); ok {
- dIndexes, err := finder.GetIndexes(ctx)
- indexes := make([]Index, len(dIndexes))
- for i, index := range dIndexes {
- indexes[i] = Index(index)
- }
- return indexes, err
- }
- return nil, findNotImplemented
-}
-
-// QueryPlan is the query execution plan for a query, as returned by the Explain
-// function.
-type QueryPlan struct {
- DBName string `json:"dbname"`
- Index map[string]interface{} `json:"index"`
- Selector map[string]interface{} `json:"selector"`
- Options map[string]interface{} `json:"opts"`
- Limit int64 `json:"limit"`
- Skip int64 `json:"skip"`
-
- // Fields is the list of fields to be returned in the result set, or
- // an empty list if all fields are to be returned.
- Fields []interface{} `json:"fields"`
- Range map[string]interface{} `json:"range"`
-}
-
-// Explain returns the query plan for a given query. Explain takes the same
-// arguments as Find.
-func (db *DB) Explain(ctx context.Context, query interface{}) (*QueryPlan, error) {
- if explainer, ok := db.driverDB.(driver.Finder); ok {
- plan, err := explainer.Explain(ctx, query)
- if err != nil {
- return nil, err
- }
- qp := QueryPlan(*plan)
- return &qp, nil
- }
- return nil, findNotImplemented
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/go.mod b/vendor/github.com/go-kivik/kivik/v3/go.mod
deleted file mode 100644
index 218f968d19..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/go.mod
+++ /dev/null
@@ -1,9 +0,0 @@
-module github.com/go-kivik/kivik/v3
-
-go 1.13
-
-require (
- github.com/pkg/errors v0.8.1
- gitlab.com/flimzy/testy v0.0.3
- golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
-)
diff --git a/vendor/github.com/go-kivik/kivik/v3/go.sum b/vendor/github.com/go-kivik/kivik/v3/go.sum
deleted file mode 100644
index 8cc4bfec6e..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/go.sum
+++ /dev/null
@@ -1,16 +0,0 @@
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc=
-github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
-github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95 h1:+OLn68pqasWca0z5ryit9KGfp3sUsW4Lqg32iRMJyzs=
-github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
-github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
-github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
-github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
-github.com/pkg/errors v0.8.1/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=
-gitlab.com/flimzy/testy v0.0.3 h1:UkCz4aDa52cUX6uwvuVrwlTFZC1AesU5W6grDUcVFlg=
-gitlab.com/flimzy/testy v0.0.3/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/vendor/github.com/go-kivik/kivik/v3/iterator.go b/vendor/github.com/go-kivik/kivik/v3/iterator.go
deleted file mode 100644
index f12bf985ef..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/iterator.go
+++ /dev/null
@@ -1,154 +0,0 @@
-package kivik
-
-import (
- "context"
- "encoding/json"
- "io"
- "net/http"
- "reflect"
- "sync"
-)
-
-type iterator interface {
- Next(interface{}) error
- Close() error
-}
-
-type iter struct {
- feed iterator
-
- mu sync.RWMutex
- ready bool // Set to true once Next() has been called
- closed bool
- lasterr error // non-nil only if closed is true
-
- cancel func() // cancel function to exit context goroutine when iterator is closed
-
- curVal interface{}
-}
-
-func (i *iter) rlock() (unlock func(), err error) {
- i.mu.RLock()
- if i.closed {
- i.mu.RUnlock()
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Message: "kivik: Iterator is closed"}
- }
- if !i.ready {
- i.mu.RUnlock()
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Message: "kivik: Iterator access before calling Next"}
- }
- return func() { i.mu.RUnlock() }, nil
-}
-
-// newIterator instantiates a new iterator.
-//
-// ctx is a possibly-cancellable context
-// zeroValue is an empty instance of the data type this iterator iterates over
-// feed is the iterator interface, which typically wraps a driver.X iterator
-func newIterator(ctx context.Context, feed iterator, zeroValue interface{}) *iter {
- i := &iter{
- feed: feed,
- curVal: zeroValue,
- }
- ctx, i.cancel = context.WithCancel(ctx)
- go i.awaitDone(ctx)
- return i
-}
-
-// awaitDone blocks until the rows are closed or the context is cancelled, then closes the iterator if it's still open.
-func (i *iter) awaitDone(ctx context.Context) {
- <-ctx.Done()
- _ = i.close(ctx.Err())
-}
-
-// Next prepares the next iterator result value for reading. It returns true on
-// success, or false if there is no next result or an error occurs while
-// preparing it. Err should be consulted to distinguish between the two.
-func (i *iter) Next() bool {
- doClose, ok := i.next()
- if doClose {
- _ = i.Close()
- }
- return ok
-}
-
-func (i *iter) next() (doClose, ok bool) {
- i.mu.RLock()
- defer i.mu.RUnlock()
- if i.closed {
- return false, false
- }
- i.ready = true
- i.lasterr = i.feed.Next(i.curVal)
- if i.lasterr != nil {
- return true, false
- }
- return false, true
-}
-
-// Close closes the Iterator, preventing further enumeration, and freeing any
-// resources (such as the http request body) of the underlying feed. If Next is
-// called and there are no further results, Iterator is closed automatically and
-// it will suffice to check the result of Err. Close is idempotent and does not
-// affect the result of Err.
-func (i *iter) Close() error {
- return i.close(nil)
-}
-
-func (i *iter) close(err error) error {
- i.mu.Lock()
- defer i.mu.Unlock()
- if i.closed {
- return nil
- }
- i.closed = true
-
- if i.lasterr == nil {
- i.lasterr = err
- }
-
- err = i.feed.Close()
-
- if i.cancel != nil {
- i.cancel()
- }
-
- return err
-}
-
-// Err returns the error, if any, that was encountered during iteration. Err
-// may be called after an explicit or implicit Close.
-func (i *iter) Err() error {
- i.mu.RLock()
- defer i.mu.RUnlock()
- if i.lasterr == io.EOF {
- return nil
- }
- return i.lasterr
-}
-
-func scan(dest interface{}, val json.RawMessage) error {
- if reflect.TypeOf(dest).Kind() != reflect.Ptr {
- return errNonPtr
- }
- switch d := dest.(type) {
- case *[]byte:
- if d == nil {
- return errNilPtr
- }
- tgt := make([]byte, len(val))
- copy(tgt, val)
- *d = tgt
- return nil
- case *json.RawMessage:
- if d == nil {
- return errNilPtr
- }
- *d = val
- return nil
- }
- if err := json.Unmarshal(val, dest); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/kivik.go b/vendor/github.com/go-kivik/kivik/v3/kivik.go
deleted file mode 100644
index 5acf733d99..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/kivik.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package kivik
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Client is a client connection handle to a CouchDB-like server.
-type Client struct {
- dsn string
- driverName string
- driverClient driver.Client
-}
-
-// Options is a collection of options. The keys and values are backend specific.
-type Options map[string]interface{}
-
-func mergeOptions(otherOpts ...Options) Options {
- if len(otherOpts) == 0 {
- return nil
- }
- options := make(Options)
- for _, opts := range otherOpts {
- for k, v := range opts {
- options[k] = v
- }
- }
- if len(options) == 0 {
- return nil
- }
- return options
-}
-
-// New creates a new client object specified by its database driver name
-// and a driver-specific data source name.
-func New(driverName, dataSourceName string) (*Client, error) {
- driversMu.RLock()
- driveri, ok := drivers[driverName]
- driversMu.RUnlock()
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusBadRequest, Message: fmt.Sprintf("kivik: unknown driver %q (forgotten import?)", driverName)}
- }
- client, err := driveri.NewClient(dataSourceName)
- if err != nil {
- return nil, err
- }
- return &Client{
- dsn: dataSourceName,
- driverName: driverName,
- driverClient: client,
- }, nil
-}
-
-// Driver returns the name of the driver string used to connect this client.
-func (c *Client) Driver() string {
- return c.driverName
-}
-
-// DSN returns the data source name used to connect this client.
-func (c *Client) DSN() string {
- return c.dsn
-}
-
-// Version represents a server version response.
-type Version struct {
- // Version is the version number reported by the server or backend.
- Version string
- // Vendor is the vendor string reported by the server or backend.
- Vendor string
- // Features is a list of enabled, optional features. This was added in
- // CouchDB 2.1.0, and can be expected to be empty for older versions.
- Features []string
- // RawResponse is the raw response body returned by the server, useful if
- // you need additional backend-specific information.
- //
- // For the format of this document, see
- // http://docs.couchdb.org/en/2.0.0/api/server/common.html#get
- RawResponse json.RawMessage
-}
-
-// Version returns version and vendor info about the backend.
-func (c *Client) Version(ctx context.Context) (*Version, error) {
- ver, err := c.driverClient.Version(ctx)
- if err != nil {
- return nil, err
- }
- v := &Version{}
- *v = Version(*ver)
- return v, nil
-}
-
-// DB returns a handle to the requested database. Any options parameters
-// passed are merged, with later values taking precidence. If any errors occur
-// at this stage, they are deferred, or may be checked directly with Err()
-func (c *Client) DB(ctx context.Context, dbName string, options ...Options) *DB {
- db, err := c.driverClient.DB(ctx, dbName, mergeOptions(options...))
- return &DB{
- client: c,
- name: dbName,
- driverDB: db,
- err: err,
- }
-}
-
-// AllDBs returns a list of all databases.
-func (c *Client) AllDBs(ctx context.Context, options ...Options) ([]string, error) {
- return c.driverClient.AllDBs(ctx, mergeOptions(options...))
-}
-
-// DBExists returns true if the specified database exists.
-func (c *Client) DBExists(ctx context.Context, dbName string, options ...Options) (bool, error) {
- return c.driverClient.DBExists(ctx, dbName, mergeOptions(options...))
-}
-
-// CreateDB creates a DB of the requested name. Any errors are deferred, or may
-// be checked with Err().
-func (c *Client) CreateDB(ctx context.Context, dbName string, options ...Options) error {
- return c.driverClient.CreateDB(ctx, dbName, mergeOptions(options...))
-}
-
-// DestroyDB deletes the requested DB.
-func (c *Client) DestroyDB(ctx context.Context, dbName string, options ...Options) error {
- return c.driverClient.DestroyDB(ctx, dbName, mergeOptions(options...))
-}
-
-// Authenticate authenticates the client with the passed authenticator, which
-// is driver-specific. If the driver does not understand the authenticator, an
-// error will be returned.
-func (c *Client) Authenticate(ctx context.Context, a interface{}) error {
- if auth, ok := c.driverClient.(driver.Authenticator); ok {
- return auth.Authenticate(ctx, a)
- }
- return &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support authentication"}
-}
-
-func missingArg(arg string) error {
- return &Error{HTTPStatus: http.StatusBadRequest, Message: fmt.Sprintf("kivik: %s required", arg)}
-}
-
-// DBsStats returns database statistics about one or more databases.
-func (c *Client) DBsStats(ctx context.Context, dbnames []string) ([]*DBStats, error) {
- dbstats, err := c.nativeDBsStats(ctx, dbnames)
- switch StatusCode(err) {
- case http.StatusNotFound, http.StatusNotImplemented:
- return c.fallbackDBsStats(ctx, dbnames)
- }
- return dbstats, err
-}
-
-func (c *Client) fallbackDBsStats(ctx context.Context, dbnames []string) ([]*DBStats, error) {
- dbstats := make([]*DBStats, len(dbnames))
- for i, dbname := range dbnames {
- db := c.DB(ctx, dbname)
- stat, err := db.Stats(ctx)
- if err != nil {
- return nil, err
- }
- dbstats[i] = stat
- }
- return dbstats, nil
-}
-
-func (c *Client) nativeDBsStats(ctx context.Context, dbnames []string) ([]*DBStats, error) {
- statser, ok := c.driverClient.(driver.DBsStatser)
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: not supported by driver"}
- }
- stats, err := statser.DBsStats(ctx, dbnames)
- if err != nil {
- return nil, err
- }
- dbstats := make([]*DBStats, len(stats))
- for i, stat := range stats {
- dbstats[i] = driverStats2kivikStats(stat)
- }
- return dbstats, nil
-}
-
-// Ping returns true if the database is online and available for requests,
-// for instance by querying the /_up endpoint. If the underlying driver
-// supports the Pinger interface, it will be used. Otherwise, a fallback is
-// made to calling Version.
-func (c *Client) Ping(ctx context.Context) (bool, error) {
- if pinger, ok := c.driverClient.(driver.Pinger); ok {
- return pinger.Ping(ctx)
- }
- _, err := c.driverClient.Version(ctx)
- return err == nil, err
-}
-
-// Close cleans up any resources used by Client.
-func (c *Client) Close(ctx context.Context) error {
- if closer, ok := c.driverClient.(driver.ClientCloser); ok {
- return closer.Close(ctx)
- }
- return nil
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/package.json b/vendor/github.com/go-kivik/kivik/v3/package.json
deleted file mode 100644
index 7277154568..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "kivik",
- "version": "0.0.1",
- "description": "Isomorphic Go and GopherJS client library for CouchDB & PouchDB",
- "author": "Jonathan Hall ",
- "repository": {
- "type": "git",
- "url": "https://github.com/go-kivik/kivik"
- },
- "devDependencies": {
- "pouchdb": "*",
- "pouchdb-find": "*",
- "pouchdb-all-dbs": "*",
- "memdown": ">=1.1.0",
- "inherits": "*",
- "xhr2": "*"
- }
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/registry.go b/vendor/github.com/go-kivik/kivik/v3/registry.go
deleted file mode 100644
index 47fb1fec54..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/registry.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package kivik
-
-import (
- "sync"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var (
- driversMu sync.RWMutex
- drivers = make(map[string]driver.Driver)
-)
-
-// Register makes a database driver available by the provided name. If Register
-// is called twice with the same name or if driver is nil, it panics.
-func Register(name string, driver driver.Driver) {
- driversMu.Lock()
- defer driversMu.Unlock()
- if driver == nil {
- panic("kivik: Register driver is nil")
- }
- if _, dup := drivers[name]; dup {
- panic("kivk: Register called twice for driver " + name)
- }
- drivers[name] = driver
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/replication.go b/vendor/github.com/go-kivik/kivik/v3/replication.go
deleted file mode 100644
index 0eb0f02be6..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/replication.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
- "sync"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// ReplicationState represents a replication's state
-type ReplicationState string
-
-// The possible values for the _replication_state field in _replicator documents
-// plus a blank value for unstarted replications.
-const (
- ReplicationNotStarted ReplicationState = ""
- ReplicationStarted ReplicationState = "triggered"
- ReplicationError ReplicationState = "error"
- ReplicationComplete ReplicationState = "completed"
-)
-
-// The additional possible values for the state field in the _scheduler docs.
-const (
- ReplicationInitializing ReplicationState = "initializing"
- ReplicationRunning ReplicationState = "running"
- ReplicationPending ReplicationState = "pending"
- ReplicationCrashing ReplicationState = "crashing"
- ReplicationFailed ReplicationState = "failed"
-)
-
-// Replication represents a CouchDB replication process.
-type Replication struct {
- Source string
- Target string
-
- infoMU sync.RWMutex
- info *driver.ReplicationInfo
- statusErr error
- irep driver.Replication
-}
-
-// DocsWritten returns the number of documents written, if known.
-func (r *Replication) DocsWritten() int64 {
- if r != nil && r.info != nil {
- r.infoMU.RLock()
- defer r.infoMU.RUnlock()
- return r.info.DocsWritten
- }
- return 0
-}
-
-// DocsRead returns the number of documents read, if known.
-func (r *Replication) DocsRead() int64 {
- if r != nil && r.info != nil {
- r.infoMU.RLock()
- defer r.infoMU.RUnlock()
- return r.info.DocsRead
- }
- return 0
-}
-
-// DocWriteFailures returns the number of doc write failures, if known.
-func (r *Replication) DocWriteFailures() int64 {
- if r != nil && r.info != nil {
- r.infoMU.RLock()
- defer r.infoMU.RUnlock()
- return r.info.DocWriteFailures
- }
- return 0
-}
-
-// Progress returns the current replication progress, if known.
-func (r *Replication) Progress() float64 {
- if r != nil && r.info != nil {
- r.infoMU.RLock()
- defer r.infoMU.RUnlock()
- return r.info.Progress
- }
- return 0
-}
-
-func newReplication(rep driver.Replication) *Replication {
- return &Replication{
- Source: rep.Source(),
- Target: rep.Target(),
- irep: rep,
- }
-}
-
-// ReplicationID returns the _replication_id field of the replicator document.
-func (r *Replication) ReplicationID() string {
- return r.irep.ReplicationID()
-}
-
-// StartTime returns the replication start time, once the replication has been
-// triggered.
-func (r *Replication) StartTime() time.Time {
- return r.irep.StartTime()
-}
-
-// EndTime returns the replication end time, once the replication has terminated.
-func (r *Replication) EndTime() time.Time {
- return r.irep.EndTime()
-}
-
-// State returns the current replication state
-func (r *Replication) State() ReplicationState {
- return ReplicationState(r.irep.State())
-}
-
-// Err returns the error, if any, that caused the replication to abort.
-func (r *Replication) Err() error {
- if r == nil {
- return nil
- }
- return r.irep.Err()
-}
-
-// IsActive returns true if the replication has not yet completed or
-// errored.
-func (r *Replication) IsActive() bool {
- if r == nil {
- return false
- }
- switch r.State() {
- case ReplicationError, ReplicationComplete, ReplicationCrashing, ReplicationFailed:
- return false
- default:
- return true
- }
-}
-
-// Delete deletes a replication. If it is currently running, it will be
-// cancelled.
-func (r *Replication) Delete(ctx context.Context) error {
- return r.irep.Delete(ctx)
-}
-
-// Update requests a replication state update from the server. If there is an
-// error retrieving the update, it is returned and the replication state is
-// unaltered.
-func (r *Replication) Update(ctx context.Context) error {
- var info driver.ReplicationInfo
- r.statusErr = r.irep.Update(ctx, &info)
- if r.statusErr != nil {
- return r.statusErr
- }
- r.infoMU.Lock()
- r.info = &info
- r.infoMU.Unlock()
- return nil
-}
-
-var replicationNotImplemented = &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support replication"}
-
-// GetReplications returns a list of defined replications in the _replicator
-// database. Options are in the same format as to AllDocs(), except that
-// "conflicts" and "update_seq" are ignored.
-func (c *Client) GetReplications(ctx context.Context, options ...Options) ([]*Replication, error) {
- replicator, ok := c.driverClient.(driver.ClientReplicator)
- if !ok {
- return nil, replicationNotImplemented
- }
- reps, err := replicator.GetReplications(ctx, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- replications := make([]*Replication, len(reps))
- for i, rep := range reps {
- replications[i] = newReplication(rep)
- }
- return replications, nil
-}
-
-// Replicate initiates a replication from source to target.
-func (c *Client) Replicate(ctx context.Context, targetDSN, sourceDSN string, options ...Options) (*Replication, error) {
- replicator, ok := c.driverClient.(driver.ClientReplicator)
- if !ok {
- return nil, replicationNotImplemented
- }
- rep, err := replicator.Replicate(ctx, targetDSN, sourceDSN, mergeOptions(options...))
- if err != nil {
- return nil, err
- }
- return newReplication(rep), nil
-}
-
-// ReplicationInfo represents a snapshot of the status of a replication.
-type ReplicationInfo struct {
- DocWriteFailures int64
- DocsRead int64
- DocsWritten int64
- Progress float64
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/rows.go b/vendor/github.com/go-kivik/kivik/v3/rows.go
deleted file mode 100644
index db11fd0eda..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/rows.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Rows is an iterator over a a multi-value query.
-type Rows struct {
- *iter
- rowsi driver.Rows
-}
-
-// Next prepares the next result value for reading. It returns true on success
-// or false if there are no more results or an error occurs while preparing it.
-// Err should be consulted to distinguish between the two.
-func (r *Rows) Next() bool {
- return r.iter.Next()
-}
-
-// Err returns the error, if any, that was encountered during iteration. Err may
-// be called after an explicit or implicit Close.
-func (r *Rows) Err() error {
- return r.iter.Err()
-}
-
-// Close closes the Rows, preventing further enumeration, and freeing any
-// resources (such as the http request body) of the underlying query. If Next is
-// called and there are no further results, Rows is closed automatically and it
-// will suffice to check the result of Err. Close is idempotent and does not
-// affect the result of Err.
-func (r *Rows) Close() error {
- return r.iter.Close()
-}
-
-type rowsIterator struct{ driver.Rows }
-
-var _ iterator = &rowsIterator{}
-
-func (r *rowsIterator) Next(i interface{}) error { return r.Rows.Next(i.(*driver.Row)) }
-
-func newRows(ctx context.Context, rowsi driver.Rows) *Rows {
- return &Rows{
- iter: newIterator(ctx, &rowsIterator{rowsi}, &driver.Row{}),
- rowsi: rowsi,
- }
-}
-
-var (
- errNilPtr = &Error{HTTPStatus: http.StatusBadRequest, Message: "kivik: destination pointer is nil"}
- errNonPtr = &Error{HTTPStatus: http.StatusBadRequest, Message: "kivik: destination is not a pointer"}
-)
-
-// ScanValue copies the data from the result value into the value pointed at by
-// dest. Think of this as a json.Unmarshal into dest.
-//
-// If the dest argument has type *[]byte, Scan stores a copy of the input data.
-// The copy is owned by the caller and can be modified and held indefinitely.
-//
-// The copy can be avoided by using an argument of type *json.RawMessage
-// instead. After a ScanValue into a json.RawMessage, the slice is only valid
-// until the next call to Next or Close.
-//
-// For all other types, refer to the documentation for json.Unmarshal for type
-// conversion rules.
-func (r *Rows) ScanValue(dest interface{}) error {
- runlock, err := r.rlock()
- if err != nil {
- return err
- }
- defer runlock()
- if err := r.curVal.(*driver.Row).Error; err != nil {
- return err
- }
- return scan(dest, r.curVal.(*driver.Row).Value)
-}
-
-// ScanDoc works the same as ScanValue, but on the doc field of the result. It
-// will panic if the query does not include documents.
-func (r *Rows) ScanDoc(dest interface{}) error {
- runlock, err := r.rlock()
- if err != nil {
- return err
- }
- defer runlock()
- if err := r.curVal.(*driver.Row).Error; err != nil {
- return err
- }
- doc := r.curVal.(*driver.Row).Doc
- if doc == nil {
- return &Error{HTTPStatus: http.StatusBadRequest, Message: "kivik: doc is nil; does the query include docs?"}
- }
- return scan(dest, doc)
-}
-
-// ScanKey works the same as ScanValue, but on the key field of the result. For
-// simple keys, which are just strings, the Key() method may be easier to use.
-func (r *Rows) ScanKey(dest interface{}) error {
- runlock, err := r.rlock()
- if err != nil {
- return err
- }
- if err := r.curVal.(*driver.Row).Error; err != nil {
- return err
- }
- defer runlock()
- return scan(dest, r.curVal.(*driver.Row).Key)
-}
-
-// ID returns the ID of the current result.
-func (r *Rows) ID() string {
- runlock, err := r.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return r.curVal.(*driver.Row).ID
-}
-
-// Key returns the Key of the current result as a raw JSON string. For
-// compound keys, the ScanKey() method may be more convenient.
-func (r *Rows) Key() string {
- runlock, err := r.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return string(r.curVal.(*driver.Row).Key)
-}
-
-// Offset returns the starting offset where the result set started. It is
-// only guaranteed to be set after all result rows have been enumerated through
-// by Next, and thus should only be read after processing all rows in a result
-// set. Calling Close before enumerating will render this value unreliable.
-func (r *Rows) Offset() int64 {
- return r.rowsi.Offset()
-}
-
-// TotalRows returns the total number of rows in the view which would have been
-// returned if no limiting were used. This value is only guaranteed to be set
-// after all result rows have been enumerated through by Next, and thus should
-// only be read after processing all rows in a result set. Calling Close before
-// enumerating will render this value unreliable.
-func (r *Rows) TotalRows() int64 {
- return r.rowsi.TotalRows()
-}
-
-// UpdateSeq returns the sequence id of the underlying database the view
-// reflects, if requested in the query. This value is only guaranteed to be set
-// after all result rows have been enumerated through by Next, and thus should
-// only be read after processing all rows in a result set. Calling Close before
-// enumerating will render this value unreliable.
-func (r *Rows) UpdateSeq() string {
- return r.rowsi.UpdateSeq()
-}
-
-// Warning returns a warning generated by the query, if any. This value is only
-// guaranteed to be set after all result rows have been enumeratd through by
-// Next.
-func (r *Rows) Warning() string {
- if w, ok := r.rowsi.(driver.RowsWarner); ok {
- return w.Warning()
- }
- return ""
-}
-
-// Bookmark returns the paging bookmark, if one was provided with the result
-// set. This is intended for use with the Mango /_find interface, with CouchDB
-// 2.1.1 and later. Consult the official CouchDB documentation for detailed
-// usage instructions. http://docs.couchdb.org/en/2.1.1/api/database/find.html#pagination
-func (r *Rows) Bookmark() string {
- if b, ok := r.rowsi.(driver.Bookmarker); ok {
- return b.Bookmark()
- }
- return ""
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/security.go b/vendor/github.com/go-kivik/kivik/v3/security.go
deleted file mode 100644
index af3da4b0b3..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/security.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package kivik
-
-// Members represents the members of a database security document.
-type Members struct {
- Names []string `json:"names,omitempty"`
- Roles []string `json:"roles,omitempty"`
-}
-
-// Security represents a database security document.
-type Security struct {
- Admins Members `json:"admins"`
- Members Members `json:"members"`
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/session.go b/vendor/github.com/go-kivik/kivik/v3/session.go
deleted file mode 100644
index 56a6f4647b..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/session.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package kivik
-
-import (
- "context"
- "encoding/json"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Session represents an authentication session.
-type Session struct {
- // Name is the name of the authenticated user.
- Name string
- // Roles is a list of roles the user belongs to.
- Roles []string
- // AuthenticationMethod is the authentication method that was used for this
- // session.
- AuthenticationMethod string
- // AuthenticationDB is the user database against which authentication was
- // performed.
- AuthenticationDB string
- // AuthenticationHandlers is a list of authentication handlers configured on
- // the server.
- AuthenticationHandlers []string
- // RawResponse is the raw JSON response sent by the server, useful for
- // custom backends which may provide additional fields.
- RawResponse json.RawMessage
-}
-
-// Session returns information about the currently authenticated user.
-func (c *Client) Session(ctx context.Context) (*Session, error) {
- if sessioner, ok := c.driverClient.(driver.Sessioner); ok {
- session, err := sessioner.Session(ctx)
- if err != nil {
- return nil, err
- }
- ses := Session(*session)
- return &ses, nil
- }
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not support sessions"}
-}
diff --git a/vendor/github.com/go-kivik/kivik/v3/updates.go b/vendor/github.com/go-kivik/kivik/v3/updates.go
deleted file mode 100644
index e6bd159660..0000000000
--- a/vendor/github.com/go-kivik/kivik/v3/updates.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package kivik
-
-import (
- "context"
- "net/http"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// DBUpdates provides access to database updates.
-type DBUpdates struct {
- *iter
- updatesi driver.DBUpdates
-}
-
-// Next returns the next DBUpdate from the feed. This function will block
-// until an event is received. If an error occurs, it will be returned and
-// the feed closed. If the feed was closed normally, io.EOF will be returned
-// when there are no more events in the buffer.
-func (f *DBUpdates) Next() bool {
- return f.iter.Next()
-}
-
-// Close closes the feed. Any unread updates will still be accessible via
-// Next().
-func (f *DBUpdates) Close() error {
- return f.iter.Close()
-}
-
-// Err returns the error, if any, that was encountered during iteration. Err
-// may be called after an explicit or implicit Close.
-func (f *DBUpdates) Err() error {
- return f.iter.Err()
-}
-
-type updatesIterator struct{ driver.DBUpdates }
-
-var _ iterator = &updatesIterator{}
-
-func (r *updatesIterator) Next(i interface{}) error { return r.DBUpdates.Next(i.(*driver.DBUpdate)) }
-
-func newDBUpdates(ctx context.Context, updatesi driver.DBUpdates) *DBUpdates {
- return &DBUpdates{
- iter: newIterator(ctx, &updatesIterator{updatesi}, &driver.DBUpdate{}),
- updatesi: updatesi,
- }
-}
-
-// DBName returns the database name for the current update.
-func (f *DBUpdates) DBName() string {
- runlock, err := f.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return f.curVal.(*driver.DBUpdate).DBName
-}
-
-// Type returns the type of the current update.
-func (f *DBUpdates) Type() string {
- runlock, err := f.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return f.curVal.(*driver.DBUpdate).Type
-}
-
-// Seq returns the update sequence of the current update.
-func (f *DBUpdates) Seq() string {
- runlock, err := f.rlock()
- if err != nil {
- return ""
- }
- defer runlock()
- return f.curVal.(*driver.DBUpdate).Seq
-}
-
-// DBUpdates begins polling for database updates.
-func (c *Client) DBUpdates(ctx context.Context) (*DBUpdates, error) {
- updater, ok := c.driverClient.(driver.DBUpdater)
- if !ok {
- return nil, &Error{HTTPStatus: http.StatusNotImplemented, Message: "kivik: driver does not implement DBUpdater"}
- }
- updatesi, err := updater.DBUpdates(ctx)
- if err != nil {
- return nil, err
- }
- return newDBUpdates(context.Background(), updatesi), nil
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/.gitignore b/vendor/github.com/go-kivik/kivikmock/v3/.gitignore
deleted file mode 100644
index 899e64b8ed..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-vendor/
-Gopkg.lock
-other/
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/.gitlab-ci.yml b/vendor/github.com/go-kivik/kivikmock/v3/.gitlab-ci.yml
deleted file mode 100644
index d43ddb1ce3..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/.gitlab-ci.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-stages:
- - test
-
-variables:
- GO111MODULE: "on"
-
-.test: &test_template
- stage: test
- script:
- - go mod download
- - go test -race -tags=livetest ./...
-
-lint:
- stage: test
- image: golang:1.13
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6
- - golangci-lint run ./...
-
-coverage:
- stage: test
- image: golang:1.13
- services: []
- before_script:
- - ''
- script:
- - go mod download
- - ./script/coverage.sh
-
-go-1.11:
- <<: *test_template
- image: golang:1.11
-
-go-1.12:
- <<: *test_template
- image: golang:1.12
-
-go-1.13:
- <<: *test_template
- image: golang:1.13
-
-gopherjs-1.12:
- <<: *test_template
- variables:
- SRCDIR: /go/src/github.com/go-kivik/kivikmock/v3
- GO111MODULE: "on"
- image: golang:1.12
- script:
- - go get golang.org/dl/go1.12.16
- - go1.12.16 download
- - mkdir -p ${SRCDIR}
- - mv ${CI_PROJECT_DIR}/* ${SRCDIR}
- - cd ${SRCDIR}
- - go mod vendor
- - curl -sL https://deb.nodesource.com/setup_12.x | bash -
- - apt-get update -qq && apt-get install -y nodejs
- - npm install
- - GO111MODULE=off go get -u github.com/gopherjs/gopherjs
- - npm install source-map-support
- - |
- (
- cd $GOPATH/src/github.com/gopherjs/gopherjs/node-syscall/
- npm install --global node-gyp
- node-gyp rebuild
- mkdir -p ~/.node_libraries/
- cp build/Release/syscall.node ~/.node_libraries/syscall.node
- )
- - GOPHERJS_GOROOT="$(go1.12.16 env GOROOT)" gopherjs test ./...
-
-go-rc:
- <<: *test_template
- stage: test
- image: golang:rc
- allow_failure: true
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/.golangci.toml b/vendor/github.com/go-kivik/kivikmock/v3/.golangci.toml
deleted file mode 100644
index 2949d722af..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/.golangci.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[output]
-format = "colored-line-number"
-
-[linters]
-enable = [
- "interfacer", "gocyclo", "unconvert", "goimports", "unused", "varcheck",
- "vetshadow", "misspell", "nakedret", "errcheck", "golint", "ineffassign",
- "deadcode", "goconst", "vet", "unparam", "gofmt"
-]
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/LICENSE.md b/vendor/github.com/go-kivik/kivikmock/v3/LICENSE.md
deleted file mode 100644
index 883a19055a..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2019 Jonathan Hall
-
-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/vendor/github.com/go-kivik/kivikmock/v3/README.md b/vendor/github.com/go-kivik/kivikmock/v3/README.md
deleted file mode 100644
index f0534d3162..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-[](https://travis-ci.org/go-kivik/kivikmock) [](https://codecov.io/gh/go-kivik/kivikmock) [](https://goreportcard.com/report/github.com/go-kivik/kivikmock) [](http://godoc.org/github.com/go-kivik/kivikmock) [](http://kivik.io)
-
-# Kivikmock
-
-Package **kivikmock** is a mock library implementing a Kivik driver.
-
-This package is heavily influenced by [github.com/DATA-DOG/go-sqlmock](https://github.com/DATA-DOG/go-sqlmock), the SQL mock driver from [Datadog](https://www.datadoghq.com/).
-
-# Usage
-
-To use this package, in your `*_test.go` file, create a mock Kivik connection:
-
- client, mock, err := kivikmock.New()
- if err != nil {
- panic(err)
- }
-
-The returned `client` object is a `*kivik.Client`, and can be passed to your
-methods to be tested. `mock` is used to control the execution of the mock
-driver, by setting expectations. To test a function which fetches a user,
-for example, you might do something like this:
-
- func TestGetUser(t *testing.T) {
- client, mock, err := kivikmock.New()
- if err != nil {
- t.Fatal(err)
- }
-
- mock.ExpectDB().WithName("_users").WillReturn(mock.NewDB().
- ExpectGet().WithDocID("bob").
- WillReturn(kivikmock.DocumentT(t, `{"_id":"org.couchdb.user:bob"}`)),
- )
- user, err := GetUser(client, "bob")
- if err != nil {
- t.Error(err)
- }
- // other validation
- }
-
-# Versions
-
-This package targets the unstable release of Kivik.
-
-## License
-
-This software is released under the terms of the Apache 2.0 license. See
-LICENCE.md, or read the [full license](http://www.apache.org/licenses/LICENSE-2.0).
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/bulk.go b/vendor/github.com/go-kivik/kivikmock/v3/bulk.go
deleted file mode 100644
index 12ba54bc3c..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/bulk.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// BulkResults is a mocked collection of BulkDoc results.
-type BulkResults struct {
- iter
-}
-
-type driverBulkResults struct {
- context.Context
- *BulkResults
-}
-
-var _ driver.BulkResults = &driverBulkResults{}
-
-func (r *driverBulkResults) Next(res *driver.BulkResult) error {
- result, err := r.unshift(r.Context)
- if err != nil {
- return err
- }
- *res = *result.(*driver.BulkResult)
- return nil
-}
-
-// CloseError sets an error to be returned when the iterator is closed.
-func (r *BulkResults) CloseError(err error) *BulkResults {
- r.closeErr = err
- return r
-}
-
-// AddResult adds a bulk result to be returned by the iterator. If
-// AddResultError has been set, this method will panic.
-func (r *BulkResults) AddResult(result *driver.BulkResult) *BulkResults {
- if r.resultErr != nil {
- panic("It is invalid to set more results after AddResultError is defined.")
- }
- r.push(&item{item: result})
- return r
-}
-
-// AddResultError adds an error to be returned during iteration.
-func (r *BulkResults) AddResultError(err error) *BulkResults {
- r.resultErr = err
- return r
-}
-
-// AddDelay adds a delay before the next iteration will complete.
-func (r *BulkResults) AddDelay(delay time.Duration) *BulkResults {
- r.push(&item{delay: delay})
- return r
-}
-
-// Final converts the BulkResults object to a driver.BulkResults. This method
-// is intended for use within WillExecute() to return results.
-func (r *BulkResults) Final() driver.BulkResults {
- return &driverBulkResults{BulkResults: r}
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/changes.go b/vendor/github.com/go-kivik/kivikmock/v3/changes.go
deleted file mode 100644
index 2c846d3baf..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/changes.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Changes is a mocked collection of Changes results.
-type Changes struct {
- iter
- lastSeq string
- pending int64
- etag string
-}
-
-type driverChanges struct {
- context.Context
- *Changes
-}
-
-var _ driver.Changes = &driverChanges{}
-
-func (r *driverChanges) Next(res *driver.Change) error {
- result, err := r.unshift(r.Context)
- if err != nil {
- return err
- }
- *res = *result.(*driver.Change)
- return nil
-}
-
-func (r *driverChanges) LastSeq() string { return r.lastSeq }
-func (r *driverChanges) Pending() int64 { return r.pending }
-func (r *driverChanges) ETag() string { return r.etag }
-
-// CloseError sets an error to be returned when the iterator is closed.
-func (r *Changes) CloseError(err error) *Changes {
- r.closeErr = err
- return r
-}
-
-// LastSeq sets the last_seq value to be returned by the changes iterator.
-func (r *Changes) LastSeq(seq string) *Changes {
- r.lastSeq = seq
- return r
-}
-
-// Pending sets the pending value to be returned by the changes iterator.
-func (r *Changes) Pending(pending int64) *Changes {
- r.pending = pending
- return r
-}
-
-// ETag sets the etag value to be returned by the changes iterator.
-func (r *Changes) ETag(etag string) *Changes {
- r.etag = etag
- return r
-}
-
-// AddChange adds a change result to be returned by the iterator. If
-// AddResultError has been set, this method will panic.
-func (r *Changes) AddChange(change *driver.Change) *Changes {
- if r.resultErr != nil {
- panic("It is invalid to set more changes after AddChangeError is defined.")
- }
- r.push(&item{item: change})
- return r
-}
-
-// AddChangeError adds an error to be returned during iteration.
-func (r *Changes) AddChangeError(err error) *Changes {
- r.resultErr = err
- return r
-}
-
-// AddDelay adds a delay before the next iteration will complete.
-func (r *Changes) AddDelay(delay time.Duration) *Changes {
- r.push(&item{delay: delay})
- return r
-}
-
-// Final converts the Changes object to a driver.Changes. This method is
-// intended for use within WillExecute() to return results.
-func (r *Changes) Final() driver.Changes {
- return &driverChanges{Changes: r}
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/client.go b/vendor/github.com/go-kivik/kivikmock/v3/client.go
deleted file mode 100644
index a0a3a1db24..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/client.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "errors"
- "reflect"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type driverClient struct {
- *Client
-}
-
-var _ driver.Client = &driverClient{}
-var _ driver.ClientCloser = &driverClient{}
-var _ driver.Authenticator = &driverClient{}
-var _ driver.Cluster = &driverClient{}
-var _ driver.DBsStatser = &driverClient{}
-var _ driver.Pinger = &driverClient{}
-var _ driver.Sessioner = &driverClient{}
-var _ driver.Configer = &driverClient{}
-
-func (c *driverClient) Authenticate(ctx context.Context, authenticator interface{}) error {
- expected := &ExpectedAuthenticate{
- authType: reflect.TypeOf(authenticator).Name(),
- }
- if err := c.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, authenticator)
- }
- return expected.wait(ctx)
-}
-
-func (c *driverClient) CreateDB(ctx context.Context, name string, options map[string]interface{}) error {
- expected := &ExpectedCreateDB{
- arg0: name,
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, name, options)
- }
- return expected.wait(ctx)
-}
-
-type driverReplication struct {
- *Replication
-}
-
-var _ driver.Replication = &driverReplication{}
-
-func (r *driverReplication) ReplicationID() string {
- return r.Replication.id
-}
-
-func (r *driverReplication) Source() string {
- return r.Replication.source
-}
-
-func (r *driverReplication) Target() string {
- return r.Replication.target
-}
-
-func (r *driverReplication) StartTime() time.Time {
- return r.Replication.startTime
-}
-
-func (r *driverReplication) EndTime() time.Time {
- return r.Replication.endTime
-}
-
-func (r *driverReplication) State() string {
- return r.Replication.state
-}
-
-func (r *driverReplication) Err() error {
- return r.Replication.err
-}
-
-func (r *driverReplication) Delete(_ context.Context) error {
- return errors.New("not implemented")
-}
-
-func (r *driverReplication) Update(_ context.Context, _ *driver.ReplicationInfo) error {
- return errors.New("not implemented")
-}
-
-func driverReplications(in []*Replication) []driver.Replication {
- out := make([]driver.Replication, len(in))
- for i, r := range in {
- out[i] = &driverReplication{r}
- }
- return out
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/client_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/client_gen.go
deleted file mode 100644
index c57ccd7b30..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/client_gen.go
+++ /dev/null
@@ -1,278 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- "context"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = &driver.Attachment{}
-
-func (c *driverClient) AllDBs(ctx context.Context, options map[string]interface{}) ([]string, error) {
- expected := &ExpectedAllDBs{
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) Close(ctx context.Context) error {
- expected := &ExpectedClose{}
- if err := c.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.wait(ctx)
-}
-
-func (c *driverClient) ClusterSetup(ctx context.Context, arg0 interface{}) error {
- expected := &ExpectedClusterSetup{
- arg0: arg0,
- }
- if err := c.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.wait(ctx)
-}
-
-func (c *driverClient) ClusterStatus(ctx context.Context, options map[string]interface{}) (string, error) {
- expected := &ExpectedClusterStatus{
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) ConfigValue(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error) {
- expected := &ExpectedConfigValue{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- }
- if err := c.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) DBExists(ctx context.Context, arg0 string, options map[string]interface{}) (bool, error) {
- expected := &ExpectedDBExists{
- arg0: arg0,
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return false, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) DeleteConfigKey(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error) {
- expected := &ExpectedDeleteConfigKey{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- }
- if err := c.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) DestroyDB(ctx context.Context, arg0 string, options map[string]interface{}) error {
- expected := &ExpectedDestroyDB{
- arg0: arg0,
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return expected.wait(ctx)
-}
-
-func (c *driverClient) Ping(ctx context.Context) (bool, error) {
- expected := &ExpectedPing{}
- if err := c.nextExpectation(expected); err != nil {
- return false, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) SetConfigValue(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error) {
- expected := &ExpectedSetConfigValue{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- arg3: arg3,
- }
- if err := c.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2, arg3)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) Config(ctx context.Context, arg0 string) (driver.Config, error) {
- expected := &ExpectedConfig{
- arg0: arg0,
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) ConfigSection(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error) {
- expected := &ExpectedConfigSection{
- arg0: arg0,
- arg1: arg1,
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) DB(ctx context.Context, arg0 string, options map[string]interface{}) (driver.DB, error) {
- expected := &ExpectedDB{
- arg0: arg0,
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- expected.ret0.mu.Lock()
- expected.ret0.name = arg0
- expected.ret0.mu.Unlock()
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return &driverDB{DB: expected.ret0}, expected.wait(ctx)
-}
-
-func (c *driverClient) DBUpdates(ctx context.Context) (driver.DBUpdates, error) {
- expected := &ExpectedDBUpdates{}
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return &driverDBUpdates{Context: ctx, Updates: expected.ret0}, expected.wait(ctx)
-}
-
-func (c *driverClient) DBsStats(ctx context.Context, arg0 []string) ([]*driver.DBStats, error) {
- expected := &ExpectedDBsStats{
- arg0: arg0,
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) GetReplications(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error) {
- expected := &ExpectedGetReplications{
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return driverReplications(expected.ret0), expected.wait(ctx)
-}
-
-func (c *driverClient) Replicate(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Replication, error) {
- expected := &ExpectedReplicate{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- options: options,
- },
- }
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return &driverReplication{Replication: expected.ret0}, expected.wait(ctx)
-}
-
-func (c *driverClient) Session(ctx context.Context) (*driver.Session, error) {
- expected := &ExpectedSession{}
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (c *driverClient) Version(ctx context.Context) (*driver.Version, error) {
- expected := &ExpectedVersion{}
- if err := c.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/clientexpectations_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/clientexpectations_gen.go
deleted file mode 100644
index 318d055cc7..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/clientexpectations_gen.go
+++ /dev/null
@@ -1,1058 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- "context"
- "fmt"
- "reflect"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = &driver.Attachment{}
-var _ = reflect.Int
-
-// ExpectedAllDBs represents an expectation for a call to AllDBs().
-type ExpectedAllDBs struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) ([]string, error)
- ret0 []string
-}
-
-// WithOptions sets the expected options for the call to AllDBs().
-func (e *ExpectedAllDBs) WithOptions(options map[string]interface{}) *ExpectedAllDBs {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedAllDBs) WillExecute(cb func(ctx context.Context, options map[string]interface{}) ([]string, error)) *ExpectedAllDBs {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to AllDBs().
-func (e *ExpectedAllDBs) WillReturn(ret0 []string) *ExpectedAllDBs {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to AllDBs().
-func (e *ExpectedAllDBs) WillReturnError(err error) *ExpectedAllDBs {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to AllDBs() to delay.
-func (e *ExpectedAllDBs) WillDelay(delay time.Duration) *ExpectedAllDBs {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedAllDBs) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedAllDBs) method(v bool) string {
- if !v {
- return "AllDBs()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("AllDBs(ctx, %s)", options)
-}
-
-// ExpectedClose represents an expectation for a call to Close().
-type ExpectedClose struct {
- commonExpectation
- callback func(ctx context.Context) error
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedClose) WillExecute(cb func(ctx context.Context) error) *ExpectedClose {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Close().
-func (e *ExpectedClose) WillReturnError(err error) *ExpectedClose {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Close() to delay.
-func (e *ExpectedClose) WillDelay(delay time.Duration) *ExpectedClose {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedClose) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedClose) method(v bool) string {
- if !v {
- return "Close()"
- }
- return fmt.Sprintf("Close(ctx)")
-}
-
-// ExpectedClusterSetup represents an expectation for a call to ClusterSetup().
-type ExpectedClusterSetup struct {
- commonExpectation
- callback func(ctx context.Context, arg0 interface{}) error
- arg0 interface{}
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedClusterSetup) WillExecute(cb func(ctx context.Context, arg0 interface{}) error) *ExpectedClusterSetup {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to ClusterSetup().
-func (e *ExpectedClusterSetup) WillReturnError(err error) *ExpectedClusterSetup {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to ClusterSetup() to delay.
-func (e *ExpectedClusterSetup) WillDelay(delay time.Duration) *ExpectedClusterSetup {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedClusterSetup) met(ex expectation) bool {
- exp := ex.(*ExpectedClusterSetup)
- if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedClusterSetup) method(v bool) string {
- if !v {
- return "ClusterSetup()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("ClusterSetup(ctx, %s)", arg0)
-}
-
-// ExpectedClusterStatus represents an expectation for a call to ClusterStatus().
-type ExpectedClusterStatus struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) (string, error)
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to ClusterStatus().
-func (e *ExpectedClusterStatus) WithOptions(options map[string]interface{}) *ExpectedClusterStatus {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedClusterStatus) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (string, error)) *ExpectedClusterStatus {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to ClusterStatus().
-func (e *ExpectedClusterStatus) WillReturn(ret0 string) *ExpectedClusterStatus {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to ClusterStatus().
-func (e *ExpectedClusterStatus) WillReturnError(err error) *ExpectedClusterStatus {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to ClusterStatus() to delay.
-func (e *ExpectedClusterStatus) WillDelay(delay time.Duration) *ExpectedClusterStatus {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedClusterStatus) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedClusterStatus) method(v bool) string {
- if !v {
- return "ClusterStatus()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("ClusterStatus(ctx, %s)", options)
-}
-
-// ExpectedConfigValue represents an expectation for a call to ConfigValue().
-type ExpectedConfigValue struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
- arg0 string
- arg1 string
- arg2 string
- ret0 string
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedConfigValue {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to ConfigValue().
-func (e *ExpectedConfigValue) WillReturn(ret0 string) *ExpectedConfigValue {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to ConfigValue().
-func (e *ExpectedConfigValue) WillReturnError(err error) *ExpectedConfigValue {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to ConfigValue() to delay.
-func (e *ExpectedConfigValue) WillDelay(delay time.Duration) *ExpectedConfigValue {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedConfigValue) met(ex expectation) bool {
- exp := ex.(*ExpectedConfigValue)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != "" && exp.arg2 != e.arg2 {
- return false
- }
- return true
-}
-
-func (e *ExpectedConfigValue) method(v bool) string {
- if !v {
- return "ConfigValue()"
- }
- arg0, arg1, arg2 := "?", "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != "" {
- arg2 = fmt.Sprintf("%q", e.arg2)
- }
- return fmt.Sprintf("ConfigValue(ctx, %s, %s, %s)", arg0, arg1, arg2)
-}
-
-// ExpectedDBExists represents an expectation for a call to DBExists().
-type ExpectedDBExists struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) (bool, error)
- arg0 string
- ret0 bool
-}
-
-// WithOptions sets the expected options for the call to DBExists().
-func (e *ExpectedDBExists) WithOptions(options map[string]interface{}) *ExpectedDBExists {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDBExists) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (bool, error)) *ExpectedDBExists {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DBExists().
-func (e *ExpectedDBExists) WillReturn(ret0 bool) *ExpectedDBExists {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DBExists().
-func (e *ExpectedDBExists) WillReturnError(err error) *ExpectedDBExists {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DBExists() to delay.
-func (e *ExpectedDBExists) WillDelay(delay time.Duration) *ExpectedDBExists {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDBExists) met(ex expectation) bool {
- exp := ex.(*ExpectedDBExists)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDBExists) method(v bool) string {
- if !v {
- return "DBExists()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DBExists(ctx, %s, %s)", arg0, options)
-}
-
-// ExpectedDeleteConfigKey represents an expectation for a call to DeleteConfigKey().
-type ExpectedDeleteConfigKey struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)
- arg0 string
- arg1 string
- arg2 string
- ret0 string
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDeleteConfigKey) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string) (string, error)) *ExpectedDeleteConfigKey {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DeleteConfigKey().
-func (e *ExpectedDeleteConfigKey) WillReturn(ret0 string) *ExpectedDeleteConfigKey {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DeleteConfigKey().
-func (e *ExpectedDeleteConfigKey) WillReturnError(err error) *ExpectedDeleteConfigKey {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DeleteConfigKey() to delay.
-func (e *ExpectedDeleteConfigKey) WillDelay(delay time.Duration) *ExpectedDeleteConfigKey {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDeleteConfigKey) met(ex expectation) bool {
- exp := ex.(*ExpectedDeleteConfigKey)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != "" && exp.arg2 != e.arg2 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDeleteConfigKey) method(v bool) string {
- if !v {
- return "DeleteConfigKey()"
- }
- arg0, arg1, arg2 := "?", "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != "" {
- arg2 = fmt.Sprintf("%q", e.arg2)
- }
- return fmt.Sprintf("DeleteConfigKey(ctx, %s, %s, %s)", arg0, arg1, arg2)
-}
-
-// ExpectedDestroyDB represents an expectation for a call to DestroyDB().
-type ExpectedDestroyDB struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) error
- arg0 string
-}
-
-// WithOptions sets the expected options for the call to DestroyDB().
-func (e *ExpectedDestroyDB) WithOptions(options map[string]interface{}) *ExpectedDestroyDB {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDestroyDB) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) error) *ExpectedDestroyDB {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DestroyDB().
-func (e *ExpectedDestroyDB) WillReturnError(err error) *ExpectedDestroyDB {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DestroyDB() to delay.
-func (e *ExpectedDestroyDB) WillDelay(delay time.Duration) *ExpectedDestroyDB {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDestroyDB) met(ex expectation) bool {
- exp := ex.(*ExpectedDestroyDB)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDestroyDB) method(v bool) string {
- if !v {
- return "DestroyDB()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DestroyDB(ctx, %s, %s)", arg0, options)
-}
-
-// ExpectedPing represents an expectation for a call to Ping().
-type ExpectedPing struct {
- commonExpectation
- callback func(ctx context.Context) (bool, error)
- ret0 bool
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedPing) WillExecute(cb func(ctx context.Context) (bool, error)) *ExpectedPing {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to Ping().
-func (e *ExpectedPing) WillReturn(ret0 bool) *ExpectedPing {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Ping().
-func (e *ExpectedPing) WillReturnError(err error) *ExpectedPing {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Ping() to delay.
-func (e *ExpectedPing) WillDelay(delay time.Duration) *ExpectedPing {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedPing) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedPing) method(v bool) string {
- if !v {
- return "Ping()"
- }
- return fmt.Sprintf("Ping(ctx)")
-}
-
-// ExpectedSetConfigValue represents an expectation for a call to SetConfigValue().
-type ExpectedSetConfigValue struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)
- arg0 string
- arg1 string
- arg2 string
- arg3 string
- ret0 string
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedSetConfigValue) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string, arg3 string) (string, error)) *ExpectedSetConfigValue {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to SetConfigValue().
-func (e *ExpectedSetConfigValue) WillReturn(ret0 string) *ExpectedSetConfigValue {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to SetConfigValue().
-func (e *ExpectedSetConfigValue) WillReturnError(err error) *ExpectedSetConfigValue {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to SetConfigValue() to delay.
-func (e *ExpectedSetConfigValue) WillDelay(delay time.Duration) *ExpectedSetConfigValue {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedSetConfigValue) met(ex expectation) bool {
- exp := ex.(*ExpectedSetConfigValue)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != "" && exp.arg2 != e.arg2 {
- return false
- }
- if exp.arg3 != "" && exp.arg3 != e.arg3 {
- return false
- }
- return true
-}
-
-func (e *ExpectedSetConfigValue) method(v bool) string {
- if !v {
- return "SetConfigValue()"
- }
- arg0, arg1, arg2, arg3 := "?", "?", "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != "" {
- arg2 = fmt.Sprintf("%q", e.arg2)
- }
- if e.arg3 != "" {
- arg3 = fmt.Sprintf("%q", e.arg3)
- }
- return fmt.Sprintf("SetConfigValue(ctx, %s, %s, %s, %s)", arg0, arg1, arg2, arg3)
-}
-
-// ExpectedConfig represents an expectation for a call to Config().
-type ExpectedConfig struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string) (driver.Config, error)
- arg0 string
- ret0 driver.Config
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedConfig) WillExecute(cb func(ctx context.Context, arg0 string) (driver.Config, error)) *ExpectedConfig {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to Config().
-func (e *ExpectedConfig) WillReturn(ret0 driver.Config) *ExpectedConfig {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Config().
-func (e *ExpectedConfig) WillReturnError(err error) *ExpectedConfig {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Config() to delay.
-func (e *ExpectedConfig) WillDelay(delay time.Duration) *ExpectedConfig {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedConfig) met(ex expectation) bool {
- exp := ex.(*ExpectedConfig)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedConfig) method(v bool) string {
- if !v {
- return "Config()"
- }
- arg0 := "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- return fmt.Sprintf("Config(ctx, %s)", arg0)
-}
-
-// ExpectedConfigSection represents an expectation for a call to ConfigSection().
-type ExpectedConfigSection struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)
- arg0 string
- arg1 string
- ret0 driver.ConfigSection
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedConfigSection) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string) (driver.ConfigSection, error)) *ExpectedConfigSection {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to ConfigSection().
-func (e *ExpectedConfigSection) WillReturn(ret0 driver.ConfigSection) *ExpectedConfigSection {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to ConfigSection().
-func (e *ExpectedConfigSection) WillReturnError(err error) *ExpectedConfigSection {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to ConfigSection() to delay.
-func (e *ExpectedConfigSection) WillDelay(delay time.Duration) *ExpectedConfigSection {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedConfigSection) met(ex expectation) bool {
- exp := ex.(*ExpectedConfigSection)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedConfigSection) method(v bool) string {
- if !v {
- return "ConfigSection()"
- }
- arg0, arg1 := "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- return fmt.Sprintf("ConfigSection(ctx, %s, %s)", arg0, arg1)
-}
-
-// ExpectedDB represents an expectation for a call to DB().
-type ExpectedDB struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) (driver.DB, error)
- arg0 string
- ret0 *DB
-}
-
-// WithOptions sets the expected options for the call to DB().
-func (e *ExpectedDB) WithOptions(options map[string]interface{}) *ExpectedDB {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDB) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (driver.DB, error)) *ExpectedDB {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB().
-func (e *ExpectedDB) WillReturn(ret0 *DB) *ExpectedDB {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB().
-func (e *ExpectedDB) WillReturnError(err error) *ExpectedDB {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB() to delay.
-func (e *ExpectedDB) WillDelay(delay time.Duration) *ExpectedDB {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDB) met(ex expectation) bool {
- exp := ex.(*ExpectedDB)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDB) method(v bool) string {
- if !v {
- return "DB()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(ctx, %s, %s)", arg0, options)
-}
-
-// ExpectedDBUpdates represents an expectation for a call to DBUpdates().
-type ExpectedDBUpdates struct {
- commonExpectation
- callback func(ctx context.Context) (driver.DBUpdates, error)
- ret0 *Updates
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDBUpdates) WillExecute(cb func(ctx context.Context) (driver.DBUpdates, error)) *ExpectedDBUpdates {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DBUpdates().
-func (e *ExpectedDBUpdates) WillReturn(ret0 *Updates) *ExpectedDBUpdates {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DBUpdates().
-func (e *ExpectedDBUpdates) WillReturnError(err error) *ExpectedDBUpdates {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DBUpdates() to delay.
-func (e *ExpectedDBUpdates) WillDelay(delay time.Duration) *ExpectedDBUpdates {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDBUpdates) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedDBUpdates) method(v bool) string {
- if !v {
- return "DBUpdates()"
- }
- return fmt.Sprintf("DBUpdates(ctx)")
-}
-
-// ExpectedDBsStats represents an expectation for a call to DBsStats().
-type ExpectedDBsStats struct {
- commonExpectation
- callback func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)
- arg0 []string
- ret0 []*driver.DBStats
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDBsStats) WillExecute(cb func(ctx context.Context, arg0 []string) ([]*driver.DBStats, error)) *ExpectedDBsStats {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DBsStats().
-func (e *ExpectedDBsStats) WillReturn(ret0 []*driver.DBStats) *ExpectedDBsStats {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DBsStats().
-func (e *ExpectedDBsStats) WillReturnError(err error) *ExpectedDBsStats {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DBsStats() to delay.
-func (e *ExpectedDBsStats) WillDelay(delay time.Duration) *ExpectedDBsStats {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDBsStats) met(ex expectation) bool {
- exp := ex.(*ExpectedDBsStats)
- if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedDBsStats) method(v bool) string {
- if !v {
- return "DBsStats()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DBsStats(ctx, %s)", arg0)
-}
-
-// ExpectedGetReplications represents an expectation for a call to GetReplications().
-type ExpectedGetReplications struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error)
- ret0 []*Replication
-}
-
-// WithOptions sets the expected options for the call to GetReplications().
-func (e *ExpectedGetReplications) WithOptions(options map[string]interface{}) *ExpectedGetReplications {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGetReplications) WillExecute(cb func(ctx context.Context, options map[string]interface{}) ([]driver.Replication, error)) *ExpectedGetReplications {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to GetReplications().
-func (e *ExpectedGetReplications) WillReturn(ret0 []*Replication) *ExpectedGetReplications {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to GetReplications().
-func (e *ExpectedGetReplications) WillReturnError(err error) *ExpectedGetReplications {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to GetReplications() to delay.
-func (e *ExpectedGetReplications) WillDelay(delay time.Duration) *ExpectedGetReplications {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGetReplications) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedGetReplications) method(v bool) string {
- if !v {
- return "GetReplications()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("GetReplications(ctx, %s)", options)
-}
-
-// ExpectedReplicate represents an expectation for a call to Replicate().
-type ExpectedReplicate struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Replication, error)
- arg0 string
- arg1 string
- ret0 *Replication
-}
-
-// WithOptions sets the expected options for the call to Replicate().
-func (e *ExpectedReplicate) WithOptions(options map[string]interface{}) *ExpectedReplicate {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedReplicate) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Replication, error)) *ExpectedReplicate {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to Replicate().
-func (e *ExpectedReplicate) WillReturn(ret0 *Replication) *ExpectedReplicate {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Replicate().
-func (e *ExpectedReplicate) WillReturnError(err error) *ExpectedReplicate {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Replicate() to delay.
-func (e *ExpectedReplicate) WillDelay(delay time.Duration) *ExpectedReplicate {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedReplicate) met(ex expectation) bool {
- exp := ex.(*ExpectedReplicate)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedReplicate) method(v bool) string {
- if !v {
- return "Replicate()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("Replicate(ctx, %s, %s, %s)", arg0, arg1, options)
-}
-
-// ExpectedSession represents an expectation for a call to Session().
-type ExpectedSession struct {
- commonExpectation
- callback func(ctx context.Context) (*driver.Session, error)
- ret0 *driver.Session
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedSession) WillExecute(cb func(ctx context.Context) (*driver.Session, error)) *ExpectedSession {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to Session().
-func (e *ExpectedSession) WillReturn(ret0 *driver.Session) *ExpectedSession {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Session().
-func (e *ExpectedSession) WillReturnError(err error) *ExpectedSession {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Session() to delay.
-func (e *ExpectedSession) WillDelay(delay time.Duration) *ExpectedSession {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedSession) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedSession) method(v bool) string {
- if !v {
- return "Session()"
- }
- return fmt.Sprintf("Session(ctx)")
-}
-
-// ExpectedVersion represents an expectation for a call to Version().
-type ExpectedVersion struct {
- commonExpectation
- callback func(ctx context.Context) (*driver.Version, error)
- ret0 *driver.Version
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedVersion) WillExecute(cb func(ctx context.Context) (*driver.Version, error)) *ExpectedVersion {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to Version().
-func (e *ExpectedVersion) WillReturn(ret0 *driver.Version) *ExpectedVersion {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to Version().
-func (e *ExpectedVersion) WillReturnError(err error) *ExpectedVersion {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to Version() to delay.
-func (e *ExpectedVersion) WillDelay(delay time.Duration) *ExpectedVersion {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedVersion) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedVersion) method(v bool) string {
- if !v {
- return "Version()"
- }
- return fmt.Sprintf("Version(ctx)")
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/clientmock.go b/vendor/github.com/go-kivik/kivikmock/v3/clientmock.go
deleted file mode 100644
index a66f15a161..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/clientmock.go
+++ /dev/null
@@ -1,230 +0,0 @@
-package kivikmock
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "time"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-// MockClient is deprecated
-type MockClient = Client
-
-// Client allows configuring the mock kivik client.
-type Client struct {
- ordered bool
- dsn string
- opened int
- drv *mockDriver
- expected []expectation
- newdbcount int
-}
-
-// nextExpectation accepts the expected value `e`, checks that this is a valid
-// expectation, and if so, populates e with the matching expectation. If the
-// expectation is not expected, an error is returned.
-func (c *Client) nextExpectation(actual expectation) error {
- c.drv.Lock()
- defer c.drv.Unlock()
-
- var expected expectation
- var fulfilled int
- for _, next := range c.expected {
- next.Lock()
- if next.fulfilled() {
- next.Unlock()
- fulfilled++
- continue
- }
-
- if c.ordered {
- if reflect.TypeOf(actual).Elem().Name() == reflect.TypeOf(next).Elem().Name() {
- if meets(actual, next) {
- expected = next
- break
- }
- next.Unlock()
- return fmt.Errorf("Expectation not met:\nExpected: %s\n Actual: %s",
- next, actual)
- }
- next.Unlock()
- return fmt.Errorf("call to %s was not expected. Next expectation is: %s", actual.method(false), next.method(false))
- }
- if meets(actual, next) {
- expected = next
- break
- }
-
- next.Unlock()
- }
-
- if expected == nil {
- if fulfilled == len(c.expected) {
- return fmt.Errorf("call to %s was not expected, all expectations already fulfilled", actual.method(false))
- }
- return fmt.Errorf("call to %s was not expected", actual.method(!c.ordered))
- }
-
- defer expected.Unlock()
- expected.fulfill()
-
- reflect.ValueOf(actual).Elem().Set(reflect.ValueOf(expected).Elem())
- return nil
-}
-
-func (c *Client) open() (*kivik.Client, *Client, error) {
- client, err := kivik.New("kivikmock", c.dsn)
- return client, c, err
-}
-
-// ExpectationsWereMet returns an error if any outstanding expectatios were
-// not met.
-func (c *Client) ExpectationsWereMet() error {
- c.drv.Lock()
- defer c.drv.Unlock()
- for _, e := range c.expected {
- e.Lock()
- fulfilled := e.fulfilled()
- e.Unlock()
-
- if !fulfilled {
- return fmt.Errorf("there is a remaining unmet expectation: %s", e)
- }
- }
- return nil
-}
-
-// MatchExpectationsInOrder sets whether expectations should occur in the
-// precise order in which they were defined.
-func (c *Client) MatchExpectationsInOrder(b bool) {
- c.ordered = b
-}
-
-// ExpectAuthenticate queues an expectation for an Authenticate() call.
-func (c *Client) ExpectAuthenticate() *ExpectedAuthenticate {
- e := &ExpectedAuthenticate{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectCreateDB queues an expectation for a CreateDB() call.
-func (c *Client) ExpectCreateDB() *ExpectedCreateDB {
- e := &ExpectedCreateDB{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// NewDB creates a new mock DB object, which can be used along with ExpectDB()
-// or ExpectCreateDB() calls to mock database actions.
-func (c *Client) NewDB() *DB {
- c.newdbcount++
- return &DB{
- client: c,
- id: c.newdbcount,
- }
-}
-
-// NewRows returns a new, empty set of rows, which can be returned by any of
-// the row-returning expectations.
-func NewRows() *Rows {
- return &Rows{}
-}
-
-// NewBulkResults returns a new, empty set of bulk results, which can be
-// returned by the DB.BulkDocs() expectation.
-func NewBulkResults() *BulkResults {
- return &BulkResults{}
-}
-
-// NewChanges returns a new, empty changes set, which can be returned by the
-// DB.Changes() expectation.
-func NewChanges() *Changes {
- return &Changes{}
-}
-
-// NewDBUpdates returns a new, empty update set, which can be returned by the
-// DBUpdates() expectation.
-func NewDBUpdates() *Updates {
- return &Updates{}
-}
-
-// Replication is a replication instance.
-type Replication struct {
- id string
- source string
- target string
- startTime time.Time
- endTime time.Time
- state string
- err error
-}
-
-// NewReplication returns a new, empty Replication.
-func (c *Client) NewReplication() *Replication {
- return &Replication{}
-}
-
-func (r *Replication) MarshalJSON() ([]byte, error) {
- type rep struct {
- ID string `json:"replication_id,omitempty"`
- Source string `json:"source,omitempty"`
- Target string `json:"target,omitempty"`
- StartTime *time.Time `json:"start_time,omitempty"`
- EndTime *time.Time `json:"end_time,omitempty"`
- State string `json:"state,omitempty"`
- Err string `json:"error,omitempty"`
- }
- doc := &rep{
- ID: r.id,
- Source: r.source,
- Target: r.target,
- State: r.state,
- }
- if !r.startTime.IsZero() {
- doc.StartTime = &r.startTime
- }
- if !r.endTime.IsZero() {
- doc.EndTime = &r.endTime
- }
- if r.err != nil {
- doc.Err = r.err.Error()
- }
- return json.Marshal(doc)
-}
-
-func (r *Replication) ID(id string) *Replication {
- r.id = id
- return r
-}
-
-func (r *Replication) Source(s string) *Replication {
- r.source = s
- return r
-}
-
-func (r *Replication) Target(t string) *Replication {
- r.target = t
- return r
-}
-
-func (r *Replication) StartTime(t time.Time) *Replication {
- r.startTime = t
- return r
-}
-
-func (r *Replication) EndTime(t time.Time) *Replication {
- r.endTime = t
- return r
-}
-
-func (r *Replication) State(s kivik.ReplicationState) *Replication {
- r.state = string(s)
- return r
-}
-
-func (r *Replication) Err(e error) *Replication {
- r.err = e
- return r
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/clientmock_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/clientmock_gen.go
deleted file mode 100644
index 0419ba0edf..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/clientmock_gen.go
+++ /dev/null
@@ -1,148 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = kivik.EndKeySuffix // To ensure a reference to kivik package
-var _ = &driver.Attachment{}
-
-// ExpectAllDBs queues an expectation that AllDBs will be called.
-func (c *Client) ExpectAllDBs() *ExpectedAllDBs {
- e := &ExpectedAllDBs{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectClose queues an expectation that Close will be called.
-func (c *Client) ExpectClose() *ExpectedClose {
- e := &ExpectedClose{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectClusterSetup queues an expectation that ClusterSetup will be called.
-func (c *Client) ExpectClusterSetup() *ExpectedClusterSetup {
- e := &ExpectedClusterSetup{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectClusterStatus queues an expectation that ClusterStatus will be called.
-func (c *Client) ExpectClusterStatus() *ExpectedClusterStatus {
- e := &ExpectedClusterStatus{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectConfigValue queues an expectation that ConfigValue will be called.
-func (c *Client) ExpectConfigValue() *ExpectedConfigValue {
- e := &ExpectedConfigValue{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDBExists queues an expectation that DBExists will be called.
-func (c *Client) ExpectDBExists() *ExpectedDBExists {
- e := &ExpectedDBExists{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDeleteConfigKey queues an expectation that DeleteConfigKey will be called.
-func (c *Client) ExpectDeleteConfigKey() *ExpectedDeleteConfigKey {
- e := &ExpectedDeleteConfigKey{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDestroyDB queues an expectation that DestroyDB will be called.
-func (c *Client) ExpectDestroyDB() *ExpectedDestroyDB {
- e := &ExpectedDestroyDB{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectPing queues an expectation that Ping will be called.
-func (c *Client) ExpectPing() *ExpectedPing {
- e := &ExpectedPing{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectSetConfigValue queues an expectation that SetConfigValue will be called.
-func (c *Client) ExpectSetConfigValue() *ExpectedSetConfigValue {
- e := &ExpectedSetConfigValue{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectConfig queues an expectation that Config will be called.
-func (c *Client) ExpectConfig() *ExpectedConfig {
- e := &ExpectedConfig{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectConfigSection queues an expectation that ConfigSection will be called.
-func (c *Client) ExpectConfigSection() *ExpectedConfigSection {
- e := &ExpectedConfigSection{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDB queues an expectation that DB will be called.
-func (c *Client) ExpectDB() *ExpectedDB {
- e := &ExpectedDB{
- ret0: &DB{},
- }
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDBUpdates queues an expectation that DBUpdates will be called.
-func (c *Client) ExpectDBUpdates() *ExpectedDBUpdates {
- e := &ExpectedDBUpdates{
- ret0: &Updates{},
- }
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectDBsStats queues an expectation that DBsStats will be called.
-func (c *Client) ExpectDBsStats() *ExpectedDBsStats {
- e := &ExpectedDBsStats{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectGetReplications queues an expectation that GetReplications will be called.
-func (c *Client) ExpectGetReplications() *ExpectedGetReplications {
- e := &ExpectedGetReplications{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectReplicate queues an expectation that Replicate will be called.
-func (c *Client) ExpectReplicate() *ExpectedReplicate {
- e := &ExpectedReplicate{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectSession queues an expectation that Session will be called.
-func (c *Client) ExpectSession() *ExpectedSession {
- e := &ExpectedSession{}
- c.expected = append(c.expected, e)
- return e
-}
-
-// ExpectVersion queues an expectation that Version will be called.
-func (c *Client) ExpectVersion() *ExpectedVersion {
- e := &ExpectedVersion{}
- c.expected = append(c.expected, e)
- return e
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/codecov.yml b/vendor/github.com/go-kivik/kivikmock/v3/codecov.yml
deleted file mode 100644
index a09657ce7e..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/codecov.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-ignore:
- - "*_gen.go"
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/common.go b/vendor/github.com/go-kivik/kivikmock/v3/common.go
deleted file mode 100644
index 7e62f682f3..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/common.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "fmt"
- "sync"
- "time"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-type expectation interface {
- fulfill()
- fulfilled() bool
- Lock()
- Unlock()
- fmt.Stringer
- // method should return the name of the method that would trigger this
- // condition. If verbose is true, the output should disambiguate between
- // different calls to the same method.
- method(verbose bool) string
- error() error
- wait(context.Context) error
- // met is called on the actual value, and returns true if the expectation
- // is met.
- met(expectation) bool
- // for DB methods, this returns the associated *DB object
- dbo() *DB
- opts() kivik.Options
-}
-
-// commonExpectation satisfies the expectation interface, except the String()
-// and method() methods.
-type commonExpectation struct {
- sync.Mutex
- triggered bool
- err error // nolint: structcheck
- delay time.Duration
- options kivik.Options
- db *DB
-}
-
-func (e *commonExpectation) opts() kivik.Options {
- return e.options
-}
-
-func (e *commonExpectation) dbo() *DB {
- return e.db
-}
-
-func (e *commonExpectation) fulfill() {
- e.triggered = true
-}
-
-func (e *commonExpectation) fulfilled() bool {
- return e.triggered
-}
-
-func (e *commonExpectation) error() error {
- return e.err
-}
-
-// wait blocks until e.delay expires, or ctx is cancelled. If e.delay expires,
-// e.err is returned, otherwise ctx.Err() is returned.
-func (e *commonExpectation) wait(ctx context.Context) error {
- if e.delay == 0 {
- return e.err
- }
- if err := pause(ctx, e.delay); err != nil {
- return err
- }
- return e.err
-}
-
-func pause(ctx context.Context, delay time.Duration) error {
- if delay == 0 {
- return nil
- }
- t := time.NewTimer(delay)
- defer t.Stop()
- select {
- case <-t.C:
- return nil
- case <-ctx.Done():
- return ctx.Err()
- }
-}
-
-const (
- defaultOptionPlaceholder = "[?]"
-)
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/db.go b/vendor/github.com/go-kivik/kivikmock/v3/db.go
deleted file mode 100644
index 9767c11552..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/db.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package kivikmock
-
-import (
- "context"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-type driverDB struct {
- *DB
-}
-
-var _ driver.DB = &driverDB{}
-var _ driver.BulkGetter = &driverDB{}
-var _ driver.Finder = &driverDB{}
-
-func (db *driverDB) Close(ctx context.Context) error {
- expected := &ExpectedDBClose{
- commonExpectation: commonExpectation{db: db.DB},
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.wait(ctx)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/db_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/db_gen.go
deleted file mode 100644
index 950a2cf158..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/db_gen.go
+++ /dev/null
@@ -1,527 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- "context"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = &driver.Attachment{}
-
-func (db *driverDB) Compact(ctx context.Context) error {
- expected := &ExpectedCompact{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) CompactView(ctx context.Context, arg0 string) error {
- expected := &ExpectedCompactView{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) Copy(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error) {
- expected := &ExpectedCopy{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) CreateDoc(ctx context.Context, arg0 interface{}, options map[string]interface{}) (string, string, error) {
- expected := &ExpectedCreateDoc{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return expected.ret0, expected.ret1, expected.wait(ctx)
-}
-
-func (db *driverDB) CreateIndex(ctx context.Context, arg0 string, arg1 string, arg2 interface{}) error {
- expected := &ExpectedCreateIndex{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) Delete(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error) {
- expected := &ExpectedDelete{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) DeleteAttachment(ctx context.Context, arg0 string, arg1 string, arg2 string, options map[string]interface{}) (string, error) {
- expected := &ExpectedDeleteAttachment{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) DeleteIndex(ctx context.Context, arg0 string, arg1 string) error {
- expected := &ExpectedDeleteIndex{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) Flush(ctx context.Context) error {
- expected := &ExpectedFlush{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) GetMeta(ctx context.Context, arg0 string, options map[string]interface{}) (int64, string, error) {
- expected := &ExpectedGetMeta{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return 0, "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return expected.ret0, expected.ret1, expected.wait(ctx)
-}
-
-func (db *driverDB) Put(ctx context.Context, arg0 string, arg1 interface{}, options map[string]interface{}) (string, error) {
- expected := &ExpectedPut{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) ViewCleanup(ctx context.Context) error {
- expected := &ExpectedViewCleanup{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) AllDocs(ctx context.Context, options map[string]interface{}) (driver.Rows, error) {
- expected := &ExpectedAllDocs{
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) BulkDocs(ctx context.Context, arg0 []interface{}, options map[string]interface{}) (driver.BulkResults, error) {
- expected := &ExpectedBulkDocs{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return &driverBulkResults{Context: ctx, BulkResults: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) BulkGet(ctx context.Context, arg0 []driver.BulkGetReference, options map[string]interface{}) (driver.Rows, error) {
- expected := &ExpectedBulkGet{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) Changes(ctx context.Context, options map[string]interface{}) (driver.Changes, error) {
- expected := &ExpectedChanges{
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return &driverChanges{Context: ctx, Changes: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) DesignDocs(ctx context.Context, options map[string]interface{}) (driver.Rows, error) {
- expected := &ExpectedDesignDocs{
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) Explain(ctx context.Context, arg0 interface{}) (*driver.QueryPlan, error) {
- expected := &ExpectedExplain{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) Find(ctx context.Context, arg0 interface{}) (driver.Rows, error) {
- expected := &ExpectedFind{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) Get(ctx context.Context, arg0 string, options map[string]interface{}) (*driver.Document, error) {
- expected := &ExpectedGet{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) GetAttachment(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error) {
- expected := &ExpectedGetAttachment{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) GetAttachmentMeta(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error) {
- expected := &ExpectedGetAttachmentMeta{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) GetIndexes(ctx context.Context) ([]driver.Index, error) {
- expected := &ExpectedGetIndexes{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) LocalDocs(ctx context.Context, options map[string]interface{}) (driver.Rows, error) {
- expected := &ExpectedLocalDocs{
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, options)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) Purge(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error) {
- expected := &ExpectedPurge{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) PutAttachment(ctx context.Context, arg0 string, arg1 string, arg2 *driver.Attachment, options map[string]interface{}) (string, error) {
- expected := &ExpectedPutAttachment{
- arg0: arg0,
- arg1: arg1,
- arg2: arg2,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return "", err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, arg2, options)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) Query(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Rows, error) {
- expected := &ExpectedQuery{
- arg0: arg0,
- arg1: arg1,
- commonExpectation: commonExpectation{
- db: db.DB,
- options: options,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0, arg1, options)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) RevsDiff(ctx context.Context, arg0 interface{}) (driver.Rows, error) {
- expected := &ExpectedRevsDiff{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return &driverRows{Context: ctx, Rows: expected.ret0}, expected.wait(ctx)
-}
-
-func (db *driverDB) Security(ctx context.Context) (*driver.Security, error) {
- expected := &ExpectedSecurity{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
-
-func (db *driverDB) SetSecurity(ctx context.Context, arg0 *driver.Security) error {
- expected := &ExpectedSetSecurity{
- arg0: arg0,
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return err
- }
- if expected.callback != nil {
- return expected.callback(ctx, arg0)
- }
- return expected.wait(ctx)
-}
-
-func (db *driverDB) Stats(ctx context.Context) (*driver.DBStats, error) {
- expected := &ExpectedStats{
- commonExpectation: commonExpectation{
- db: db.DB,
- },
- }
- if err := db.client.nextExpectation(expected); err != nil {
- return nil, err
- }
- if expected.callback != nil {
- return expected.callback(ctx)
- }
- return expected.ret0, expected.wait(ctx)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations.go b/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations.go
deleted file mode 100644
index af7a1e3153..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations.go
+++ /dev/null
@@ -1,687 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// ExpectedDBClose is used to manage *kivik.Client.Close expectation returned
-// by Mock.ExpectClose.
-type ExpectedDBClose struct {
- commonExpectation
- callback func(ctx context.Context) error
-}
-
-func (e *ExpectedDBClose) method(v bool) string {
- if v {
- return "DB.Close(ctx)"
- }
- return "DB.Close()"
-}
-
-func (e *ExpectedDBClose) met(ex expectation) bool {
- return true
-}
-
-// WillReturnError allows setting an error for *kivik.Client.Close action.
-func (e *ExpectedDBClose) WillReturnError(err error) *ExpectedDBClose {
- e.err = err
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDBClose) WillExecute(cb func(ctx context.Context) error) *ExpectedDBClose {
- e.callback = cb
- return e
-}
-
-func (e *ExpectedDBClose) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).Close()", e.dbo().name, e.dbo().id)
- extra := delayString(e.delay)
- extra += errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-// WillDelay will cause execution of Close() to delay by duration d.
-func (e *ExpectedDBClose) WillDelay(d time.Duration) *ExpectedDBClose {
- e.delay = d
- return e
-}
-
-func (e *ExpectedAllDocs) String() string {
- var rets []string
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("AllDocs", &e.commonExpectation, withOptions, nil, rets)
-}
-
-func jsonDoc(i interface{}) string {
- jsonText, err := json.Marshal(i)
- if err != nil {
- return fmt.Sprintf("", err)
- }
- return string(jsonText)
-}
-
-func (e *ExpectedBulkGet) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).BulkGet() which:", e.dbo().name, e.dbo().id)
- if e.arg0 == nil {
- msg += "\n\t- has any doc references"
- } else {
- msg += fmt.Sprintf("\n\t- has doc references: %v", jsonDoc(e.arg0))
- }
- msg += optionsString(e.options)
- if e.ret0 != nil {
- msg += fmt.Sprintf("\n\t- should return: %d results", e.ret0.count())
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedFind) String() string {
- var opts, rets []string
- if e.arg0 == nil {
- opts = append(opts, "has any query")
- } else {
- opts = append(opts, fmt.Sprintf("has query: %v", e.arg0))
- }
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("Find", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithQuery sets the expected query for the Find() call.
-func (e *ExpectedFind) WithQuery(query interface{}) *ExpectedFind {
- e.arg0 = query
- return e
-}
-
-func (e *ExpectedCreateIndex) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).CreateIndex() which:", e.dbo().name, e.dbo().id)
- if e.arg0 == "" {
- msg += "\n\t- has any ddoc"
- } else {
- msg += "\n\t- has ddoc: " + e.arg0
- }
- if e.arg1 == "" {
- msg += "\n\t- has any name"
- } else {
- msg += "\n\t- has name: " + e.arg1
- }
- if e.arg2 == nil {
- msg += "\n\t- has any index"
- } else {
- msg += fmt.Sprintf("\n\t- has index: %v", e.arg2)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-// WithDDocID sets the expected ddocID value for the DB.CreateIndex() call.
-func (e *ExpectedCreateIndex) WithDDocID(ddocID string) *ExpectedCreateIndex {
- e.arg0 = ddocID
- return e
-}
-
-// WithName sets the expected name value for the DB.CreateIndex() call.
-func (e *ExpectedCreateIndex) WithName(name string) *ExpectedCreateIndex {
- e.arg1 = name
- return e
-}
-
-// WithIndex sets the expected index value for the DB.CreateIndex() call.
-func (e *ExpectedCreateIndex) WithIndex(index interface{}) *ExpectedCreateIndex {
- e.arg2 = index
- return e
-}
-
-func (e *ExpectedGetIndexes) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).GetIndexes()", e.dbo().name, e.dbo().id)
- var extra string
- if e.ret0 != nil {
- extra += fmt.Sprintf("\n\t- should return indexes: %v", e.ret0)
- }
- extra += delayString(e.delay)
- extra += errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedDeleteIndex) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).DeleteIndex() which:", e.dbo().name, e.dbo().id)
- msg += fieldString("ddoc", e.arg0)
- msg += fieldString("name", e.arg1)
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-// WithDDoc sets the expected ddoc to be passed to the DB.DeleteIndex() call.
-func (e *ExpectedDeleteIndex) WithDDoc(ddoc string) *ExpectedDeleteIndex {
- e.arg0 = ddoc
- return e
-}
-
-// WithName sets the expected name to be passed to the DB.DeleteIndex() call.
-func (e *ExpectedDeleteIndex) WithName(name string) *ExpectedDeleteIndex {
- e.arg1 = name
- return e
-}
-
-func (e *ExpectedExplain) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).Explain() which:", e.dbo().name, e.dbo().id)
- if e.arg0 == nil {
- msg += "\n\t- has any query"
- } else {
- msg += fmt.Sprintf("\n\t- has query: %v", e.arg0)
- }
- if e.ret0 != nil {
- msg += fmt.Sprintf("\n\t- should return query plan: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-// WithQuery sets the expected query for the Explain() call.
-func (e *ExpectedExplain) WithQuery(query interface{}) *ExpectedExplain {
- e.arg0 = query
- return e
-}
-
-func (e *ExpectedCreateDoc) String() string {
- msg := fmt.Sprintf("call to DB(%s#%d).CreateDoc() which:", e.dbo().name, e.dbo().id)
- if e.arg0 == nil {
- msg += "\n\t- has any doc"
- } else {
- msg += fmt.Sprintf("\n\t- has doc: %s", jsonDoc(e.arg0))
- }
- msg += optionsString(e.options)
- if e.ret0 != "" {
- msg += "\n\t- should return docID: " + e.ret0
- }
- if e.ret1 != "" {
- msg += "\n\t- should return rev: " + e.ret1
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-// WithDoc sets the expected doc for the call to CreateDoc().
-func (e *ExpectedCreateDoc) WithDoc(doc interface{}) *ExpectedCreateDoc {
- e.arg0 = doc
- return e
-}
-
-const (
- withOptions = 1 << iota
-)
-
-func dbStringer(methodName string, e *commonExpectation, flags int, opts []string, rets []string) string {
- msg := fmt.Sprintf("call to DB(%s#%d).%s()", e.db.name, e.db.id, methodName)
- var extra string
- for _, c := range opts {
- extra += "\n\t- " + c
- }
- if flags&withOptions > 0 {
- extra += optionsString(e.options)
- }
- for _, c := range rets {
- extra += "\n\t- " + c
- }
- extra += delayString(e.delay)
- extra += errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedCompact) String() string {
- return dbStringer("Compact", &e.commonExpectation, 0, nil, nil)
-}
-
-func (e *ExpectedViewCleanup) String() string {
- return dbStringer("ViewCleanup", &e.commonExpectation, 0, nil, nil)
-}
-
-func (e *ExpectedPut) String() string {
- custom := []string{}
- if e.arg0 == "" {
- custom = append(custom, "has any docID")
- } else {
- custom = append(custom, fmt.Sprintf("has docID: %s", e.arg0))
- }
- if e.arg1 == nil {
- custom = append(custom, "has any doc")
- } else {
- custom = append(custom, fmt.Sprintf("has doc: %s", jsonDoc(e.arg1)))
- }
- return dbStringer("Put", &e.commonExpectation, withOptions, custom, nil)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.Put() call.
-func (e *ExpectedPut) WithDocID(docID string) *ExpectedPut {
- e.arg0 = docID
- return e
-}
-
-// WithDoc sets the expectation for the doc passed to the DB.Put() call.
-func (e *ExpectedPut) WithDoc(doc interface{}) *ExpectedPut {
- e.arg1 = doc
- return e
-}
-
-func (e *ExpectedGetMeta) String() string {
- var opts []string
- if e.arg0 == "" {
- opts = append(opts, "has any docID")
- } else {
- opts = append(opts, fmt.Sprintf("has docID: %s", e.arg0))
- }
- var rets []string
- if e.ret0 != 0 {
- rets = append(rets, fmt.Sprintf("should return size: %d", e.ret0))
- }
- if e.ret1 != "" {
- rets = append(rets, "should return rev: "+e.ret1)
- }
- return dbStringer("GetMeta", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.GetMeta() call.
-func (e *ExpectedGetMeta) WithDocID(docID string) *ExpectedGetMeta {
- e.arg0 = docID
- return e
-}
-
-func (e *ExpectedFlush) String() string {
- return dbStringer("Flush", &e.commonExpectation, 0, nil, nil)
-}
-
-func (e *ExpectedDeleteAttachment) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any docID")
- } else {
- opts = append(opts, "has docID: "+e.arg0)
- }
- if e.arg1 == "" {
- opts = append(opts, "has any rev")
- } else {
- opts = append(opts, "has rev: "+e.arg1)
- }
- if e.arg2 == "" {
- opts = append(opts, "has any filename")
- } else {
- opts = append(opts, "has filename: "+e.arg2)
- }
- if e.ret0 != "" {
- rets = append(rets, "should return rev: "+e.ret0)
- }
- return dbStringer("DeleteAttachment", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.DeleteAttachment() call.
-func (e *ExpectedDeleteAttachment) WithDocID(docID string) *ExpectedDeleteAttachment {
- e.arg0 = docID
- return e
-}
-
-// WithRev sets the expectation for the rev passed to the DB.DeleteAttachment() call.
-func (e *ExpectedDeleteAttachment) WithRev(rev string) *ExpectedDeleteAttachment {
- e.arg1 = rev
- return e
-}
-
-// WithFilename sets the expectation for the filename passed to the DB.DeleteAttachment() call.
-func (e *ExpectedDeleteAttachment) WithFilename(filename string) *ExpectedDeleteAttachment {
- e.arg2 = filename
- return e
-}
-
-func (e *ExpectedDelete) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any docID")
- } else {
- opts = append(opts, "has docID: "+e.arg0)
- }
- if e.arg1 == "" {
- opts = append(opts, "has any rev")
- } else {
- opts = append(opts, "has rev: "+e.arg1)
- }
- if e.ret0 != "" {
- rets = append(rets, "should return rev: "+e.ret0)
- }
- return dbStringer("Delete", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.Delete() call.
-func (e *ExpectedDelete) WithDocID(docID string) *ExpectedDelete {
- e.arg0 = docID
- return e
-}
-
-// WithRev sets the expectation for the rev passed to the DB.Delete() call.
-func (e *ExpectedDelete) WithRev(rev string) *ExpectedDelete {
- e.arg1 = rev
- return e
-}
-
-func (e *ExpectedCopy) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any targetID")
- } else {
- opts = append(opts, "has targetID: "+e.arg0)
- }
- if e.arg1 == "" {
- opts = append(opts, "has any sourceID")
- } else {
- opts = append(opts, "has sourceID: "+e.arg1)
- }
- if e.ret0 != "" {
- rets = append(rets, "should return rev: "+e.ret0)
- }
- return dbStringer("Copy", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithTargetID sets the expectation for the docID passed to the DB.Copy() call.
-func (e *ExpectedCopy) WithTargetID(docID string) *ExpectedCopy {
- e.arg0 = docID
- return e
-}
-
-// WithSourceID sets the expectation for the docID passed to the DB.Copy() call.
-func (e *ExpectedCopy) WithSourceID(docID string) *ExpectedCopy {
- e.arg1 = docID
- return e
-}
-
-func (e *ExpectedCompactView) String() string {
- var opts []string
- if e.arg0 == "" {
- opts = []string{"has any ddocID"}
- } else {
- opts = []string{"has ddocID: " + e.arg0}
- }
- return dbStringer("CompactView", &e.commonExpectation, 0, opts, nil)
-}
-
-// WithDDoc sets the expected design doc name for the call to DB.CompactView().
-func (e *ExpectedCompactView) WithDDoc(ddocID string) *ExpectedCompactView {
- e.arg0 = ddocID
- return e
-}
-
-func (e *ExpectedGet) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = []string{"has any docID"}
- } else {
- opts = []string{"has docID: " + e.arg0}
- }
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return document with rev: %s", e.ret0.Rev)}
- }
- return dbStringer("Get", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expected docID for the DB.Get() call.
-func (e *ExpectedGet) WithDocID(docID string) *ExpectedGet {
- e.arg0 = docID
- return e
-}
-
-func (e *ExpectedGetAttachmentMeta) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = []string{"has any docID"}
- } else {
- opts = []string{"has docID: " + e.arg0}
- }
- if e.arg1 == "" {
- opts = append(opts, "has any filename")
- } else {
- opts = append(opts, "has filename: "+e.arg1)
- }
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return attachment: %s", e.ret0.Filename)}
- }
- return dbStringer("GetAttachmentMeta", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.GetAttachmentMeta() call.
-func (e *ExpectedGetAttachmentMeta) WithDocID(docID string) *ExpectedGetAttachmentMeta {
- e.arg0 = docID
- return e
-}
-
-// WithFilename sets the expectation for the doc passed to the DB.GetAttachmentMeta() call.
-func (e *ExpectedGetAttachmentMeta) WithFilename(filename string) *ExpectedGetAttachmentMeta {
- e.arg1 = filename
- return e
-}
-
-func (e *ExpectedLocalDocs) String() string {
- var rets []string
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("LocalDocs", &e.commonExpectation, withOptions, nil, rets)
-}
-
-func (e *ExpectedPurge) String() string {
- var opts, rets []string
- if e.arg0 == nil {
- opts = []string{"has any docRevMap"}
- } else {
- opts = []string{fmt.Sprintf("has docRevMap: %v", e.arg0)}
- }
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return result: %v", e.ret0)}
- }
- return dbStringer("Purge", &e.commonExpectation, 0, opts, rets)
-}
-
-// WithDocRevMap sets the expected docRevMap for the call to DB.Purge().
-func (e *ExpectedPurge) WithDocRevMap(docRevMap map[string][]string) *ExpectedPurge {
- e.arg0 = docRevMap
- return e
-}
-
-func (e *ExpectedPutAttachment) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any docID")
- } else {
- opts = append(opts, fmt.Sprintf("has docID: %s", e.arg0))
- }
- if e.arg1 == "" {
- opts = append(opts, "has any rev")
- } else {
- opts = append(opts, "has rev: "+e.arg1)
- }
- if e.arg2 == nil {
- opts = append(opts, "has any attachment")
- } else {
- opts = append(opts, fmt.Sprintf("has attachment: %s", e.arg2.Filename))
- }
- if e.ret0 != "" {
- rets = append(rets, "should return rev: "+e.ret0)
- }
- return dbStringer("PutAttachment", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.PutAttachment() call.
-func (e *ExpectedPutAttachment) WithDocID(docID string) *ExpectedPutAttachment {
- e.arg0 = docID
- return e
-}
-
-// WithRev sets the expectation for the rev passed to the DB.PutAttachment() call.
-func (e *ExpectedPutAttachment) WithRev(rev string) *ExpectedPutAttachment {
- e.arg1 = rev
- return e
-}
-
-// WithAttachment sets the expectation for the rev passed to the DB.PutAttachment() call.
-func (e *ExpectedPutAttachment) WithAttachment(att *driver.Attachment) *ExpectedPutAttachment {
- e.arg2 = att
- return e
-}
-
-func (e *ExpectedQuery) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any ddocID")
- } else {
- opts = append(opts, "has ddocID: "+e.arg0)
- }
- if e.arg1 == "" {
- opts = append(opts, "has any view")
- } else {
- opts = append(opts, "has view: "+e.arg1)
- }
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("Query", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDDocID sets the expected ddocID value for the DB.Query() call.
-func (e *ExpectedQuery) WithDDocID(ddocID string) *ExpectedQuery {
- e.arg0 = ddocID
- return e
-}
-
-// WithView sets the expected view value for the DB.Query() call.
-func (e *ExpectedQuery) WithView(view string) *ExpectedQuery {
- e.arg1 = view
- return e
-}
-
-func (e *ExpectedSecurity) String() string {
- return dbStringer("Security", &e.commonExpectation, 0, nil, nil)
-}
-
-func (e *ExpectedSetSecurity) String() string {
- var opts []string
- if e.arg0 == nil {
- opts = append(opts, "has any security object")
- } else {
- opts = append(opts, fmt.Sprintf("has security object: %v", e.arg0))
- }
- return dbStringer("SetSecurity", &e.commonExpectation, 0, opts, nil)
-}
-
-// WithSecurity sets the expected security object for the DB.SetSecurity() call.
-func (e *ExpectedSetSecurity) WithSecurity(sec *driver.Security) *ExpectedSetSecurity {
- e.arg0 = sec
- return e
-}
-
-func (e *ExpectedStats) String() string {
- var rets []string
- if e.ret0 != nil {
- rets = append(rets, fmt.Sprintf("should return stats: %v", e.ret0))
- }
- return dbStringer("Stats", &e.commonExpectation, 0, nil, rets)
-}
-
-func (e *ExpectedBulkDocs) String() string {
- var opts, rets []string
- if e.arg0 == nil {
- opts = append(opts, "has any docs")
- } else {
- opts = append(opts, fmt.Sprintf("has: %d docs", len(e.arg0)))
- }
- if e.ret0 != nil {
- rets = append(rets, fmt.Sprintf("should return: %d results", e.ret0.count()))
- }
- return dbStringer("BulkDocs", &e.commonExpectation, withOptions, opts, rets)
-}
-
-func (e *ExpectedGetAttachment) String() string {
- var opts, rets []string
- if e.arg0 == "" {
- opts = append(opts, "has any docID")
- } else {
- opts = append(opts, "has docID: "+e.arg0)
- }
- if e.arg1 == "" {
- opts = append(opts, "has any filename")
- } else {
- opts = append(opts, "has filename: "+e.arg1)
- }
- if e.ret0 != nil {
- rets = append(rets, "should return attachment: "+e.ret0.Filename)
- }
- return dbStringer("GetAttachment", &e.commonExpectation, withOptions, opts, rets)
-}
-
-// WithDocID sets the expectation for the docID passed to the DB.GetAttachment() call.
-func (e *ExpectedGetAttachment) WithDocID(docID string) *ExpectedGetAttachment {
- e.arg0 = docID
- return e
-}
-
-// WithFilename sets the expectation for the filename passed to the DB.GetAttachment() call.
-func (e *ExpectedGetAttachment) WithFilename(docID string) *ExpectedGetAttachment {
- e.arg1 = docID
- return e
-}
-
-func (e *ExpectedDesignDocs) String() string {
- var rets []string
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("DesignDocs", &e.commonExpectation, withOptions, nil, rets)
-}
-
-func (e *ExpectedChanges) String() string {
- var rets []string
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- return dbStringer("Changes", &e.commonExpectation, withOptions, nil, rets)
-}
-
-func (e *ExpectedRevsDiff) String() string {
- var rets, opts []string
- if e.ret0 != nil {
- rets = []string{fmt.Sprintf("should return: %d results", e.ret0.count())}
- }
- if e.arg0 != nil {
- opts = []string{fmt.Sprintf("with revMap: %v", e.arg0)}
- } else {
- opts = []string{"has any revMap"}
- }
- return dbStringer("RevsDiff", &e.commonExpectation, 0, opts, rets)
-}
-
-// WithRevLookup sets the expectation for the rev lookup passed to the
-// DB.RevsDiff() call.
-func (e *ExpectedRevsDiff) WithRevLookup(revLookup interface{}) *ExpectedRevsDiff {
- e.arg0 = revLookup
- return e
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations_gen.go
deleted file mode 100644
index 8ef3ff0c81..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/dbexpectations_gen.go
+++ /dev/null
@@ -1,1771 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- "context"
- "fmt"
- "reflect"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = &driver.Attachment{}
-var _ = reflect.Int
-
-// ExpectedCompact represents an expectation for a call to DB.Compact().
-type ExpectedCompact struct {
- commonExpectation
- callback func(ctx context.Context) error
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCompact) WillExecute(cb func(ctx context.Context) error) *ExpectedCompact {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Compact().
-func (e *ExpectedCompact) WillReturnError(err error) *ExpectedCompact {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Compact() to delay.
-func (e *ExpectedCompact) WillDelay(delay time.Duration) *ExpectedCompact {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedCompact) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedCompact) method(v bool) string {
- if !v {
- return "DB.Compact()"
- }
- return fmt.Sprintf("DB(%s).Compact(ctx)", e.dbo().name)
-}
-
-// ExpectedCompactView represents an expectation for a call to DB.CompactView().
-type ExpectedCompactView struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string) error
- arg0 string
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCompactView) WillExecute(cb func(ctx context.Context, arg0 string) error) *ExpectedCompactView {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.CompactView().
-func (e *ExpectedCompactView) WillReturnError(err error) *ExpectedCompactView {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.CompactView() to delay.
-func (e *ExpectedCompactView) WillDelay(delay time.Duration) *ExpectedCompactView {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedCompactView) met(ex expectation) bool {
- exp := ex.(*ExpectedCompactView)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedCompactView) method(v bool) string {
- if !v {
- return "DB.CompactView()"
- }
- arg0 := "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- return fmt.Sprintf("DB(%s).CompactView(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedCopy represents an expectation for a call to DB.Copy().
-type ExpectedCopy struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error)
- arg0 string
- arg1 string
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to DB.Copy().
-func (e *ExpectedCopy) WithOptions(options map[string]interface{}) *ExpectedCopy {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCopy) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error)) *ExpectedCopy {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Copy().
-func (e *ExpectedCopy) WillReturn(ret0 string) *ExpectedCopy {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Copy().
-func (e *ExpectedCopy) WillReturnError(err error) *ExpectedCopy {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Copy() to delay.
-func (e *ExpectedCopy) WillDelay(delay time.Duration) *ExpectedCopy {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedCopy) met(ex expectation) bool {
- exp := ex.(*ExpectedCopy)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedCopy) method(v bool) string {
- if !v {
- return "DB.Copy()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Copy(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedCreateDoc represents an expectation for a call to DB.CreateDoc().
-type ExpectedCreateDoc struct {
- commonExpectation
- callback func(ctx context.Context, arg0 interface{}, options map[string]interface{}) (string, string, error)
- arg0 interface{}
- ret0 string
- ret1 string
-}
-
-// WithOptions sets the expected options for the call to DB.CreateDoc().
-func (e *ExpectedCreateDoc) WithOptions(options map[string]interface{}) *ExpectedCreateDoc {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCreateDoc) WillExecute(cb func(ctx context.Context, arg0 interface{}, options map[string]interface{}) (string, string, error)) *ExpectedCreateDoc {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.CreateDoc().
-func (e *ExpectedCreateDoc) WillReturn(ret0 string, ret1 string) *ExpectedCreateDoc {
- e.ret0 = ret0
- e.ret1 = ret1
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.CreateDoc().
-func (e *ExpectedCreateDoc) WillReturnError(err error) *ExpectedCreateDoc {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.CreateDoc() to delay.
-func (e *ExpectedCreateDoc) WillDelay(delay time.Duration) *ExpectedCreateDoc {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedCreateDoc) met(ex expectation) bool {
- exp := ex.(*ExpectedCreateDoc)
- if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedCreateDoc) method(v bool) string {
- if !v {
- return "DB.CreateDoc()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).CreateDoc(ctx, %s, %s)", e.dbo().name, arg0, options)
-}
-
-// ExpectedCreateIndex represents an expectation for a call to DB.CreateIndex().
-type ExpectedCreateIndex struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 interface{}) error
- arg0 string
- arg1 string
- arg2 interface{}
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCreateIndex) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 interface{}) error) *ExpectedCreateIndex {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.CreateIndex().
-func (e *ExpectedCreateIndex) WillReturnError(err error) *ExpectedCreateIndex {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.CreateIndex() to delay.
-func (e *ExpectedCreateIndex) WillDelay(delay time.Duration) *ExpectedCreateIndex {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedCreateIndex) met(ex expectation) bool {
- exp := ex.(*ExpectedCreateIndex)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != nil && !jsonMeets(exp.arg2, e.arg2) {
- return false
- }
- return true
-}
-
-func (e *ExpectedCreateIndex) method(v bool) string {
- if !v {
- return "DB.CreateIndex()"
- }
- arg0, arg1, arg2 := "?", "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != nil {
- arg2 = fmt.Sprintf("%v", e.arg2)
- }
- return fmt.Sprintf("DB(%s).CreateIndex(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, arg2)
-}
-
-// ExpectedDelete represents an expectation for a call to DB.Delete().
-type ExpectedDelete struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error)
- arg0 string
- arg1 string
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to DB.Delete().
-func (e *ExpectedDelete) WithOptions(options map[string]interface{}) *ExpectedDelete {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDelete) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (string, error)) *ExpectedDelete {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Delete().
-func (e *ExpectedDelete) WillReturn(ret0 string) *ExpectedDelete {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Delete().
-func (e *ExpectedDelete) WillReturnError(err error) *ExpectedDelete {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Delete() to delay.
-func (e *ExpectedDelete) WillDelay(delay time.Duration) *ExpectedDelete {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDelete) met(ex expectation) bool {
- exp := ex.(*ExpectedDelete)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDelete) method(v bool) string {
- if !v {
- return "DB.Delete()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Delete(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedDeleteAttachment represents an expectation for a call to DB.DeleteAttachment().
-type ExpectedDeleteAttachment struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 string, options map[string]interface{}) (string, error)
- arg0 string
- arg1 string
- arg2 string
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to DB.DeleteAttachment().
-func (e *ExpectedDeleteAttachment) WithOptions(options map[string]interface{}) *ExpectedDeleteAttachment {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDeleteAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 string, options map[string]interface{}) (string, error)) *ExpectedDeleteAttachment {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.DeleteAttachment().
-func (e *ExpectedDeleteAttachment) WillReturn(ret0 string) *ExpectedDeleteAttachment {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.DeleteAttachment().
-func (e *ExpectedDeleteAttachment) WillReturnError(err error) *ExpectedDeleteAttachment {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.DeleteAttachment() to delay.
-func (e *ExpectedDeleteAttachment) WillDelay(delay time.Duration) *ExpectedDeleteAttachment {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDeleteAttachment) met(ex expectation) bool {
- exp := ex.(*ExpectedDeleteAttachment)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != "" && exp.arg2 != e.arg2 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDeleteAttachment) method(v bool) string {
- if !v {
- return "DB.DeleteAttachment()"
- }
- arg0, arg1, arg2, options := "?", "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != "" {
- arg2 = fmt.Sprintf("%q", e.arg2)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).DeleteAttachment(ctx, %s, %s, %s, %s)", e.dbo().name, arg0, arg1, arg2, options)
-}
-
-// ExpectedDeleteIndex represents an expectation for a call to DB.DeleteIndex().
-type ExpectedDeleteIndex struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string) error
- arg0 string
- arg1 string
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDeleteIndex) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string) error) *ExpectedDeleteIndex {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.DeleteIndex().
-func (e *ExpectedDeleteIndex) WillReturnError(err error) *ExpectedDeleteIndex {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.DeleteIndex() to delay.
-func (e *ExpectedDeleteIndex) WillDelay(delay time.Duration) *ExpectedDeleteIndex {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDeleteIndex) met(ex expectation) bool {
- exp := ex.(*ExpectedDeleteIndex)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedDeleteIndex) method(v bool) string {
- if !v {
- return "DB.DeleteIndex()"
- }
- arg0, arg1 := "?", "?"
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- return fmt.Sprintf("DB(%s).DeleteIndex(ctx, %s, %s)", e.dbo().name, arg0, arg1)
-}
-
-// ExpectedFlush represents an expectation for a call to DB.Flush().
-type ExpectedFlush struct {
- commonExpectation
- callback func(ctx context.Context) error
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedFlush) WillExecute(cb func(ctx context.Context) error) *ExpectedFlush {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Flush().
-func (e *ExpectedFlush) WillReturnError(err error) *ExpectedFlush {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Flush() to delay.
-func (e *ExpectedFlush) WillDelay(delay time.Duration) *ExpectedFlush {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedFlush) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedFlush) method(v bool) string {
- if !v {
- return "DB.Flush()"
- }
- return fmt.Sprintf("DB(%s).Flush(ctx)", e.dbo().name)
-}
-
-// ExpectedGetMeta represents an expectation for a call to DB.GetMeta().
-type ExpectedGetMeta struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) (int64, string, error)
- arg0 string
- ret0 int64
- ret1 string
-}
-
-// WithOptions sets the expected options for the call to DB.GetMeta().
-func (e *ExpectedGetMeta) WithOptions(options map[string]interface{}) *ExpectedGetMeta {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGetMeta) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (int64, string, error)) *ExpectedGetMeta {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.GetMeta().
-func (e *ExpectedGetMeta) WillReturn(ret0 int64, ret1 string) *ExpectedGetMeta {
- e.ret0 = ret0
- e.ret1 = ret1
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.GetMeta().
-func (e *ExpectedGetMeta) WillReturnError(err error) *ExpectedGetMeta {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.GetMeta() to delay.
-func (e *ExpectedGetMeta) WillDelay(delay time.Duration) *ExpectedGetMeta {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGetMeta) met(ex expectation) bool {
- exp := ex.(*ExpectedGetMeta)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedGetMeta) method(v bool) string {
- if !v {
- return "DB.GetMeta()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).GetMeta(ctx, %s, %s)", e.dbo().name, arg0, options)
-}
-
-// ExpectedPut represents an expectation for a call to DB.Put().
-type ExpectedPut struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 interface{}, options map[string]interface{}) (string, error)
- arg0 string
- arg1 interface{}
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to DB.Put().
-func (e *ExpectedPut) WithOptions(options map[string]interface{}) *ExpectedPut {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedPut) WillExecute(cb func(ctx context.Context, arg0 string, arg1 interface{}, options map[string]interface{}) (string, error)) *ExpectedPut {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Put().
-func (e *ExpectedPut) WillReturn(ret0 string) *ExpectedPut {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Put().
-func (e *ExpectedPut) WillReturnError(err error) *ExpectedPut {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Put() to delay.
-func (e *ExpectedPut) WillDelay(delay time.Duration) *ExpectedPut {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedPut) met(ex expectation) bool {
- exp := ex.(*ExpectedPut)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != nil && !jsonMeets(exp.arg1, e.arg1) {
- return false
- }
- return true
-}
-
-func (e *ExpectedPut) method(v bool) string {
- if !v {
- return "DB.Put()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != nil {
- arg1 = fmt.Sprintf("%v", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Put(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedViewCleanup represents an expectation for a call to DB.ViewCleanup().
-type ExpectedViewCleanup struct {
- commonExpectation
- callback func(ctx context.Context) error
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedViewCleanup) WillExecute(cb func(ctx context.Context) error) *ExpectedViewCleanup {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.ViewCleanup().
-func (e *ExpectedViewCleanup) WillReturnError(err error) *ExpectedViewCleanup {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.ViewCleanup() to delay.
-func (e *ExpectedViewCleanup) WillDelay(delay time.Duration) *ExpectedViewCleanup {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedViewCleanup) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedViewCleanup) method(v bool) string {
- if !v {
- return "DB.ViewCleanup()"
- }
- return fmt.Sprintf("DB(%s).ViewCleanup(ctx)", e.dbo().name)
-}
-
-// ExpectedAllDocs represents an expectation for a call to DB.AllDocs().
-type ExpectedAllDocs struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)
- ret0 *Rows
-}
-
-// WithOptions sets the expected options for the call to DB.AllDocs().
-func (e *ExpectedAllDocs) WithOptions(options map[string]interface{}) *ExpectedAllDocs {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedAllDocs) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)) *ExpectedAllDocs {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.AllDocs().
-func (e *ExpectedAllDocs) WillReturn(ret0 *Rows) *ExpectedAllDocs {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.AllDocs().
-func (e *ExpectedAllDocs) WillReturnError(err error) *ExpectedAllDocs {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.AllDocs() to delay.
-func (e *ExpectedAllDocs) WillDelay(delay time.Duration) *ExpectedAllDocs {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedAllDocs) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedAllDocs) method(v bool) string {
- if !v {
- return "DB.AllDocs()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).AllDocs(ctx, %s)", e.dbo().name, options)
-}
-
-// ExpectedBulkDocs represents an expectation for a call to DB.BulkDocs().
-type ExpectedBulkDocs struct {
- commonExpectation
- callback func(ctx context.Context, arg0 []interface{}, options map[string]interface{}) (driver.BulkResults, error)
- arg0 []interface{}
- ret0 *BulkResults
-}
-
-// WithOptions sets the expected options for the call to DB.BulkDocs().
-func (e *ExpectedBulkDocs) WithOptions(options map[string]interface{}) *ExpectedBulkDocs {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedBulkDocs) WillExecute(cb func(ctx context.Context, arg0 []interface{}, options map[string]interface{}) (driver.BulkResults, error)) *ExpectedBulkDocs {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.BulkDocs().
-func (e *ExpectedBulkDocs) WillReturn(ret0 *BulkResults) *ExpectedBulkDocs {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.BulkDocs().
-func (e *ExpectedBulkDocs) WillReturnError(err error) *ExpectedBulkDocs {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.BulkDocs() to delay.
-func (e *ExpectedBulkDocs) WillDelay(delay time.Duration) *ExpectedBulkDocs {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedBulkDocs) met(ex expectation) bool {
- exp := ex.(*ExpectedBulkDocs)
- if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedBulkDocs) method(v bool) string {
- if !v {
- return "DB.BulkDocs()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).BulkDocs(ctx, %s, %s)", e.dbo().name, arg0, options)
-}
-
-// ExpectedBulkGet represents an expectation for a call to DB.BulkGet().
-type ExpectedBulkGet struct {
- commonExpectation
- callback func(ctx context.Context, arg0 []driver.BulkGetReference, options map[string]interface{}) (driver.Rows, error)
- arg0 []driver.BulkGetReference
- ret0 *Rows
-}
-
-// WithOptions sets the expected options for the call to DB.BulkGet().
-func (e *ExpectedBulkGet) WithOptions(options map[string]interface{}) *ExpectedBulkGet {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedBulkGet) WillExecute(cb func(ctx context.Context, arg0 []driver.BulkGetReference, options map[string]interface{}) (driver.Rows, error)) *ExpectedBulkGet {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.BulkGet().
-func (e *ExpectedBulkGet) WillReturn(ret0 *Rows) *ExpectedBulkGet {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.BulkGet().
-func (e *ExpectedBulkGet) WillReturnError(err error) *ExpectedBulkGet {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.BulkGet() to delay.
-func (e *ExpectedBulkGet) WillDelay(delay time.Duration) *ExpectedBulkGet {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedBulkGet) met(ex expectation) bool {
- exp := ex.(*ExpectedBulkGet)
- if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedBulkGet) method(v bool) string {
- if !v {
- return "DB.BulkGet()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).BulkGet(ctx, %s, %s)", e.dbo().name, arg0, options)
-}
-
-// ExpectedChanges represents an expectation for a call to DB.Changes().
-type ExpectedChanges struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) (driver.Changes, error)
- ret0 *Changes
-}
-
-// WithOptions sets the expected options for the call to DB.Changes().
-func (e *ExpectedChanges) WithOptions(options map[string]interface{}) *ExpectedChanges {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedChanges) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (driver.Changes, error)) *ExpectedChanges {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Changes().
-func (e *ExpectedChanges) WillReturn(ret0 *Changes) *ExpectedChanges {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Changes().
-func (e *ExpectedChanges) WillReturnError(err error) *ExpectedChanges {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Changes() to delay.
-func (e *ExpectedChanges) WillDelay(delay time.Duration) *ExpectedChanges {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedChanges) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedChanges) method(v bool) string {
- if !v {
- return "DB.Changes()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Changes(ctx, %s)", e.dbo().name, options)
-}
-
-// ExpectedDesignDocs represents an expectation for a call to DB.DesignDocs().
-type ExpectedDesignDocs struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)
- ret0 *Rows
-}
-
-// WithOptions sets the expected options for the call to DB.DesignDocs().
-func (e *ExpectedDesignDocs) WithOptions(options map[string]interface{}) *ExpectedDesignDocs {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedDesignDocs) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)) *ExpectedDesignDocs {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.DesignDocs().
-func (e *ExpectedDesignDocs) WillReturn(ret0 *Rows) *ExpectedDesignDocs {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.DesignDocs().
-func (e *ExpectedDesignDocs) WillReturnError(err error) *ExpectedDesignDocs {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.DesignDocs() to delay.
-func (e *ExpectedDesignDocs) WillDelay(delay time.Duration) *ExpectedDesignDocs {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDesignDocs) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedDesignDocs) method(v bool) string {
- if !v {
- return "DB.DesignDocs()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).DesignDocs(ctx, %s)", e.dbo().name, options)
-}
-
-// ExpectedExplain represents an expectation for a call to DB.Explain().
-type ExpectedExplain struct {
- commonExpectation
- callback func(ctx context.Context, arg0 interface{}) (*driver.QueryPlan, error)
- arg0 interface{}
- ret0 *driver.QueryPlan
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedExplain) WillExecute(cb func(ctx context.Context, arg0 interface{}) (*driver.QueryPlan, error)) *ExpectedExplain {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Explain().
-func (e *ExpectedExplain) WillReturn(ret0 *driver.QueryPlan) *ExpectedExplain {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Explain().
-func (e *ExpectedExplain) WillReturnError(err error) *ExpectedExplain {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Explain() to delay.
-func (e *ExpectedExplain) WillDelay(delay time.Duration) *ExpectedExplain {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedExplain) met(ex expectation) bool {
- exp := ex.(*ExpectedExplain)
- if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedExplain) method(v bool) string {
- if !v {
- return "DB.Explain()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DB(%s).Explain(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedFind represents an expectation for a call to DB.Find().
-type ExpectedFind struct {
- commonExpectation
- callback func(ctx context.Context, arg0 interface{}) (driver.Rows, error)
- arg0 interface{}
- ret0 *Rows
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedFind) WillExecute(cb func(ctx context.Context, arg0 interface{}) (driver.Rows, error)) *ExpectedFind {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Find().
-func (e *ExpectedFind) WillReturn(ret0 *Rows) *ExpectedFind {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Find().
-func (e *ExpectedFind) WillReturnError(err error) *ExpectedFind {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Find() to delay.
-func (e *ExpectedFind) WillDelay(delay time.Duration) *ExpectedFind {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedFind) met(ex expectation) bool {
- exp := ex.(*ExpectedFind)
- if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedFind) method(v bool) string {
- if !v {
- return "DB.Find()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DB(%s).Find(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedGet represents an expectation for a call to DB.Get().
-type ExpectedGet struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) (*driver.Document, error)
- arg0 string
- ret0 *driver.Document
-}
-
-// WithOptions sets the expected options for the call to DB.Get().
-func (e *ExpectedGet) WithOptions(options map[string]interface{}) *ExpectedGet {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGet) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) (*driver.Document, error)) *ExpectedGet {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Get().
-func (e *ExpectedGet) WillReturn(ret0 *driver.Document) *ExpectedGet {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Get().
-func (e *ExpectedGet) WillReturnError(err error) *ExpectedGet {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Get() to delay.
-func (e *ExpectedGet) WillDelay(delay time.Duration) *ExpectedGet {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGet) met(ex expectation) bool {
- exp := ex.(*ExpectedGet)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- return true
-}
-
-func (e *ExpectedGet) method(v bool) string {
- if !v {
- return "DB.Get()"
- }
- arg0, options := "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Get(ctx, %s, %s)", e.dbo().name, arg0, options)
-}
-
-// ExpectedGetAttachment represents an expectation for a call to DB.GetAttachment().
-type ExpectedGetAttachment struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error)
- arg0 string
- arg1 string
- ret0 *driver.Attachment
-}
-
-// WithOptions sets the expected options for the call to DB.GetAttachment().
-func (e *ExpectedGetAttachment) WithOptions(options map[string]interface{}) *ExpectedGetAttachment {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGetAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error)) *ExpectedGetAttachment {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.GetAttachment().
-func (e *ExpectedGetAttachment) WillReturn(ret0 *driver.Attachment) *ExpectedGetAttachment {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.GetAttachment().
-func (e *ExpectedGetAttachment) WillReturnError(err error) *ExpectedGetAttachment {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.GetAttachment() to delay.
-func (e *ExpectedGetAttachment) WillDelay(delay time.Duration) *ExpectedGetAttachment {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGetAttachment) met(ex expectation) bool {
- exp := ex.(*ExpectedGetAttachment)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedGetAttachment) method(v bool) string {
- if !v {
- return "DB.GetAttachment()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).GetAttachment(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedGetAttachmentMeta represents an expectation for a call to DB.GetAttachmentMeta().
-type ExpectedGetAttachmentMeta struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error)
- arg0 string
- arg1 string
- ret0 *driver.Attachment
-}
-
-// WithOptions sets the expected options for the call to DB.GetAttachmentMeta().
-func (e *ExpectedGetAttachmentMeta) WithOptions(options map[string]interface{}) *ExpectedGetAttachmentMeta {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGetAttachmentMeta) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (*driver.Attachment, error)) *ExpectedGetAttachmentMeta {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.GetAttachmentMeta().
-func (e *ExpectedGetAttachmentMeta) WillReturn(ret0 *driver.Attachment) *ExpectedGetAttachmentMeta {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.GetAttachmentMeta().
-func (e *ExpectedGetAttachmentMeta) WillReturnError(err error) *ExpectedGetAttachmentMeta {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.GetAttachmentMeta() to delay.
-func (e *ExpectedGetAttachmentMeta) WillDelay(delay time.Duration) *ExpectedGetAttachmentMeta {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGetAttachmentMeta) met(ex expectation) bool {
- exp := ex.(*ExpectedGetAttachmentMeta)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedGetAttachmentMeta) method(v bool) string {
- if !v {
- return "DB.GetAttachmentMeta()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).GetAttachmentMeta(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedGetIndexes represents an expectation for a call to DB.GetIndexes().
-type ExpectedGetIndexes struct {
- commonExpectation
- callback func(ctx context.Context) ([]driver.Index, error)
- ret0 []driver.Index
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedGetIndexes) WillExecute(cb func(ctx context.Context) ([]driver.Index, error)) *ExpectedGetIndexes {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.GetIndexes().
-func (e *ExpectedGetIndexes) WillReturn(ret0 []driver.Index) *ExpectedGetIndexes {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.GetIndexes().
-func (e *ExpectedGetIndexes) WillReturnError(err error) *ExpectedGetIndexes {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.GetIndexes() to delay.
-func (e *ExpectedGetIndexes) WillDelay(delay time.Duration) *ExpectedGetIndexes {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedGetIndexes) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedGetIndexes) method(v bool) string {
- if !v {
- return "DB.GetIndexes()"
- }
- return fmt.Sprintf("DB(%s).GetIndexes(ctx)", e.dbo().name)
-}
-
-// ExpectedLocalDocs represents an expectation for a call to DB.LocalDocs().
-type ExpectedLocalDocs struct {
- commonExpectation
- callback func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)
- ret0 *Rows
-}
-
-// WithOptions sets the expected options for the call to DB.LocalDocs().
-func (e *ExpectedLocalDocs) WithOptions(options map[string]interface{}) *ExpectedLocalDocs {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedLocalDocs) WillExecute(cb func(ctx context.Context, options map[string]interface{}) (driver.Rows, error)) *ExpectedLocalDocs {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.LocalDocs().
-func (e *ExpectedLocalDocs) WillReturn(ret0 *Rows) *ExpectedLocalDocs {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.LocalDocs().
-func (e *ExpectedLocalDocs) WillReturnError(err error) *ExpectedLocalDocs {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.LocalDocs() to delay.
-func (e *ExpectedLocalDocs) WillDelay(delay time.Duration) *ExpectedLocalDocs {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedLocalDocs) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedLocalDocs) method(v bool) string {
- if !v {
- return "DB.LocalDocs()"
- }
- options := defaultOptionPlaceholder
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).LocalDocs(ctx, %s)", e.dbo().name, options)
-}
-
-// ExpectedPurge represents an expectation for a call to DB.Purge().
-type ExpectedPurge struct {
- commonExpectation
- callback func(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error)
- arg0 map[string][]string
- ret0 *driver.PurgeResult
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedPurge) WillExecute(cb func(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error)) *ExpectedPurge {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Purge().
-func (e *ExpectedPurge) WillReturn(ret0 *driver.PurgeResult) *ExpectedPurge {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Purge().
-func (e *ExpectedPurge) WillReturnError(err error) *ExpectedPurge {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Purge() to delay.
-func (e *ExpectedPurge) WillDelay(delay time.Duration) *ExpectedPurge {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedPurge) met(ex expectation) bool {
- exp := ex.(*ExpectedPurge)
- if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedPurge) method(v bool) string {
- if !v {
- return "DB.Purge()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DB(%s).Purge(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedPutAttachment represents an expectation for a call to DB.PutAttachment().
-type ExpectedPutAttachment struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, arg2 *driver.Attachment, options map[string]interface{}) (string, error)
- arg0 string
- arg1 string
- arg2 *driver.Attachment
- ret0 string
-}
-
-// WithOptions sets the expected options for the call to DB.PutAttachment().
-func (e *ExpectedPutAttachment) WithOptions(options map[string]interface{}) *ExpectedPutAttachment {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedPutAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 *driver.Attachment, options map[string]interface{}) (string, error)) *ExpectedPutAttachment {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.PutAttachment().
-func (e *ExpectedPutAttachment) WillReturn(ret0 string) *ExpectedPutAttachment {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.PutAttachment().
-func (e *ExpectedPutAttachment) WillReturnError(err error) *ExpectedPutAttachment {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.PutAttachment() to delay.
-func (e *ExpectedPutAttachment) WillDelay(delay time.Duration) *ExpectedPutAttachment {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedPutAttachment) met(ex expectation) bool {
- exp := ex.(*ExpectedPutAttachment)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- if exp.arg2 != nil && !reflect.DeepEqual(exp.arg2, e.arg2) {
- return false
- }
- return true
-}
-
-func (e *ExpectedPutAttachment) method(v bool) string {
- if !v {
- return "DB.PutAttachment()"
- }
- arg0, arg1, arg2, options := "?", "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.arg2 != nil {
- arg2 = fmt.Sprintf("%v", e.arg2)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).PutAttachment(ctx, %s, %s, %s, %s)", e.dbo().name, arg0, arg1, arg2, options)
-}
-
-// ExpectedQuery represents an expectation for a call to DB.Query().
-type ExpectedQuery struct {
- commonExpectation
- callback func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Rows, error)
- arg0 string
- arg1 string
- ret0 *Rows
-}
-
-// WithOptions sets the expected options for the call to DB.Query().
-func (e *ExpectedQuery) WithOptions(options map[string]interface{}) *ExpectedQuery {
- e.options = options
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedQuery) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options map[string]interface{}) (driver.Rows, error)) *ExpectedQuery {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Query().
-func (e *ExpectedQuery) WillReturn(ret0 *Rows) *ExpectedQuery {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Query().
-func (e *ExpectedQuery) WillReturnError(err error) *ExpectedQuery {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Query() to delay.
-func (e *ExpectedQuery) WillDelay(delay time.Duration) *ExpectedQuery {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedQuery) met(ex expectation) bool {
- exp := ex.(*ExpectedQuery)
- if exp.arg0 != "" && exp.arg0 != e.arg0 {
- return false
- }
- if exp.arg1 != "" && exp.arg1 != e.arg1 {
- return false
- }
- return true
-}
-
-func (e *ExpectedQuery) method(v bool) string {
- if !v {
- return "DB.Query()"
- }
- arg0, arg1, options := "?", "?", defaultOptionPlaceholder
- if e.arg0 != "" {
- arg0 = fmt.Sprintf("%q", e.arg0)
- }
- if e.arg1 != "" {
- arg1 = fmt.Sprintf("%q", e.arg1)
- }
- if e.options != nil {
- options = fmt.Sprintf("%v", e.options)
- }
- return fmt.Sprintf("DB(%s).Query(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options)
-}
-
-// ExpectedRevsDiff represents an expectation for a call to DB.RevsDiff().
-type ExpectedRevsDiff struct {
- commonExpectation
- callback func(ctx context.Context, arg0 interface{}) (driver.Rows, error)
- arg0 interface{}
- ret0 *Rows
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedRevsDiff) WillExecute(cb func(ctx context.Context, arg0 interface{}) (driver.Rows, error)) *ExpectedRevsDiff {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.RevsDiff().
-func (e *ExpectedRevsDiff) WillReturn(ret0 *Rows) *ExpectedRevsDiff {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.RevsDiff().
-func (e *ExpectedRevsDiff) WillReturnError(err error) *ExpectedRevsDiff {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.RevsDiff() to delay.
-func (e *ExpectedRevsDiff) WillDelay(delay time.Duration) *ExpectedRevsDiff {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedRevsDiff) met(ex expectation) bool {
- exp := ex.(*ExpectedRevsDiff)
- if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedRevsDiff) method(v bool) string {
- if !v {
- return "DB.RevsDiff()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DB(%s).RevsDiff(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedSecurity represents an expectation for a call to DB.Security().
-type ExpectedSecurity struct {
- commonExpectation
- callback func(ctx context.Context) (*driver.Security, error)
- ret0 *driver.Security
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedSecurity) WillExecute(cb func(ctx context.Context) (*driver.Security, error)) *ExpectedSecurity {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Security().
-func (e *ExpectedSecurity) WillReturn(ret0 *driver.Security) *ExpectedSecurity {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Security().
-func (e *ExpectedSecurity) WillReturnError(err error) *ExpectedSecurity {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Security() to delay.
-func (e *ExpectedSecurity) WillDelay(delay time.Duration) *ExpectedSecurity {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedSecurity) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedSecurity) method(v bool) string {
- if !v {
- return "DB.Security()"
- }
- return fmt.Sprintf("DB(%s).Security(ctx)", e.dbo().name)
-}
-
-// ExpectedSetSecurity represents an expectation for a call to DB.SetSecurity().
-type ExpectedSetSecurity struct {
- commonExpectation
- callback func(ctx context.Context, arg0 *driver.Security) error
- arg0 *driver.Security
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedSetSecurity) WillExecute(cb func(ctx context.Context, arg0 *driver.Security) error) *ExpectedSetSecurity {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.SetSecurity().
-func (e *ExpectedSetSecurity) WillReturnError(err error) *ExpectedSetSecurity {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.SetSecurity() to delay.
-func (e *ExpectedSetSecurity) WillDelay(delay time.Duration) *ExpectedSetSecurity {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedSetSecurity) met(ex expectation) bool {
- exp := ex.(*ExpectedSetSecurity)
- if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) {
- return false
- }
- return true
-}
-
-func (e *ExpectedSetSecurity) method(v bool) string {
- if !v {
- return "DB.SetSecurity()"
- }
- arg0 := "?"
- if e.arg0 != nil {
- arg0 = fmt.Sprintf("%v", e.arg0)
- }
- return fmt.Sprintf("DB(%s).SetSecurity(ctx, %s)", e.dbo().name, arg0)
-}
-
-// ExpectedStats represents an expectation for a call to DB.Stats().
-type ExpectedStats struct {
- commonExpectation
- callback func(ctx context.Context) (*driver.DBStats, error)
- ret0 *driver.DBStats
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedStats) WillExecute(cb func(ctx context.Context) (*driver.DBStats, error)) *ExpectedStats {
- e.callback = cb
- return e
-}
-
-// WillReturn sets the values that will be returned by the call to DB.Stats().
-func (e *ExpectedStats) WillReturn(ret0 *driver.DBStats) *ExpectedStats {
- e.ret0 = ret0
- return e
-}
-
-// WillReturnError sets the error value that will be returned by the call to DB.Stats().
-func (e *ExpectedStats) WillReturnError(err error) *ExpectedStats {
- e.err = err
- return e
-}
-
-// WillDelay causes the call to DB.Stats() to delay.
-func (e *ExpectedStats) WillDelay(delay time.Duration) *ExpectedStats {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedStats) met(_ expectation) bool {
- return true
-}
-
-func (e *ExpectedStats) method(v bool) string {
- if !v {
- return "DB.Stats()"
- }
- return fmt.Sprintf("DB(%s).Stats(ctx)", e.dbo().name)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/dbmock.go b/vendor/github.com/go-kivik/kivikmock/v3/dbmock.go
deleted file mode 100644
index 71b41d4070..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/dbmock.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package kivikmock
-
-import "sync"
-
-// MockDB is deprecated
-type MockDB = DB
-
-// DB serves to create expectations for database actions to mock and test real
-// database behavior.
-type DB struct {
- name string
- id int
- client *Client
- count int
- mu sync.RWMutex
-}
-
-func (db *DB) expectations() int {
- return db.count
-}
-
-// ExpectClose queues an expectation for DB.Close() to be called.
-func (db *DB) ExpectClose() *ExpectedDBClose {
- e := &ExpectedDBClose{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/dbmock_gen.go b/vendor/github.com/go-kivik/kivikmock/v3/dbmock_gen.go
deleted file mode 100644
index 753bfbfd72..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/dbmock_gen.go
+++ /dev/null
@@ -1,330 +0,0 @@
-/* This file is auto-generated. Do not edit it! */
-
-package kivikmock
-
-import (
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var _ = kivik.EndKeySuffix // To ensure a reference to kivik package
-var _ = &driver.Attachment{}
-
-// ExpectCompact queues an expectation that DB.Compact will be called.
-func (db *DB) ExpectCompact() *ExpectedCompact {
- e := &ExpectedCompact{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectCompactView queues an expectation that DB.CompactView will be called.
-func (db *DB) ExpectCompactView() *ExpectedCompactView {
- e := &ExpectedCompactView{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectCopy queues an expectation that DB.Copy will be called.
-func (db *DB) ExpectCopy() *ExpectedCopy {
- e := &ExpectedCopy{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectCreateDoc queues an expectation that DB.CreateDoc will be called.
-func (db *DB) ExpectCreateDoc() *ExpectedCreateDoc {
- e := &ExpectedCreateDoc{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectCreateIndex queues an expectation that DB.CreateIndex will be called.
-func (db *DB) ExpectCreateIndex() *ExpectedCreateIndex {
- e := &ExpectedCreateIndex{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectDelete queues an expectation that DB.Delete will be called.
-func (db *DB) ExpectDelete() *ExpectedDelete {
- e := &ExpectedDelete{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectDeleteAttachment queues an expectation that DB.DeleteAttachment will be called.
-func (db *DB) ExpectDeleteAttachment() *ExpectedDeleteAttachment {
- e := &ExpectedDeleteAttachment{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectDeleteIndex queues an expectation that DB.DeleteIndex will be called.
-func (db *DB) ExpectDeleteIndex() *ExpectedDeleteIndex {
- e := &ExpectedDeleteIndex{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectFlush queues an expectation that DB.Flush will be called.
-func (db *DB) ExpectFlush() *ExpectedFlush {
- e := &ExpectedFlush{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectGetMeta queues an expectation that DB.GetMeta will be called.
-func (db *DB) ExpectGetMeta() *ExpectedGetMeta {
- e := &ExpectedGetMeta{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectPut queues an expectation that DB.Put will be called.
-func (db *DB) ExpectPut() *ExpectedPut {
- e := &ExpectedPut{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectViewCleanup queues an expectation that DB.ViewCleanup will be called.
-func (db *DB) ExpectViewCleanup() *ExpectedViewCleanup {
- e := &ExpectedViewCleanup{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectAllDocs queues an expectation that DB.AllDocs will be called.
-func (db *DB) ExpectAllDocs() *ExpectedAllDocs {
- e := &ExpectedAllDocs{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectBulkDocs queues an expectation that DB.BulkDocs will be called.
-func (db *DB) ExpectBulkDocs() *ExpectedBulkDocs {
- e := &ExpectedBulkDocs{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectBulkGet queues an expectation that DB.BulkGet will be called.
-func (db *DB) ExpectBulkGet() *ExpectedBulkGet {
- e := &ExpectedBulkGet{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectChanges queues an expectation that DB.Changes will be called.
-func (db *DB) ExpectChanges() *ExpectedChanges {
- e := &ExpectedChanges{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectDesignDocs queues an expectation that DB.DesignDocs will be called.
-func (db *DB) ExpectDesignDocs() *ExpectedDesignDocs {
- e := &ExpectedDesignDocs{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectExplain queues an expectation that DB.Explain will be called.
-func (db *DB) ExpectExplain() *ExpectedExplain {
- e := &ExpectedExplain{
- commonExpectation: commonExpectation{db: db},
- ret0: &driver.QueryPlan{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectFind queues an expectation that DB.Find will be called.
-func (db *DB) ExpectFind() *ExpectedFind {
- e := &ExpectedFind{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectGet queues an expectation that DB.Get will be called.
-func (db *DB) ExpectGet() *ExpectedGet {
- e := &ExpectedGet{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectGetAttachment queues an expectation that DB.GetAttachment will be called.
-func (db *DB) ExpectGetAttachment() *ExpectedGetAttachment {
- e := &ExpectedGetAttachment{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectGetAttachmentMeta queues an expectation that DB.GetAttachmentMeta will be called.
-func (db *DB) ExpectGetAttachmentMeta() *ExpectedGetAttachmentMeta {
- e := &ExpectedGetAttachmentMeta{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectGetIndexes queues an expectation that DB.GetIndexes will be called.
-func (db *DB) ExpectGetIndexes() *ExpectedGetIndexes {
- e := &ExpectedGetIndexes{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectLocalDocs queues an expectation that DB.LocalDocs will be called.
-func (db *DB) ExpectLocalDocs() *ExpectedLocalDocs {
- e := &ExpectedLocalDocs{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectPurge queues an expectation that DB.Purge will be called.
-func (db *DB) ExpectPurge() *ExpectedPurge {
- e := &ExpectedPurge{
- commonExpectation: commonExpectation{db: db},
- ret0: &driver.PurgeResult{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectPutAttachment queues an expectation that DB.PutAttachment will be called.
-func (db *DB) ExpectPutAttachment() *ExpectedPutAttachment {
- e := &ExpectedPutAttachment{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectQuery queues an expectation that DB.Query will be called.
-func (db *DB) ExpectQuery() *ExpectedQuery {
- e := &ExpectedQuery{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectRevsDiff queues an expectation that DB.RevsDiff will be called.
-func (db *DB) ExpectRevsDiff() *ExpectedRevsDiff {
- e := &ExpectedRevsDiff{
- commonExpectation: commonExpectation{db: db},
- ret0: &Rows{},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectSecurity queues an expectation that DB.Security will be called.
-func (db *DB) ExpectSecurity() *ExpectedSecurity {
- e := &ExpectedSecurity{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectSetSecurity queues an expectation that DB.SetSecurity will be called.
-func (db *DB) ExpectSetSecurity() *ExpectedSetSecurity {
- e := &ExpectedSetSecurity{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
-
-// ExpectStats queues an expectation that DB.Stats will be called.
-func (db *DB) ExpectStats() *ExpectedStats {
- e := &ExpectedStats{
- commonExpectation: commonExpectation{db: db},
- }
- db.count++
- db.client.expected = append(db.client.expected, e)
- return e
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/driver.go b/vendor/github.com/go-kivik/kivikmock/v3/driver.go
deleted file mode 100644
index ff839c383b..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/driver.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package kivikmock
-
-import (
- "errors"
- "fmt"
- "sync"
- "testing"
-
- kivik "github.com/go-kivik/kivik/v3"
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-var pool *mockDriver
-
-func init() {
- pool = &mockDriver{
- clients: make(map[string]*Client),
- }
- kivik.Register("kivikmock", pool)
-}
-
-type mockDriver struct {
- sync.Mutex
- counter int
- clients map[string]*Client
-}
-
-var _ driver.Driver = &mockDriver{}
-
-func (d *mockDriver) NewClient(dsn string) (driver.Client, error) {
- d.Lock()
- defer d.Unlock()
-
- c, ok := d.clients[dsn]
- if !ok {
- return nil, errors.New("kivikmock: no available connection found")
- }
- c.opened++
- return &driverClient{Client: c}, nil
-}
-
-// New creates a kivik client connection and a mock to manage expectations.
-func New() (*kivik.Client, *Client, error) {
- pool.Lock()
- dsn := fmt.Sprintf("kivikmock_%d", pool.counter)
- pool.counter++
-
- kmock := &Client{dsn: dsn, drv: pool, ordered: true}
- pool.clients[dsn] = kmock
- pool.Unlock()
-
- return kmock.open()
-}
-
-// NewT works exactly as New, except that any error will be passed to t.Fatal.
-func NewT(t *testing.T) (*kivik.Client, *Client) {
- t.Helper()
- client, mock, err := New()
- if err != nil {
- t.Fatal(err)
- }
- return client, mock
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/expectations.go b/vendor/github.com/go-kivik/kivikmock/v3/expectations.go
deleted file mode 100644
index 40ac3ab5a5..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/expectations.go
+++ /dev/null
@@ -1,476 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "fmt"
- "reflect"
- "time"
-)
-
-func (e *ExpectedClose) String() string {
- extra := delayString(e.delay) + errorString(e.err)
- msg := "call to Close()"
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-// String satisfies the fmt.Stringer interface.
-func (e *ExpectedAllDBs) String() string {
- return "call to AllDBs() which:" +
- optionsString(e.options) +
- delayString(e.delay) +
- errorString(e.err)
-}
-
-// ExpectedAuthenticate is used to manage *kivik.Client.Authenticate
-// expectation returned by Mock.ExpectAuthenticate.
-type ExpectedAuthenticate struct {
- commonExpectation
- authType string
- callback func(ctx context.Context, authenticator interface{}) error
-}
-
-// String satisfies the fmt.Stringer interface.
-func (e *ExpectedAuthenticate) String() string {
- msg := fmt.Sprintf("call to %s which:", e.method(false))
- if e.authType == "" {
- msg += "\n\t- has any authenticator"
- } else {
- msg += fmt.Sprint("\n\t- has an authenticator of type: " + e.authType)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedAuthenticate) method(v bool) string {
- if !v {
- return "Authenticate()"
- }
- if e.authType == "" {
- return "Authenticate(ctx, ?)"
- }
- return fmt.Sprintf("Authenticate(ctx, <%s>)", e.authType)
-}
-
-func (e *ExpectedAuthenticate) met(ex expectation) bool {
- exp := ex.(*ExpectedAuthenticate)
- if exp.authType == "" {
- return true
- }
- return e.authType == exp.authType
-}
-
-// WillReturnError allows setting an error for *kivik.Client.Authenticate action.
-func (e *ExpectedAuthenticate) WillReturnError(err error) *ExpectedAuthenticate {
- e.err = err
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedAuthenticate) WillExecute(cb func(ctx context.Context, authenticator interface{}) error) *ExpectedAuthenticate {
- e.callback = cb
- return e
-}
-
-// WithAuthenticator will match the the provide authenticator _type_ against
-// that provided. There is no way to validate the authenticated credentials
-// with this method.
-func (e *ExpectedAuthenticate) WithAuthenticator(authenticator interface{}) *ExpectedAuthenticate {
- e.authType = reflect.TypeOf(authenticator).Name()
- return e
-}
-
-// WillDelay will cause execution of Authenticate() to delay by duration d.
-func (e *ExpectedAuthenticate) WillDelay(d time.Duration) *ExpectedAuthenticate {
- e.delay = d
- return e
-}
-
-func (e *ExpectedClusterSetup) String() string {
- msg := "call to ClusterSetup() which:"
- if e.arg0 == nil {
- msg += "\n\t- has any action"
- } else {
- msg += fmt.Sprintf("\n\t- has the action: %v", e.arg0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-// String satisfies the fmt.Stringer interface
-func (e *ExpectedClusterStatus) String() string {
- return "call to ClusterStatus() which:" +
- optionsString(e.options) +
- delayString(e.delay) +
- errorString(e.err)
-}
-
-// WithAction specifies the action to be matched. Note that this expectation
-// is compared with the actual action's marshaled JSON output, so it is not
-// essential that the data types match exactly, in a Go sense.
-func (e *ExpectedClusterSetup) WithAction(action interface{}) *ExpectedClusterSetup {
- e.arg0 = action
- return e
-}
-
-func (e *ExpectedDBExists) String() string {
- msg := "call to DBExists() which:" +
- fieldString("name", e.arg0) +
- optionsString(e.options) +
- delayString(e.delay)
- if e.err == nil {
- msg += fmt.Sprintf("\n\t- should return: %t", e.ret0)
- } else {
- msg += fmt.Sprintf("\n\t- should return error: %s", e.err)
- }
- return msg
-}
-
-// WithName sets the expectation that DBExists will be called with the provided
-// name.
-func (e *ExpectedDBExists) WithName(name string) *ExpectedDBExists {
- e.arg0 = name
- return e
-}
-
-func (e *ExpectedDestroyDB) String() string {
- return "call to DestroyDB() which:" +
- fieldString("name", e.arg0) +
- optionsString(e.options) +
- delayString(e.delay) +
- errorString(e.err)
-}
-
-// WithName sets the expectation that DestroyDB will be called with this name.
-func (e *ExpectedDestroyDB) WithName(name string) *ExpectedDestroyDB {
- e.arg0 = name
- return e
-}
-
-func (e *ExpectedDBsStats) String() string {
- msg := "call to DBsStats() which:"
- if e.arg0 == nil {
- msg += "\n\t- has any names"
- } else {
- msg += fmt.Sprintf("\n\t- has names: %s", e.arg0)
- }
- return msg + delayString(e.delay) + errorString(e.err)
-}
-
-// WithNames sets the expectation that DBsStats will be called with these names.
-func (e *ExpectedDBsStats) WithNames(names []string) *ExpectedDBsStats {
- e.arg0 = names
- return e
-}
-
-func (e *ExpectedPing) String() string {
- msg := "call to Ping()"
- extra := delayString(e.delay) + errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedSession) String() string {
- msg := "call to Session()"
- extra := ""
- if e.ret0 != nil {
- extra += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- extra += delayString(e.delay) + errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedVersion) String() string {
- msg := "call to Version()"
- extra := ""
- if e.ret0 != nil {
- extra += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- extra += delayString(e.delay) + errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedDB) String() string {
- msg := "call to DB() which:" +
- fieldString("name", e.arg0) +
- optionsString(e.options)
- if e.db != nil {
- msg += fmt.Sprintf("\n\t- should return database with %d expectations", e.db.expectations())
- }
- msg += delayString(e.delay)
- return msg
-}
-
-// WithName sets the expectation that DB() will be called with this name.
-func (e *ExpectedDB) WithName(name string) *ExpectedDB {
- e.arg0 = name
- return e
-}
-
-// ExpectedCreateDB represents an expectation to call the CreateDB() method.
-//
-// Implementation note: Because kivik always calls DB() after a
-// successful CreateDB() is executed, ExpectCreateDB() creates two
-// expectations under the covers, one for the backend CreateDB() call,
-// and one for the DB() call. If WillReturnError() is called, the DB() call
-// expectation is removed.
-type ExpectedCreateDB struct {
- commonExpectation
- arg0 string
- callback func(ctx context.Context, arg0 string, options map[string]interface{}) error
-}
-
-func (e *ExpectedCreateDB) String() string {
- msg := "call to CreateDB() which:" +
- fieldString("name", e.arg0) +
- optionsString(e.options)
- if e.db != nil {
- msg += fmt.Sprintf("\n\t- should return database with %d expectations", e.db.expectations())
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedCreateDB) method(v bool) string {
- if !v {
- return "CreateDB()"
- }
- var name, options string
- if e.arg0 == "" {
- name = "?"
- } else {
- name = fmt.Sprintf("%q", e.arg0)
- }
- if e.options != nil {
- options = fmt.Sprintf(", %v", e.options)
- }
- return fmt.Sprintf("CreateDB(ctx, %s%s)", name, options)
-}
-
-func (e *ExpectedCreateDB) met(ex expectation) bool {
- exp := ex.(*ExpectedCreateDB)
- return exp.arg0 == "" || exp.arg0 == e.arg0
-}
-
-// WithOptions set the expectation that DB() will be called with these options.
-func (e *ExpectedCreateDB) WithOptions(options map[string]interface{}) *ExpectedCreateDB {
- e.options = options
- return e
-}
-
-// WithName sets the expectation that DB() will be called with this name.
-func (e *ExpectedCreateDB) WithName(name string) *ExpectedCreateDB {
- e.arg0 = name
- return e
-}
-
-// WillExecute sets a callback function to be called with any inputs to the
-// original function. Any values returned by the callback will be returned as
-// if generated by the driver.
-func (e *ExpectedCreateDB) WillExecute(cb func(ctx context.Context, arg0 string, options map[string]interface{}) error) *ExpectedCreateDB {
- e.callback = cb
- return e
-}
-
-// WillReturnError sets the return value for the DB() call.
-func (e *ExpectedCreateDB) WillReturnError(err error) *ExpectedCreateDB {
- e.err = err
- return e
-}
-
-// WillDelay will cause execution of DB() to delay by duration d.
-func (e *ExpectedCreateDB) WillDelay(delay time.Duration) *ExpectedCreateDB {
- e.delay = delay
- return e
-}
-
-func (e *ExpectedDBUpdates) String() string {
- msg := "call to DBUpdates()"
- var extra string
- if e.ret0 != nil {
- extra += fmt.Sprintf("\n\t- should return: %d results", e.ret0.count())
- }
- extra += delayString(e.delay)
- extra += errorString(e.err)
- if extra != "" {
- msg += " which:" + extra
- }
- return msg
-}
-
-func (e *ExpectedConfig) String() string {
- msg := "call to Config() which:"
- msg += fieldString("node", e.arg0)
- if e.ret0 != nil {
- msg += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedConfig) WithNode(node string) *ExpectedConfig {
- e.arg0 = node
- return e
-}
-
-func (e *ExpectedConfigSection) String() string {
- msg := "call to ConfigSection() which:" +
- fieldString("node", e.arg0) +
- fieldString("section", e.arg1)
- if e.ret0 != nil {
- msg += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedConfigSection) WithNode(node string) *ExpectedConfigSection {
- e.arg0 = node
- return e
-}
-
-func (e *ExpectedConfigSection) WithSection(section string) *ExpectedConfigSection {
- e.arg1 = section
- return e
-}
-
-func (e *ExpectedConfigValue) String() string {
- msg := "call to ConfigValue() which:" +
- fieldString("node", e.arg0) +
- fieldString("section", e.arg1) +
- fieldString("key", e.arg2)
- if e.ret0 != "" {
- msg += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedConfigValue) WithNode(node string) *ExpectedConfigValue {
- e.arg0 = node
- return e
-}
-
-func (e *ExpectedConfigValue) WithSection(section string) *ExpectedConfigValue {
- e.arg1 = section
- return e
-}
-
-func (e *ExpectedConfigValue) WithKey(key string) *ExpectedConfigValue {
- e.arg2 = key
- return e
-}
-
-func (e *ExpectedSetConfigValue) String() string {
- msg := "call to SetConfigValue() which:" +
- fieldString("node", e.arg0) +
- fieldString("section", e.arg1) +
- fieldString("key", e.arg2) +
- fieldString("value", e.arg3)
- if e.ret0 != "" {
- msg += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedSetConfigValue) WithNode(node string) *ExpectedSetConfigValue {
- e.arg0 = node
- return e
-}
-
-func (e *ExpectedSetConfigValue) WithSection(section string) *ExpectedSetConfigValue {
- e.arg1 = section
- return e
-}
-
-func (e *ExpectedSetConfigValue) WithKey(key string) *ExpectedSetConfigValue {
- e.arg2 = key
- return e
-}
-
-func (e *ExpectedSetConfigValue) WithValue(value string) *ExpectedSetConfigValue {
- e.arg3 = value
- return e
-}
-
-func (e *ExpectedDeleteConfigKey) String() string {
- msg := "call to DeleteConfigKey() which:" +
- fieldString("node", e.arg0) +
- fieldString("section", e.arg1) +
- fieldString("key", e.arg2)
- if e.ret0 != "" {
- msg += fmt.Sprintf("\n\t- should return: %v", e.ret0)
- }
- msg += delayString(e.delay)
- msg += errorString(e.err)
- return msg
-}
-
-func (e *ExpectedDeleteConfigKey) WithNode(node string) *ExpectedDeleteConfigKey {
- e.arg0 = node
- return e
-}
-
-func (e *ExpectedDeleteConfigKey) WithSection(section string) *ExpectedDeleteConfigKey {
- e.arg1 = section
- return e
-}
-
-func (e *ExpectedDeleteConfigKey) WithKey(key string) *ExpectedDeleteConfigKey {
- e.arg2 = key
- return e
-}
-
-func (e *ExpectedReplicate) String() string {
- msg := "call to Replicate() which:" +
- fieldString("target", e.arg0) +
- fieldString("source", e.arg1) +
- optionsString(e.options)
- if e.ret0 != nil {
- msg += fmt.Sprintf("\n\t- should return: %v", jsonDoc(e.ret0))
- }
- return msg +
- delayString(e.delay) +
- errorString(e.err)
-}
-
-func (e *ExpectedReplicate) WithSource(source string) *ExpectedReplicate {
- e.arg1 = source
- return e
-}
-
-func (e *ExpectedReplicate) WithTarget(target string) *ExpectedReplicate {
- e.arg0 = target
- return e
-}
-
-func (e *ExpectedGetReplications) String() string {
- msg := "call to GetReplications() which:" +
- optionsString(e.options)
- if l := len(e.ret0); l > 0 {
- msg += fmt.Sprintf("\n\t- should return: %d results", l)
- }
- return msg +
- delayString(e.delay) +
- errorString(e.err)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/go.mod b/vendor/github.com/go-kivik/kivikmock/v3/go.mod
deleted file mode 100644
index 4397c964a1..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/go.mod
+++ /dev/null
@@ -1,10 +0,0 @@
-module github.com/go-kivik/kivikmock/v3
-
-go 1.13
-
-require (
- github.com/flimzy/diff v0.1.6
- github.com/go-kivik/couchdb/v3 v3.0.0
- github.com/go-kivik/kivik/v3 v3.0.0
- gitlab.com/flimzy/testy v0.0.2
-)
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/go.sum b/vendor/github.com/go-kivik/kivikmock/v3/go.sum
deleted file mode 100644
index d800190c60..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/go.sum
+++ /dev/null
@@ -1,50 +0,0 @@
-bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/flimzy/diff v0.1.5/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/diff v0.1.6 h1:ufTsTKcDtlaczpJTo3u1NeYqzuP6oRpy1VwQUIrgmBY=
-github.com/flimzy/diff v0.1.6/go.mod h1:lFJtC7SPsK0EroDmGTSrdtWKAxOk3rO+q+e04LL05Hs=
-github.com/flimzy/testy v0.1.17-0.20190521133342-95b386c3ece6 h1:uw6StVCll2vXdHJMAiKvhfAwcwBYD6d9dgWOIdHMku8=
-github.com/flimzy/testy v0.1.17-0.20190521133342-95b386c3ece6/go.mod h1:3szguN8NXqgq9bt9Gu8TQVj698PJWmyx/VY1frwwKrM=
-github.com/go-kivik/couchdb/v3 v3.0.0 h1:HBDO5gD2FxXECKqb1HMBK+pitv4E+p88RvlaJQZwFcs=
-github.com/go-kivik/couchdb/v3 v3.0.0/go.mod h1:eTGmiw9fnA30gdqQCgH3vNrW+glhl+48RbvZga8/wLk=
-github.com/go-kivik/kivik/v3 v3.0.0 h1:5KHMMQ1oeUPF3IOQlZaj5C/4d/zsT4TuY4g3zsU9yBQ=
-github.com/go-kivik/kivik/v3 v3.0.0/go.mod h1:7tmQDvkta/pcijpUjLMsQ9HJUELiKD5zm6jQ3Gb9cxE=
-github.com/go-kivik/kiviktest/v3 v3.0.0 h1:xHXdFHx1YVbULTDGi+hzs7rjMzamCl+hf7UbXojZZMM=
-github.com/go-kivik/kiviktest/v3 v3.0.0/go.mod h1:pLjkg/F61+X4Ks1BpbrTgbChjdPcINX2HysR8i7AfBM=
-github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5 h1:On5cS+huOk7mqad9QjklHw+BMGKykSmu6QG32X+C77o=
-github.com/gopherjs/gopherjs v0.0.0-20200209144316-f9cef593def5/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc=
-github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc=
-github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
-github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776 h1:o59bHXu8Ejas8Kq6pjoVJQ9/neN66SM8AKh6wI42BBs=
-github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4=
-github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw=
-github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M=
-github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
-github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
-github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
-github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
-github.com/pkg/errors v0.9.1/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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-gitlab.com/flimzy/testy v0.0.0-20190816103046-aca1ef5ffe7e/go.mod h1:MQwjgAyueIbBZv+qSYAMs6LaZwsJysPs0BK/niv9JiI=
-gitlab.com/flimzy/testy v0.0.2 h1:wii65HpZEbstqGT44+msiwzrX7SaxqNXj0BFjJc9iUY=
-gitlab.com/flimzy/testy v0.0.2/go.mod h1:YObF4cq711ubd/3U0ydRQQVz7Cnq/ChgJpVwNr/AJac=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
-golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/helpers.go b/vendor/github.com/go-kivik/kivikmock/v3/helpers.go
deleted file mode 100644
index 17997d65ad..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/helpers.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package kivikmock
-
-import (
- "bytes"
- "encoding/json"
- "io/ioutil"
- "testing"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// ToDocumentT is deprecated.
-func ToDocumentT(t *testing.T, i interface{}) *driver.Document {
- t.Helper()
- return DocumentT(t, i)
-}
-
-// ToDocument is deprecated.
-func ToDocument(i interface{}) (*driver.Document, error) {
- return Document(i)
-}
-
-// DocumentT calls Document, and passes any error to t.Fatal.
-func DocumentT(t *testing.T, i interface{}) *driver.Document {
- t.Helper()
- doc, err := Document(i)
- if err != nil {
- t.Fatal(err)
- }
- return doc
-}
-
-// Document converts i, which should be of a supported type (see below), into
-// a document which can be passed to ExpectedGet.WillReturn().
-//
-// i is checked against the following list of types, in order. If no match
-// is found, an error is returned. Attachments is not populated by this method.
-//
-// - string, []byte, or json.RawMessage (interpreted as a JSON string)
-// - io.Reader (assumes JSON can be read from the stream)
-// - any other JSON-marshalable object
-func Document(i interface{}) (*driver.Document, error) {
- buf, err := toJSON(i)
- if err != nil {
- return nil, err
- }
- var meta struct {
- Rev string `json:"_rev"`
- }
- if err := json.Unmarshal(buf, &meta); err != nil {
- return nil, err
- }
- return &driver.Document{
- ContentLength: int64(len(buf)),
- Rev: meta.Rev,
- Body: ioutil.NopCloser(bytes.NewReader(buf)),
- Attachments: nil,
- }, nil
-}
-
-func toJSON(i interface{}) ([]byte, error) {
- switch t := i.(type) {
- case string:
- return []byte(t), nil
- case []byte:
- return t, nil
- case json.RawMessage:
- return t, nil
- }
- buf := &bytes.Buffer{}
- err := json.NewEncoder(buf).Encode(i)
- return buf.Bytes(), err
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/iter.go b/vendor/github.com/go-kivik/kivikmock/v3/iter.go
deleted file mode 100644
index 704e9ddde6..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/iter.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "io"
- "time"
-)
-
-type item struct {
- delay time.Duration
- item interface{}
-}
-
-type iter struct {
- items []*item
- closeErr error
- resultErr error
-}
-
-func (i *iter) Close() error { return i.closeErr }
-
-func (i *iter) push(item *item) {
- i.items = append(i.items, item)
-}
-
-func (i *iter) unshift(ctx context.Context) (interface{}, error) {
- if len(i.items) == 0 {
- if i.resultErr != nil {
- return nil, i.resultErr
- }
- return nil, io.EOF
- }
- var item *item
- item, i.items = i.items[0], i.items[1:]
- if item.delay == 0 {
- return item.item, nil
- }
- if err := pause(ctx, item.delay); err != nil {
- return nil, err
- }
- return i.unshift(ctx)
-}
-
-func (i *iter) count() int {
- if len(i.items) == 0 {
- return 0
- }
- var count int
- for _, result := range i.items {
- if result != nil && result.item != nil {
- count++
- }
- }
-
- return count
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/kivikmock.go b/vendor/github.com/go-kivik/kivikmock/v3/kivikmock.go
deleted file mode 100644
index 3117eeed64..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/kivikmock.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Package kivikmock provides a full Kivik driver implementation, for mocking
-// unit tests.
-package kivikmock
-
-//go:generate go run ./gen ./gen/templates
-//go:generate gofmt -s -w clientexpectations_gen.go client_gen.go dbexpectations_gen.go db_gen.go clientmock_gen.go dbmock_gen.go
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/meets.go b/vendor/github.com/go-kivik/kivikmock/v3/meets.go
deleted file mode 100644
index 7009bdd2f4..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/meets.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package kivikmock
-
-import (
- "encoding/json"
- "reflect"
-
- kivik "github.com/go-kivik/kivik/v3"
-)
-
-func meets(a, e expectation) bool {
- if reflect.TypeOf(a).Elem().Name() != reflect.TypeOf(e).Elem().Name() {
- return false
- }
- // Skip the DB test for the dbo() method
- if _, ok := e.(*ExpectedDB); !ok {
- if !dbMeetsExpectation(a.dbo(), e.dbo()) {
- return false
- }
- }
- if !optionsMeetExpectation(a.opts(), e.opts()) {
- return false
- }
- return a.met(e)
-}
-
-func dbMeetsExpectation(a, e *DB) bool {
- if e == nil {
- return true
- }
- e.mu.RLock()
- defer e.mu.RUnlock()
- a.mu.RLock()
- defer a.mu.RUnlock()
- return e.name == a.name && e.id == a.id
-}
-
-func optionsMeetExpectation(a, e kivik.Options) bool {
- if e == nil {
- return true
- }
- return reflect.DeepEqual(e, a)
-}
-
-func jsonMeets(e, a interface{}) bool {
- eJSON, _ := json.Marshal(e)
- aJSON, _ := json.Marshal(a)
- var eI, aI interface{}
- _ = json.Unmarshal(eJSON, &eI)
- _ = json.Unmarshal(aJSON, &aI)
- return reflect.DeepEqual(eI, aI)
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/rows.go b/vendor/github.com/go-kivik/kivikmock/v3/rows.go
deleted file mode 100644
index ac80d20f25..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/rows.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Rows is a mocked collection of rows.
-type Rows struct {
- iter
- offset int64
- updateSeq string
- totalRows int64
- warning string
-}
-
-type driverRows struct {
- context.Context
- *Rows
-}
-
-var _ driver.Rows = &driverRows{}
-var _ driver.RowsWarner = &driverRows{}
-
-func (r *driverRows) Offset() int64 { return r.offset }
-func (r *driverRows) UpdateSeq() string { return r.updateSeq }
-func (r *driverRows) TotalRows() int64 { return r.totalRows }
-func (r *driverRows) Warning() string { return r.warning }
-
-func (r *driverRows) Next(row *driver.Row) error {
- result, err := r.unshift(r.Context)
- if err != nil {
- return err
- }
- *row = *result.(*driver.Row)
- return nil
-}
-
-// CloseError sets an error to be returned when the rows iterator is closed.
-func (r *Rows) CloseError(err error) *Rows {
- r.closeErr = err
- return r
-}
-
-// Offset sets the offset value to be returned by the rows iterator.
-func (r *Rows) Offset(offset int64) *Rows {
- r.offset = offset
- return r
-}
-
-// TotalRows sets the total rows value to be returned by the rows iterator.
-func (r *Rows) TotalRows(totalRows int64) *Rows {
- r.totalRows = totalRows
- return r
-}
-
-// UpdateSeq sets the update sequence value to be returned by the rows iterator.
-func (r *Rows) UpdateSeq(seq string) *Rows {
- r.updateSeq = seq
- return r
-}
-
-// Warning sets the warning value to be returned by the rows iterator.
-func (r *Rows) Warning(warning string) *Rows {
- r.warning = warning
- return r
-}
-
-// AddRow adds a row to be returned by the rows iterator. If AddrowError has
-// been set, this method will panic.
-func (r *Rows) AddRow(row *driver.Row) *Rows {
- if r.resultErr != nil {
- panic("It is invalid to set more rows after AddRowError is defined.")
- }
- r.push(&item{item: row})
- return r
-}
-
-// AddRowError adds an error to be returned during row iteration.
-func (r *Rows) AddRowError(err error) *Rows {
- r.resultErr = err
- return r
-}
-
-// AddDelay adds a delay before the next iteration will complete.
-func (r *Rows) AddDelay(delay time.Duration) *Rows {
- r.push(&item{delay: delay})
- return r
-}
-
-// Final converts the Rows object to a driver.Rows. This method is intended for
-// use within WillExecute() to return results.
-func (r *Rows) Final() driver.Rows {
- return &driverRows{Rows: r}
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/updates.go b/vendor/github.com/go-kivik/kivikmock/v3/updates.go
deleted file mode 100644
index d609935a5d..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/updates.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package kivikmock
-
-import (
- "context"
- "time"
-
- "github.com/go-kivik/kivik/v3/driver"
-)
-
-// Updates is a mocked collection of database updates.
-type Updates struct {
- iter
-}
-
-type driverDBUpdates struct {
- context.Context
- *Updates
-}
-
-var _ driver.DBUpdates = &driverDBUpdates{}
-
-func (u *driverDBUpdates) Next(update *driver.DBUpdate) error {
- result, err := u.unshift(u.Context)
- if err != nil {
- return err
- }
- *update = *result.(*driver.DBUpdate)
- return nil
-}
-
-// CloseError sets an error to be returned when the updates iterator is closed.
-func (u *Updates) CloseError(err error) *Updates {
- u.closeErr = err
- return u
-}
-
-// AddUpdateError adds an error to be returned during update iteration.
-func (u *Updates) AddUpdateError(err error) *Updates {
- u.resultErr = err
- return u
-}
-
-// AddUpdate adds a database update to be returned by the DBUpdates iterator. If
-// AddUpdateError has been set, this method will panic.
-func (u *Updates) AddUpdate(update *driver.DBUpdate) *Updates {
- if u.resultErr != nil {
- panic("It is invalid to set more updates after AddUpdateError is defined.")
- }
- u.push(&item{item: update})
- return u
-}
-
-// AddDelay adds a delay before the next iteration will complete.
-func (u *Updates) AddDelay(delay time.Duration) *Updates {
- u.push(&item{delay: delay})
- return u
-}
-
-// Final converts the Updates object to a driver.DBUpdates. This method is
-// intended for use within WillExecute() to return results.
-func (u *Updates) Final() driver.DBUpdates {
- return &driverDBUpdates{Updates: u}
-}
diff --git a/vendor/github.com/go-kivik/kivikmock/v3/util.go b/vendor/github.com/go-kivik/kivikmock/v3/util.go
deleted file mode 100644
index 7b9064148a..0000000000
--- a/vendor/github.com/go-kivik/kivikmock/v3/util.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package kivikmock
-
-import (
- "fmt"
- "time"
-)
-
-func optionsString(opt map[string]interface{}) string {
- if opt == nil {
- return "\n\t- has any options"
- }
- return fmt.Sprintf("\n\t- has options: %v", opt)
-}
-
-func errorString(err error) string {
- if err == nil {
- return ""
- }
- return fmt.Sprintf("\n\t- should return error: %s", err)
-}
-
-func delayString(delay time.Duration) string {
- if delay == 0 {
- return ""
- }
- return fmt.Sprintf("\n\t- should delay for: %s", delay)
-}
-
-func fieldString(field, value string) string {
- if value == "" {
- return "\n\t- has any " + field
- }
- return "\n\t- has " + field + ": " + value
-}
diff --git a/vendor/golang.org/x/net/publicsuffix/list.go b/vendor/golang.org/x/net/publicsuffix/list.go
deleted file mode 100644
index 200617ea86..0000000000
--- a/vendor/golang.org/x/net/publicsuffix/list.go
+++ /dev/null
@@ -1,181 +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.
-
-//go:generate go run gen.go
-
-// Package publicsuffix provides a public suffix list based on data from
-// https://publicsuffix.org/
-//
-// A public suffix is one under which Internet users can directly register
-// names. It is related to, but different from, a TLD (top level domain).
-//
-// "com" is a TLD (top level domain). Top level means it has no dots.
-//
-// "com" is also a public suffix. Amazon and Google have registered different
-// siblings under that domain: "amazon.com" and "google.com".
-//
-// "au" is another TLD, again because it has no dots. But it's not "amazon.au".
-// Instead, it's "amazon.com.au".
-//
-// "com.au" isn't an actual TLD, because it's not at the top level (it has
-// dots). But it is an eTLD (effective TLD), because that's the branching point
-// for domain name registrars.
-//
-// Another name for "an eTLD" is "a public suffix". Often, what's more of
-// interest is the eTLD+1, or one more label than the public suffix. For
-// example, browsers partition read/write access to HTTP cookies according to
-// the eTLD+1. Web pages served from "amazon.com.au" can't read cookies from
-// "google.com.au", but web pages served from "maps.google.com" can share
-// cookies from "www.google.com", so you don't have to sign into Google Maps
-// separately from signing into Google Web Search. Note that all four of those
-// domains have 3 labels and 2 dots. The first two domains are each an eTLD+1,
-// the last two are not (but share the same eTLD+1: "google.com").
-//
-// All of these domains have the same eTLD+1:
-// - "www.books.amazon.co.uk"
-// - "books.amazon.co.uk"
-// - "amazon.co.uk"
-// Specifically, the eTLD+1 is "amazon.co.uk", because the eTLD is "co.uk".
-//
-// There is no closed form algorithm to calculate the eTLD of a domain.
-// Instead, the calculation is data driven. This package provides a
-// pre-compiled snapshot of Mozilla's PSL (Public Suffix List) data at
-// https://publicsuffix.org/
-package publicsuffix // import "golang.org/x/net/publicsuffix"
-
-// TODO: specify case sensitivity and leading/trailing dot behavior for
-// func PublicSuffix and func EffectiveTLDPlusOne.
-
-import (
- "fmt"
- "net/http/cookiejar"
- "strings"
-)
-
-// List implements the cookiejar.PublicSuffixList interface by calling the
-// PublicSuffix function.
-var List cookiejar.PublicSuffixList = list{}
-
-type list struct{}
-
-func (list) PublicSuffix(domain string) string {
- ps, _ := PublicSuffix(domain)
- return ps
-}
-
-func (list) String() string {
- return version
-}
-
-// PublicSuffix returns the public suffix of the domain using a copy of the
-// publicsuffix.org database compiled into the library.
-//
-// icann is whether the public suffix is managed by the Internet Corporation
-// for Assigned Names and Numbers. If not, the public suffix is either a
-// privately managed domain (and in practice, not a top level domain) or an
-// unmanaged top level domain (and not explicitly mentioned in the
-// publicsuffix.org list). For example, "foo.org" and "foo.co.uk" are ICANN
-// domains, "foo.dyndns.org" and "foo.blogspot.co.uk" are private domains and
-// "cromulent" is an unmanaged top level domain.
-//
-// Use cases for distinguishing ICANN domains like "foo.com" from private
-// domains like "foo.appspot.com" can be found at
-// https://wiki.mozilla.org/Public_Suffix_List/Use_Cases
-func PublicSuffix(domain string) (publicSuffix string, icann bool) {
- lo, hi := uint32(0), uint32(numTLD)
- s, suffix, icannNode, wildcard := domain, len(domain), false, false
-loop:
- for {
- dot := strings.LastIndex(s, ".")
- if wildcard {
- icann = icannNode
- suffix = 1 + dot
- }
- if lo == hi {
- break
- }
- f := find(s[1+dot:], lo, hi)
- if f == notFound {
- break
- }
-
- u := nodes[f] >> (nodesBitsTextOffset + nodesBitsTextLength)
- icannNode = u&(1<>= nodesBitsICANN
- u = children[u&(1<>= childrenBitsLo
- hi = u & (1<>= childrenBitsHi
- switch u & (1<>= childrenBitsNodeType
- wildcard = u&(1<>= nodesBitsTextLength
- offset := x & (1<