huge refactor
This commit is contained in:
parent
8d6c2b6687
commit
38829c0179
23 changed files with 544 additions and 141 deletions
193
proto/surugayaScrapper/scrapper.pb.go
Normal file
193
proto/surugayaScrapper/scrapper.pb.go
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.8
|
||||
// protoc v6.32.0
|
||||
// source: scrapper.proto
|
||||
|
||||
package surugayaScrapper
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
MerchUuid string `protobuf:"bytes,1,opt,name=merch_uuid,json=merchUuid,proto3" json:"merch_uuid,omitempty"`
|
||||
Link string `protobuf:"bytes,2,opt,name=link,proto3" json:"link,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Task) Reset() {
|
||||
*x = Task{}
|
||||
mi := &file_scrapper_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Task) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Task) ProtoMessage() {}
|
||||
|
||||
func (x *Task) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scrapper_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Task.ProtoReflect.Descriptor instead.
|
||||
func (*Task) Descriptor() ([]byte, []int) {
|
||||
return file_scrapper_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Task) GetMerchUuid() string {
|
||||
if x != nil {
|
||||
return x.MerchUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Task) GetLink() string {
|
||||
if x != nil {
|
||||
return x.Link
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
MerchUuid string `protobuf:"bytes,1,opt,name=merch_uuid,json=merchUuid,proto3" json:"merch_uuid,omitempty"`
|
||||
Price int32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Result) Reset() {
|
||||
*x = Result{}
|
||||
mi := &file_scrapper_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Result) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Result) ProtoMessage() {}
|
||||
|
||||
func (x *Result) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scrapper_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Result.ProtoReflect.Descriptor instead.
|
||||
func (*Result) Descriptor() ([]byte, []int) {
|
||||
return file_scrapper_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Result) GetMerchUuid() string {
|
||||
if x != nil {
|
||||
return x.MerchUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Result) GetPrice() int32 {
|
||||
if x != nil {
|
||||
return x.Price
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_scrapper_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_scrapper_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0escrapper.proto\x12\x10surugayaScrapper\"9\n" +
|
||||
"\x04Task\x12\x1d\n" +
|
||||
"\n" +
|
||||
"merch_uuid\x18\x01 \x01(\tR\tmerchUuid\x12\x12\n" +
|
||||
"\x04link\x18\x02 \x01(\tR\x04link\"=\n" +
|
||||
"\x06Result\x12\x1d\n" +
|
||||
"\n" +
|
||||
"merch_uuid\x18\x01 \x01(\tR\tmerchUuid\x12\x14\n" +
|
||||
"\x05price\x18\x02 \x01(\x05R\x05price2X\n" +
|
||||
"\x10SurugayaScrapper\x12D\n" +
|
||||
"\fProcessTasks\x12\x16.surugayaScrapper.Task\x1a\x18.surugayaScrapper.Result(\x010\x01B\x14Z\x12./surugayaScrapperb\x06proto3"
|
||||
|
||||
var (
|
||||
file_scrapper_proto_rawDescOnce sync.Once
|
||||
file_scrapper_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_scrapper_proto_rawDescGZIP() []byte {
|
||||
file_scrapper_proto_rawDescOnce.Do(func() {
|
||||
file_scrapper_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_scrapper_proto_rawDesc), len(file_scrapper_proto_rawDesc)))
|
||||
})
|
||||
return file_scrapper_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_scrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_scrapper_proto_goTypes = []any{
|
||||
(*Task)(nil), // 0: surugayaScrapper.Task
|
||||
(*Result)(nil), // 1: surugayaScrapper.Result
|
||||
}
|
||||
var file_scrapper_proto_depIdxs = []int32{
|
||||
0, // 0: surugayaScrapper.SurugayaScrapper.ProcessTasks:input_type -> surugayaScrapper.Task
|
||||
1, // 1: surugayaScrapper.SurugayaScrapper.ProcessTasks:output_type -> surugayaScrapper.Result
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_scrapper_proto_init() }
|
||||
func file_scrapper_proto_init() {
|
||||
if File_scrapper_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_scrapper_proto_rawDesc), len(file_scrapper_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_scrapper_proto_goTypes,
|
||||
DependencyIndexes: file_scrapper_proto_depIdxs,
|
||||
MessageInfos: file_scrapper_proto_msgTypes,
|
||||
}.Build()
|
||||
File_scrapper_proto = out.File
|
||||
file_scrapper_proto_goTypes = nil
|
||||
file_scrapper_proto_depIdxs = nil
|
||||
}
|
||||
115
proto/surugayaScrapper/scrapper_grpc.pb.go
Normal file
115
proto/surugayaScrapper/scrapper_grpc.pb.go
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.32.0
|
||||
// source: scrapper.proto
|
||||
|
||||
package surugayaScrapper
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// 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.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
SurugayaScrapper_ProcessTasks_FullMethodName = "/surugayaScrapper.SurugayaScrapper/ProcessTasks"
|
||||
)
|
||||
|
||||
// SurugayaScrapperClient is the client API for SurugayaScrapper service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type SurugayaScrapperClient interface {
|
||||
ProcessTasks(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Task, Result], error)
|
||||
}
|
||||
|
||||
type surugayaScrapperClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSurugayaScrapperClient(cc grpc.ClientConnInterface) SurugayaScrapperClient {
|
||||
return &surugayaScrapperClient{cc}
|
||||
}
|
||||
|
||||
func (c *surugayaScrapperClient) ProcessTasks(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Task, Result], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &SurugayaScrapper_ServiceDesc.Streams[0], SurugayaScrapper_ProcessTasks_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[Task, Result]{ClientStream: stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SurugayaScrapper_ProcessTasksClient = grpc.BidiStreamingClient[Task, Result]
|
||||
|
||||
// SurugayaScrapperServer is the server API for SurugayaScrapper service.
|
||||
// All implementations must embed UnimplementedSurugayaScrapperServer
|
||||
// for forward compatibility.
|
||||
type SurugayaScrapperServer interface {
|
||||
ProcessTasks(grpc.BidiStreamingServer[Task, Result]) error
|
||||
mustEmbedUnimplementedSurugayaScrapperServer()
|
||||
}
|
||||
|
||||
// UnimplementedSurugayaScrapperServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedSurugayaScrapperServer struct{}
|
||||
|
||||
func (UnimplementedSurugayaScrapperServer) ProcessTasks(grpc.BidiStreamingServer[Task, Result]) error {
|
||||
return status.Errorf(codes.Unimplemented, "method ProcessTasks not implemented")
|
||||
}
|
||||
func (UnimplementedSurugayaScrapperServer) mustEmbedUnimplementedSurugayaScrapperServer() {}
|
||||
func (UnimplementedSurugayaScrapperServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeSurugayaScrapperServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to SurugayaScrapperServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeSurugayaScrapperServer interface {
|
||||
mustEmbedUnimplementedSurugayaScrapperServer()
|
||||
}
|
||||
|
||||
func RegisterSurugayaScrapperServer(s grpc.ServiceRegistrar, srv SurugayaScrapperServer) {
|
||||
// If the following call pancis, it indicates UnimplementedSurugayaScrapperServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&SurugayaScrapper_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _SurugayaScrapper_ProcessTasks_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(SurugayaScrapperServer).ProcessTasks(&grpc.GenericServerStream[Task, Result]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SurugayaScrapper_ProcessTasksServer = grpc.BidiStreamingServer[Task, Result]
|
||||
|
||||
// SurugayaScrapper_ServiceDesc is the grpc.ServiceDesc for SurugayaScrapper service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var SurugayaScrapper_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "surugayaScrapper.SurugayaScrapper",
|
||||
HandlerType: (*SurugayaScrapperServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "ProcessTasks",
|
||||
Handler: _SurugayaScrapper_ProcessTasks_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "scrapper.proto",
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue