From 45caff1a20857c7557d1cff5d552e5b8bec8ded5 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 14 May 2018 15:21:29 -0400 Subject: [PATCH 1/3] changelog and version --- CHANGELOG.md | 2 +- version/version.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9db04f131..d87f094b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.8.3 (develop branch) +## 0.8.3 (May 14th, 2018) FEATURES: diff --git a/version/version.go b/version/version.go index 107f5cf3a..40472c9a9 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,3 @@ package version -const Version = "0.8.2" +const Version = "0.8.3" From 468be0f8d6115c1c710a2a50cf19a7b3bc6a7040 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 14 May 2018 15:49:00 -0400 Subject: [PATCH 2/3] mv remotedb, proto, grpcdb all under db/remotedb --- CHANGELOG.md | 2 + Makefile | 6 +- {remotedb => db/remotedb}/doc.go | 0 {grpcdb => db/remotedb/grpcdb}/client.go | 2 +- {grpcdb => db/remotedb/grpcdb}/doc.go | 0 .../remotedb/grpcdb}/example_test.go | 4 +- {grpcdb => db/remotedb/grpcdb}/server.go | 2 +- {proto => db/remotedb/proto}/defs.pb.go | 340 +++++++++++++----- {proto => db/remotedb/proto}/defs.proto | 0 {remotedb => db/remotedb}/remotedb.go | 4 +- {remotedb => db/remotedb}/remotedb_test.go | 14 +- 11 files changed, 274 insertions(+), 100 deletions(-) rename {remotedb => db/remotedb}/doc.go (100%) rename {grpcdb => db/remotedb/grpcdb}/client.go (92%) rename {grpcdb => db/remotedb/grpcdb}/doc.go (100%) rename {grpcdb => db/remotedb/grpcdb}/example_test.go (90%) rename {grpcdb => db/remotedb/grpcdb}/server.go (98%) rename {proto => db/remotedb/proto}/defs.pb.go (66%) rename {proto => db/remotedb/proto}/defs.proto (100%) rename {remotedb => db/remotedb}/remotedb.go (98%) rename {remotedb => db/remotedb}/remotedb_test.go (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index d87f094b0..06f9f08e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ FEATURES: + - [db/remotedb] New DB type using an external CLevelDB process via + GRPC - [autofile] logjack command for piping stdin to a rotating file - [common] ASCIITrim() diff --git a/Makefile b/Makefile index 41e5f1291..efef45996 100644 --- a/Makefile +++ b/Makefile @@ -72,12 +72,12 @@ gen_certs: clean_certs certstrap init --common-name "tendermint.com" --passphrase "" certstrap request-cert -ip "::" --passphrase "" certstrap sign "::" --CA "tendermint.com" --passphrase "" - mv out/::.crt out/::.key remotedb + mv out/::.crt out/::.key db/remotedb clean_certs: ## Cleaning TLS testing certificates... rm -rf out - rm -f remotedb/::.crt remotedb/::.key + rm -f db/remotedb/::.crt db/remotedb/::.key test: gen_certs go test -tags gcc $(shell go list ./... | grep -v vendor) @@ -135,4 +135,4 @@ metalinter_all: .PHONY: check protoc build check_tools get_tools get_protoc update_tools get_vendor_deps test fmt metalinter metalinter_all gen_certs clean_certs grpc_dbserver: - protoc -I proto/ proto/defs.proto --go_out=plugins=grpc:proto + protoc -I db/remotedb/proto/ db/remotedb/proto/defs.proto --go_out=plugins=grpc:db/remotedb/proto diff --git a/remotedb/doc.go b/db/remotedb/doc.go similarity index 100% rename from remotedb/doc.go rename to db/remotedb/doc.go diff --git a/grpcdb/client.go b/db/remotedb/grpcdb/client.go similarity index 92% rename from grpcdb/client.go rename to db/remotedb/grpcdb/client.go index bae38b1c5..86aa12c7f 100644 --- a/grpcdb/client.go +++ b/db/remotedb/grpcdb/client.go @@ -4,7 +4,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" - protodb "github.com/tendermint/tmlibs/proto" + protodb "github.com/tendermint/tmlibs/db/remotedb/proto" ) // Security defines how the client will talk to the gRPC server. diff --git a/grpcdb/doc.go b/db/remotedb/grpcdb/doc.go similarity index 100% rename from grpcdb/doc.go rename to db/remotedb/grpcdb/doc.go diff --git a/grpcdb/example_test.go b/db/remotedb/grpcdb/example_test.go similarity index 90% rename from grpcdb/example_test.go rename to db/remotedb/grpcdb/example_test.go index 5a9c6eed9..827a1cf36 100644 --- a/grpcdb/example_test.go +++ b/db/remotedb/grpcdb/example_test.go @@ -5,8 +5,8 @@ import ( "context" "log" - grpcdb "github.com/tendermint/tmlibs/grpcdb" - protodb "github.com/tendermint/tmlibs/proto" + grpcdb "github.com/tendermint/tmlibs/db/remotedb/grpcdb" + protodb "github.com/tendermint/tmlibs/db/remotedb/proto" ) func Example() { diff --git a/grpcdb/server.go b/db/remotedb/grpcdb/server.go similarity index 98% rename from grpcdb/server.go rename to db/remotedb/grpcdb/server.go index d4cfe4433..8320c0517 100644 --- a/grpcdb/server.go +++ b/db/remotedb/grpcdb/server.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc/credentials" "github.com/tendermint/tmlibs/db" - protodb "github.com/tendermint/tmlibs/proto" + protodb "github.com/tendermint/tmlibs/db/remotedb/proto" ) // ListenAndServe is a blocking function that sets up a gRPC based diff --git a/proto/defs.pb.go b/db/remotedb/proto/defs.pb.go similarity index 66% rename from proto/defs.pb.go rename to db/remotedb/proto/defs.pb.go index 4d9f0b272..86b8f9b8d 100644 --- a/proto/defs.pb.go +++ b/db/remotedb/proto/defs.pb.go @@ -1,22 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: defs.proto -/* -Package protodb is a generated protocol buffer package. - -It is generated from these files: - defs.proto - -It has these top-level messages: - Batch - Operation - Entity - Nothing - Domain - Iterator - Stats - Init -*/ package protodb import proto "github.com/golang/protobuf/proto" @@ -58,16 +42,40 @@ var Operation_Type_value = map[string]int32{ func (x Operation_Type) String() string { return proto.EnumName(Operation_Type_name, int32(x)) } -func (Operation_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} } +func (Operation_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{1, 0} +} type Batch struct { - Ops []*Operation `protobuf:"bytes,1,rep,name=ops" json:"ops,omitempty"` + Ops []*Operation `protobuf:"bytes,1,rep,name=ops" json:"ops,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Batch) Reset() { *m = Batch{} } +func (m *Batch) String() string { return proto.CompactTextString(m) } +func (*Batch) ProtoMessage() {} +func (*Batch) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{0} +} +func (m *Batch) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Batch.Unmarshal(m, b) +} +func (m *Batch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Batch.Marshal(b, m, deterministic) +} +func (dst *Batch) XXX_Merge(src proto.Message) { + xxx_messageInfo_Batch.Merge(dst, src) +} +func (m *Batch) XXX_Size() int { + return xxx_messageInfo_Batch.Size(m) +} +func (m *Batch) XXX_DiscardUnknown() { + xxx_messageInfo_Batch.DiscardUnknown(m) } -func (m *Batch) Reset() { *m = Batch{} } -func (m *Batch) String() string { return proto.CompactTextString(m) } -func (*Batch) ProtoMessage() {} -func (*Batch) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +var xxx_messageInfo_Batch proto.InternalMessageInfo func (m *Batch) GetOps() []*Operation { if m != nil { @@ -77,14 +85,36 @@ func (m *Batch) GetOps() []*Operation { } type Operation struct { - Entity *Entity `protobuf:"bytes,1,opt,name=entity" json:"entity,omitempty"` - Type Operation_Type `protobuf:"varint,2,opt,name=type,enum=protodb.Operation_Type" json:"type,omitempty"` + Entity *Entity `protobuf:"bytes,1,opt,name=entity" json:"entity,omitempty"` + Type Operation_Type `protobuf:"varint,2,opt,name=type,enum=protodb.Operation_Type" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Operation) Reset() { *m = Operation{} } +func (m *Operation) String() string { return proto.CompactTextString(m) } +func (*Operation) ProtoMessage() {} +func (*Operation) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{1} +} +func (m *Operation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Operation.Unmarshal(m, b) +} +func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Operation.Marshal(b, m, deterministic) +} +func (dst *Operation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Operation.Merge(dst, src) +} +func (m *Operation) XXX_Size() int { + return xxx_messageInfo_Operation.Size(m) +} +func (m *Operation) XXX_DiscardUnknown() { + xxx_messageInfo_Operation.DiscardUnknown(m) } -func (m *Operation) Reset() { *m = Operation{} } -func (m *Operation) String() string { return proto.CompactTextString(m) } -func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +var xxx_messageInfo_Operation proto.InternalMessageInfo func (m *Operation) GetEntity() *Entity { if m != nil { @@ -101,20 +131,42 @@ func (m *Operation) GetType() Operation_Type { } type Entity struct { - Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Exists bool `protobuf:"varint,4,opt,name=exists" json:"exists,omitempty"` - Start []byte `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,6,opt,name=end,proto3" json:"end,omitempty"` - Err string `protobuf:"bytes,7,opt,name=err" json:"err,omitempty"` - CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` + Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Exists bool `protobuf:"varint,4,opt,name=exists" json:"exists,omitempty"` + Start []byte `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"` + End []byte `protobuf:"bytes,6,opt,name=end,proto3" json:"end,omitempty"` + Err string `protobuf:"bytes,7,opt,name=err" json:"err,omitempty"` + CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Entity) Reset() { *m = Entity{} } -func (m *Entity) String() string { return proto.CompactTextString(m) } -func (*Entity) ProtoMessage() {} -func (*Entity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *Entity) Reset() { *m = Entity{} } +func (m *Entity) String() string { return proto.CompactTextString(m) } +func (*Entity) ProtoMessage() {} +func (*Entity) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{2} +} +func (m *Entity) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Entity.Unmarshal(m, b) +} +func (m *Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Entity.Marshal(b, m, deterministic) +} +func (dst *Entity) XXX_Merge(src proto.Message) { + xxx_messageInfo_Entity.Merge(dst, src) +} +func (m *Entity) XXX_Size() int { + return xxx_messageInfo_Entity.Size(m) +} +func (m *Entity) XXX_DiscardUnknown() { + xxx_messageInfo_Entity.DiscardUnknown(m) +} + +var xxx_messageInfo_Entity proto.InternalMessageInfo func (m *Entity) GetId() int32 { if m != nil { @@ -173,22 +225,66 @@ func (m *Entity) GetCreatedAt() int64 { } type Nothing struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Nothing) Reset() { *m = Nothing{} } +func (m *Nothing) String() string { return proto.CompactTextString(m) } +func (*Nothing) ProtoMessage() {} +func (*Nothing) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{3} +} +func (m *Nothing) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Nothing.Unmarshal(m, b) +} +func (m *Nothing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Nothing.Marshal(b, m, deterministic) +} +func (dst *Nothing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Nothing.Merge(dst, src) +} +func (m *Nothing) XXX_Size() int { + return xxx_messageInfo_Nothing.Size(m) +} +func (m *Nothing) XXX_DiscardUnknown() { + xxx_messageInfo_Nothing.DiscardUnknown(m) } -func (m *Nothing) Reset() { *m = Nothing{} } -func (m *Nothing) String() string { return proto.CompactTextString(m) } -func (*Nothing) ProtoMessage() {} -func (*Nothing) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +var xxx_messageInfo_Nothing proto.InternalMessageInfo type Domain struct { - Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` + Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` + End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Domain) Reset() { *m = Domain{} } -func (m *Domain) String() string { return proto.CompactTextString(m) } -func (*Domain) ProtoMessage() {} -func (*Domain) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (m *Domain) Reset() { *m = Domain{} } +func (m *Domain) String() string { return proto.CompactTextString(m) } +func (*Domain) ProtoMessage() {} +func (*Domain) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{4} +} +func (m *Domain) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Domain.Unmarshal(m, b) +} +func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Domain.Marshal(b, m, deterministic) +} +func (dst *Domain) XXX_Merge(src proto.Message) { + xxx_messageInfo_Domain.Merge(dst, src) +} +func (m *Domain) XXX_Size() int { + return xxx_messageInfo_Domain.Size(m) +} +func (m *Domain) XXX_DiscardUnknown() { + xxx_messageInfo_Domain.DiscardUnknown(m) +} + +var xxx_messageInfo_Domain proto.InternalMessageInfo func (m *Domain) GetStart() []byte { if m != nil { @@ -205,16 +301,38 @@ func (m *Domain) GetEnd() []byte { } type Iterator struct { - Domain *Domain `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"` - Valid bool `protobuf:"varint,2,opt,name=valid" json:"valid,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + Domain *Domain `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"` + Valid bool `protobuf:"varint,2,opt,name=valid" json:"valid,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Iterator) Reset() { *m = Iterator{} } -func (m *Iterator) String() string { return proto.CompactTextString(m) } -func (*Iterator) ProtoMessage() {} -func (*Iterator) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (m *Iterator) Reset() { *m = Iterator{} } +func (m *Iterator) String() string { return proto.CompactTextString(m) } +func (*Iterator) ProtoMessage() {} +func (*Iterator) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{5} +} +func (m *Iterator) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Iterator.Unmarshal(m, b) +} +func (m *Iterator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Iterator.Marshal(b, m, deterministic) +} +func (dst *Iterator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Iterator.Merge(dst, src) +} +func (m *Iterator) XXX_Size() int { + return xxx_messageInfo_Iterator.Size(m) +} +func (m *Iterator) XXX_DiscardUnknown() { + xxx_messageInfo_Iterator.DiscardUnknown(m) +} + +var xxx_messageInfo_Iterator proto.InternalMessageInfo func (m *Iterator) GetDomain() *Domain { if m != nil { @@ -245,14 +363,36 @@ func (m *Iterator) GetValue() []byte { } type Stats struct { - Data map[string]string `protobuf:"bytes,1,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - TimeAt int64 `protobuf:"varint,2,opt,name=time_at,json=timeAt" json:"time_at,omitempty"` + Data map[string]string `protobuf:"bytes,1,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + TimeAt int64 `protobuf:"varint,2,opt,name=time_at,json=timeAt" json:"time_at,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Stats) Reset() { *m = Stats{} } -func (m *Stats) String() string { return proto.CompactTextString(m) } -func (*Stats) ProtoMessage() {} -func (*Stats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (m *Stats) Reset() { *m = Stats{} } +func (m *Stats) String() string { return proto.CompactTextString(m) } +func (*Stats) ProtoMessage() {} +func (*Stats) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{6} +} +func (m *Stats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Stats.Unmarshal(m, b) +} +func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Stats.Marshal(b, m, deterministic) +} +func (dst *Stats) XXX_Merge(src proto.Message) { + xxx_messageInfo_Stats.Merge(dst, src) +} +func (m *Stats) XXX_Size() int { + return xxx_messageInfo_Stats.Size(m) +} +func (m *Stats) XXX_DiscardUnknown() { + xxx_messageInfo_Stats.DiscardUnknown(m) +} + +var xxx_messageInfo_Stats proto.InternalMessageInfo func (m *Stats) GetData() map[string]string { if m != nil { @@ -269,15 +409,37 @@ func (m *Stats) GetTimeAt() int64 { } type Init struct { - Type string `protobuf:"bytes,1,opt,name=Type" json:"Type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` - Dir string `protobuf:"bytes,3,opt,name=Dir" json:"Dir,omitempty"` + Type string `protobuf:"bytes,1,opt,name=Type" json:"Type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` + Dir string `protobuf:"bytes,3,opt,name=Dir" json:"Dir,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Init) Reset() { *m = Init{} } +func (m *Init) String() string { return proto.CompactTextString(m) } +func (*Init) ProtoMessage() {} +func (*Init) Descriptor() ([]byte, []int) { + return fileDescriptor_defs_7303098f1c775f7f, []int{7} +} +func (m *Init) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Init.Unmarshal(m, b) +} +func (m *Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Init.Marshal(b, m, deterministic) +} +func (dst *Init) XXX_Merge(src proto.Message) { + xxx_messageInfo_Init.Merge(dst, src) +} +func (m *Init) XXX_Size() int { + return xxx_messageInfo_Init.Size(m) +} +func (m *Init) XXX_DiscardUnknown() { + xxx_messageInfo_Init.DiscardUnknown(m) } -func (m *Init) Reset() { *m = Init{} } -func (m *Init) String() string { return proto.CompactTextString(m) } -func (*Init) ProtoMessage() {} -func (*Init) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +var xxx_messageInfo_Init proto.InternalMessageInfo func (m *Init) GetType() string { if m != nil { @@ -308,6 +470,7 @@ func init() { proto.RegisterType((*Domain)(nil), "protodb.Domain") proto.RegisterType((*Iterator)(nil), "protodb.Iterator") proto.RegisterType((*Stats)(nil), "protodb.Stats") + proto.RegisterMapType((map[string]string)(nil), "protodb.Stats.DataEntry") proto.RegisterType((*Init)(nil), "protodb.Init") proto.RegisterEnum("protodb.Operation_Type", Operation_Type_name, Operation_Type_value) } @@ -320,8 +483,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for DB service - +// DBClient is the client API for DB service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type DBClient interface { Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) @@ -349,7 +513,7 @@ func NewDBClient(cc *grpc.ClientConn) DBClient { func (c *dBClient) Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := grpc.Invoke(ctx, "/protodb.DB/init", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/init", in, out, opts...) if err != nil { return nil, err } @@ -358,7 +522,7 @@ func (c *dBClient) Init(ctx context.Context, in *Init, opts ...grpc.CallOption) func (c *dBClient) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := grpc.Invoke(ctx, "/protodb.DB/get", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/get", in, out, opts...) if err != nil { return nil, err } @@ -366,7 +530,7 @@ func (c *dBClient) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) } func (c *dBClient) GetStream(ctx context.Context, opts ...grpc.CallOption) (DB_GetStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[0], c.cc, "/protodb.DB/getStream", opts...) + stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[0], "/protodb.DB/getStream", opts...) if err != nil { return nil, err } @@ -398,7 +562,7 @@ func (x *dBGetStreamClient) Recv() (*Entity, error) { func (c *dBClient) Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := grpc.Invoke(ctx, "/protodb.DB/has", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/has", in, out, opts...) if err != nil { return nil, err } @@ -407,7 +571,7 @@ func (c *dBClient) Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) func (c *dBClient) Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/set", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/set", in, out, opts...) if err != nil { return nil, err } @@ -416,7 +580,7 @@ func (c *dBClient) Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) func (c *dBClient) SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/setSync", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/setSync", in, out, opts...) if err != nil { return nil, err } @@ -425,7 +589,7 @@ func (c *dBClient) SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOpt func (c *dBClient) Delete(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/delete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/delete", in, out, opts...) if err != nil { return nil, err } @@ -434,7 +598,7 @@ func (c *dBClient) Delete(ctx context.Context, in *Entity, opts ...grpc.CallOpti func (c *dBClient) DeleteSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/deleteSync", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/deleteSync", in, out, opts...) if err != nil { return nil, err } @@ -442,7 +606,7 @@ func (c *dBClient) DeleteSync(ctx context.Context, in *Entity, opts ...grpc.Call } func (c *dBClient) Iterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_IteratorClient, error) { - stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[1], c.cc, "/protodb.DB/iterator", opts...) + stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[1], "/protodb.DB/iterator", opts...) if err != nil { return nil, err } @@ -474,7 +638,7 @@ func (x *dBIteratorClient) Recv() (*Iterator, error) { } func (c *dBClient) ReverseIterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_ReverseIteratorClient, error) { - stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[2], c.cc, "/protodb.DB/reverseIterator", opts...) + stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[2], "/protodb.DB/reverseIterator", opts...) if err != nil { return nil, err } @@ -507,7 +671,7 @@ func (x *dBReverseIteratorClient) Recv() (*Iterator, error) { func (c *dBClient) Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOption) (*Stats, error) { out := new(Stats) - err := grpc.Invoke(ctx, "/protodb.DB/stats", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/stats", in, out, opts...) if err != nil { return nil, err } @@ -516,7 +680,7 @@ func (c *dBClient) Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOpti func (c *dBClient) BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/batchWrite", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/batchWrite", in, out, opts...) if err != nil { return nil, err } @@ -525,7 +689,7 @@ func (c *dBClient) BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallO func (c *dBClient) BatchWriteSync(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := grpc.Invoke(ctx, "/protodb.DB/batchWriteSync", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/protodb.DB/batchWriteSync", in, out, opts...) if err != nil { return nil, err } @@ -869,9 +1033,9 @@ var _DB_serviceDesc = grpc.ServiceDesc{ Metadata: "defs.proto", } -func init() { proto.RegisterFile("defs.proto", fileDescriptor0) } +func init() { proto.RegisterFile("defs.proto", fileDescriptor_defs_7303098f1c775f7f) } -var fileDescriptor0 = []byte{ +var fileDescriptor_defs_7303098f1c775f7f = []byte{ // 606 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, 0x10, 0xcd, 0xda, 0x8e, 0x13, 0x4f, 0x7f, 0xbf, 0x34, 0x8c, 0x10, 0xb5, 0x8a, 0x90, 0x22, 0x0b, diff --git a/proto/defs.proto b/db/remotedb/proto/defs.proto similarity index 100% rename from proto/defs.proto rename to db/remotedb/proto/defs.proto diff --git a/remotedb/remotedb.go b/db/remotedb/remotedb.go similarity index 98% rename from remotedb/remotedb.go rename to db/remotedb/remotedb.go index f6e4d9c17..5332bd68e 100644 --- a/remotedb/remotedb.go +++ b/db/remotedb/remotedb.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/tendermint/tmlibs/db" - "github.com/tendermint/tmlibs/grpcdb" - protodb "github.com/tendermint/tmlibs/proto" + "github.com/tendermint/tmlibs/db/remotedb/grpcdb" + protodb "github.com/tendermint/tmlibs/db/remotedb/proto" ) type RemoteDB struct { diff --git a/remotedb/remotedb_test.go b/db/remotedb/remotedb_test.go similarity index 90% rename from remotedb/remotedb_test.go rename to db/remotedb/remotedb_test.go index cbe9d9095..b126a9012 100644 --- a/remotedb/remotedb_test.go +++ b/db/remotedb/remotedb_test.go @@ -2,12 +2,13 @@ package remotedb_test import ( "net" + "os" "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/tmlibs/grpcdb" - "github.com/tendermint/tmlibs/remotedb" + "github.com/tendermint/tmlibs/db/remotedb" + "github.com/tendermint/tmlibs/db/remotedb/grpcdb" ) func TestRemoteDB(t *testing.T) { @@ -26,7 +27,14 @@ func TestRemoteDB(t *testing.T) { client, err := remotedb.NewRemoteDB(ln.Addr().String(), cert) require.Nil(t, err, "expecting a successful client creation") - require.Nil(t, client.InitRemote(&remotedb.Init{Name: "test-remote-db", Type: "leveldb"})) + dbName := "test-remote-db" + require.Nil(t, client.InitRemote(&remotedb.Init{Name: dbName, Type: "leveldb"})) + defer func() { + err := os.RemoveAll(dbName + ".db") + if err != nil { + panic(err) + } + }() k1 := []byte("key-1") v1 := client.Get(k1) From f27c358a8a7bb82c3c5e12012775dec3e762853b Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 21 May 2018 17:37:53 -0400 Subject: [PATCH 3/3] revert protobuf recompile --- db/remotedb/proto/defs.pb.go | 340 +++++++++-------------------------- 1 file changed, 88 insertions(+), 252 deletions(-) diff --git a/db/remotedb/proto/defs.pb.go b/db/remotedb/proto/defs.pb.go index 86b8f9b8d..4d9f0b272 100644 --- a/db/remotedb/proto/defs.pb.go +++ b/db/remotedb/proto/defs.pb.go @@ -1,6 +1,22 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: defs.proto +/* +Package protodb is a generated protocol buffer package. + +It is generated from these files: + defs.proto + +It has these top-level messages: + Batch + Operation + Entity + Nothing + Domain + Iterator + Stats + Init +*/ package protodb import proto "github.com/golang/protobuf/proto" @@ -42,40 +58,16 @@ var Operation_Type_value = map[string]int32{ func (x Operation_Type) String() string { return proto.EnumName(Operation_Type_name, int32(x)) } -func (Operation_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{1, 0} -} +func (Operation_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1, 0} } type Batch struct { - Ops []*Operation `protobuf:"bytes,1,rep,name=ops" json:"ops,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Batch) Reset() { *m = Batch{} } -func (m *Batch) String() string { return proto.CompactTextString(m) } -func (*Batch) ProtoMessage() {} -func (*Batch) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{0} -} -func (m *Batch) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Batch.Unmarshal(m, b) -} -func (m *Batch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Batch.Marshal(b, m, deterministic) -} -func (dst *Batch) XXX_Merge(src proto.Message) { - xxx_messageInfo_Batch.Merge(dst, src) -} -func (m *Batch) XXX_Size() int { - return xxx_messageInfo_Batch.Size(m) -} -func (m *Batch) XXX_DiscardUnknown() { - xxx_messageInfo_Batch.DiscardUnknown(m) + Ops []*Operation `protobuf:"bytes,1,rep,name=ops" json:"ops,omitempty"` } -var xxx_messageInfo_Batch proto.InternalMessageInfo +func (m *Batch) Reset() { *m = Batch{} } +func (m *Batch) String() string { return proto.CompactTextString(m) } +func (*Batch) ProtoMessage() {} +func (*Batch) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *Batch) GetOps() []*Operation { if m != nil { @@ -85,36 +77,14 @@ func (m *Batch) GetOps() []*Operation { } type Operation struct { - Entity *Entity `protobuf:"bytes,1,opt,name=entity" json:"entity,omitempty"` - Type Operation_Type `protobuf:"varint,2,opt,name=type,enum=protodb.Operation_Type" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Operation) Reset() { *m = Operation{} } -func (m *Operation) String() string { return proto.CompactTextString(m) } -func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{1} -} -func (m *Operation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Operation.Unmarshal(m, b) -} -func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Operation.Marshal(b, m, deterministic) -} -func (dst *Operation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operation.Merge(dst, src) -} -func (m *Operation) XXX_Size() int { - return xxx_messageInfo_Operation.Size(m) -} -func (m *Operation) XXX_DiscardUnknown() { - xxx_messageInfo_Operation.DiscardUnknown(m) + Entity *Entity `protobuf:"bytes,1,opt,name=entity" json:"entity,omitempty"` + Type Operation_Type `protobuf:"varint,2,opt,name=type,enum=protodb.Operation_Type" json:"type,omitempty"` } -var xxx_messageInfo_Operation proto.InternalMessageInfo +func (m *Operation) Reset() { *m = Operation{} } +func (m *Operation) String() string { return proto.CompactTextString(m) } +func (*Operation) ProtoMessage() {} +func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *Operation) GetEntity() *Entity { if m != nil { @@ -131,42 +101,20 @@ func (m *Operation) GetType() Operation_Type { } type Entity struct { - Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Exists bool `protobuf:"varint,4,opt,name=exists" json:"exists,omitempty"` - Start []byte `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,6,opt,name=end,proto3" json:"end,omitempty"` - Err string `protobuf:"bytes,7,opt,name=err" json:"err,omitempty"` - CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Exists bool `protobuf:"varint,4,opt,name=exists" json:"exists,omitempty"` + Start []byte `protobuf:"bytes,5,opt,name=start,proto3" json:"start,omitempty"` + End []byte `protobuf:"bytes,6,opt,name=end,proto3" json:"end,omitempty"` + Err string `protobuf:"bytes,7,opt,name=err" json:"err,omitempty"` + CreatedAt int64 `protobuf:"varint,8,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` } -func (m *Entity) Reset() { *m = Entity{} } -func (m *Entity) String() string { return proto.CompactTextString(m) } -func (*Entity) ProtoMessage() {} -func (*Entity) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{2} -} -func (m *Entity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Entity.Unmarshal(m, b) -} -func (m *Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Entity.Marshal(b, m, deterministic) -} -func (dst *Entity) XXX_Merge(src proto.Message) { - xxx_messageInfo_Entity.Merge(dst, src) -} -func (m *Entity) XXX_Size() int { - return xxx_messageInfo_Entity.Size(m) -} -func (m *Entity) XXX_DiscardUnknown() { - xxx_messageInfo_Entity.DiscardUnknown(m) -} - -var xxx_messageInfo_Entity proto.InternalMessageInfo +func (m *Entity) Reset() { *m = Entity{} } +func (m *Entity) String() string { return proto.CompactTextString(m) } +func (*Entity) ProtoMessage() {} +func (*Entity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *Entity) GetId() int32 { if m != nil { @@ -225,66 +173,22 @@ func (m *Entity) GetCreatedAt() int64 { } type Nothing struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Nothing) Reset() { *m = Nothing{} } -func (m *Nothing) String() string { return proto.CompactTextString(m) } -func (*Nothing) ProtoMessage() {} -func (*Nothing) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{3} -} -func (m *Nothing) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Nothing.Unmarshal(m, b) -} -func (m *Nothing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Nothing.Marshal(b, m, deterministic) -} -func (dst *Nothing) XXX_Merge(src proto.Message) { - xxx_messageInfo_Nothing.Merge(dst, src) -} -func (m *Nothing) XXX_Size() int { - return xxx_messageInfo_Nothing.Size(m) -} -func (m *Nothing) XXX_DiscardUnknown() { - xxx_messageInfo_Nothing.DiscardUnknown(m) } -var xxx_messageInfo_Nothing proto.InternalMessageInfo +func (m *Nothing) Reset() { *m = Nothing{} } +func (m *Nothing) String() string { return proto.CompactTextString(m) } +func (*Nothing) ProtoMessage() {} +func (*Nothing) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } type Domain struct { - Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` + End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` } -func (m *Domain) Reset() { *m = Domain{} } -func (m *Domain) String() string { return proto.CompactTextString(m) } -func (*Domain) ProtoMessage() {} -func (*Domain) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{4} -} -func (m *Domain) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Domain.Unmarshal(m, b) -} -func (m *Domain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Domain.Marshal(b, m, deterministic) -} -func (dst *Domain) XXX_Merge(src proto.Message) { - xxx_messageInfo_Domain.Merge(dst, src) -} -func (m *Domain) XXX_Size() int { - return xxx_messageInfo_Domain.Size(m) -} -func (m *Domain) XXX_DiscardUnknown() { - xxx_messageInfo_Domain.DiscardUnknown(m) -} - -var xxx_messageInfo_Domain proto.InternalMessageInfo +func (m *Domain) Reset() { *m = Domain{} } +func (m *Domain) String() string { return proto.CompactTextString(m) } +func (*Domain) ProtoMessage() {} +func (*Domain) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *Domain) GetStart() []byte { if m != nil { @@ -301,38 +205,16 @@ func (m *Domain) GetEnd() []byte { } type Iterator struct { - Domain *Domain `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"` - Valid bool `protobuf:"varint,2,opt,name=valid" json:"valid,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Domain *Domain `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"` + Valid bool `protobuf:"varint,2,opt,name=valid" json:"valid,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` } -func (m *Iterator) Reset() { *m = Iterator{} } -func (m *Iterator) String() string { return proto.CompactTextString(m) } -func (*Iterator) ProtoMessage() {} -func (*Iterator) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{5} -} -func (m *Iterator) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Iterator.Unmarshal(m, b) -} -func (m *Iterator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Iterator.Marshal(b, m, deterministic) -} -func (dst *Iterator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Iterator.Merge(dst, src) -} -func (m *Iterator) XXX_Size() int { - return xxx_messageInfo_Iterator.Size(m) -} -func (m *Iterator) XXX_DiscardUnknown() { - xxx_messageInfo_Iterator.DiscardUnknown(m) -} - -var xxx_messageInfo_Iterator proto.InternalMessageInfo +func (m *Iterator) Reset() { *m = Iterator{} } +func (m *Iterator) String() string { return proto.CompactTextString(m) } +func (*Iterator) ProtoMessage() {} +func (*Iterator) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *Iterator) GetDomain() *Domain { if m != nil { @@ -363,36 +245,14 @@ func (m *Iterator) GetValue() []byte { } type Stats struct { - Data map[string]string `protobuf:"bytes,1,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - TimeAt int64 `protobuf:"varint,2,opt,name=time_at,json=timeAt" json:"time_at,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Data map[string]string `protobuf:"bytes,1,rep,name=data" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + TimeAt int64 `protobuf:"varint,2,opt,name=time_at,json=timeAt" json:"time_at,omitempty"` } -func (m *Stats) Reset() { *m = Stats{} } -func (m *Stats) String() string { return proto.CompactTextString(m) } -func (*Stats) ProtoMessage() {} -func (*Stats) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{6} -} -func (m *Stats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Stats.Unmarshal(m, b) -} -func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Stats.Marshal(b, m, deterministic) -} -func (dst *Stats) XXX_Merge(src proto.Message) { - xxx_messageInfo_Stats.Merge(dst, src) -} -func (m *Stats) XXX_Size() int { - return xxx_messageInfo_Stats.Size(m) -} -func (m *Stats) XXX_DiscardUnknown() { - xxx_messageInfo_Stats.DiscardUnknown(m) -} - -var xxx_messageInfo_Stats proto.InternalMessageInfo +func (m *Stats) Reset() { *m = Stats{} } +func (m *Stats) String() string { return proto.CompactTextString(m) } +func (*Stats) ProtoMessage() {} +func (*Stats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *Stats) GetData() map[string]string { if m != nil { @@ -409,37 +269,15 @@ func (m *Stats) GetTimeAt() int64 { } type Init struct { - Type string `protobuf:"bytes,1,opt,name=Type" json:"Type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` - Dir string `protobuf:"bytes,3,opt,name=Dir" json:"Dir,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Init) Reset() { *m = Init{} } -func (m *Init) String() string { return proto.CompactTextString(m) } -func (*Init) ProtoMessage() {} -func (*Init) Descriptor() ([]byte, []int) { - return fileDescriptor_defs_7303098f1c775f7f, []int{7} -} -func (m *Init) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Init.Unmarshal(m, b) -} -func (m *Init) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Init.Marshal(b, m, deterministic) -} -func (dst *Init) XXX_Merge(src proto.Message) { - xxx_messageInfo_Init.Merge(dst, src) -} -func (m *Init) XXX_Size() int { - return xxx_messageInfo_Init.Size(m) -} -func (m *Init) XXX_DiscardUnknown() { - xxx_messageInfo_Init.DiscardUnknown(m) + Type string `protobuf:"bytes,1,opt,name=Type" json:"Type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` + Dir string `protobuf:"bytes,3,opt,name=Dir" json:"Dir,omitempty"` } -var xxx_messageInfo_Init proto.InternalMessageInfo +func (m *Init) Reset() { *m = Init{} } +func (m *Init) String() string { return proto.CompactTextString(m) } +func (*Init) ProtoMessage() {} +func (*Init) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *Init) GetType() string { if m != nil { @@ -470,7 +308,6 @@ func init() { proto.RegisterType((*Domain)(nil), "protodb.Domain") proto.RegisterType((*Iterator)(nil), "protodb.Iterator") proto.RegisterType((*Stats)(nil), "protodb.Stats") - proto.RegisterMapType((map[string]string)(nil), "protodb.Stats.DataEntry") proto.RegisterType((*Init)(nil), "protodb.Init") proto.RegisterEnum("protodb.Operation_Type", Operation_Type_name, Operation_Type_value) } @@ -483,9 +320,8 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// DBClient is the client API for DB service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +// Client API for DB service + type DBClient interface { Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) @@ -513,7 +349,7 @@ func NewDBClient(cc *grpc.ClientConn) DBClient { func (c *dBClient) Init(ctx context.Context, in *Init, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/init", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/init", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -522,7 +358,7 @@ func (c *dBClient) Init(ctx context.Context, in *Init, opts ...grpc.CallOption) func (c *dBClient) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/get", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/get", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -530,7 +366,7 @@ func (c *dBClient) Get(ctx context.Context, in *Entity, opts ...grpc.CallOption) } func (c *dBClient) GetStream(ctx context.Context, opts ...grpc.CallOption) (DB_GetStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[0], "/protodb.DB/getStream", opts...) + stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[0], c.cc, "/protodb.DB/getStream", opts...) if err != nil { return nil, err } @@ -562,7 +398,7 @@ func (x *dBGetStreamClient) Recv() (*Entity, error) { func (c *dBClient) Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Entity, error) { out := new(Entity) - err := c.cc.Invoke(ctx, "/protodb.DB/has", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/has", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -571,7 +407,7 @@ func (c *dBClient) Has(ctx context.Context, in *Entity, opts ...grpc.CallOption) func (c *dBClient) Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/set", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/set", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -580,7 +416,7 @@ func (c *dBClient) Set(ctx context.Context, in *Entity, opts ...grpc.CallOption) func (c *dBClient) SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/setSync", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/setSync", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -589,7 +425,7 @@ func (c *dBClient) SetSync(ctx context.Context, in *Entity, opts ...grpc.CallOpt func (c *dBClient) Delete(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/delete", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -598,7 +434,7 @@ func (c *dBClient) Delete(ctx context.Context, in *Entity, opts ...grpc.CallOpti func (c *dBClient) DeleteSync(ctx context.Context, in *Entity, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/deleteSync", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/deleteSync", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -606,7 +442,7 @@ func (c *dBClient) DeleteSync(ctx context.Context, in *Entity, opts ...grpc.Call } func (c *dBClient) Iterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_IteratorClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[1], "/protodb.DB/iterator", opts...) + stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[1], c.cc, "/protodb.DB/iterator", opts...) if err != nil { return nil, err } @@ -638,7 +474,7 @@ func (x *dBIteratorClient) Recv() (*Iterator, error) { } func (c *dBClient) ReverseIterator(ctx context.Context, in *Entity, opts ...grpc.CallOption) (DB_ReverseIteratorClient, error) { - stream, err := c.cc.NewStream(ctx, &_DB_serviceDesc.Streams[2], "/protodb.DB/reverseIterator", opts...) + stream, err := grpc.NewClientStream(ctx, &_DB_serviceDesc.Streams[2], c.cc, "/protodb.DB/reverseIterator", opts...) if err != nil { return nil, err } @@ -671,7 +507,7 @@ func (x *dBReverseIteratorClient) Recv() (*Iterator, error) { func (c *dBClient) Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOption) (*Stats, error) { out := new(Stats) - err := c.cc.Invoke(ctx, "/protodb.DB/stats", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/stats", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -680,7 +516,7 @@ func (c *dBClient) Stats(ctx context.Context, in *Nothing, opts ...grpc.CallOpti func (c *dBClient) BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/batchWrite", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/batchWrite", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -689,7 +525,7 @@ func (c *dBClient) BatchWrite(ctx context.Context, in *Batch, opts ...grpc.CallO func (c *dBClient) BatchWriteSync(ctx context.Context, in *Batch, opts ...grpc.CallOption) (*Nothing, error) { out := new(Nothing) - err := c.cc.Invoke(ctx, "/protodb.DB/batchWriteSync", in, out, opts...) + err := grpc.Invoke(ctx, "/protodb.DB/batchWriteSync", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1033,9 +869,9 @@ var _DB_serviceDesc = grpc.ServiceDesc{ Metadata: "defs.proto", } -func init() { proto.RegisterFile("defs.proto", fileDescriptor_defs_7303098f1c775f7f) } +func init() { proto.RegisterFile("defs.proto", fileDescriptor0) } -var fileDescriptor_defs_7303098f1c775f7f = []byte{ +var fileDescriptor0 = []byte{ // 606 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, 0x10, 0xcd, 0xda, 0x8e, 0x13, 0x4f, 0x7f, 0xbf, 0x34, 0x8c, 0x10, 0xb5, 0x8a, 0x90, 0x22, 0x0b,