From 8d7bff55cd7826ca0387f105b357afe6fd2116ca Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Tue, 10 May 2022 22:59:32 +0300 Subject: [PATCH] added an option to force reset cache --- Makefile | 4 +- README.md | 38 ++- src/api/proto/storage.proto | 10 +- src/cmd/server/main.go | 8 +- src/cmd/storage/main.go | 17 +- src/internal/cachers/cacher.go | 3 +- src/internal/cachers/inmemory/repository.go | 6 +- src/internal/cachers/rstorage/service.go | 11 +- src/pkg/api/storage/storage.pb.go | 340 +++++++++++++------- src/pkg/api/storage/storage_grpc.pb.go | 54 +++- 10 files changed, 350 insertions(+), 141 deletions(-) diff --git a/Makefile b/Makefile index 5344784..1aff513 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: init build build-server build-storage up run start down stop +.PHONY: init build build-server build-storage up run start down stop restart init: @if [ ! -f '.env' ]; then \ @@ -34,3 +34,5 @@ run: down: stop stop: docker-compose down + +restart: stop run diff --git a/README.md b/README.md index c04eda6..9d3c31f 100644 --- a/README.md +++ b/README.md @@ -3,26 +3,27 @@ GO Prerender > Inspired by https://github.com/goprerender/prerender -GO Prerender is a dockerized server app written in Golang that uses Headless Chrome to render HTML and JS files out of any web page. -The Prerender server listens for a http request, takes the URL and loads it in Headless Chrome, waits for the page to finish loading by waiting for the network to be idle, and then returns your content. +GO Prerender is a dockerized server app written in Golang that uses Headless Chrome to render HTML and JS files out of +any web page. +The Prerender server listens for a http request, takes the URL and loads it in Headless Chrome, waits for the page to +finish loading by waiting for the network to be idle, and then returns your content. #### In memory cache -Caches pages in memory using prerender `storage` container. +It caches pages in memory using prerender `storage` container. -### Installation +### Installation * clone repository * run `make init` * configure `.env` and `docker-compose.yml` to fit your needs or use the default. * run `make up` - this will build and start docker containers - ### Development Run `make build-server` to build server Go application. Run `make build-storage` to build storage Go application. -Run `make build` to build both Go applications server and storage. +Run `make build` to build both Go applications server and storage. #### Usage @@ -33,3 +34,28 @@ To prerender some URL you need to specify it as a query parameter, like this: ``` http://localhost:3000/render?url=https://www.example.com/ ``` + +#### Purge cache + +Cached pages are valid for 7 days by default, but you can force clear it. + +To purge all cached pages you need to pass the `Cache-Control` header +with the value `must-revalidate` or the `Clear-Site-Data` header with any value. + +Just send a usual request to + +``` +http://localhost:3000/render?url=https://www.example.com/ +``` + +With this header + +``` +Cache-Control: must-revalidate +``` + +or + +``` +Clear-Site-Data: * +``` diff --git a/src/api/proto/storage.proto b/src/api/proto/storage.proto index 84c0be4..f0095d5 100644 --- a/src/api/proto/storage.proto +++ b/src/api/proto/storage.proto @@ -10,11 +10,13 @@ import "google/protobuf/timestamp.proto"; // The storage service definition. service Storage { // Sends a store request message - rpc Store (StoreRequest) returns (StoreReply) {} + rpc Store(StoreRequest) returns (StoreReply) {} // Get a request from storage - rpc Get (GetRequest) returns (GetReplay) {} + rpc Get(GetRequest) returns (GetReplay) {} // rpc Len(LenRequest) returns (LenReplay) {} + // + rpc Purge(PurgeRequest) returns (PurgeReply) {} } message Page { @@ -57,3 +59,7 @@ message LenRequest {} message LenReplay { int32 length = 1; } + +message PurgeRequest {} + +message PurgeReply {} diff --git a/src/cmd/server/main.go b/src/cmd/server/main.go index 0a0424f..295a1ca 100644 --- a/src/cmd/server/main.go +++ b/src/cmd/server/main.go @@ -52,7 +52,7 @@ func main() { logger.Infof("Starting server...") time.Sleep(5 * time.Second) - logger.Infof("Connecting to storage %v", address) + logger.Infof("Connecting to storage %v", address) // Set up a connection to the server. conn, err := grpc.Dial(address, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { @@ -156,6 +156,12 @@ func handleRequest(ctx context.Context, pc cachers.Сacher, logger prLog.Logger) ctx, cancel := context.WithTimeout(newTabCtx, time.Second*60) defer cancel() + req := c.Request + + if req.Header.Get("Cache-Control") == "must-revalidate" || req.Header.Get("Clear-Site-Data") != "" { + pc.Purge() + } + res, err := renderer.DoRender(ctx, queryString, pc, false, logger) if err != nil { return err diff --git a/src/cmd/storage/main.go b/src/cmd/storage/main.go index 8b506be..4f40161 100644 --- a/src/cmd/storage/main.go +++ b/src/cmd/storage/main.go @@ -16,13 +16,13 @@ import ( ) const ( - port = ":50051" - duration = time.Hour*24*7 + port = ":50051" + duration = time.Hour * 24 * 7 ) var gc = gcache.New(100000). - LRU(). - Build() + LRU(). + Build() // server is used to implement Saver. type server struct { @@ -51,12 +51,17 @@ func (s *server) Get(ctx context.Context, in *storage.GetRequest) (*storage.GetR } func (s *server) Len(ctx context.Context, in *storage.LenRequest) (*storage.LenReplay, error) { - log.Printf("Received: Len request") + //log.Printf("Received: Len request") return &storage.LenReplay{Length: int32(gc.Len(true))}, nil } -func main() { +func (s *server) Purge(ctx context.Context, in *storage.PurgeRequest) (*storage.PurgeReply, error) { + gc.Purge() + + return &storage.PurgeReply{}, nil +} +func main() { ctx := context.Background() lis, err := net.Listen("tcp", port) if err != nil { diff --git a/src/internal/cachers/cacher.go b/src/internal/cachers/cacher.go index 573017e..290a2b9 100644 --- a/src/internal/cachers/cacher.go +++ b/src/internal/cachers/cacher.go @@ -4,4 +4,5 @@ type Сacher interface { Put(key string, data []byte) error Get(key string) ([]byte, error) Len() int - } + Purge() +} diff --git a/src/internal/cachers/inmemory/repository.go b/src/internal/cachers/inmemory/repository.go index 89e8f9b..18d5992 100644 --- a/src/internal/cachers/inmemory/repository.go +++ b/src/internal/cachers/inmemory/repository.go @@ -12,7 +12,7 @@ type repository struct { } func New(gc gcache.Cache) cachers.Сacher { - return repository{gc: gc, dd: time.Hour*24*7} + return repository{gc: gc, dd: time.Hour * 24 * 7} } func (r repository) Put(key string, data []byte) error { @@ -30,3 +30,7 @@ func (r repository) Get(key string) ([]byte, error) { func (r repository) Len() int { return r.gc.Len(true) } + +func (r repository) Purge() { + r.gc.Purge() +} diff --git a/src/internal/cachers/rstorage/service.go b/src/internal/cachers/rstorage/service.go index b3977d6..87e5cec 100644 --- a/src/internal/cachers/rstorage/service.go +++ b/src/internal/cachers/rstorage/service.go @@ -47,7 +47,16 @@ func (s server) Len() int { req := storage.LenRequest{} result, err := s.gw.Len(ctx, &req) if err != nil { - log.Fatal( err) + log.Fatal(err) } return int(result.GetLength()) } + +func (s server) Purge() { + ctx := context.Background() + req := storage.PurgeRequest{} + _, err := s.gw.Purge(ctx, &req) + if err != nil { + log.Fatal(err) + } +} diff --git a/src/pkg/api/storage/storage.pb.go b/src/pkg/api/storage/storage.pb.go index 3d4757d..7af2c67 100644 --- a/src/pkg/api/storage/storage.pb.go +++ b/src/pkg/api/storage/storage.pb.go @@ -1,16 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.13.0 -// source: api/proto/storage.proto +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: storage.proto package storage import ( - proto "github.com/golang/protobuf/proto" - timestamp "github.com/golang/protobuf/ptypes/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -22,10 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type Page struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -35,13 +30,13 @@ type Page struct { Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // Date and time to remind the storage - CreatedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` } func (x *Page) Reset() { *x = Page{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[0] + mi := &file_storage_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -54,7 +49,7 @@ func (x *Page) String() string { func (*Page) ProtoMessage() {} func (x *Page) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[0] + mi := &file_storage_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -67,7 +62,7 @@ func (x *Page) ProtoReflect() protoreflect.Message { // Deprecated: Use Page.ProtoReflect.Descriptor instead. func (*Page) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{0} + return file_storage_proto_rawDescGZIP(), []int{0} } func (x *Page) GetHash() string { @@ -84,7 +79,7 @@ func (x *Page) GetData() []byte { return nil } -func (x *Page) GetCreatedAt() *timestamp.Timestamp { +func (x *Page) GetCreatedAt() *timestamppb.Timestamp { if x != nil { return x.CreatedAt } @@ -105,7 +100,7 @@ type StoreRequest struct { func (x *StoreRequest) Reset() { *x = StoreRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[1] + mi := &file_storage_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118,7 +113,7 @@ func (x *StoreRequest) String() string { func (*StoreRequest) ProtoMessage() {} func (x *StoreRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[1] + mi := &file_storage_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -131,7 +126,7 @@ func (x *StoreRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StoreRequest.ProtoReflect.Descriptor instead. func (*StoreRequest) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{1} + return file_storage_proto_rawDescGZIP(), []int{1} } func (x *StoreRequest) GetApi() string { @@ -160,7 +155,7 @@ type StoreReply struct { func (x *StoreReply) Reset() { *x = StoreReply{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[2] + mi := &file_storage_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -173,7 +168,7 @@ func (x *StoreReply) String() string { func (*StoreReply) ProtoMessage() {} func (x *StoreReply) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[2] + mi := &file_storage_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -186,7 +181,7 @@ func (x *StoreReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StoreReply.ProtoReflect.Descriptor instead. func (*StoreReply) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{2} + return file_storage_proto_rawDescGZIP(), []int{2} } func (x *StoreReply) GetApi() string { @@ -208,7 +203,7 @@ type GetRequest struct { func (x *GetRequest) Reset() { *x = GetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[3] + mi := &file_storage_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -221,7 +216,7 @@ func (x *GetRequest) String() string { func (*GetRequest) ProtoMessage() {} func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[3] + mi := &file_storage_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -234,7 +229,7 @@ func (x *GetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{3} + return file_storage_proto_rawDescGZIP(), []int{3} } func (x *GetRequest) GetHash() string { @@ -257,7 +252,7 @@ type GetReplay struct { func (x *GetReplay) Reset() { *x = GetReplay{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[4] + mi := &file_storage_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -270,7 +265,7 @@ func (x *GetReplay) String() string { func (*GetReplay) ProtoMessage() {} func (x *GetReplay) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[4] + mi := &file_storage_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -283,7 +278,7 @@ func (x *GetReplay) ProtoReflect() protoreflect.Message { // Deprecated: Use GetReplay.ProtoReflect.Descriptor instead. func (*GetReplay) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{4} + return file_storage_proto_rawDescGZIP(), []int{4} } func (x *GetReplay) GetData() []byte { @@ -309,7 +304,7 @@ type LenRequest struct { func (x *LenRequest) Reset() { *x = LenRequest{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[5] + mi := &file_storage_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -322,7 +317,7 @@ func (x *LenRequest) String() string { func (*LenRequest) ProtoMessage() {} func (x *LenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[5] + mi := &file_storage_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -335,7 +330,7 @@ func (x *LenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LenRequest.ProtoReflect.Descriptor instead. func (*LenRequest) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{5} + return file_storage_proto_rawDescGZIP(), []int{5} } type LenReplay struct { @@ -349,7 +344,7 @@ type LenReplay struct { func (x *LenReplay) Reset() { *x = LenReplay{} if protoimpl.UnsafeEnabled { - mi := &file_api_proto_storage_proto_msgTypes[6] + mi := &file_storage_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -362,7 +357,7 @@ func (x *LenReplay) String() string { func (*LenReplay) ProtoMessage() {} func (x *LenReplay) ProtoReflect() protoreflect.Message { - mi := &file_api_proto_storage_proto_msgTypes[6] + mi := &file_storage_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -375,7 +370,7 @@ func (x *LenReplay) ProtoReflect() protoreflect.Message { // Deprecated: Use LenReplay.ProtoReflect.Descriptor instead. func (*LenReplay) Descriptor() ([]byte, []int) { - return file_api_proto_storage_proto_rawDescGZIP(), []int{6} + return file_storage_proto_rawDescGZIP(), []int{6} } func (x *LenReplay) GetLength() int32 { @@ -385,95 +380,180 @@ func (x *LenReplay) GetLength() int32 { return 0 } -var File_api_proto_storage_proto protoreflect.FileDescriptor - -var file_api_proto_storage_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, - 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x38, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x43, 0x0a, - 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, - 0x21, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x04, 0x70, 0x61, - 0x67, 0x65, 0x22, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, - 0x70, 0x69, 0x22, 0x20, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x22, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, - 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x0c, 0x0a, - 0x0a, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x23, 0x0a, 0x09, 0x4c, - 0x65, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x32, 0xa4, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x05, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x13, 0x2e, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x12, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, - 0x6c, 0x61, 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x03, 0x4c, 0x65, 0x6e, 0x12, 0x13, 0x2e, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x4c, 0x65, 0x6e, 0x52, - 0x65, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x00, 0x42, 0x0d, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +type PurgeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PurgeRequest) Reset() { + *x = PurgeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_storage_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PurgeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PurgeRequest) ProtoMessage() {} + +func (x *PurgeRequest) ProtoReflect() protoreflect.Message { + mi := &file_storage_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PurgeRequest.ProtoReflect.Descriptor instead. +func (*PurgeRequest) Descriptor() ([]byte, []int) { + return file_storage_proto_rawDescGZIP(), []int{7} +} + +type PurgeReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PurgeReply) Reset() { + *x = PurgeReply{} + if protoimpl.UnsafeEnabled { + mi := &file_storage_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PurgeReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PurgeReply) ProtoMessage() {} + +func (x *PurgeReply) ProtoReflect() protoreflect.Message { + mi := &file_storage_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PurgeReply.ProtoReflect.Descriptor instead. +func (*PurgeReply) Descriptor() ([]byte, []int) { + return file_storage_proto_rawDescGZIP(), []int{8} +} + +var File_storage_proto protoreflect.FileDescriptor + +var file_storage_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x04, 0x50, 0x61, 0x67, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x38, 0x0a, 0x09, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x22, 0x43, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, 0x21, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x61, + 0x67, 0x65, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x70, 0x69, 0x22, 0x20, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x37, 0x0a, 0x09, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x22, 0x0c, 0x0a, 0x0a, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x23, 0x0a, 0x09, 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x16, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x0e, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x0c, 0x0a, 0x0a, 0x50, 0x75, 0x72, 0x67, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x32, 0xdb, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x12, 0x35, 0x0a, 0x05, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x13, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x13, + 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x03, 0x4c, 0x65, 0x6e, + 0x12, 0x13, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x4c, 0x65, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, + 0x4c, 0x65, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x05, 0x50, + 0x75, 0x72, 0x67, 0x65, 0x12, 0x15, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x50, + 0x75, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x75, 0x72, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x42, 0x0d, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_api_proto_storage_proto_rawDescOnce sync.Once - file_api_proto_storage_proto_rawDescData = file_api_proto_storage_proto_rawDesc + file_storage_proto_rawDescOnce sync.Once + file_storage_proto_rawDescData = file_storage_proto_rawDesc ) -func file_api_proto_storage_proto_rawDescGZIP() []byte { - file_api_proto_storage_proto_rawDescOnce.Do(func() { - file_api_proto_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_proto_storage_proto_rawDescData) +func file_storage_proto_rawDescGZIP() []byte { + file_storage_proto_rawDescOnce.Do(func() { + file_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_storage_proto_rawDescData) }) - return file_api_proto_storage_proto_rawDescData -} - -var file_api_proto_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_api_proto_storage_proto_goTypes = []interface{}{ - (*Page)(nil), // 0: storage.Page - (*StoreRequest)(nil), // 1: storage.StoreRequest - (*StoreReply)(nil), // 2: storage.StoreReply - (*GetRequest)(nil), // 3: storage.GetRequest - (*GetReplay)(nil), // 4: storage.GetReplay - (*LenRequest)(nil), // 5: storage.LenRequest - (*LenReplay)(nil), // 6: storage.LenReplay - (*timestamp.Timestamp)(nil), // 7: google.protobuf.Timestamp -} -var file_api_proto_storage_proto_depIdxs = []int32{ - 7, // 0: storage.Page.createdAt:type_name -> google.protobuf.Timestamp + return file_storage_proto_rawDescData +} + +var file_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_storage_proto_goTypes = []interface{}{ + (*Page)(nil), // 0: storage.Page + (*StoreRequest)(nil), // 1: storage.StoreRequest + (*StoreReply)(nil), // 2: storage.StoreReply + (*GetRequest)(nil), // 3: storage.GetRequest + (*GetReplay)(nil), // 4: storage.GetReplay + (*LenRequest)(nil), // 5: storage.LenRequest + (*LenReplay)(nil), // 6: storage.LenReplay + (*PurgeRequest)(nil), // 7: storage.PurgeRequest + (*PurgeReply)(nil), // 8: storage.PurgeReply + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp +} +var file_storage_proto_depIdxs = []int32{ + 9, // 0: storage.Page.createdAt:type_name -> google.protobuf.Timestamp 0, // 1: storage.StoreRequest.page:type_name -> storage.Page 1, // 2: storage.Storage.Store:input_type -> storage.StoreRequest 3, // 3: storage.Storage.Get:input_type -> storage.GetRequest 5, // 4: storage.Storage.Len:input_type -> storage.LenRequest - 2, // 5: storage.Storage.Store:output_type -> storage.StoreReply - 4, // 6: storage.Storage.Get:output_type -> storage.GetReplay - 6, // 7: storage.Storage.Len:output_type -> storage.LenReplay - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type + 7, // 5: storage.Storage.Purge:input_type -> storage.PurgeRequest + 2, // 6: storage.Storage.Store:output_type -> storage.StoreReply + 4, // 7: storage.Storage.Get:output_type -> storage.GetReplay + 6, // 8: storage.Storage.Len:output_type -> storage.LenReplay + 8, // 9: storage.Storage.Purge:output_type -> storage.PurgeReply + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name } -func init() { file_api_proto_storage_proto_init() } -func file_api_proto_storage_proto_init() { - if File_api_proto_storage_proto != nil { +func init() { file_storage_proto_init() } +func file_storage_proto_init() { + if File_storage_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_api_proto_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Page); i { case 0: return &v.state @@ -485,7 +565,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StoreRequest); i { case 0: return &v.state @@ -497,7 +577,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StoreReply); i { case 0: return &v.state @@ -509,7 +589,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRequest); i { case 0: return &v.state @@ -521,7 +601,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetReplay); i { case 0: return &v.state @@ -533,7 +613,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LenRequest); i { case 0: return &v.state @@ -545,7 +625,7 @@ func file_api_proto_storage_proto_init() { return nil } } - file_api_proto_storage_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_storage_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LenReplay); i { case 0: return &v.state @@ -557,23 +637,47 @@ func file_api_proto_storage_proto_init() { return nil } } + file_storage_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PurgeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_storage_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PurgeReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_proto_storage_proto_rawDesc, + RawDescriptor: file_storage_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_proto_storage_proto_goTypes, - DependencyIndexes: file_api_proto_storage_proto_depIdxs, - MessageInfos: file_api_proto_storage_proto_msgTypes, + GoTypes: file_storage_proto_goTypes, + DependencyIndexes: file_storage_proto_depIdxs, + MessageInfos: file_storage_proto_msgTypes, }.Build() - File_api_proto_storage_proto = out.File - file_api_proto_storage_proto_rawDesc = nil - file_api_proto_storage_proto_goTypes = nil - file_api_proto_storage_proto_depIdxs = nil + File_storage_proto = out.File + file_storage_proto_rawDesc = nil + file_storage_proto_goTypes = nil + file_storage_proto_depIdxs = nil } diff --git a/src/pkg/api/storage/storage_grpc.pb.go b/src/pkg/api/storage/storage_grpc.pb.go index a7bebd5..0a85af6 100644 --- a/src/pkg/api/storage/storage_grpc.pb.go +++ b/src/pkg/api/storage/storage_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: storage.proto package storage @@ -11,6 +15,7 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 // StorageClient is the client API for Storage service. @@ -23,6 +28,8 @@ type StorageClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReplay, error) // Len(ctx context.Context, in *LenRequest, opts ...grpc.CallOption) (*LenReplay, error) + // + Purge(ctx context.Context, in *PurgeRequest, opts ...grpc.CallOption) (*PurgeReply, error) } type storageClient struct { @@ -60,6 +67,15 @@ func (c *storageClient) Len(ctx context.Context, in *LenRequest, opts ...grpc.Ca return out, nil } +func (c *storageClient) Purge(ctx context.Context, in *PurgeRequest, opts ...grpc.CallOption) (*PurgeReply, error) { + out := new(PurgeReply) + err := c.cc.Invoke(ctx, "/storage.Storage/Purge", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StorageServer is the server API for Storage service. // All implementations must embed UnimplementedStorageServer // for forward compatibility @@ -70,6 +86,8 @@ type StorageServer interface { Get(context.Context, *GetRequest) (*GetReplay, error) // Len(context.Context, *LenRequest) (*LenReplay, error) + // + Purge(context.Context, *PurgeRequest) (*PurgeReply, error) mustEmbedUnimplementedStorageServer() } @@ -86,6 +104,9 @@ func (UnimplementedStorageServer) Get(context.Context, *GetRequest) (*GetReplay, func (UnimplementedStorageServer) Len(context.Context, *LenRequest) (*LenReplay, error) { return nil, status.Errorf(codes.Unimplemented, "method Len not implemented") } +func (UnimplementedStorageServer) Purge(context.Context, *PurgeRequest) (*PurgeReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Purge not implemented") +} func (UnimplementedStorageServer) mustEmbedUnimplementedStorageServer() {} // UnsafeStorageServer may be embedded to opt out of forward compatibility for this service. @@ -95,8 +116,8 @@ type UnsafeStorageServer interface { mustEmbedUnimplementedStorageServer() } -func RegisterStorageServer(s *grpc.Server, srv StorageServer) { - s.RegisterService(&_Storage_serviceDesc, srv) +func RegisterStorageServer(s grpc.ServiceRegistrar, srv StorageServer) { + s.RegisterService(&Storage_ServiceDesc, srv) } func _Storage_Store_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -153,7 +174,28 @@ func _Storage_Len_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } -var _Storage_serviceDesc = grpc.ServiceDesc{ +func _Storage_Purge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PurgeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StorageServer).Purge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/storage.Storage/Purge", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StorageServer).Purge(ctx, req.(*PurgeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Storage_ServiceDesc is the grpc.ServiceDesc for Storage service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Storage_ServiceDesc = grpc.ServiceDesc{ ServiceName: "storage.Storage", HandlerType: (*StorageServer)(nil), Methods: []grpc.MethodDesc{ @@ -169,7 +211,11 @@ var _Storage_serviceDesc = grpc.ServiceDesc{ MethodName: "Len", Handler: _Storage_Len_Handler, }, + { + MethodName: "Purge", + Handler: _Storage_Purge_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/proto/storage.proto", + Metadata: "storage.proto", }