Browse Source

更新apiprovier文档

lijian 3 years ago
parent
commit
0b41f59bd5

+ 4 - 5
pkg/mqtt/connection.go

@@ -35,8 +35,7 @@ type Connection struct {
 	LastHbTime      int64
 	Token           []byte
 	VendorId        string
-	closeChan chan struct{}
-
+	closeChan       chan struct{}
 }
 
 // NewConnection create a connection
@@ -48,7 +47,7 @@ func NewConnection(conn net.Conn, mgr *Manager) *Connection {
 		Mgr:             mgr,
 		KeepAlive:       defaultKeepAlive,
 		MessageWaitChan: make(map[uint16]chan error),
-		closeChan: make(chan struct{}),
+		closeChan:       make(chan struct{}),
 	}
 
 	go c.SendMsgToClient()
@@ -175,7 +174,7 @@ func (c *Connection) RcvMsgFromClient() {
 			device := &models.Device{}
 			err = server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindDeviceById", DeviceID, device)
 			if err != nil {
-				server.Log.Errorf("device not found %d", ret, DeviceID)
+				server.Log.Errorf("device not found %d", DeviceID)
 				c.Close()
 				return
 			}
@@ -315,7 +314,7 @@ func (c *Connection) SendMsgToClient() {
 		select {
 		case <-c.closeChan:
 			return
-		case msg, ok :=<-c.SendChan:
+		case msg, ok := <-c.SendChan:
 			if !ok {
 				server.Log.Errorf("%s is end now", host)
 				return

+ 1 - 1
pkg/online/online.go

@@ -80,7 +80,7 @@ func (mgr *Manager) SetHeartbeat(id string) error {
 	}
 
 	if status == nil {
-		return errors.New("device offline.")
+		return errors.New("device offline")
 	}
 
 	key := OnlineStatusKeyPrefix + id

+ 2 - 1
pkg/queue/msgQueue/rabbitmq.go

@@ -107,6 +107,7 @@ func (r *RabbitMqProducer) Send(info *queue.TopicPartitionInfo, payload protocol
 		server.Log.Errorf("queue message marshal error:%s", err.Error())
 		return err
 	}
+	server.Log.Debugf("publish message to %s", info.String())
 	err = r.channel.Publish("", info.String(), false, false,
 		amqp.Publishing{
 			DeliveryMode: amqp.Persistent,
@@ -158,7 +159,7 @@ func (r *RabbitMqConsumer) Subscribe() error {
 	defer r.mu.Unlock()
 	r.partitions = append(r.partitions, &queue.TopicPartitionInfo{
 		Topic:       r.topic,
-		TenantId:    "",
+		TenantId:    "1ps9djpswi0cds7cofynkso300eql4iu",
 		Partition:   0,
 		MyPartition: true,
 	})

+ 5 - 3
pkg/queue/queue_msg.go

@@ -46,7 +46,7 @@ func NewGobQueueMessage(msg *protocol.Message) (*GobQueueMessage, error) {
 	return &GobQueueMessage{
 		Key:     guid.S(),
 		Value:   b,
-		Headers: new(DefaultQueueMsgHeader),
+		Headers: NewDefaultQueueMsgHeader(),
 	}, nil
 }
 
@@ -67,12 +67,14 @@ func (g *GobQueueMessage) UnMarshal(data []byte) error {
 	return dec.Decode(g)
 }
 
-
-
 type DefaultQueueMsgHeader struct {
 	Data map[string][]byte
 }
 
+func NewDefaultQueueMsgHeader() *DefaultQueueMsgHeader {
+	return &DefaultQueueMsgHeader{Data: make(map[string][]byte)}
+}
+
 func (d *DefaultQueueMsgHeader) Put(key string, value []byte) {
 	d.Data[key] = value
 }

+ 3 - 3
pkg/queue/topic_partition_info.go

@@ -13,7 +13,7 @@ type TopicPartitionInfo struct {
 }
 
 func (a *TopicPartitionInfo) String() string {
-	return fmt.Sprintf("%s", a.Topic)
+	return fmt.Sprintf("%s.%s.%d", a.Topic, a.TenantId, a.Partition)
 }
 
 func (a *TopicPartitionInfo) HashCode() string {
@@ -24,8 +24,8 @@ func (a *TopicPartitionInfo) HashCode() string {
 func ResolvePartition(serviceType, queueName, tenantId, entityId string) *TopicPartitionInfo {
 	// TODO:生成主题逻辑
 	return &TopicPartitionInfo{
-		Topic: queueName,
-		TenantId: tenantId,
+		Topic:       queueName,
+		TenantId:    tenantId,
 		MyPartition: true,
 	}
 }

+ 46 - 1
pkg/ruleEngine/nodes/kafka_node.go

@@ -1,9 +1,54 @@
 package nodes
 
-// KafkaNode Kafka Node sends messages to Kafka brokers. Expects messages with any message type. Will send record via Kafka producer to Kafka server
+import (
+	"context"
+	"encoding/json"
+	"github.com/segmentio/kafka-go"
+	"sparrow/pkg/protocol"
+	"sparrow/pkg/ruleEngine"
+)
+
+// KafkaNode Kafka Node sends messages to Kafka brokers.
+// Expects messages with any message type.
+// Will send record via Kafka producer to Kafka server
 type KafkaNode struct {
+	config   *KafkaNodeConfiguration
+	producer *kafka.Conn
+}
+
+func (k *KafkaNode) Init(ctx ruleEngine.Context, config string) error {
+	if config == "" {
+		k.config = &KafkaNodeConfiguration{
+			TopicPattern:        "",
+			BootstrapServer:     "",
+			RetryTimes:          0,
+			BatchSize:           0,
+			LocallyBufferTime:   0,
+			MaxSizeClientBuffer: 0,
+			MetaData:            nil,
+			AckNumber:           0,
+		}
+	} else {
+		c := new(KafkaNodeConfiguration)
+		err := json.Unmarshal([]byte(config), c)
+		if err != nil {
+			return err
+		}
+		k.config = c
+	}
+	conn, err := kafka.DialLeader(context.Background(), "tcp", k.config.BootstrapServer, k.config.TopicPattern, 0)
+	if err != nil {
+		return err
+	}
+	k.producer = conn
+	return nil
+}
+
+func (k *KafkaNode) OnMessage(ctx ruleEngine.Context, message *protocol.Message) error {
+	panic("implement me")
 }
 
+// KafkaNodeConfiguration 配置信息
 type KafkaNodeConfiguration struct {
 	TopicPattern        string            `json:"topic_pattern"`
 	BootstrapServer     string            `json:"bootstrap_server"`

+ 6 - 10
services/apiprovider/actions.go

@@ -236,12 +236,7 @@ func SendCommandToDevice(device *models.Device, config *productconfig.ProductCon
 	}
 	cmdreply := rpcs.ReplySendCommand{}
 
-	//opentracing
-	span, ctx := opentracing.StartSpanFromContext(context.Background(), "SendCommandToDevice")
-	defer span.Finish()
-	ext.SpanKindRPCClient.Set(span)
-
-	err = server.RPCCallByName(ctx, rpcs.ControllerName, "Controller.SendCommand", cmdargs, &cmdreply)
+	err = server.RPCCallByName(context.Background(), rpcs.ControllerName, "Controller.SendCommand", cmdargs, &cmdreply)
 	if err != nil {
 		server.Log.Errorf("send devie command error: %v", err)
 		r.JSON(http.StatusOK, renderError(ErrSystemFault, err))
@@ -307,18 +302,19 @@ func AppAuth(req *http.Request, r render.Render) {
 	err = server.RPCCallByName(ctx, rpcs.RegistryServerName, "Registry.FindApplicationByAppKey", ruleReq, app)
 	if err != nil {
 
-		r.JSON(http.StatusOK, renderError(ErrWrongSecret, errors.New("Invalid secret key")))
+		r.JSON(http.StatusOK, renderError(ErrWrongSecret, errors.New("invalid secret key")))
 		return
 	}
 
 	if app.SecretKey != ruleReq.Secretkey {
 		// device secret is wrong.
-		r.JSON(http.StatusOK, renderError(ErrWrongSecret, errors.New("wrong application secret.")))
+		r.JSON(http.StatusOK, renderError(ErrWrongSecret, errors.New("wrong application secret")))
 		return
 	}
-
+	token, timeSnap := TokenMaker(app)
 	result := AppAuthDataResponse{
-		AccessToken: TokenMaker(app),
+		AccessToken: token,
+		ExpireAt:    timeSnap,
 	}
 
 	r.JSON(http.StatusOK, Common{

+ 143 - 0
services/apiprovider/apiprovider.md

@@ -0,0 +1,143 @@
+## apiprovicer服务接口文档
+
+### 1.服务功能
+
+为厂商app提供平台原生的api调用能力
+
+### 2.接口说明
+
+|接口URL|请求类型|功能说明|
+|---|---|---
+|/application/v1/device/info|GET|根据device_key获取设备基本信息|
+|/application/v1//devices/{identifier}/info|GET|根据设备identifier获取设备信息|
+|/application/v1/devices/{identifier}/status/current|GET|获取设备当前状态|
+|/application/v1/devices/{identifier}/status|PUT|设置设备当前设备的状态|
+|/application/v1/devices/{identifier}/commands|POST|向指定设备发送命令|
+|/application/auth|POST|获取app认证token|
+
+### 2.1 获取App Token
+
+_首先应用方要获取当前应用的授权访问token,为后续的接口请求提供正确的认证_
+
+* 接口URL: `application/auth`
+* 请求方法: `POST`
+* 请求参数: `BODY`
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|AppKey|字符串|Y|平台为应用分配的AppKey|
+Secretkey|字符串|Y|平台为应用分配的Secretkey
+
+* 接口响应: `JSON`
+
+```json
+{
+  "code": 0,
+  "message": "",
+  "result": {
+    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcHBJRCI6MSwiQXBwTmFtZSI6ImNsaWVudCIsIkFwcEtleSI6IjRkMjJmZDZjOWU4YWY0MzQwM2QwZmU2MWMwYzdlNTYzODc4YTg1YWE5ZDE4MGZmNjcyNmUwOWIxYTEzOTdjOTZkN2MyNjkzZWM4NjlhZmU3MDc5ODZmZDgyNTMxYzdlZiIsIlNlY3JldEtleSI6Im5yM3preHBLRDg0UTJCV1giLCJWZW5kb3JJRCI6IjFwczlkanBzd2kwY2RzN2NvZnlua3NvMzAwZXFsNGl1IiwiZXhwIjoxNjMwOTg0MTU2LCJpYXQiOjE2MzA4OTc3NTYsImlzcyI6ImFwaXByb3ZpZGVyIn0.t0KX26p_8Q5WxzU-96Gwg5t6iuFnA8iDmUJk8bmW4Uc",
+    "expire_at": 1630984156
+  }
+}
+```
+
+|字符|类型|说明|
+|---|---|---|
+|access_token|字符串|token字符串
+expire_at|数字|精确到秒的过期时间戳
+
+### 2.2 根据设备device_key获取设备信息
+
+_厂商可以通过平台为设备生成的device_key查询设备基础信息_
+
+* 请求URL: `/application/v1/device/info`
+* 请求方法: `GET`
+* 请求参数: `Query`
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|device_key|字符串|Y|设备device_key,注册流程可以得到这个数据|
+
+* 请求响应:
+
+```json
+{
+  "code": 0,
+  "message": "",
+  "result": null,
+  "data": {
+    "identifier": "1-1-relay-test",
+    "name": "TSL-8",
+    "description": "模块",
+    "version": "1.0.0"
+  }
+}
+```
+
+### 2.3 根据设备identifier获取设备基本信息
+
+* 请求URL: `/application/v1/devices/{identifier}/info`
+* 请求方法: `GET`
+* 请求参数: `Path参数`
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|identifier|字符串|Y|设备的identifier,注册流程可以得到这个数据|
+
+* 请求Header:
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|App-Key|字符串|Y|由平台分配的应用AppKey的值|
+
+* 请求响应: `JSON`
+
+```json
+{
+  "code": 0,
+  "message": "",
+  "result": null,
+  "data": {
+    "identifier": "1-1-relay",
+    "name": "TSL-8",
+    "description": "模块",
+    "version": "1.0.0"
+  }
+}
+```
+
+### 2.4 根据设备identifier获取设备当前最新的状态值
+
+* 请求URL: `/application/v1/devices/{identifier}/status/current`
+* 请求方法: `GET`
+* 请求参数: `Path参数`
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|identifier|字符串|Y|设备的identifier,注册流程可以得到这个数据|
+
+* 请求Header:
+
+|参数|类型|是否必填|说明|
+|---|----|-----|----|
+|App-Key|字符串|Y|由平台分配的应用AppKey的值|
+
+* 请求响应: `JSON`
+
+_data字符中的具体响应内容是根据产品配置中相应的字段名称生成的,以最终配置为准,平台会以格式化的数据,返回设备的最新状态_
+
+```json
+{
+  "code": 0,
+  "message": "",
+  "result": null,
+  "data": {
+    "device_id": 9480,
+    "outputState": {
+      "route": 2,
+      "value": 0
+    }
+  }
+}
+```
+

+ 1 - 0
services/apiprovider/response.go

@@ -28,4 +28,5 @@ type DeviceStatusResponse struct {
 
 type AppAuthDataResponse struct {
 	AccessToken string `json:"access_token"`
+	ExpireAt    int64  `json:"expire_at"`
 }

+ 1 - 11
services/apiprovider/router.go

@@ -24,22 +24,12 @@ func ValidateTokenMiddleware(w http.ResponseWriter, r *http.Request, c martini.C
 		}
 	} else {
 		w.WriteHeader(http.StatusUnauthorized)
-		fmt.Fprint(w, "Unauthorized access to this resource")
+		fmt.Fprint(w, fmt.Sprintf("Unauthorized access to this resource:%s", err.Error()))
 	}
 }
 
-
 // martini router
 func route(m *martini.ClassicMartini) {
-
-	// jwt handler
-	// handler := New(Config{
-	// 	ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
-	// 		return []byte(SignedString), nil
-	// 	},
-	// 	SigningMethod: jwt.SigningMethodHS256,
-	// })
-
 	m.Group("/application/v1", func(r martini.Router) {
 		// find a device by key
 		r.Get("/device/info", GetDeviceInfoByKey)

+ 4 - 3
services/apiprovider/token.go

@@ -19,7 +19,7 @@ type AppClaims struct {
 }
 
 // TokenMaker 生成token
-func TokenMaker(app *models.Application) string {
+func TokenMaker(app *models.Application) (string, int64) {
 	claims := AppClaims{
 		AppID:     app.ID,
 		AppName:   app.AppName,
@@ -27,10 +27,11 @@ func TokenMaker(app *models.Application) string {
 		SecretKey: app.SecretKey,
 		VendorID:  app.VendorID,
 	}
-	claims.ExpiresAt = time.Now().Add(time.Hour * 24).Unix()
+	expireAt := time.Now().Add(time.Hour * 24).Unix()
+	claims.ExpiresAt = expireAt
 	claims.IssuedAt = time.Now().Unix()
 	claims.Issuer = "apiprovider"
 	token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
 	ser, _ := token.SignedString([]byte(SignedString))
-	return ser
+	return ser, expireAt
 }

+ 4 - 1
services/controller/controller.go

@@ -97,6 +97,7 @@ func (c *Controller) OnStatus(args rpcs.ArgsOnStatus, reply *rpcs.ReplyOnStatus)
 	if err != nil {
 		return err
 	}
+	g.Headers.Put("tanant_id", []byte(args.VendorId))
 	return c.producer.Send(tpi, g, nil)
 }
 
@@ -221,9 +222,11 @@ func (c *Controller) launchConsumer() {
 			if err := ruleEngineMsg.Decode(msg.GetData()); err != nil {
 				fmt.Println("解析消息失败")
 			}
+			tanantId := msg.GetHeaders().Get("tanant_id")
+			server.Log.Debugf("tanant_id:%s", tanantId)
 			if c.actorContext != nil {
 				c.actorContext.Tell(&ruleEngine.QueueToRuleEngineMsg{
-					TenantId: "tenant_1",
+					TenantId: string(tanantId),
 					Message:  ruleEngineMsg,
 				})
 			}

+ 1 - 0
services/registry/registry.go

@@ -78,6 +78,7 @@ func setDevice(target *models.Device, src *models.Device) {
 	target.DeviceVersion = src.DeviceVersion
 	target.CreatedAt = src.CreatedAt
 	target.UpdatedAt = src.UpdatedAt
+	target.VendorID = src.VendorID
 }
 
 // SaveVendor will create a vendor if the ID field is not initialized

+ 292 - 27
vendor/github.com/klauspost/compress/LICENSE

@@ -1,27 +1,292 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright (c) 2012 The Go Authors. All rights reserved.
+Copyright (c) 2019 Klaus Post. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+------------------
+
+Files: gzhttp/*
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2016-2017 The New York Times Company
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+------------------
+
+Files: s2/cmd/internal/readahead/*
+
+The MIT License (MIT)
+
+Copyright (c) 2015 Klaus Post
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+---------------------
+Files: snappy/*
+Files: internal/snapref/*
+
+Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 216 - 0
vendor/vendor.json

@@ -597,6 +597,12 @@
 			"revision": "9fbdb9712bdb9da1009476b881fa0aec67ef9d1f",
 			"revisionTime": "2021-01-04T11:50:44Z"
 		},
+		{
+			"checksumSHA1": "FSuu9sdy04lPD8CA9Mr5M4sFCgA=",
+			"path": "github.com/golang/snappy",
+			"revision": "544b4180ac705b7605231d4a4550a1acb22a19fe",
+			"revisionTime": "2021-06-08T04:05:37Z"
+		},
 		{
 			"checksumSHA1": "73htiRJAyEYC5HJaFtkhmosWlbE=",
 			"path": "github.com/gomodule/redigo/redis",
@@ -937,6 +943,12 @@
 			"revision": "b1670413ba6a7532e46c12ff23d0914c270d2768",
 			"revisionTime": "2018-09-01T16:27:21Z"
 		},
+		{
+			"checksumSHA1": "KIktZ+qtWxdRuzTZqUkKxHu27Hc=",
+			"path": "github.com/klauspost/compress",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
 		{
 			"checksumSHA1": "gPRajLnUQu9IiJkfvom+3gqiLpM=",
 			"origin": "github.com/kataras/iris/vendor/github.com/klauspost/compress/flate",
@@ -944,6 +956,12 @@
 			"revision": "b1670413ba6a7532e46c12ff23d0914c270d2768",
 			"revisionTime": "2018-09-01T16:27:21Z"
 		},
+		{
+			"checksumSHA1": "UMHIUgpT/C/8bmbRLA0KsWC/TdM=",
+			"path": "github.com/klauspost/compress/fse",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
 		{
 			"checksumSHA1": "V1lQwkoDR1fPmZBSgkmZjgZofeU=",
 			"origin": "github.com/kataras/iris/vendor/github.com/klauspost/compress/gzip",
@@ -951,6 +969,30 @@
 			"revision": "b1670413ba6a7532e46c12ff23d0914c270d2768",
 			"revisionTime": "2018-09-01T16:27:21Z"
 		},
+		{
+			"checksumSHA1": "khickIoAh2RybhyitpidwqEbYso=",
+			"path": "github.com/klauspost/compress/huff0",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
+		{
+			"checksumSHA1": "iJJZG1oRv2UzEk46A0CZnwB23Ak=",
+			"path": "github.com/klauspost/compress/internal/snapref",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
+		{
+			"checksumSHA1": "lnz/PMR83mmKwbqeoMkZDx1Va3k=",
+			"path": "github.com/klauspost/compress/zstd",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
+		{
+			"checksumSHA1": "/pDqkenWx80Tws5c+k8YtVoO+F8=",
+			"path": "github.com/klauspost/compress/zstd/internal/xxhash",
+			"revision": "c409afa4a33c15b788339244f823a98c1380691d",
+			"revisionTime": "2021-08-30T17:02:29Z"
+		},
 		{
 			"checksumSHA1": "rZxik/yTPboAr9Hd6K2cIv/5zFk=",
 			"origin": "github.com/kataras/iris/vendor/github.com/klauspost/cpuid",
@@ -1062,6 +1104,12 @@
 			"path": "github.com/pborman/uuid",
 			"revision": ""
 		},
+		{
+			"checksumSHA1": "+kh52VnpHO1plRZvZcNPLzF6pG4=",
+			"path": "github.com/pierrec/lz4",
+			"revision": "97cb0e84dcdf233d6521dae917ca9f84031b9828",
+			"revisionTime": "2021-08-28T19:55:31Z"
+		},
 		{
 			"checksumSHA1": "ljd3FhYRJ91cLZz3wsH9BQQ2JbA=",
 			"path": "github.com/pkg/errors",
@@ -1093,6 +1141,174 @@
 			"revision": "36e9d2ebbde5e3f13ab2e25625fd453271d6522e",
 			"revisionTime": "2018-01-03T17:44:51Z"
 		},
+		{
+			"checksumSHA1": "/ym0fD2qoLk0CiFEZ4uCrDghQSY=",
+			"path": "github.com/segmentio/kafka-go",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "joxRdDsMuHeEqfUWo96Uz4WKx3o=",
+			"path": "github.com/segmentio/kafka-go/compress",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "iMnEl4R90CaZPQ+6v15TaIP6sdA=",
+			"path": "github.com/segmentio/kafka-go/compress/gzip",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "UYnHkLv7EuP01KQUbuQ0NYZ1iGE=",
+			"path": "github.com/segmentio/kafka-go/compress/lz4",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "933MMt6N/03TgEGPANZWJdM02ZU=",
+			"path": "github.com/segmentio/kafka-go/compress/snappy",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "nInzTvVaLvd3f0lbXN1jw26Ao8g=",
+			"path": "github.com/segmentio/kafka-go/compress/zstd",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "1V0wk4QPo9DvWIy2QtW29xQ9ywA=",
+			"path": "github.com/segmentio/kafka-go/protocol",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "NxH7XQmdK+JtcSiiY/LeSwAwj2c=",
+			"path": "github.com/segmentio/kafka-go/protocol/alterconfigs",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "zR2K8vHrZhsZsmiyusNYX+0cnro=",
+			"path": "github.com/segmentio/kafka-go/protocol/alterpartitionreassignments",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "BYxj9itBEB1OF8obWWEdfwf4pd8=",
+			"path": "github.com/segmentio/kafka-go/protocol/apiversions",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "zcYZP32J+EqTuZhy6gzd5WpFUDQ=",
+			"path": "github.com/segmentio/kafka-go/protocol/createpartitions",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "rcP9dcNpIQTsB5s85TqiQMyyuig=",
+			"path": "github.com/segmentio/kafka-go/protocol/createtopics",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "y0cHRuZX+U/lFG0EAQRi/7XK+hQ=",
+			"path": "github.com/segmentio/kafka-go/protocol/deletetopics",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "mEWlNo3FdpB1oCD7eQHWeh18ANM=",
+			"path": "github.com/segmentio/kafka-go/protocol/describeconfigs",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "W3LOC/o6LfzshNV6v1pJhTt3XQA=",
+			"path": "github.com/segmentio/kafka-go/protocol/describegroups",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "BXLNL0O24lGPwrB3ueFLnDI5htM=",
+			"path": "github.com/segmentio/kafka-go/protocol/electleaders",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "DRS4zwB4Y8LNoByVJXGPQQOvafI=",
+			"path": "github.com/segmentio/kafka-go/protocol/fetch",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "wwtV0c0QUedoMgTlOiF04XI6eKk=",
+			"path": "github.com/segmentio/kafka-go/protocol/findcoordinator",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "ajedOexDqoYhI0exwHzbYv1bqNA=",
+			"path": "github.com/segmentio/kafka-go/protocol/incrementalalterconfigs",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "2HRN4TWkR4TE9DDziBLpOw5VeMQ=",
+			"path": "github.com/segmentio/kafka-go/protocol/initproducerid",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "LfmkiGGVoEM364fYv8wIrycvu0M=",
+			"path": "github.com/segmentio/kafka-go/protocol/listgroups",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "5oYEb40hzqPdJTUBxHIoE0fhDCY=",
+			"path": "github.com/segmentio/kafka-go/protocol/listoffsets",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "V0IrBgYbYHLY48GPnUiaeAAMUns=",
+			"path": "github.com/segmentio/kafka-go/protocol/metadata",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "nnVcgP6vEoYPeHrBEz9ZVx8Ddi8=",
+			"path": "github.com/segmentio/kafka-go/protocol/offsetfetch",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "2yVHZpWE2eus3zz6k2eS0lkJVOw=",
+			"path": "github.com/segmentio/kafka-go/protocol/produce",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "AkZbEiGFoPbY3CWbCrL5gpGxwBw=",
+			"path": "github.com/segmentio/kafka-go/protocol/saslauthenticate",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "VnJ307+HsXo4pNuPOvEIV5PaeSM=",
+			"path": "github.com/segmentio/kafka-go/protocol/saslhandshake",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
+		{
+			"checksumSHA1": "JGDT0mBs8CQLavGQyKqU1EJU4eY=",
+			"path": "github.com/segmentio/kafka-go/sasl",
+			"revision": "a4890bd956b5658ca57e964dd28381c0ee4fd617",
+			"revisionTime": "2021-08-09T22:16:23Z"
+		},
 		{
 			"checksumSHA1": "v7C+aJ1D/z3MEeCte6bxvpoGjM4=",
 			"origin": "github.com/iris-contrib/httpexpect/vendor/github.com/sergi/go-diff/diffmatchpatch",