From 9b481df4ce690bbbad9bf4012ca199e3f858e689 Mon Sep 17 00:00:00 2001 From: Sergey Cherepanov Date: Mon, 31 Jul 2023 16:50:31 +0200 Subject: [PATCH] anyid proto --- Makefile | 2 + anyid/anyidproto/anyid.pb.go | 1416 +++++++++++++++++++++++++++ anyid/anyidproto/anyid_drpc.pb.go | 193 ++++ anyid/anyidproto/protos/anyid.proto | 48 + 4 files changed, 1659 insertions(+) create mode 100644 anyid/anyidproto/anyid.pb.go create mode 100644 anyid/anyidproto/anyid_drpc.pb.go create mode 100644 anyid/anyidproto/protos/anyid.proto diff --git a/Makefile b/Makefile index 003fbbf7..3b92c45a 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ proto: protoc --gogofaster_out=:. net/secureservice/handshake/handshakeproto/protos/*.proto protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. coordinator/coordinatorproto/protos/*.proto protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. consensus/consensusproto/protos/*.proto + protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. anyid/anyidproto/protos/*.proto + deps: go mod download diff --git a/anyid/anyidproto/anyid.pb.go b/anyid/anyidproto/anyid.pb.go new file mode 100644 index 00000000..38dddad3 --- /dev/null +++ b/anyid/anyidproto/anyid.pb.go @@ -0,0 +1,1416 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: anyid/anyidproto/protos/anyid.proto + +package anyidproto + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Data struct { + King string `protobuf:"bytes,1,opt,name=king,proto3" json:"king,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *Data) Reset() { *m = Data{} } +func (m *Data) String() string { return proto.CompactTextString(m) } +func (*Data) ProtoMessage() {} +func (*Data) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{0} +} +func (m *Data) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Data.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_Data.Merge(m, src) +} +func (m *Data) XXX_Size() int { + return m.Size() +} +func (m *Data) XXX_DiscardUnknown() { + xxx_messageInfo_Data.DiscardUnknown(m) +} + +var xxx_messageInfo_Data proto.InternalMessageInfo + +func (m *Data) GetKing() string { + if m != nil { + return m.King + } + return "" +} + +func (m *Data) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type DataPutRequest struct { + // string representation of identity, must be equal handshake result + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // data to save + Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *DataPutRequest) Reset() { *m = DataPutRequest{} } +func (m *DataPutRequest) String() string { return proto.CompactTextString(m) } +func (*DataPutRequest) ProtoMessage() {} +func (*DataPutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{1} +} +func (m *DataPutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataPutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataPutRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DataPutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataPutRequest.Merge(m, src) +} +func (m *DataPutRequest) XXX_Size() int { + return m.Size() +} +func (m *DataPutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DataPutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DataPutRequest proto.InternalMessageInfo + +func (m *DataPutRequest) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *DataPutRequest) GetData() *Data { + if m != nil { + return m.Data + } + return nil +} + +type DataDeleteRequest struct { + // string representation of identity, must be equal handshake result + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // kinds of data to delete, if empty all kinds will be deleted + Kinds []string `protobuf:"bytes,2,rep,name=kinds,proto3" json:"kinds,omitempty"` +} + +func (m *DataDeleteRequest) Reset() { *m = DataDeleteRequest{} } +func (m *DataDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DataDeleteRequest) ProtoMessage() {} +func (*DataDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{2} +} +func (m *DataDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataDeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DataDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataDeleteRequest.Merge(m, src) +} +func (m *DataDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *DataDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DataDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DataDeleteRequest proto.InternalMessageInfo + +func (m *DataDeleteRequest) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *DataDeleteRequest) GetKinds() []string { + if m != nil { + return m.Kinds + } + return nil +} + +type DataPullRequest struct { + // string representation of identity wanted to request + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // kinds of data wanted to request + Kinds []string `protobuf:"bytes,2,rep,name=kinds,proto3" json:"kinds,omitempty"` +} + +func (m *DataPullRequest) Reset() { *m = DataPullRequest{} } +func (m *DataPullRequest) String() string { return proto.CompactTextString(m) } +func (*DataPullRequest) ProtoMessage() {} +func (*DataPullRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{3} +} +func (m *DataPullRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataPullRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataPullRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DataPullRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataPullRequest.Merge(m, src) +} +func (m *DataPullRequest) XXX_Size() int { + return m.Size() +} +func (m *DataPullRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DataPullRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DataPullRequest proto.InternalMessageInfo + +func (m *DataPullRequest) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *DataPullRequest) GetKinds() []string { + if m != nil { + return m.Kinds + } + return nil +} + +type DataPullResponse struct { + Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // a list of data with requested kinds + Data []*Data `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"` +} + +func (m *DataPullResponse) Reset() { *m = DataPullResponse{} } +func (m *DataPullResponse) String() string { return proto.CompactTextString(m) } +func (*DataPullResponse) ProtoMessage() {} +func (*DataPullResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{4} +} +func (m *DataPullResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataPullResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DataPullResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DataPullResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataPullResponse.Merge(m, src) +} +func (m *DataPullResponse) XXX_Size() int { + return m.Size() +} +func (m *DataPullResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DataPullResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DataPullResponse proto.InternalMessageInfo + +func (m *DataPullResponse) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *DataPullResponse) GetData() []*Data { + if m != nil { + return m.Data + } + return nil +} + +type Ok struct { +} + +func (m *Ok) Reset() { *m = Ok{} } +func (m *Ok) String() string { return proto.CompactTextString(m) } +func (*Ok) ProtoMessage() {} +func (*Ok) Descriptor() ([]byte, []int) { + return fileDescriptor_31318339f82210e9, []int{5} +} +func (m *Ok) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Ok) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Ok.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Ok) XXX_Merge(src proto.Message) { + xxx_messageInfo_Ok.Merge(m, src) +} +func (m *Ok) XXX_Size() int { + return m.Size() +} +func (m *Ok) XXX_DiscardUnknown() { + xxx_messageInfo_Ok.DiscardUnknown(m) +} + +var xxx_messageInfo_Ok proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Data)(nil), "anyid.Data") + proto.RegisterType((*DataPutRequest)(nil), "anyid.DataPutRequest") + proto.RegisterType((*DataDeleteRequest)(nil), "anyid.DataDeleteRequest") + proto.RegisterType((*DataPullRequest)(nil), "anyid.DataPullRequest") + proto.RegisterType((*DataPullResponse)(nil), "anyid.DataPullResponse") + proto.RegisterType((*Ok)(nil), "anyid.Ok") +} + +func init() { + proto.RegisterFile("anyid/anyidproto/protos/anyid.proto", fileDescriptor_31318339f82210e9) +} + +var fileDescriptor_31318339f82210e9 = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xcc, 0xab, 0xcc, + 0x4c, 0xd1, 0x07, 0x93, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0xfa, 0x60, 0xb2, 0x18, 0x22, 0xa2, 0x07, + 0xe6, 0x08, 0xb1, 0x82, 0x39, 0x4a, 0x7a, 0x5c, 0x2c, 0x2e, 0x89, 0x25, 0x89, 0x42, 0x42, 0x5c, + 0x2c, 0xd9, 0x99, 0x79, 0xe9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0x36, 0x48, 0x2c, + 0x25, 0xb1, 0x24, 0x51, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xcc, 0x56, 0xf2, 0xe5, 0xe2, + 0x03, 0xa9, 0x0f, 0x28, 0x2d, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x92, 0xe2, 0xe2, + 0xc8, 0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x2c, 0xa9, 0x84, 0xea, 0x86, 0xf3, 0x85, 0xe4, 0x91, 0x4c, + 0xe0, 0x36, 0xe2, 0xd6, 0x83, 0x38, 0x00, 0x64, 0x00, 0xd4, 0x38, 0x57, 0x2e, 0x41, 0x10, 0xcf, + 0x25, 0x35, 0x27, 0xb5, 0x24, 0x95, 0x18, 0x13, 0x45, 0xb8, 0x58, 0xb3, 0x33, 0xf3, 0x52, 0x8a, + 0x25, 0x98, 0x14, 0x98, 0x35, 0x38, 0x83, 0x20, 0x1c, 0x25, 0x67, 0x2e, 0x7e, 0x88, 0xab, 0x72, + 0x72, 0xc8, 0x37, 0xc4, 0x9f, 0x4b, 0x00, 0x61, 0x48, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x91, + 0x9e, 0x63, 0xc6, 0xee, 0x39, 0x16, 0x2e, 0x26, 0xff, 0x6c, 0xa3, 0x25, 0x8c, 0x5c, 0xac, 0x8e, + 0x79, 0x95, 0x9e, 0x29, 0x42, 0xda, 0x5c, 0xec, 0xd0, 0xb0, 0x13, 0x12, 0x45, 0x52, 0x8d, 0x08, + 0x4b, 0x29, 0x4e, 0xa8, 0xb0, 0x7f, 0xb6, 0x90, 0x21, 0x17, 0x17, 0x22, 0x64, 0x84, 0x24, 0x90, + 0xd4, 0xa3, 0x04, 0x16, 0xb2, 0x16, 0x6b, 0x2e, 0x0e, 0x98, 0x07, 0x84, 0xc4, 0x50, 0x2c, 0x80, + 0x07, 0x8b, 0x94, 0x38, 0x86, 0x38, 0xc4, 0xa7, 0x4e, 0x5a, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, + 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, + 0x78, 0x2c, 0xc7, 0x10, 0x25, 0x80, 0x9e, 0x9c, 0x92, 0xd8, 0xc0, 0x94, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xfb, 0x45, 0x2e, 0x1d, 0x69, 0x02, 0x00, 0x00, +} + +func (m *Data) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Data) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if len(m.King) > 0 { + i -= len(m.King) + copy(dAtA[i:], m.King) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.King))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DataPutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DataPutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataPutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAnyid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DataDeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DataDeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Kinds) > 0 { + for iNdEx := len(m.Kinds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Kinds[iNdEx]) + copy(dAtA[i:], m.Kinds[iNdEx]) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Kinds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DataPullRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DataPullRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataPullRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Kinds) > 0 { + for iNdEx := len(m.Kinds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Kinds[iNdEx]) + copy(dAtA[i:], m.Kinds[iNdEx]) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Kinds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DataPullResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DataPullResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataPullResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAnyid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAnyid(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Ok) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Ok) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Ok) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintAnyid(dAtA []byte, offset int, v uint64) int { + offset -= sovAnyid(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Data) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.King) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + return n +} + +func (m *DataPutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovAnyid(uint64(l)) + } + return n +} + +func (m *DataDeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + if len(m.Kinds) > 0 { + for _, s := range m.Kinds { + l = len(s) + n += 1 + l + sovAnyid(uint64(l)) + } + } + return n +} + +func (m *DataPullRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + if len(m.Kinds) > 0 { + for _, s := range m.Kinds { + l = len(s) + n += 1 + l + sovAnyid(uint64(l)) + } + } + return n +} + +func (m *DataPullResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAnyid(uint64(l)) + } + if len(m.Data) > 0 { + for _, e := range m.Data { + l = e.Size() + n += 1 + l + sovAnyid(uint64(l)) + } + } + return n +} + +func (m *Ok) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovAnyid(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozAnyid(x uint64) (n int) { + return sovAnyid(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Data) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field King", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.King = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataPutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DataPutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataPutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &Data{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataDeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DataDeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kinds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kinds = append(m.Kinds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataPullRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DataPullRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataPullRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kinds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kinds = append(m.Kinds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataPullResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DataPullResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataPullResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAnyid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAnyid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data, &Data{}) + if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Ok) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnyid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Ok: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Ok: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipAnyid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnyid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAnyid(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAnyid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAnyid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAnyid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthAnyid + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupAnyid + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthAnyid + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthAnyid = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAnyid = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupAnyid = fmt.Errorf("proto: unexpected end of group") +) diff --git a/anyid/anyidproto/anyid_drpc.pb.go b/anyid/anyidproto/anyid_drpc.pb.go new file mode 100644 index 00000000..8752f470 --- /dev/null +++ b/anyid/anyidproto/anyid_drpc.pb.go @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-go-drpc. DO NOT EDIT. +// protoc-gen-go-drpc version: v0.0.33 +// source: anyid/anyidproto/protos/anyid.proto + +package anyidproto + +import ( + bytes "bytes" + context "context" + errors "errors" + jsonpb "github.com/gogo/protobuf/jsonpb" + proto "github.com/gogo/protobuf/proto" + drpc "storj.io/drpc" + drpcerr "storj.io/drpc/drpcerr" +) + +type drpcEncoding_File_anyid_anyidproto_protos_anyid_proto struct{} + +func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) Marshal(msg drpc.Message) ([]byte, error) { + return proto.Marshal(msg.(proto.Message)) +} + +func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) Unmarshal(buf []byte, msg drpc.Message) error { + return proto.Unmarshal(buf, msg.(proto.Message)) +} + +func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) JSONMarshal(msg drpc.Message) ([]byte, error) { + var buf bytes.Buffer + err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message)) + if err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (drpcEncoding_File_anyid_anyidproto_protos_anyid_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error { + return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message)) +} + +type DRPCAnyIdClient interface { + DRPCConn() drpc.Conn + + DataPut(ctx context.Context, in *DataPutRequest) (*Ok, error) + DataDelete(ctx context.Context, in *DataDeleteRequest) (*Ok, error) + DataPull(ctx context.Context, in *DataPullRequest) (*DataPullResponse, error) +} + +type drpcAnyIdClient struct { + cc drpc.Conn +} + +func NewDRPCAnyIdClient(cc drpc.Conn) DRPCAnyIdClient { + return &drpcAnyIdClient{cc} +} + +func (c *drpcAnyIdClient) DRPCConn() drpc.Conn { return c.cc } + +func (c *drpcAnyIdClient) DataPut(ctx context.Context, in *DataPutRequest) (*Ok, error) { + out := new(Ok) + err := c.cc.Invoke(ctx, "/anyid.AnyId/DataPut", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyIdClient) DataDelete(ctx context.Context, in *DataDeleteRequest) (*Ok, error) { + out := new(Ok) + err := c.cc.Invoke(ctx, "/anyid.AnyId/DataDelete", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcAnyIdClient) DataPull(ctx context.Context, in *DataPullRequest) (*DataPullResponse, error) { + out := new(DataPullResponse) + err := c.cc.Invoke(ctx, "/anyid.AnyId/DataPull", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DRPCAnyIdServer interface { + DataPut(context.Context, *DataPutRequest) (*Ok, error) + DataDelete(context.Context, *DataDeleteRequest) (*Ok, error) + DataPull(context.Context, *DataPullRequest) (*DataPullResponse, error) +} + +type DRPCAnyIdUnimplementedServer struct{} + +func (s *DRPCAnyIdUnimplementedServer) DataPut(context.Context, *DataPutRequest) (*Ok, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyIdUnimplementedServer) DataDelete(context.Context, *DataDeleteRequest) (*Ok, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCAnyIdUnimplementedServer) DataPull(context.Context, *DataPullRequest) (*DataPullResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +type DRPCAnyIdDescription struct{} + +func (DRPCAnyIdDescription) NumMethods() int { return 3 } + +func (DRPCAnyIdDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { + switch n { + case 0: + return "/anyid.AnyId/DataPut", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyIdServer). + DataPut( + ctx, + in1.(*DataPutRequest), + ) + }, DRPCAnyIdServer.DataPut, true + case 1: + return "/anyid.AnyId/DataDelete", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyIdServer). + DataDelete( + ctx, + in1.(*DataDeleteRequest), + ) + }, DRPCAnyIdServer.DataDelete, true + case 2: + return "/anyid.AnyId/DataPull", drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCAnyIdServer). + DataPull( + ctx, + in1.(*DataPullRequest), + ) + }, DRPCAnyIdServer.DataPull, true + default: + return "", nil, nil, nil, false + } +} + +func DRPCRegisterAnyId(mux drpc.Mux, impl DRPCAnyIdServer) error { + return mux.Register(impl, DRPCAnyIdDescription{}) +} + +type DRPCAnyId_DataPutStream interface { + drpc.Stream + SendAndClose(*Ok) error +} + +type drpcAnyId_DataPutStream struct { + drpc.Stream +} + +func (x *drpcAnyId_DataPutStream) SendAndClose(m *Ok) error { + if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyId_DataDeleteStream interface { + drpc.Stream + SendAndClose(*Ok) error +} + +type drpcAnyId_DataDeleteStream struct { + drpc.Stream +} + +func (x *drpcAnyId_DataDeleteStream) SendAndClose(m *Ok) error { + if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCAnyId_DataPullStream interface { + drpc.Stream + SendAndClose(*DataPullResponse) error +} + +type drpcAnyId_DataPullStream struct { + drpc.Stream +} + +func (x *drpcAnyId_DataPullStream) SendAndClose(m *DataPullResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_anyid_anyidproto_protos_anyid_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/anyid/anyidproto/protos/anyid.proto b/anyid/anyidproto/protos/anyid.proto new file mode 100644 index 00000000..dfa0cfd7 --- /dev/null +++ b/anyid/anyidproto/protos/anyid.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package anyid; + +option go_package = "anyid/anyidproto"; + +service AnyId { + // DataPut puts client data to a repository + rpc DataPut(DataPutRequest) returns (Ok); + // DataDelete deletes client data from a repository + rpc DataDelete(DataDeleteRequest) returns (Ok); + // DataPull pulls client data from a repository + rpc DataPull(DataPullRequest) returns (DataPullResponse); +} + +message Data { + string king = 1; + bytes data = 2; +} + +message DataPutRequest { + // string representation of identity, must be equal handshake result + string identity = 1; + // data to save + Data data = 2; +} + +message DataDeleteRequest { + // string representation of identity, must be equal handshake result + string identity = 1; + // kinds of data to delete, if empty all kinds will be deleted + repeated string kinds = 2; +} + +message DataPullRequest { + // string representation of identity wanted to request + string identity = 1; + // kinds of data wanted to request + repeated string kinds = 2; +} + +message DataPullResponse { + string identity = 1; + // a list of data with requested kinds + repeated Data data = 2; +} + + +message Ok {} \ No newline at end of file