mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
cache : add cache service (#457)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
8a9cb0f803
commit
dccc7cd2ff
46 changed files with 1837 additions and 587 deletions
329
internal/grpc/cache/cache.pb.go
vendored
Normal file
329
internal/grpc/cache/cache.pb.go
vendored
Normal file
|
@ -0,0 +1,329 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: cache.proto
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
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.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type GetRequest struct {
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetRequest) Reset() { *m = GetRequest{} }
|
||||
func (m *GetRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetRequest) ProtoMessage() {}
|
||||
func (*GetRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5fca3b110c9bbf3a, []int{0}
|
||||
}
|
||||
|
||||
func (m *GetRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetRequest.Size(m)
|
||||
}
|
||||
func (m *GetRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetRequest) GetKey() string {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetReply struct {
|
||||
Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"`
|
||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetReply) Reset() { *m = GetReply{} }
|
||||
func (m *GetReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetReply) ProtoMessage() {}
|
||||
func (*GetReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5fca3b110c9bbf3a, []int{1}
|
||||
}
|
||||
|
||||
func (m *GetReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetReply.Size(m)
|
||||
}
|
||||
func (m *GetReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetReply) GetExists() bool {
|
||||
if m != nil {
|
||||
return m.Exists
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *GetReply) GetValue() []byte {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SetRequest struct {
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SetRequest) Reset() { *m = SetRequest{} }
|
||||
func (m *SetRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetRequest) ProtoMessage() {}
|
||||
func (*SetRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5fca3b110c9bbf3a, []int{2}
|
||||
}
|
||||
|
||||
func (m *SetRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SetRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *SetRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SetRequest.Merge(m, src)
|
||||
}
|
||||
func (m *SetRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_SetRequest.Size(m)
|
||||
}
|
||||
func (m *SetRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SetRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SetRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *SetRequest) GetKey() string {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SetRequest) GetValue() []byte {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SetReply struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SetReply) Reset() { *m = SetReply{} }
|
||||
func (m *SetReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetReply) ProtoMessage() {}
|
||||
func (*SetReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_5fca3b110c9bbf3a, []int{3}
|
||||
}
|
||||
|
||||
func (m *SetReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SetReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SetReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *SetReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SetReply.Merge(m, src)
|
||||
}
|
||||
func (m *SetReply) XXX_Size() int {
|
||||
return xxx_messageInfo_SetReply.Size(m)
|
||||
}
|
||||
func (m *SetReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SetReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SetReply proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GetRequest)(nil), "cache.GetRequest")
|
||||
proto.RegisterType((*GetReply)(nil), "cache.GetReply")
|
||||
proto.RegisterType((*SetRequest)(nil), "cache.SetRequest")
|
||||
proto.RegisterType((*SetReply)(nil), "cache.SetReply")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cache.proto", fileDescriptor_5fca3b110c9bbf3a) }
|
||||
|
||||
var fileDescriptor_5fca3b110c9bbf3a = []byte{
|
||||
// 176 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0x4e, 0x4c, 0xce,
|
||||
0x48, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0x94, 0xe4, 0xb8, 0xb8, 0xdc,
|
||||
0x53, 0x4b, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b,
|
||||
0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x40, 0x4c, 0x25, 0x0b, 0x2e, 0x0e, 0xb0, 0x7c, 0x41,
|
||||
0x4e, 0xa5, 0x90, 0x18, 0x17, 0x5b, 0x6a, 0x45, 0x66, 0x71, 0x49, 0x31, 0x58, 0x01, 0x47, 0x10,
|
||||
0x94, 0x27, 0x24, 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x9a, 0x2a, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1,
|
||||
0x13, 0x04, 0xe1, 0x28, 0x99, 0x70, 0x71, 0x05, 0xe3, 0x31, 0x19, 0x87, 0x2e, 0x2e, 0x2e, 0x8e,
|
||||
0x60, 0xa8, 0x7d, 0x46, 0x89, 0x5c, 0xac, 0xce, 0x20, 0x47, 0x0a, 0x69, 0x73, 0x31, 0xbb, 0xa7,
|
||||
0x96, 0x08, 0x09, 0xea, 0x41, 0x3c, 0x80, 0x70, 0xb0, 0x14, 0x3f, 0xb2, 0x50, 0x41, 0x4e, 0xa5,
|
||||
0x12, 0x03, 0x48, 0x71, 0x30, 0x92, 0xe2, 0x60, 0x4c, 0xc5, 0xc1, 0x70, 0xc5, 0x49, 0x6c, 0xe0,
|
||||
0xc0, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xef, 0x5f, 0x9e, 0x1b, 0x01, 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
|
||||
|
||||
// CacheClient is the client API for Cache service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type CacheClient interface {
|
||||
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error)
|
||||
Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetReply, error)
|
||||
}
|
||||
|
||||
type cacheClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewCacheClient(cc *grpc.ClientConn) CacheClient {
|
||||
return &cacheClient{cc}
|
||||
}
|
||||
|
||||
func (c *cacheClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error) {
|
||||
out := new(GetReply)
|
||||
err := c.cc.Invoke(ctx, "/cache.Cache/Get", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *cacheClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetReply, error) {
|
||||
out := new(SetReply)
|
||||
err := c.cc.Invoke(ctx, "/cache.Cache/Set", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CacheServer is the server API for Cache service.
|
||||
type CacheServer interface {
|
||||
Get(context.Context, *GetRequest) (*GetReply, error)
|
||||
Set(context.Context, *SetRequest) (*SetReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedCacheServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedCacheServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedCacheServer) Get(ctx context.Context, req *GetRequest) (*GetReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (*UnimplementedCacheServer) Set(ctx context.Context, req *SetRequest) (*SetReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
|
||||
}
|
||||
|
||||
func RegisterCacheServer(s *grpc.Server, srv CacheServer) {
|
||||
s.RegisterService(&_Cache_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Cache_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.(CacheServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cache.Cache/Get",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CacheServer).Get(ctx, req.(*GetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cache_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CacheServer).Set(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cache.Cache/Set",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CacheServer).Set(ctx, req.(*SetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Cache_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cache.Cache",
|
||||
HandlerType: (*CacheServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _Cache_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Set",
|
||||
Handler: _Cache_Set_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cache.proto",
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue