diff options
| author | Nicolas Paul <n@nc0.fr> | 2023-04-25 12:08:12 +0200 | 
|---|---|---|
| committer | Nicolas Paul <n@nc0.fr> | 2023-04-25 12:08:12 +0200 | 
| commit | afef100dbf70c34d94056f6aff7714355d9e423c (patch) | |
| tree | b35c283e56bd6e019851769d622f82fcdaeee471 /api/nc0/clawflake/generator/v3 | |
| parent | 8c2948e788cb7ec8499cff3b926e091a1d36c964 (diff) | |
Change domain
Diffstat (limited to 'api/nc0/clawflake/generator/v3')
| -rw-r--r-- | api/nc0/clawflake/generator/v3/generator.pb.go | 242 | ||||
| -rw-r--r-- | api/nc0/clawflake/generator/v3/generator.proto | 40 | ||||
| -rw-r--r-- | api/nc0/clawflake/generator/v3/generator_grpc.pb.go | 107 | 
3 files changed, 389 insertions, 0 deletions
diff --git a/api/nc0/clawflake/generator/v3/generator.pb.go b/api/nc0/clawflake/generator/v3/generator.pb.go new file mode 100644 index 0000000..37e1d04 --- /dev/null +++ b/api/nc0/clawflake/generator/v3/generator.pb.go @@ -0,0 +1,242 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// 	protoc-gen-go v1.28.1 +// 	protoc        v3.21.12 +// source: api/nc0/clawflake/generator/v3/generator.proto + +package v3 + +import ( +	_ "google.golang.org/genproto/googleapis/api/annotations" +	protoreflect "google.golang.org/protobuf/reflect/protoreflect" +	protoimpl "google.golang.org/protobuf/runtime/protoimpl" +	reflect "reflect" +	sync "sync" +) + +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) +) + +// The request of a Generate RPC. +type GenerateRequest struct { +	state         protoimpl.MessageState +	sizeCache     protoimpl.SizeCache +	unknownFields protoimpl.UnknownFields + +	// The amount of ID numbers to generate. +	// The value should be in the interval [1, 4096]. +	// Values not in the interval will not be coerced and the request will be +	// aborted. +	Amount uint32 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *GenerateRequest) Reset() { +	*x = GenerateRequest{} +	if protoimpl.UnsafeEnabled { +		mi := &file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[0] +		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) +		ms.StoreMessageInfo(mi) +	} +} + +func (x *GenerateRequest) String() string { +	return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateRequest) ProtoMessage() {} + +func (x *GenerateRequest) ProtoReflect() protoreflect.Message { +	mi := &file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[0] +	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 GenerateRequest.ProtoReflect.Descriptor instead. +func (*GenerateRequest) Descriptor() ([]byte, []int) { +	return file_api_nc0_clawflake_generator_v3_generator_proto_rawDescGZIP(), []int{0} +} + +func (x *GenerateRequest) GetAmount() uint32 { +	if x != nil { +		return x.Amount +	} +	return 0 +} + +// The response of a Generate RPC. +type GenerateResponse struct { +	state         protoimpl.MessageState +	sizeCache     protoimpl.SizeCache +	unknownFields protoimpl.UnknownFields + +	// The generate ID numbers. +	IdNumbers []string `protobuf:"bytes,1,rep,name=id_numbers,json=idNumbers,proto3" json:"id_numbers,omitempty"` +} + +func (x *GenerateResponse) Reset() { +	*x = GenerateResponse{} +	if protoimpl.UnsafeEnabled { +		mi := &file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[1] +		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) +		ms.StoreMessageInfo(mi) +	} +} + +func (x *GenerateResponse) String() string { +	return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateResponse) ProtoMessage() {} + +func (x *GenerateResponse) ProtoReflect() protoreflect.Message { +	mi := &file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[1] +	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 GenerateResponse.ProtoReflect.Descriptor instead. +func (*GenerateResponse) Descriptor() ([]byte, []int) { +	return file_api_nc0_clawflake_generator_v3_generator_proto_rawDescGZIP(), []int{1} +} + +func (x *GenerateResponse) GetIdNumbers() []string { +	if x != nil { +		return x.IdNumbers +	} +	return nil +} + +var File_api_nc0_clawflake_generator_v3_generator_proto protoreflect.FileDescriptor + +var file_api_nc0_clawflake_generator_v3_generator_proto_rawDesc = []byte{ +	0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x63, 0x30, 0x2f, 0x63, 0x6c, 0x61, 0x77, 0x66, 0x6c, +	0x61, 0x6b, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x76, 0x33, +	0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, +	0x12, 0x1a, 0x6e, 0x63, 0x30, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2e, +	0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x33, 0x1a, 0x1c, 0x67, 0x6f, +	0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, +	0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, +	0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, +	0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, +	0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, +	0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, +	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, +	0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x06, 0x61, 0x6d, +	0x6f, 0x75, 0x6e, 0x74, 0x22, 0x36, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, +	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x69, 0x64, 0x5f, 0x6e, +	0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, +	0x06, 0x52, 0x09, 0x69, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x32, 0xa0, 0x01, 0x0a, +	0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, +	0x65, 0x12, 0x8b, 0x01, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x2b, +	0x2e, 0x6e, 0x63, 0x30, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2e, 0x67, +	0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x65, 0x6e, 0x65, +	0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x63, +	0x30, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2e, 0x67, 0x65, 0x6e, 0x65, +	0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, +	0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, +	0x15, 0x22, 0x10, 0x2f, 0x76, 0x33, 0x2f, 0x69, 0x64, 0x73, 0x3a, 0x67, 0x65, 0x6e, 0x65, 0x72, +	0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0xda, 0x41, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, +	0x82, 0x01, 0x0a, 0x1d, 0x66, 0x72, 0x2e, 0x6e, 0x63, 0x30, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x66, +	0x6c, 0x61, 0x6b, 0x65, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x76, +	0x33, 0x42, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, +	0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x2e, 0x6e, 0x63, 0x30, 0x2e, 0x66, 0x72, 0x2f, 0x63, +	0x6c, 0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x63, 0x30, +	0x2f, 0x63, 0x6c, 0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, +	0x61, 0x74, 0x6f, 0x72, 0x2f, 0x76, 0x33, 0xaa, 0x02, 0x1a, 0x4e, 0x63, 0x30, 0x2e, 0x43, 0x6c, +	0x61, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, +	0x72, 0x2e, 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( +	file_api_nc0_clawflake_generator_v3_generator_proto_rawDescOnce sync.Once +	file_api_nc0_clawflake_generator_v3_generator_proto_rawDescData = file_api_nc0_clawflake_generator_v3_generator_proto_rawDesc +) + +func file_api_nc0_clawflake_generator_v3_generator_proto_rawDescGZIP() []byte { +	file_api_nc0_clawflake_generator_v3_generator_proto_rawDescOnce.Do(func() { +		file_api_nc0_clawflake_generator_v3_generator_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_nc0_clawflake_generator_v3_generator_proto_rawDescData) +	}) +	return file_api_nc0_clawflake_generator_v3_generator_proto_rawDescData +} + +var file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_nc0_clawflake_generator_v3_generator_proto_goTypes = []interface{}{ +	(*GenerateRequest)(nil),  // 0: nc0.clawflake.generator.v3.GenerateRequest +	(*GenerateResponse)(nil), // 1: nc0.clawflake.generator.v3.GenerateResponse +} +var file_api_nc0_clawflake_generator_v3_generator_proto_depIdxs = []int32{ +	0, // 0: nc0.clawflake.generator.v3.GeneratorService.Generate:input_type -> nc0.clawflake.generator.v3.GenerateRequest +	1, // 1: nc0.clawflake.generator.v3.GeneratorService.Generate:output_type -> nc0.clawflake.generator.v3.GenerateResponse +	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_api_nc0_clawflake_generator_v3_generator_proto_init() } +func file_api_nc0_clawflake_generator_v3_generator_proto_init() { +	if File_api_nc0_clawflake_generator_v3_generator_proto != nil { +		return +	} +	if !protoimpl.UnsafeEnabled { +		file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { +			switch v := v.(*GenerateRequest); i { +			case 0: +				return &v.state +			case 1: +				return &v.sizeCache +			case 2: +				return &v.unknownFields +			default: +				return nil +			} +		} +		file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { +			switch v := v.(*GenerateResponse); 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_nc0_clawflake_generator_v3_generator_proto_rawDesc, +			NumEnums:      0, +			NumMessages:   2, +			NumExtensions: 0, +			NumServices:   1, +		}, +		GoTypes:           file_api_nc0_clawflake_generator_v3_generator_proto_goTypes, +		DependencyIndexes: file_api_nc0_clawflake_generator_v3_generator_proto_depIdxs, +		MessageInfos:      file_api_nc0_clawflake_generator_v3_generator_proto_msgTypes, +	}.Build() +	File_api_nc0_clawflake_generator_v3_generator_proto = out.File +	file_api_nc0_clawflake_generator_v3_generator_proto_rawDesc = nil +	file_api_nc0_clawflake_generator_v3_generator_proto_goTypes = nil +	file_api_nc0_clawflake_generator_v3_generator_proto_depIdxs = nil +} diff --git a/api/nc0/clawflake/generator/v3/generator.proto b/api/nc0/clawflake/generator/v3/generator.proto new file mode 100644 index 0000000..605790c --- /dev/null +++ b/api/nc0/clawflake/generator/v3/generator.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package nc0.clawflake.generator.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Nc0.Clawflake.Generator.V3"; +option go_package = "go.nc0.fr/clawflake/api/nc0/clawflake/generator/v3"; +option java_package = "fr.nc0.clawflake.generator.v3"; +option java_multiple_files = true; +option java_outer_classname = "GeneratorProto"; + +// The generator service allows requesting a new ID. +service GeneratorService { +  // Generate ID numbers. +  rpc Generate(GenerateRequest) returns (GenerateResponse) { +    option (google.api.http) = { +      post: "/v3/ids:generate" +      body: "*" +    }; +    option (google.api.method_signature) = "amount"; +  } +} + +// The request of a Generate RPC. +message GenerateRequest { +  // The amount of ID numbers to generate. +  // The value should be in the interval [1, 4096]. +  // Values not in the interval will not be coerced and the request will be +  // aborted. +  uint32 amount = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a Generate RPC. +message GenerateResponse { +  // The generate ID numbers. +  repeated string id_numbers = 1 [(google.api.field_behavior) = UNORDERED_LIST]; +}
\ No newline at end of file diff --git a/api/nc0/clawflake/generator/v3/generator_grpc.pb.go b/api/nc0/clawflake/generator/v3/generator_grpc.pb.go new file mode 100644 index 0000000..fe9432a --- /dev/null +++ b/api/nc0/clawflake/generator/v3/generator_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc             v3.21.12 +// source: api/nc0/clawflake/generator/v3/generator.proto + +package v3 + +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.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// GeneratorServiceClient is the client API for GeneratorService 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 GeneratorServiceClient interface { +	// Generate ID numbers. +	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) +} + +type generatorServiceClient struct { +	cc grpc.ClientConnInterface +} + +func NewGeneratorServiceClient(cc grpc.ClientConnInterface) GeneratorServiceClient { +	return &generatorServiceClient{cc} +} + +func (c *generatorServiceClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { +	out := new(GenerateResponse) +	err := c.cc.Invoke(ctx, "/nc0.clawflake.generator.v3.GeneratorService/Generate", in, out, opts...) +	if err != nil { +		return nil, err +	} +	return out, nil +} + +// GeneratorServiceServer is the server API for GeneratorService service. +// All implementations must embed UnimplementedGeneratorServiceServer +// for forward compatibility +type GeneratorServiceServer interface { +	// Generate ID numbers. +	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) +	mustEmbedUnimplementedGeneratorServiceServer() +} + +// UnimplementedGeneratorServiceServer must be embedded to have forward compatible implementations. +type UnimplementedGeneratorServiceServer struct { +} + +func (UnimplementedGeneratorServiceServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { +	return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") +} +func (UnimplementedGeneratorServiceServer) mustEmbedUnimplementedGeneratorServiceServer() {} + +// UnsafeGeneratorServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GeneratorServiceServer will +// result in compilation errors. +type UnsafeGeneratorServiceServer interface { +	mustEmbedUnimplementedGeneratorServiceServer() +} + +func RegisterGeneratorServiceServer(s grpc.ServiceRegistrar, srv GeneratorServiceServer) { +	s.RegisterService(&GeneratorService_ServiceDesc, srv) +} + +func _GeneratorService_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +	in := new(GenerateRequest) +	if err := dec(in); err != nil { +		return nil, err +	} +	if interceptor == nil { +		return srv.(GeneratorServiceServer).Generate(ctx, in) +	} +	info := &grpc.UnaryServerInfo{ +		Server:     srv, +		FullMethod: "/nc0.clawflake.generator.v3.GeneratorService/Generate", +	} +	handler := func(ctx context.Context, req interface{}) (interface{}, error) { +		return srv.(GeneratorServiceServer).Generate(ctx, req.(*GenerateRequest)) +	} +	return interceptor(ctx, in, info, handler) +} + +// GeneratorService_ServiceDesc is the grpc.ServiceDesc for GeneratorService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GeneratorService_ServiceDesc = grpc.ServiceDesc{ +	ServiceName: "nc0.clawflake.generator.v3.GeneratorService", +	HandlerType: (*GeneratorServiceServer)(nil), +	Methods: []grpc.MethodDesc{ +		{ +			MethodName: "Generate", +			Handler:    _GeneratorService_Generate_Handler, +		}, +	}, +	Streams:  []grpc.StreamDesc{}, +	Metadata: "api/nc0/clawflake/generator/v3/generator.proto", +}  | 
