storj/protos/netstate/netstate.pb.go
Natalie Villasana 1a06c2b0c7 adding grpc interface to network state (#33)
* adds proto files for netstate crud

* moves netstate grpc client lib into pkg/netstate where grpc netstate service is defined

* starts adding grpc client and server tests

* moves creation of grpc server into cmd/netstate/main.go, removes pkg/netstate/service.go, adds more client testing

* changed all 'Path' and 'Value' fields from strings to bytes, updated tests

* changes Get and Delete in proto file to receive 'requests' instead of 'file paths', adds tests for Get, List, and Delete

* changes netstate-routes to get 'fileValue' bytes not 'fileInfo'

* adds example rpc client in 'examples' and adds more specific debug logs

* adds readmes for netstate rpc services and updates netstate-routes
2018-05-14 18:31:26 -06:00

401 lines
14 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: netstate.proto
/*
Package netstate is a generated protocol buffer package.
It is generated from these files:
netstate.proto
It has these top-level messages:
FilePath
GetRequest
ListRequest
PutResponse
GetResponse
ListResponse
DeleteRequest
DeleteResponse
*/
package netstate
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
// FilePath is a request message for the Put rpc call
type FilePath struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
// smallValue is a value too small to be broken up and stored
// in different places
SmallValue []byte `protobuf:"bytes,2,opt,name=smallValue,proto3" json:"smallValue,omitempty"`
}
func (m *FilePath) Reset() { *m = FilePath{} }
func (m *FilePath) String() string { return proto.CompactTextString(m) }
func (*FilePath) ProtoMessage() {}
func (*FilePath) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *FilePath) GetPath() []byte {
if m != nil {
return m.Path
}
return nil
}
func (m *FilePath) GetSmallValue() []byte {
if m != nil {
return m.SmallValue
}
return nil
}
// GetRequest is a request message for the Get rpc call
type GetRequest struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
}
func (m *GetRequest) Reset() { *m = GetRequest{} }
func (m *GetRequest) String() string { return proto.CompactTextString(m) }
func (*GetRequest) ProtoMessage() {}
func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *GetRequest) GetPath() []byte {
if m != nil {
return m.Path
}
return nil
}
// ListRequest is a request message for the List rpc call
type ListRequest struct {
Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
}
func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *ListRequest) GetBucket() []byte {
if m != nil {
return m.Bucket
}
return nil
}
// PutResponse is a response message for the Put rpc call
type PutResponse struct {
Confirmation string `protobuf:"bytes,1,opt,name=confirmation" json:"confirmation,omitempty"`
}
func (m *PutResponse) Reset() { *m = PutResponse{} }
func (m *PutResponse) String() string { return proto.CompactTextString(m) }
func (*PutResponse) ProtoMessage() {}
func (*PutResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *PutResponse) GetConfirmation() string {
if m != nil {
return m.Confirmation
}
return ""
}
// GetResponse is a response message for the Get rpc call
type GetResponse struct {
SmallValue []byte `protobuf:"bytes,1,opt,name=smallValue,proto3" json:"smallValue,omitempty"`
}
func (m *GetResponse) Reset() { *m = GetResponse{} }
func (m *GetResponse) String() string { return proto.CompactTextString(m) }
func (*GetResponse) ProtoMessage() {}
func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *GetResponse) GetSmallValue() []byte {
if m != nil {
return m.SmallValue
}
return nil
}
// ListResponse is a response message for the List rpc call
type ListResponse struct {
Filepaths [][]byte `protobuf:"bytes,1,rep,name=filepaths,proto3" json:"filepaths,omitempty"`
}
func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *ListResponse) GetFilepaths() [][]byte {
if m != nil {
return m.Filepaths
}
return nil
}
type DeleteRequest struct {
Path []byte `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
}
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *DeleteRequest) GetPath() []byte {
if m != nil {
return m.Path
}
return nil
}
// DeleteResponse is a response message for the Delete rpc call
type DeleteResponse struct {
Confirmation string `protobuf:"bytes,1,opt,name=confirmation" json:"confirmation,omitempty"`
}
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *DeleteResponse) GetConfirmation() string {
if m != nil {
return m.Confirmation
}
return ""
}
func init() {
proto.RegisterType((*FilePath)(nil), "netstate.FilePath")
proto.RegisterType((*GetRequest)(nil), "netstate.GetRequest")
proto.RegisterType((*ListRequest)(nil), "netstate.ListRequest")
proto.RegisterType((*PutResponse)(nil), "netstate.PutResponse")
proto.RegisterType((*GetResponse)(nil), "netstate.GetResponse")
proto.RegisterType((*ListResponse)(nil), "netstate.ListResponse")
proto.RegisterType((*DeleteRequest)(nil), "netstate.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "netstate.DeleteResponse")
}
// 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
// Client API for NetState service
type NetStateClient interface {
// Put formats and hands off a file path to be saved to boltdb
Put(ctx context.Context, in *FilePath, opts ...grpc.CallOption) (*PutResponse, error)
// Get formats and hands off a file path to get a small value from boltdb
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
// List calls the bolt client's List function and returns all file paths
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
// Delete formats and hands off a file path to delete from boltdb
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
}
type netStateClient struct {
cc *grpc.ClientConn
}
func NewNetStateClient(cc *grpc.ClientConn) NetStateClient {
return &netStateClient{cc}
}
func (c *netStateClient) Put(ctx context.Context, in *FilePath, opts ...grpc.CallOption) (*PutResponse, error) {
out := new(PutResponse)
err := grpc.Invoke(ctx, "/netstate.NetState/Put", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *netStateClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
out := new(GetResponse)
err := grpc.Invoke(ctx, "/netstate.NetState/Get", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *netStateClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
out := new(ListResponse)
err := grpc.Invoke(ctx, "/netstate.NetState/List", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *netStateClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
out := new(DeleteResponse)
err := grpc.Invoke(ctx, "/netstate.NetState/Delete", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for NetState service
type NetStateServer interface {
// Put formats and hands off a file path to be saved to boltdb
Put(context.Context, *FilePath) (*PutResponse, error)
// Get formats and hands off a file path to get a small value from boltdb
Get(context.Context, *GetRequest) (*GetResponse, error)
// List calls the bolt client's List function and returns all file paths
List(context.Context, *ListRequest) (*ListResponse, error)
// Delete formats and hands off a file path to delete from boltdb
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
}
func RegisterNetStateServer(s *grpc.Server, srv NetStateServer) {
s.RegisterService(&_NetState_serviceDesc, srv)
}
func _NetState_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FilePath)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetStateServer).Put(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/netstate.NetState/Put",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetStateServer).Put(ctx, req.(*FilePath))
}
return interceptor(ctx, in, info, handler)
}
func _NetState_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetStateServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/netstate.NetState/Get",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetStateServer).Get(ctx, req.(*GetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NetState_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetStateServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/netstate.NetState/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetStateServer).List(ctx, req.(*ListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NetState_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NetStateServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/netstate.NetState/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetStateServer).Delete(ctx, req.(*DeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
var _NetState_serviceDesc = grpc.ServiceDesc{
ServiceName: "netstate.NetState",
HandlerType: (*NetStateServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Put",
Handler: _NetState_Put_Handler,
},
{
MethodName: "Get",
Handler: _NetState_Get_Handler,
},
{
MethodName: "List",
Handler: _NetState_List_Handler,
},
{
MethodName: "Delete",
Handler: _NetState_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "netstate.proto",
}
func init() { proto.RegisterFile("netstate.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 302 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x4b, 0xc3, 0x40,
0x10, 0x25, 0xb6, 0x94, 0x74, 0x12, 0x7b, 0x18, 0xb4, 0x86, 0x20, 0x12, 0x56, 0x84, 0x1e, 0xb4,
0x68, 0xd5, 0x93, 0xe0, 0x49, 0xec, 0x45, 0x24, 0x44, 0xf0, 0xbe, 0x2d, 0x53, 0x1a, 0xdc, 0x26,
0xb1, 0x3b, 0xf9, 0xc7, 0xfe, 0x10, 0xc9, 0x57, 0xb3, 0xb1, 0x22, 0xde, 0x32, 0xef, 0x23, 0x79,
0x33, 0x2f, 0x30, 0x4a, 0x88, 0x35, 0x4b, 0xa6, 0x69, 0xb6, 0x4d, 0x39, 0x45, 0xbb, 0x99, 0xc5,
0x23, 0xd8, 0xcf, 0xb1, 0xa2, 0x50, 0xf2, 0x1a, 0x11, 0xfa, 0x99, 0xe4, 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