storj/pkg/pb/vouchers.pb.go
Cameron 1283036e37
add storage node voucher request service (#2158)
* add voucher service on storage node

* config field tag syntax, go routines for requests

* hook up voucher service in storagenode/peer.go

* add voucher config to testplanet

* add voucher config to testplanet

* add voucher response status INVALID, ACCEPTED, REJECTED

* add a test for vouchers service

* handle no row from GetValid, test it

* add trust pool to voucher service

* use trusted list to get satellites

* verify vouchers upon receipt

* test VerifyVoucher
2019-06-21 18:48:52 -04:00

287 lines
11 KiB
Go

// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: vouchers.proto
package pb
import (
context "context"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
grpc "google.golang.org/grpc"
math "math"
)
// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type VoucherResponse_Status int32
const (
VoucherResponse_INVALID VoucherResponse_Status = 0
VoucherResponse_ACCEPTED VoucherResponse_Status = 1
VoucherResponse_REJECTED VoucherResponse_Status = 2
)
var VoucherResponse_Status_name = map[int32]string{
0: "INVALID",
1: "ACCEPTED",
2: "REJECTED",
}
var VoucherResponse_Status_value = map[string]int32{
"INVALID": 0,
"ACCEPTED": 1,
"REJECTED": 2,
}
func (x VoucherResponse_Status) String() string {
return proto.EnumName(VoucherResponse_Status_name, int32(x))
}
func (VoucherResponse_Status) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3659b9a115b8060d, []int{2, 0}
}
// Voucher is a signed message verifying that a node has been vetted by a particular satellite
type Voucher struct {
SatelliteId NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
StorageNodeId NodeID `protobuf:"bytes,2,opt,name=storage_node_id,json=storageNodeId,proto3,customtype=NodeID" json:"storage_node_id"`
Expiration *timestamp.Timestamp `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"`
SatelliteSignature []byte `protobuf:"bytes,4,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Voucher) Reset() { *m = Voucher{} }
func (m *Voucher) String() string { return proto.CompactTextString(m) }
func (*Voucher) ProtoMessage() {}
func (*Voucher) Descriptor() ([]byte, []int) {
return fileDescriptor_3659b9a115b8060d, []int{0}
}
func (m *Voucher) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Voucher.Unmarshal(m, b)
}
func (m *Voucher) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Voucher.Marshal(b, m, deterministic)
}
func (m *Voucher) XXX_Merge(src proto.Message) {
xxx_messageInfo_Voucher.Merge(m, src)
}
func (m *Voucher) XXX_Size() int {
return xxx_messageInfo_Voucher.Size(m)
}
func (m *Voucher) XXX_DiscardUnknown() {
xxx_messageInfo_Voucher.DiscardUnknown(m)
}
var xxx_messageInfo_Voucher proto.InternalMessageInfo
func (m *Voucher) GetExpiration() *timestamp.Timestamp {
if m != nil {
return m.Expiration
}
return nil
}
func (m *Voucher) GetSatelliteSignature() []byte {
if m != nil {
return m.SatelliteSignature
}
return nil
}
type VoucherRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *VoucherRequest) Reset() { *m = VoucherRequest{} }
func (m *VoucherRequest) String() string { return proto.CompactTextString(m) }
func (*VoucherRequest) ProtoMessage() {}
func (*VoucherRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_3659b9a115b8060d, []int{1}
}
func (m *VoucherRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VoucherRequest.Unmarshal(m, b)
}
func (m *VoucherRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoucherRequest.Marshal(b, m, deterministic)
}
func (m *VoucherRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoucherRequest.Merge(m, src)
}
func (m *VoucherRequest) XXX_Size() int {
return xxx_messageInfo_VoucherRequest.Size(m)
}
func (m *VoucherRequest) XXX_DiscardUnknown() {
xxx_messageInfo_VoucherRequest.DiscardUnknown(m)
}
var xxx_messageInfo_VoucherRequest proto.InternalMessageInfo
type VoucherResponse struct {
Voucher *Voucher `protobuf:"bytes,1,opt,name=voucher,proto3" json:"voucher,omitempty"`
Status VoucherResponse_Status `protobuf:"varint,2,opt,name=status,proto3,enum=vouchers.VoucherResponse_Status" json:"status,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *VoucherResponse) Reset() { *m = VoucherResponse{} }
func (m *VoucherResponse) String() string { return proto.CompactTextString(m) }
func (*VoucherResponse) ProtoMessage() {}
func (*VoucherResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_3659b9a115b8060d, []int{2}
}
func (m *VoucherResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_VoucherResponse.Unmarshal(m, b)
}
func (m *VoucherResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_VoucherResponse.Marshal(b, m, deterministic)
}
func (m *VoucherResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_VoucherResponse.Merge(m, src)
}
func (m *VoucherResponse) XXX_Size() int {
return xxx_messageInfo_VoucherResponse.Size(m)
}
func (m *VoucherResponse) XXX_DiscardUnknown() {
xxx_messageInfo_VoucherResponse.DiscardUnknown(m)
}
var xxx_messageInfo_VoucherResponse proto.InternalMessageInfo
func (m *VoucherResponse) GetVoucher() *Voucher {
if m != nil {
return m.Voucher
}
return nil
}
func (m *VoucherResponse) GetStatus() VoucherResponse_Status {
if m != nil {
return m.Status
}
return VoucherResponse_INVALID
}
func init() {
proto.RegisterEnum("vouchers.VoucherResponse_Status", VoucherResponse_Status_name, VoucherResponse_Status_value)
proto.RegisterType((*Voucher)(nil), "vouchers.Voucher")
proto.RegisterType((*VoucherRequest)(nil), "vouchers.VoucherRequest")
proto.RegisterType((*VoucherResponse)(nil), "vouchers.VoucherResponse")
}
func init() { proto.RegisterFile("vouchers.proto", fileDescriptor_3659b9a115b8060d) }
var fileDescriptor_3659b9a115b8060d = []byte{
// 358 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x4f, 0x4b, 0xf3, 0x40,
0x10, 0xc6, 0x9b, 0xbe, 0x25, 0x29, 0x93, 0xbe, 0x69, 0x5d, 0x2f, 0x31, 0x97, 0x96, 0x9c, 0x0a,
0x42, 0x4a, 0x23, 0x88, 0x78, 0xb2, 0x7f, 0x72, 0x88, 0x94, 0x22, 0x69, 0xe9, 0xc1, 0x4b, 0x49,
0xcd, 0x1a, 0x03, 0x6d, 0x36, 0x66, 0x37, 0xe2, 0x77, 0xf2, 0x8b, 0xf8, 0x19, 0x3c, 0x14, 0xfc,
0x26, 0xd2, 0xcd, 0x6e, 0x14, 0xac, 0xc7, 0x67, 0xe6, 0x37, 0x33, 0xcf, 0x33, 0x60, 0xbc, 0x90,
0xe2, 0xe1, 0x09, 0xe7, 0xd4, 0xc9, 0x72, 0xc2, 0x08, 0x6a, 0x4a, 0x6d, 0x41, 0x4c, 0x62, 0x52,
0x56, 0xad, 0x6e, 0x4c, 0x48, 0xbc, 0xc5, 0x03, 0xae, 0x36, 0xc5, 0xe3, 0x80, 0x25, 0x3b, 0x4c,
0x59, 0xb8, 0xcb, 0x4a, 0xc0, 0xfe, 0x54, 0x40, 0x5b, 0x95, 0x93, 0x68, 0x08, 0x2d, 0x1a, 0x32,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, 0xdd, 0x19, 0x34, 0xc5, 0x52, 0x8a, 0x6e,
0x40, 0x13, 0x21, 0x90, 0x79, 0xe4, 0x26, 0xef, 0x58, 0x67, 0x7f, 0xba, 0xb1, 0x6b, 0xe3, 0xc6,
0x7d, 0x3d, 0xdb, 0x6c, 0x54, 0xfe, 0xe4, 0x8b, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0xd8,
0xc2, 0xb8, 0x47, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// VouchersClient is the client API for Vouchers service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type VouchersClient interface {
Request(ctx context.Context, in *VoucherRequest, opts ...grpc.CallOption) (*VoucherResponse, error)
}
type vouchersClient struct {
cc *grpc.ClientConn
}
func NewVouchersClient(cc *grpc.ClientConn) VouchersClient {
return &vouchersClient{cc}
}
func (c *vouchersClient) Request(ctx context.Context, in *VoucherRequest, opts ...grpc.CallOption) (*VoucherResponse, error) {
out := new(VoucherResponse)
err := c.cc.Invoke(ctx, "/vouchers.Vouchers/Request", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// VouchersServer is the server API for Vouchers service.
type VouchersServer interface {
Request(context.Context, *VoucherRequest) (*VoucherResponse, error)
}
func RegisterVouchersServer(s *grpc.Server, srv VouchersServer) {
s.RegisterService(&_Vouchers_serviceDesc, srv)
}
func _Vouchers_Request_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VoucherRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VouchersServer).Request(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vouchers.Vouchers/Request",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VouchersServer).Request(ctx, req.(*VoucherRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Vouchers_serviceDesc = grpc.ServiceDesc{
ServiceName: "vouchers.Vouchers",
HandlerType: (*VouchersServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Request",
Handler: _Vouchers_Request_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "vouchers.proto",
}