You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2021/08/30 08:33:27 UTC

[skywalking-banyandb] branch time-series updated: Add tsdb module

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch time-series
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/time-series by this push:
     new da04343  Add tsdb module
da04343 is described below

commit da04343adf6e40388f0112cebcd4ff721c8fcdb1
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Aug 30 16:33:05 2021 +0800

    Add tsdb module
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 api/proto/banyandb/database/v2/schema.pb.go        | 403 ++++++++++++---------
 api/proto/banyandb/database/v2/schema.proto        |  14 +-
 .../schema/data/index_rules/db.instance.json       |   2 +-
 .../metadata/schema/data/index_rules/db.type.json  |   2 +-
 .../metadata/schema/data/index_rules/duration.json |   2 +-
 .../schema/data/index_rules/endpoint_id.json       |   2 +-
 .../schema/data/index_rules/http.code.json         |   2 +-
 .../schema/data/index_rules/http.method.json       |   2 +-
 .../schema/data/index_rules/mq.broker.json         |   2 +-
 .../metadata/schema/data/index_rules/mq.queue.json |   2 +-
 .../metadata/schema/data/index_rules/mq.topic.json |   2 +-
 .../metadata/schema/data/index_rules/trace_id.json |   2 +-
 banyand/metadata/schema/data/stream.json           | 120 +++---
 banyand/tsdb/block.go                              |  69 ++++
 pkg/logger/logger.go => banyand/tsdb/indexdb.go    |  28 +-
 pkg/logger/logger.go => banyand/tsdb/segment.go    |  51 ++-
 banyand/tsdb/series.go                             |  84 +++++
 pkg/logger/logger.go => banyand/tsdb/seriesdb.go   |  38 +-
 pkg/logger/logger.go => banyand/tsdb/shard.go      |  58 ++-
 banyand/tsdb/tsdb.go                               | 138 +++++++
 banyand/tsdb/tsdb_test.go                          |  75 ++++
 pkg/logger/logger.go                               |   4 +
 22 files changed, 800 insertions(+), 302 deletions(-)

diff --git a/api/proto/banyandb/database/v2/schema.pb.go b/api/proto/banyandb/database/v2/schema.pb.go
index 3b623af..5f8168e 100644
--- a/api/proto/banyandb/database/v2/schema.pb.go
+++ b/api/proto/banyandb/database/v2/schema.pb.go
@@ -198,28 +198,28 @@ func (x IndexRule_Type) Number() protoreflect.EnumNumber {
 
 // Deprecated: Use IndexRule_Type.Descriptor instead.
 func (IndexRule_Type) EnumDescriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{4, 0}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{5, 0}
 }
 
 type IndexRule_Location int32
 
 const (
-	IndexRule_LOCATION_UNSPECIFIED    IndexRule_Location = 0
-	IndexRule_LOCATION_ATTACHED_BLOCK IndexRule_Location = 1
-	IndexRule_LOCATION_AGGREGATION    IndexRule_Location = 2
+	IndexRule_LOCATION_UNSPECIFIED IndexRule_Location = 0
+	IndexRule_LOCATION_SERIES      IndexRule_Location = 1
+	IndexRule_LOCATION_GLOBAL      IndexRule_Location = 2
 )
 
 // Enum value maps for IndexRule_Location.
 var (
 	IndexRule_Location_name = map[int32]string{
 		0: "LOCATION_UNSPECIFIED",
-		1: "LOCATION_ATTACHED_BLOCK",
-		2: "LOCATION_AGGREGATION",
+		1: "LOCATION_SERIES",
+		2: "LOCATION_GLOBAL",
 	}
 	IndexRule_Location_value = map[string]int32{
-		"LOCATION_UNSPECIFIED":    0,
-		"LOCATION_ATTACHED_BLOCK": 1,
-		"LOCATION_AGGREGATION":    2,
+		"LOCATION_UNSPECIFIED": 0,
+		"LOCATION_SERIES":      1,
+		"LOCATION_GLOBAL":      2,
 	}
 )
 
@@ -247,7 +247,7 @@ func (x IndexRule_Location) Number() protoreflect.EnumNumber {
 
 // Deprecated: Use IndexRule_Location.Descriptor instead.
 func (IndexRule_Location) EnumDescriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{4, 1}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{5, 1}
 }
 
 // Duration represents the elapsed time between two instants
@@ -306,6 +306,62 @@ func (x *Duration) GetUnit() Duration_DurationUnit {
 	return Duration_DURATION_UNIT_UNSPECIFIED
 }
 
+type TagFamily struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+	// tags defines accepted tags
+	Tags []*TagSpec `protobuf:"bytes,2,rep,name=tags,proto3" json:"tags,omitempty"`
+}
+
+func (x *TagFamily) Reset() {
+	*x = TagFamily{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[1]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *TagFamily) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TagFamily) ProtoMessage() {}
+
+func (x *TagFamily) ProtoReflect() protoreflect.Message {
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[1]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use TagFamily.ProtoReflect.Descriptor instead.
+func (*TagFamily) Descriptor() ([]byte, []int) {
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *TagFamily) GetName() string {
+	if x != nil {
+		return x.Name
+	}
+	return ""
+}
+
+func (x *TagFamily) GetTags() []*TagSpec {
+	if x != nil {
+		return x.Tags
+	}
+	return nil
+}
+
 type TagSpec struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -318,7 +374,7 @@ type TagSpec struct {
 func (x *TagSpec) Reset() {
 	*x = TagSpec{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[1]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -331,7 +387,7 @@ func (x *TagSpec) String() string {
 func (*TagSpec) ProtoMessage() {}
 
 func (x *TagSpec) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[1]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -344,7 +400,7 @@ func (x *TagSpec) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use TagSpec.ProtoReflect.Descriptor instead.
 func (*TagSpec) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{1}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{2}
 }
 
 func (x *TagSpec) GetName() string {
@@ -369,8 +425,8 @@ type Stream struct {
 
 	// metadata is the identity of a trace series
 	Metadata *v2.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
-	// tags defines accepted tags
-	Tags []*TagSpec `protobuf:"bytes,2,rep,name=tags,proto3" json:"tags,omitempty"`
+	// tag_families
+	TagFamilies []*TagFamily `protobuf:"bytes,2,rep,name=tag_families,json=tagFamilies,proto3" json:"tag_families,omitempty"`
 	// entity indicates how to generate a series and shard a stream
 	Entity *Entity `protobuf:"bytes,3,opt,name=entity,proto3" json:"entity,omitempty"`
 	// duration determines how long a TraceSeries keeps its data
@@ -383,7 +439,7 @@ type Stream struct {
 func (x *Stream) Reset() {
 	*x = Stream{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[2]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[3]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -396,7 +452,7 @@ func (x *Stream) String() string {
 func (*Stream) ProtoMessage() {}
 
 func (x *Stream) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[2]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[3]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -409,7 +465,7 @@ func (x *Stream) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use Stream.ProtoReflect.Descriptor instead.
 func (*Stream) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{2}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{3}
 }
 
 func (x *Stream) GetMetadata() *v2.Metadata {
@@ -419,9 +475,9 @@ func (x *Stream) GetMetadata() *v2.Metadata {
 	return nil
 }
 
-func (x *Stream) GetTags() []*TagSpec {
+func (x *Stream) GetTagFamilies() []*TagFamily {
 	if x != nil {
-		return x.Tags
+		return x.TagFamilies
 	}
 	return nil
 }
@@ -465,7 +521,7 @@ type Entity struct {
 func (x *Entity) Reset() {
 	*x = Entity{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[3]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[4]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -478,7 +534,7 @@ func (x *Entity) String() string {
 func (*Entity) ProtoMessage() {}
 
 func (x *Entity) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[3]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[4]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -491,7 +547,7 @@ func (x *Entity) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use Entity.ProtoReflect.Descriptor instead.
 func (*Entity) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{3}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{4}
 }
 
 func (x *Entity) GetTagNames() []string {
@@ -525,7 +581,7 @@ type IndexRule struct {
 func (x *IndexRule) Reset() {
 	*x = IndexRule{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[4]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[5]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -538,7 +594,7 @@ func (x *IndexRule) String() string {
 func (*IndexRule) ProtoMessage() {}
 
 func (x *IndexRule) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[4]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[5]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -551,7 +607,7 @@ func (x *IndexRule) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use IndexRule.ProtoReflect.Descriptor instead.
 func (*IndexRule) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{4}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{5}
 }
 
 func (x *IndexRule) GetMetadata() *v2.Metadata {
@@ -604,7 +660,7 @@ type Subject struct {
 func (x *Subject) Reset() {
 	*x = Subject{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[5]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[6]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -617,7 +673,7 @@ func (x *Subject) String() string {
 func (*Subject) ProtoMessage() {}
 
 func (x *Subject) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[5]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[6]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -630,7 +686,7 @@ func (x *Subject) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use Subject.ProtoReflect.Descriptor instead.
 func (*Subject) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{5}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{6}
 }
 
 func (x *Subject) GetCatalog() v2.Catalog {
@@ -673,7 +729,7 @@ type IndexRuleBinding struct {
 func (x *IndexRuleBinding) Reset() {
 	*x = IndexRuleBinding{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_banyandb_database_v2_schema_proto_msgTypes[6]
+		mi := &file_banyandb_database_v2_schema_proto_msgTypes[7]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -686,7 +742,7 @@ func (x *IndexRuleBinding) String() string {
 func (*IndexRuleBinding) ProtoMessage() {}
 
 func (x *IndexRuleBinding) ProtoReflect() protoreflect.Message {
-	mi := &file_banyandb_database_v2_schema_proto_msgTypes[6]
+	mi := &file_banyandb_database_v2_schema_proto_msgTypes[7]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -699,7 +755,7 @@ func (x *IndexRuleBinding) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use IndexRuleBinding.ProtoReflect.Descriptor instead.
 func (*IndexRuleBinding) Descriptor() ([]byte, []int) {
-	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{6}
+	return file_banyandb_database_v2_schema_proto_rawDescGZIP(), []int{7}
 }
 
 func (x *IndexRuleBinding) GetMetadata() *v2.Metadata {
@@ -769,104 +825,109 @@ var file_banyandb_database_v2_schema_proto_rawDesc = []byte{
 	0x55, 0x4e, 0x49, 0x54, 0x5f, 0x44, 0x41, 0x59, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x55,
 	0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x49, 0x54, 0x5f, 0x57, 0x45, 0x45, 0x4b,
 	0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55,
-	0x4e, 0x49, 0x54, 0x5f, 0x4d, 0x4f, 0x4e, 0x54, 0x48, 0x10, 0x04, 0x22, 0x50, 0x0a, 0x07, 0x54,
-	0x61, 0x67, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79,
-	0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61,
-	0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e,
-	0x54, 0x61, 0x67, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xbf, 0x02,
-	0x0a, 0x06, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61,
-	0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x6e,
-	0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e,
-	0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,
-	0x74, 0x61, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
-	0x32, 0x1d, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61,
-	0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x53, 0x70, 0x65, 0x63, 0x52,
-	0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18,
-	0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62,
-	0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x6e, 0x74,
-	0x69, 0x74, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x73,
-	0x68, 0x61, 0x72, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08,
-	0x73, 0x68, 0x61, 0x72, 0x64, 0x4e, 0x75, 0x6d, 0x12, 0x3a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61,
-	0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x61, 0x6e,
+	0x4e, 0x49, 0x54, 0x5f, 0x4d, 0x4f, 0x4e, 0x54, 0x48, 0x10, 0x04, 0x22, 0x52, 0x0a, 0x09, 0x54,
+	0x61, 0x67, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x04,
+	0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x61, 0x6e,
 	0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
-	0x32, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61,
-	0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f,
-	0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
-	0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
-	0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22,
-	0x25, 0x0a, 0x06, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x67,
-	0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61,
-	0x67, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0xb1, 0x03, 0x0a, 0x09, 0x49, 0x6e, 0x64, 0x65, 0x78,
-	0x52, 0x75, 0x6c, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64,
-	0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61,
-	0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12,
-	0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61,
-	0x67, 0x73, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
-	0x32, 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61,
-	0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x75, 0x6c,
-	0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x44, 0x0a, 0x08,
-	0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28,
+	0x32, 0x2e, 0x54, 0x61, 0x67, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22,
+	0x50, 0x0a, 0x07, 0x54, 0x61, 0x67, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+	0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31,
+	0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62,
+	0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
+	0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70,
+	0x65, 0x22, 0xd0, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x38, 0x0a, 0x08,
+	0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
+	0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
+	0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65,
+	0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x61, 0x67, 0x5f, 0x66, 0x61,
+	0x6d, 0x69, 0x6c, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62,
+	0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
+	0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x52, 0x0b, 0x74,
+	0x61, 0x67, 0x46, 0x61, 0x6d, 0x69, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x65, 0x6e,
+	0x74, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x6e,
+	0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+	0x32, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
+	0x12, 0x1b, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x68, 0x61, 0x72, 0x64, 0x4e, 0x75, 0x6d, 0x12, 0x3a, 0x0a,
+	0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
+	0x1e, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62,
+	0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
+	0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64,
+	0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+	0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74,
+	0x65, 0x64, 0x41, 0x74, 0x22, 0x25, 0x0a, 0x06, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x1b,
+	0x0a, 0x09, 0x74, 0x61, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
+	0x09, 0x52, 0x08, 0x74, 0x61, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0xa4, 0x03, 0x0a, 0x09,
+	0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74,
+	0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61,
+	0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32,
+	0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64,
+	0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
+	0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62,
+	0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x64,
+	0x65, 0x78, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70,
+	0x65, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64,
+	0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78,
+	0x52, 0x75, 0x6c, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c,
+	0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
+	0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
+	0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
+	0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
+	0x41, 0x74, 0x22, 0x3e, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59,
+	0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,
+	0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x45, 0x45, 0x10, 0x01, 0x12,
+	0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x45, 0x44,
+	0x10, 0x02, 0x22, 0x4e, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18,
+	0x0a, 0x14, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
+	0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x43, 0x41,
+	0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x45, 0x52, 0x49, 0x45, 0x53, 0x10, 0x01, 0x12, 0x13, 0x0a,
+	0x0f, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c,
+	0x10, 0x02, 0x22, 0x54, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a,
+	0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b,
+	0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
+	0x2e, 0x76, 0x32, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74,
+	0x61, 0x6c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xc6, 0x02, 0x0a, 0x10, 0x49, 0x6e, 0x64,
+	0x65, 0x78, 0x52, 0x75, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x38, 0x0a,
+	0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+	0x1c, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
+	0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d,
+	0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73,
+	0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x37, 0x0a,
+	0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d,
 	0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,
-	0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x75, 0x6c, 0x65, 0x2e,
-	0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,
-	0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74,
-	0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
-	0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x3e, 0x0a,
-	0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
-	0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54,
-	0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x45, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59,
-	0x50, 0x45, 0x5f, 0x49, 0x4e, 0x56, 0x45, 0x52, 0x54, 0x45, 0x44, 0x10, 0x02, 0x22, 0x5b, 0x0a,
-	0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x14, 0x4c, 0x4f, 0x43,
-	0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
-	0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
-	0x41, 0x54, 0x54, 0x41, 0x43, 0x48, 0x45, 0x44, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x01,
-	0x12, 0x18, 0x0a, 0x14, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x47, 0x47,
-	0x52, 0x45, 0x47, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x22, 0x54, 0x0a, 0x07, 0x53, 0x75,
-	0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64,
-	0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x61, 0x74, 0x61,
-	0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04,
-	0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
-	0x22, 0xc6, 0x02, 0x0a, 0x10, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x75, 0x6c, 0x65, 0x42, 0x69,
-	0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
-	0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e,
-	0x64, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x74,
-	0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12,
-	0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
-	0x72, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64,
-	0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x75,
-	0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35,
-	0x0a, 0x08, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
-	0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
-	0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x62, 0x65,
-	0x67, 0x69, 0x6e, 0x41, 0x74, 0x12, 0x37, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f,
-	0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+	0x73, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x73,
+	0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x5f,
+	0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
 	0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
-	0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x41, 0x74, 0x12, 0x39,
-	0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01,
-	0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09,
-	0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x2a, 0x7d, 0x0a, 0x07, 0x54, 0x61, 0x67,
-	0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45,
-	0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13,
-	0x0a, 0x0f, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e,
-	0x47, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
-	0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50,
-	0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x03,
-	0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54,
-	0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x04, 0x42, 0x72, 0x0a, 0x2a, 0x6f, 0x72, 0x67, 0x2e,
-	0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x73, 0x6b, 0x79, 0x77, 0x61, 0x6c, 0x6b, 0x69, 0x6e,
-	0x67, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62,
-	0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
-	0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x73, 0x6b, 0x79, 0x77, 0x61, 0x6c,
-	0x6b, 0x69, 0x6e, 0x67, 0x2d, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2f, 0x61, 0x70,
-	0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62,
-	0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x41, 0x74, 0x12, 0x37, 0x0a,
+	0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
+	0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+	0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x65, 0x78,
+	0x70, 0x69, 0x72, 0x65, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
+	0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
+	0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d,
+	0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41,
+	0x74, 0x2a, 0x7d, 0x0a, 0x07, 0x54, 0x61, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14,
+	0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
+	0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59,
+	0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x54,
+	0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x19, 0x0a,
+	0x15, 0x54, 0x41, 0x47, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47,
+	0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x47, 0x5f,
+	0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x04,
+	0x42, 0x72, 0x0a, 0x2a, 0x6f, 0x72, 0x67, 0x2e, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x73,
+	0x6b, 0x79, 0x77, 0x61, 0x6c, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e,
+	0x64, 0x62, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x32, 0x5a, 0x44,
+	0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x61, 0x63, 0x68,
+	0x65, 0x2f, 0x73, 0x6b, 0x79, 0x77, 0x61, 0x6c, 0x6b, 0x69, 0x6e, 0x67, 0x2d, 0x62, 0x61, 0x6e,
+	0x79, 0x61, 0x6e, 0x64, 0x62, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
+	0x62, 0x61, 0x6e, 0x79, 0x61, 0x6e, 0x64, 0x62, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
+	0x65, 0x2f, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -882,46 +943,48 @@ func file_banyandb_database_v2_schema_proto_rawDescGZIP() []byte {
 }
 
 var file_banyandb_database_v2_schema_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
-var file_banyandb_database_v2_schema_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_banyandb_database_v2_schema_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
 var file_banyandb_database_v2_schema_proto_goTypes = []interface{}{
 	(TagType)(0),                  // 0: banyandb.database.v2.TagType
 	(Duration_DurationUnit)(0),    // 1: banyandb.database.v2.Duration.DurationUnit
 	(IndexRule_Type)(0),           // 2: banyandb.database.v2.IndexRule.Type
 	(IndexRule_Location)(0),       // 3: banyandb.database.v2.IndexRule.Location
 	(*Duration)(nil),              // 4: banyandb.database.v2.Duration
-	(*TagSpec)(nil),               // 5: banyandb.database.v2.TagSpec
-	(*Stream)(nil),                // 6: banyandb.database.v2.Stream
-	(*Entity)(nil),                // 7: banyandb.database.v2.Entity
-	(*IndexRule)(nil),             // 8: banyandb.database.v2.IndexRule
-	(*Subject)(nil),               // 9: banyandb.database.v2.Subject
-	(*IndexRuleBinding)(nil),      // 10: banyandb.database.v2.IndexRuleBinding
-	(*v2.Metadata)(nil),           // 11: banyandb.common.v2.Metadata
-	(*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp
-	(v2.Catalog)(0),               // 13: banyandb.common.v2.Catalog
+	(*TagFamily)(nil),             // 5: banyandb.database.v2.TagFamily
+	(*TagSpec)(nil),               // 6: banyandb.database.v2.TagSpec
+	(*Stream)(nil),                // 7: banyandb.database.v2.Stream
+	(*Entity)(nil),                // 8: banyandb.database.v2.Entity
+	(*IndexRule)(nil),             // 9: banyandb.database.v2.IndexRule
+	(*Subject)(nil),               // 10: banyandb.database.v2.Subject
+	(*IndexRuleBinding)(nil),      // 11: banyandb.database.v2.IndexRuleBinding
+	(*v2.Metadata)(nil),           // 12: banyandb.common.v2.Metadata
+	(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
+	(v2.Catalog)(0),               // 14: banyandb.common.v2.Catalog
 }
 var file_banyandb_database_v2_schema_proto_depIdxs = []int32{
 	1,  // 0: banyandb.database.v2.Duration.unit:type_name -> banyandb.database.v2.Duration.DurationUnit
-	0,  // 1: banyandb.database.v2.TagSpec.type:type_name -> banyandb.database.v2.TagType
-	11, // 2: banyandb.database.v2.Stream.metadata:type_name -> banyandb.common.v2.Metadata
-	5,  // 3: banyandb.database.v2.Stream.tags:type_name -> banyandb.database.v2.TagSpec
-	7,  // 4: banyandb.database.v2.Stream.entity:type_name -> banyandb.database.v2.Entity
-	4,  // 5: banyandb.database.v2.Stream.duration:type_name -> banyandb.database.v2.Duration
-	12, // 6: banyandb.database.v2.Stream.updated_at:type_name -> google.protobuf.Timestamp
-	11, // 7: banyandb.database.v2.IndexRule.metadata:type_name -> banyandb.common.v2.Metadata
-	2,  // 8: banyandb.database.v2.IndexRule.type:type_name -> banyandb.database.v2.IndexRule.Type
-	3,  // 9: banyandb.database.v2.IndexRule.location:type_name -> banyandb.database.v2.IndexRule.Location
-	12, // 10: banyandb.database.v2.IndexRule.updated_at:type_name -> google.protobuf.Timestamp
-	13, // 11: banyandb.database.v2.Subject.catalog:type_name -> banyandb.common.v2.Catalog
-	11, // 12: banyandb.database.v2.IndexRuleBinding.metadata:type_name -> banyandb.common.v2.Metadata
-	9,  // 13: banyandb.database.v2.IndexRuleBinding.subject:type_name -> banyandb.database.v2.Subject
-	12, // 14: banyandb.database.v2.IndexRuleBinding.begin_at:type_name -> google.protobuf.Timestamp
-	12, // 15: banyandb.database.v2.IndexRuleBinding.expire_at:type_name -> google.protobuf.Timestamp
-	12, // 16: banyandb.database.v2.IndexRuleBinding.updated_at:type_name -> google.protobuf.Timestamp
-	17, // [17:17] is the sub-list for method output_type
-	17, // [17:17] is the sub-list for method input_type
-	17, // [17:17] is the sub-list for extension type_name
-	17, // [17:17] is the sub-list for extension extendee
-	0,  // [0:17] is the sub-list for field type_name
+	6,  // 1: banyandb.database.v2.TagFamily.tags:type_name -> banyandb.database.v2.TagSpec
+	0,  // 2: banyandb.database.v2.TagSpec.type:type_name -> banyandb.database.v2.TagType
+	12, // 3: banyandb.database.v2.Stream.metadata:type_name -> banyandb.common.v2.Metadata
+	5,  // 4: banyandb.database.v2.Stream.tag_families:type_name -> banyandb.database.v2.TagFamily
+	8,  // 5: banyandb.database.v2.Stream.entity:type_name -> banyandb.database.v2.Entity
+	4,  // 6: banyandb.database.v2.Stream.duration:type_name -> banyandb.database.v2.Duration
+	13, // 7: banyandb.database.v2.Stream.updated_at:type_name -> google.protobuf.Timestamp
+	12, // 8: banyandb.database.v2.IndexRule.metadata:type_name -> banyandb.common.v2.Metadata
+	2,  // 9: banyandb.database.v2.IndexRule.type:type_name -> banyandb.database.v2.IndexRule.Type
+	3,  // 10: banyandb.database.v2.IndexRule.location:type_name -> banyandb.database.v2.IndexRule.Location
+	13, // 11: banyandb.database.v2.IndexRule.updated_at:type_name -> google.protobuf.Timestamp
+	14, // 12: banyandb.database.v2.Subject.catalog:type_name -> banyandb.common.v2.Catalog
+	12, // 13: banyandb.database.v2.IndexRuleBinding.metadata:type_name -> banyandb.common.v2.Metadata
+	10, // 14: banyandb.database.v2.IndexRuleBinding.subject:type_name -> banyandb.database.v2.Subject
+	13, // 15: banyandb.database.v2.IndexRuleBinding.begin_at:type_name -> google.protobuf.Timestamp
+	13, // 16: banyandb.database.v2.IndexRuleBinding.expire_at:type_name -> google.protobuf.Timestamp
+	13, // 17: banyandb.database.v2.IndexRuleBinding.updated_at:type_name -> google.protobuf.Timestamp
+	18, // [18:18] is the sub-list for method output_type
+	18, // [18:18] is the sub-list for method input_type
+	18, // [18:18] is the sub-list for extension type_name
+	18, // [18:18] is the sub-list for extension extendee
+	0,  // [0:18] is the sub-list for field type_name
 }
 
 func init() { file_banyandb_database_v2_schema_proto_init() }
@@ -943,7 +1006,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*TagSpec); i {
+			switch v := v.(*TagFamily); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -955,7 +1018,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*Stream); i {
+			switch v := v.(*TagSpec); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -967,7 +1030,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*Entity); i {
+			switch v := v.(*Stream); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -979,7 +1042,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*IndexRule); i {
+			switch v := v.(*Entity); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -991,7 +1054,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*Subject); i {
+			switch v := v.(*IndexRule); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -1003,6 +1066,18 @@ func file_banyandb_database_v2_schema_proto_init() {
 			}
 		}
 		file_banyandb_database_v2_schema_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Subject); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_banyandb_database_v2_schema_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*IndexRuleBinding); i {
 			case 0:
 				return &v.state
@@ -1021,7 +1096,7 @@ func file_banyandb_database_v2_schema_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_banyandb_database_v2_schema_proto_rawDesc,
 			NumEnums:      4,
-			NumMessages:   7,
+			NumMessages:   8,
 			NumExtensions: 0,
 			NumServices:   0,
 		},
diff --git a/api/proto/banyandb/database/v2/schema.proto b/api/proto/banyandb/database/v2/schema.proto
index 2ef8f25..c3745ff 100644
--- a/api/proto/banyandb/database/v2/schema.proto
+++ b/api/proto/banyandb/database/v2/schema.proto
@@ -46,6 +46,12 @@ enum TagType {
     TAG_TYPE_INT_ARRAY = 4;
 }
 
+message TagFamily {
+    string name = 1;
+    // tags defines accepted tags
+    repeated TagSpec tags = 2; 
+}
+
 message TagSpec {
     string name = 1;
     TagType type = 2;
@@ -55,8 +61,8 @@ message TagSpec {
 message Stream {
     // metadata is the identity of a trace series
     common.v2.Metadata metadata = 1;
-    // tags defines accepted tags
-    repeated TagSpec tags = 2;
+    // tag_families 
+    repeated TagFamily tag_families = 2;
     // entity indicates how to generate a series and shard a stream
     Entity entity = 3;
     // duration determines how long a TraceSeries keeps its data
@@ -89,8 +95,8 @@ message IndexRule {
     Type type = 3;
     enum Location {
         LOCATION_UNSPECIFIED = 0;
-        LOCATION_ATTACHED_BLOCK = 1;
-        LOCATION_AGGREGATION = 2;
+        LOCATION_SERIES = 1;
+        LOCATION_GLOBAL = 2;
     }
     // location indicates where to store index.
     Location location = 4;
diff --git a/banyand/metadata/schema/data/index_rules/db.instance.json b/banyand/metadata/schema/data/index_rules/db.instance.json
index e35f3a6..5d5c159 100644
--- a/banyand/metadata/schema/data/index_rules/db.instance.json
+++ b/banyand/metadata/schema/data/index_rules/db.instance.json
@@ -7,6 +7,6 @@
     "db.instance"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/db.type.json b/banyand/metadata/schema/data/index_rules/db.type.json
index 015522c..67914ee 100644
--- a/banyand/metadata/schema/data/index_rules/db.type.json
+++ b/banyand/metadata/schema/data/index_rules/db.type.json
@@ -7,6 +7,6 @@
     "db.type"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/duration.json b/banyand/metadata/schema/data/index_rules/duration.json
index 7cc8180..6f18db1 100644
--- a/banyand/metadata/schema/data/index_rules/duration.json
+++ b/banyand/metadata/schema/data/index_rules/duration.json
@@ -7,6 +7,6 @@
     "duration"
   ],
   "type": "TYPE_TREE",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/endpoint_id.json b/banyand/metadata/schema/data/index_rules/endpoint_id.json
index 248a29c..7da3b0d 100644
--- a/banyand/metadata/schema/data/index_rules/endpoint_id.json
+++ b/banyand/metadata/schema/data/index_rules/endpoint_id.json
@@ -7,6 +7,6 @@
     "endpoint_id"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/http.code.json b/banyand/metadata/schema/data/index_rules/http.code.json
index 6b5c757..bd2e86f 100644
--- a/banyand/metadata/schema/data/index_rules/http.code.json
+++ b/banyand/metadata/schema/data/index_rules/http.code.json
@@ -7,6 +7,6 @@
     "http.code"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/http.method.json b/banyand/metadata/schema/data/index_rules/http.method.json
index 7619604..3001154 100644
--- a/banyand/metadata/schema/data/index_rules/http.method.json
+++ b/banyand/metadata/schema/data/index_rules/http.method.json
@@ -7,6 +7,6 @@
     "http.method"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/mq.broker.json b/banyand/metadata/schema/data/index_rules/mq.broker.json
index 9d2bd6a..0cfbd27 100644
--- a/banyand/metadata/schema/data/index_rules/mq.broker.json
+++ b/banyand/metadata/schema/data/index_rules/mq.broker.json
@@ -7,6 +7,6 @@
     "mq.broker"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/mq.queue.json b/banyand/metadata/schema/data/index_rules/mq.queue.json
index ccf9a3c..0c589fc 100644
--- a/banyand/metadata/schema/data/index_rules/mq.queue.json
+++ b/banyand/metadata/schema/data/index_rules/mq.queue.json
@@ -7,6 +7,6 @@
     "mq.queue"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/mq.topic.json b/banyand/metadata/schema/data/index_rules/mq.topic.json
index 5255e5b..5dc51fc 100644
--- a/banyand/metadata/schema/data/index_rules/mq.topic.json
+++ b/banyand/metadata/schema/data/index_rules/mq.topic.json
@@ -7,6 +7,6 @@
     "mq.topic"
   ],
   "type": "TYPE_INVERTED",
-  "location": "LOCATION_ATTACHED_BLOCK",
+  "location": "LOCATION_SERIES",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/index_rules/trace_id.json b/banyand/metadata/schema/data/index_rules/trace_id.json
index 5061326..2f84bfb 100644
--- a/banyand/metadata/schema/data/index_rules/trace_id.json
+++ b/banyand/metadata/schema/data/index_rules/trace_id.json
@@ -7,6 +7,6 @@
     "trace_id"
   ],
   "type": "TYPE_TREE",
-  "location": "LOCATION_AGGREGATION",
+  "location": "LOCATION_GLOBAL",
   "updated_at": "2021-04-15T01:30:15.01Z"
 }
diff --git a/banyand/metadata/schema/data/stream.json b/banyand/metadata/schema/data/stream.json
index 5dfefec..c34ec65 100644
--- a/banyand/metadata/schema/data/stream.json
+++ b/banyand/metadata/schema/data/stream.json
@@ -3,62 +3,76 @@
     "name": "sw",
     "group": "default"
   },
-  "tags": [
+  "tag_families": [
     {
-      "name": "trace_id",
-      "type": "TAG_TYPE_STRING"
+      "name": "data",
+      "tags": [
+        {
+          "name": "data_binary",
+          "type": "TAG_TYPE_UNSPECIFIED"
+        }
+      ]
     },
     {
-      "name": "state",
-      "type": "TAG_TYPE_INT"
-    },
-    {
-      "name": "service_id",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "service_instance_id",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "endpoint_id",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "duration",
-      "type": "TAG_TYPE_INT"
-    },
-    {
-      "name": "start_time",
-      "type": "TAG_TYPE_INT"
-    },
-    {
-      "name": "http.method",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "status_code",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "db.type",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "db.instance",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "mq.queue",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "mq.topic",
-      "type": "TAG_TYPE_STRING"
-    },
-    {
-      "name": "mq.broker",
-      "type": "TAG_TYPE_STRING"
+      "name": "searchable",
+      "tags": [
+        {
+          "name": "trace_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "state",
+          "type": "TAG_TYPE_INT"
+        },
+        {
+          "name": "service_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "service_instance_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "endpoint_id",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "duration",
+          "type": "TAG_TYPE_INT"
+        },
+        {
+          "name": "start_time",
+          "type": "TAG_TYPE_INT"
+        },
+        {
+          "name": "http.method",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "status_code",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "db.type",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "db.instance",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "mq.queue",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "mq.topic",
+          "type": "TAG_TYPE_STRING"
+        },
+        {
+          "name": "mq.broker",
+          "type": "TAG_TYPE_STRING"
+        }
+      ]
     }
   ],
   "entity": {
diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go
new file mode 100644
index 0000000..dcab966
--- /dev/null
+++ b/banyand/tsdb/block.go
@@ -0,0 +1,69 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT 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 tsdb
+
+import (
+	"context"
+	"io"
+
+	"github.com/apache/skywalking-banyandb/banyand/kv"
+	"github.com/apache/skywalking-banyandb/pkg/logger"
+)
+
+type block struct {
+	path string
+	l    *logger.Logger
+
+	store       kv.TimeSeriesStore
+	treeIndex   kv.Store
+	closableLst []io.Closer
+	//revertedIndex kv.Store
+}
+
+type blockOpts struct {
+	path          string
+	compressLevel int
+	valueSize     int
+}
+
+func newBlock(ctx context.Context, opts blockOpts) (b *block, err error) {
+	b = &block{
+		path: opts.path,
+	}
+	parentLogger := ctx.Value(logger.ContextKey)
+	if parentLogger != nil {
+		if pl, ok := parentLogger.(*logger.Logger); ok {
+			b.l = pl.Named("block")
+		}
+	}
+	if b.store, err = kv.OpenTimeSeriesStore(0, b.path+"/store", opts.compressLevel, opts.valueSize,
+		kv.TSSWithLogger(b.l)); err != nil {
+		return nil, err
+	}
+	if b.treeIndex, err = kv.OpenStore(0, b.path+"/t_index", kv.StoreWithLogger(b.l)); err != nil {
+		return nil, err
+	}
+	b.closableLst = append(b.closableLst, b.store, b.treeIndex)
+	return b, nil
+}
+
+func (b *block) close() {
+	for _, closer := range b.closableLst {
+		_ = closer.Close()
+	}
+}
diff --git a/pkg/logger/logger.go b/banyand/tsdb/indexdb.go
similarity index 62%
copy from pkg/logger/logger.go
copy to banyand/tsdb/indexdb.go
index 1a08dc5..98e60e9 100644
--- a/pkg/logger/logger.go
+++ b/banyand/tsdb/indexdb.go
@@ -15,28 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package logger
+package tsdb
 
-import (
-	"strings"
+import databasev2 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v2"
 
-	"github.com/rs/zerolog"
-)
-
-// Logging is the config info
-type Logging struct {
-	Env   string
-	Level string
-}
-
-// Logger is wrapper for rs/zerolog logger with module, it is singleton.
-type Logger struct {
-	module string
-	*zerolog.Logger
-}
-
-func (l *Logger) Named(name string) *Logger {
-	module := strings.Join([]string{l.module, name}, ".")
-	subLogger := root.Logger.With().Str("module", module).Logger()
-	return &Logger{module: module, Logger: &subLogger}
+type IndexDatabase interface {
+	CreateSeries(rule *databasev2.IndexRule) error
+	CreateGlobal(rule *databasev2.IndexRule) error
+	WriteGlobal() error
 }
diff --git a/pkg/logger/logger.go b/banyand/tsdb/segment.go
similarity index 58%
copy from pkg/logger/logger.go
copy to banyand/tsdb/segment.go
index 1a08dc5..80af39f 100644
--- a/pkg/logger/logger.go
+++ b/banyand/tsdb/segment.go
@@ -15,28 +15,47 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package logger
+package tsdb
 
 import (
-	"strings"
-
-	"github.com/rs/zerolog"
+	"context"
+	"sync"
+	"time"
 )
 
-// Logging is the config info
-type Logging struct {
-	Env   string
-	Level string
+type segment struct {
+	path string
+
+	lst []*block
+	sync.Mutex
 }
 
-// Logger is wrapper for rs/zerolog logger with module, it is singleton.
-type Logger struct {
-	module string
-	*zerolog.Logger
+func newSegment(ctx context.Context, path string) (s *segment, err error) {
+	s = &segment{
+		path: path,
+	}
+	blockPath, err := mkdir(blockTemplate, path, time.Now().Format(blockFormat))
+	if err != nil {
+		return nil, err
+	}
+	var b *block
+	if b, err = newBlock(ctx, blockOpts{
+		path: blockPath,
+	}); err != nil {
+		return nil, err
+	}
+	{
+		s.Lock()
+		defer s.Unlock()
+		s.lst = append(s.lst, b)
+	}
+	return s, nil
 }
 
-func (l *Logger) Named(name string) *Logger {
-	module := strings.Join([]string{l.module, name}, ".")
-	subLogger := root.Logger.With().Str("module", module).Logger()
-	return &Logger{module: module, Logger: &subLogger}
+func (s *segment) close() {
+	s.Lock()
+	defer s.Unlock()
+	for _, b := range s.lst {
+		b.close()
+	}
 }
diff --git a/banyand/tsdb/series.go b/banyand/tsdb/series.go
new file mode 100644
index 0000000..03a6e65
--- /dev/null
+++ b/banyand/tsdb/series.go
@@ -0,0 +1,84 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT 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 tsdb
+
+import (
+	"time"
+
+	modelv2 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v2"
+)
+
+type Iterator interface {
+	Next() bool
+	Val() Item
+	Close() error
+}
+
+type Item interface {
+	Val(family string) []byte
+	SortingVal() []byte
+}
+
+type ConditionValue struct {
+	Values [][]byte
+	Op     modelv2.PairQuery_BinaryOp
+}
+
+type Condition map[string][]ConditionValue
+
+type ItemID struct {
+}
+
+type TimeRange struct {
+	Start    time.Time
+	Duration time.Duration
+}
+
+type Series interface {
+	Span(timeRange TimeRange) (SeriesSpan, error)
+	Get(id ItemID) (Item, error)
+}
+
+type SeriesSpan interface {
+	WriterBuilder() WriterBuilder
+	Iterator() Iterator
+	SeekerBuilder() SeekerBuilder
+}
+
+type WriterBuilder interface {
+	Family(name string) WriterBuilder
+	Time(ts time.Time) WriterBuilder
+	Val(val []byte) WriterBuilder
+	OrderBy(order modelv2.QueryOrder_Sort) WriterBuilder
+	Build() Writer
+}
+
+type Writer interface {
+	Write() ItemID
+}
+
+type SeekerBuilder interface {
+	Filter(condition Condition) SeekerBuilder
+	OrderByIndex(name string, order modelv2.QueryOrder_Sort) SeekerBuilder
+	OrderByTime(order modelv2.QueryOrder_Sort) SeekerBuilder
+	Build() Seeker
+}
+
+type Seeker interface {
+	Seek() Iterator
+}
diff --git a/pkg/logger/logger.go b/banyand/tsdb/seriesdb.go
similarity index 63%
copy from pkg/logger/logger.go
copy to banyand/tsdb/seriesdb.go
index 1a08dc5..727a6af 100644
--- a/pkg/logger/logger.go
+++ b/banyand/tsdb/seriesdb.go
@@ -15,28 +15,32 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package logger
+package tsdb
 
-import (
-	"strings"
+import "bytes"
 
-	"github.com/rs/zerolog"
-)
+var AllEntry = Entry("*")
 
-// Logging is the config info
-type Logging struct {
-	Env   string
-	Level string
+type Entity [][]byte
+
+type Path struct {
+	prefix      []byte
+	suffixStack []Entry
 }
 
-// Logger is wrapper for rs/zerolog logger with module, it is singleton.
-type Logger struct {
-	module string
-	*zerolog.Logger
+type Entry []byte
+
+func (e Entry) Equal(another Entry) bool {
+	return bytes.Equal(e, another)
+}
+
+func NewPath(entries []Entry) {
+	if entries[0].Equal(AllEntry) {
+
+	}
 }
 
-func (l *Logger) Named(name string) *Logger {
-	module := strings.Join([]string{l.module, name}, ".")
-	subLogger := root.Logger.With().Str("module", module).Logger()
-	return &Logger{module: module, Logger: &subLogger}
+type SeriesDatabase interface {
+	Create(entity Entity) error
+	List(path Path) ([]Series, error)
 }
diff --git a/pkg/logger/logger.go b/banyand/tsdb/shard.go
similarity index 52%
copy from pkg/logger/logger.go
copy to banyand/tsdb/shard.go
index 1a08dc5..ac58b9d 100644
--- a/pkg/logger/logger.go
+++ b/banyand/tsdb/shard.go
@@ -15,28 +15,54 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package logger
+package tsdb
 
 import (
-	"strings"
-
-	"github.com/rs/zerolog"
+	"context"
+	"sync"
+	"time"
 )
 
-// Logging is the config info
-type Logging struct {
-	Env   string
-	Level string
+var _ Shard = (*shard)(nil)
+
+type shard struct {
+	id  int
+	lst []*segment
+	sync.Mutex
+	location string
+}
+
+func (s *shard) Series() SeriesDatabase {
+	panic("implement me")
+}
+
+func (s *shard) Index() IndexDatabase {
+	panic("implement me")
 }
 
-// Logger is wrapper for rs/zerolog logger with module, it is singleton.
-type Logger struct {
-	module string
-	*zerolog.Logger
+func newShard(ctx context.Context, id int, location string) (*shard, error) {
+	s := &shard{
+		id:       id,
+		location: location,
+	}
+	segPath, err := mkdir(segTemplate, s.location, time.Now().Format(segFormat))
+	if err != nil {
+		return nil, err
+	}
+	seg, err := newSegment(ctx, segPath)
+	if err != nil {
+		return nil, err
+	}
+	{
+		s.Lock()
+		defer s.Unlock()
+		s.lst = append(s.lst, seg)
+	}
+	return s, nil
 }
 
-func (l *Logger) Named(name string) *Logger {
-	module := strings.Join([]string{l.module, name}, ".")
-	subLogger := root.Logger.With().Str("module", module).Logger()
-	return &Logger{module: module, Logger: &subLogger}
+func (s *shard) stop() {
+	for _, seg := range s.lst {
+		seg.close()
+	}
 }
diff --git a/banyand/tsdb/tsdb.go b/banyand/tsdb/tsdb.go
new file mode 100644
index 0000000..b14a932
--- /dev/null
+++ b/banyand/tsdb/tsdb.go
@@ -0,0 +1,138 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT 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 tsdb
+
+import (
+	"context"
+	"fmt"
+	"io"
+	"io/fs"
+	"io/ioutil"
+	"os"
+	"sync"
+
+	"github.com/pkg/errors"
+	"go.uber.org/multierr"
+
+	"github.com/apache/skywalking-banyandb/pkg/logger"
+)
+
+const (
+	shardTemplate = "%s/shard-%d"
+	segTemplate   = "%s/seg-%s"
+	blockTemplate = "%s/block-%s"
+
+	segFormat   = "20060102"
+	blockFormat = "1504"
+
+	dirPerm = 0700
+)
+
+type Database interface {
+	io.Closer
+	Shards() []Shard
+}
+
+type Shard interface {
+	Series() SeriesDatabase
+	Index() IndexDatabase
+}
+
+var _ Database = (*database)(nil)
+
+type DatabaseOpts struct {
+	Location string
+	ShardNum uint
+}
+
+type database struct {
+	logger   *logger.Logger
+	location string
+	shardNum uint
+
+	sLst []Shard
+	sync.Mutex
+}
+
+func OpenDatabase(ctx context.Context, opts DatabaseOpts) (Database, error) {
+	db := &database{
+		location: opts.Location,
+		shardNum: opts.ShardNum,
+	}
+	parentLogger := ctx.Value(logger.ContextKey)
+	if parentLogger != nil {
+		if pl, ok := parentLogger.(*logger.Logger); ok {
+			db.logger = pl.Named("tsdb")
+		}
+	}
+	if _, err := mkdir(opts.Location); err != nil {
+		return nil, err
+	}
+	db.logger.Info().Str("path", opts.Location).Msg("initialized")
+	var entries []fs.FileInfo
+	var err error
+	if entries, err = ioutil.ReadDir(opts.Location); err != nil {
+		return nil, errors.Wrap(err, "failed to read directory contents failed")
+	}
+	thisContext := context.WithValue(ctx, logger.ContextKey, db.logger)
+	if len(entries) > 0 {
+		return loadDatabase(thisContext, db)
+	}
+	return createDatabase(thisContext, db)
+}
+
+func (d *database) Close() error {
+	panic("implement me")
+}
+
+func (d *database) Shards() []Shard {
+	return d.sLst
+}
+
+func createDatabase(ctx context.Context, db *database) (Database, error) {
+	var err error
+	db.Lock()
+	defer db.Unlock()
+	for i := 0; i < int(db.shardNum); i++ {
+		shardLocation, errInternal := mkdir(shardTemplate, db.location, i)
+		if errInternal != nil {
+			err = multierr.Append(err, errInternal)
+			continue
+		}
+		so, errNewShard := newShard(ctx, i, shardLocation)
+		if errNewShard != nil {
+			err = multierr.Append(err, errNewShard)
+			continue
+		}
+		db.sLst = append(db.sLst, so)
+	}
+	return db, err
+}
+
+func loadDatabase(ctx context.Context, db *database) (Database, error) {
+	//TODO: load the existing database
+	return db, nil
+}
+
+func mkdir(format string, a ...interface{}) (path string, err error) {
+	path = fmt.Sprintf(format, a...)
+	if err = os.MkdirAll(path, dirPerm); err != nil {
+		return "", errors.Wrapf(err, "failed to create %s", path)
+	}
+	return path, err
+}
diff --git a/banyand/tsdb/tsdb_test.go b/banyand/tsdb/tsdb_test.go
new file mode 100644
index 0000000..f791d2b
--- /dev/null
+++ b/banyand/tsdb/tsdb_test.go
@@ -0,0 +1,75 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT 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 tsdb
+
+import (
+	"context"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+
+	"github.com/apache/skywalking-banyandb/pkg/logger"
+)
+
+func TestOpenDatabase(t *testing.T) {
+	tester := assert.New(t)
+	tempDir, _ := setUp(tester)
+	defer removeDir(tempDir)
+	shardPath := fmt.Sprintf(shardTemplate, tempDir, 0)
+	validateDirectory(tester, shardPath)
+	now := time.Now()
+	segPath := fmt.Sprintf(segTemplate, shardPath, now.Format(segFormat))
+	validateDirectory(tester, segPath)
+	validateDirectory(tester, fmt.Sprintf(blockTemplate, segPath, now.Format(blockFormat)))
+}
+
+func setUp(t *assert.Assertions) (tempDir string, db Database) {
+	t.NoError(logger.Init(logger.Logging{
+		Env:   "dev",
+		Level: "debug",
+	}))
+	var tempDirErr error
+	tempDir, tempDirErr = ioutil.TempDir("", "banyandb-test-*")
+	t.Nil(tempDirErr)
+	db, err := OpenDatabase(
+		context.WithValue(context.Background(), logger.ContextKey, logger.GetLogger("test")),
+		DatabaseOpts{
+			Location: tempDir,
+			ShardNum: 1,
+		})
+	t.NoError(err)
+	t.NotNil(db)
+	return tempDir, db
+}
+
+func validateDirectory(t *assert.Assertions, dir string) {
+	info, err := os.Stat(dir)
+	t.False(os.IsNotExist(err), "Directory does not exist: %v", dir)
+	t.NoError(err, "Directory error: %v", dir)
+	t.True(info.IsDir(), "Directory is a file, not a directory: %#v\n", dir)
+}
+
+func removeDir(dir string) {
+	if err := os.RemoveAll(dir); err != nil {
+		fmt.Printf("Error while removing dir: %v\n", err)
+	}
+}
diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go
index 1a08dc5..15c8e59 100644
--- a/pkg/logger/logger.go
+++ b/pkg/logger/logger.go
@@ -23,6 +23,10 @@ import (
 	"github.com/rs/zerolog"
 )
 
+var ContextKey = contextKey{}
+
+type contextKey struct{}
+
 // Logging is the config info
 type Logging struct {
 	Env   string