grpc

package
v0.0.0-...-b3eaea6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hasher_GetHashes_FullMethodName = "/hasher.Hasher/GetHashes"
)

Variables

View Source
var (
	HashType_name = map[int32]string{
		0: "HASH_UNSPECIFIED",
		1: "HASH_SHA256",
		2: "HASH_SHA512",
	}
	HashType_value = map[string]int32{
		"HASH_UNSPECIFIED": 0,
		"HASH_SHA256":      1,
		"HASH_SHA512":      2,
	}
)

Enum value maps for HashType.

View Source
var File_hasher_proto protoreflect.FileDescriptor
View Source
var Hasher_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hasher.Hasher",
	HandlerType: (*HasherServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetHashes",
			Handler:    _Hasher_GetHashes_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "hasher.proto",
}

Hasher_ServiceDesc is the grpc.ServiceDesc for Hasher service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHasherServer

func RegisterHasherServer(s grpc.ServiceRegistrar, srv HasherServer)

Types

type Handler

type Handler struct {
	Port    int
	Usecase IUsecase
}

func New

func New(port int, uc IUsecase) *Handler

func (*Handler) GetHashes

func (h *Handler) GetHashes(ctx context.Context, request *HashRequest) (response *HashResponse, err error)

func (*Handler) Run

func (h *Handler) Run() error

type HashRequest

type HashRequest struct {
	Items []*HashRequestItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*HashRequest) Descriptor deprecated

func (*HashRequest) Descriptor() ([]byte, []int)

Deprecated: Use HashRequest.ProtoReflect.Descriptor instead.

func (*HashRequest) GetItems

func (x *HashRequest) GetItems() []*HashRequestItem

func (*HashRequest) ProtoMessage

func (*HashRequest) ProtoMessage()

func (*HashRequest) ProtoReflect

func (x *HashRequest) ProtoReflect() protoreflect.Message

func (*HashRequest) Reset

func (x *HashRequest) Reset()

func (*HashRequest) String

func (x *HashRequest) String() string

type HashRequestItem

type HashRequestItem struct {
	Id   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type HashType `protobuf:"varint,2,opt,name=type,proto3,enum=hasher.HashType" json:"type,omitempty"`
	Data string   `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*HashRequestItem) Descriptor deprecated

func (*HashRequestItem) Descriptor() ([]byte, []int)

Deprecated: Use HashRequestItem.ProtoReflect.Descriptor instead.

func (*HashRequestItem) GetData

func (x *HashRequestItem) GetData() string

func (*HashRequestItem) GetId

func (x *HashRequestItem) GetId() string

func (*HashRequestItem) GetType

func (x *HashRequestItem) GetType() HashType

func (*HashRequestItem) ProtoMessage

func (*HashRequestItem) ProtoMessage()

func (*HashRequestItem) ProtoReflect

func (x *HashRequestItem) ProtoReflect() protoreflect.Message

func (*HashRequestItem) Reset

func (x *HashRequestItem) Reset()

func (*HashRequestItem) String

func (x *HashRequestItem) String() string

type HashResponse

type HashResponse struct {
	Message string              `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Items   []*HashResponseItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*HashResponse) Descriptor deprecated

func (*HashResponse) Descriptor() ([]byte, []int)

Deprecated: Use HashResponse.ProtoReflect.Descriptor instead.

func (*HashResponse) GetItems

func (x *HashResponse) GetItems() []*HashResponseItem

func (*HashResponse) GetMessage

func (x *HashResponse) GetMessage() string

func (*HashResponse) ProtoMessage

func (*HashResponse) ProtoMessage()

func (*HashResponse) ProtoReflect

func (x *HashResponse) ProtoReflect() protoreflect.Message

func (*HashResponse) Reset

func (x *HashResponse) Reset()

func (*HashResponse) String

func (x *HashResponse) String() string

type HashResponseItem

type HashResponseItem struct {
	Id     string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*HashResponseItem) Descriptor deprecated

func (*HashResponseItem) Descriptor() ([]byte, []int)

Deprecated: Use HashResponseItem.ProtoReflect.Descriptor instead.

func (*HashResponseItem) GetId

func (x *HashResponseItem) GetId() string

func (*HashResponseItem) GetResult

func (x *HashResponseItem) GetResult() string

func (*HashResponseItem) ProtoMessage

func (*HashResponseItem) ProtoMessage()

func (*HashResponseItem) ProtoReflect

func (x *HashResponseItem) ProtoReflect() protoreflect.Message

func (*HashResponseItem) Reset

func (x *HashResponseItem) Reset()

func (*HashResponseItem) String

func (x *HashResponseItem) String() string

type HashType

type HashType int32
const (
	HashType_HASH_UNSPECIFIED HashType = 0
	HashType_HASH_SHA256      HashType = 1
	HashType_HASH_SHA512      HashType = 2
)

func (HashType) Descriptor

func (HashType) Descriptor() protoreflect.EnumDescriptor

func (HashType) Enum

func (x HashType) Enum() *HashType

func (HashType) EnumDescriptor deprecated

func (HashType) EnumDescriptor() ([]byte, []int)

Deprecated: Use HashType.Descriptor instead.

func (HashType) Number

func (x HashType) Number() protoreflect.EnumNumber

func (HashType) String

func (x HashType) String() string

func (HashType) Type

type HasherClient

type HasherClient interface {
	GetHashes(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error)
}

HasherClient is the client API for Hasher 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.

func NewHasherClient

func NewHasherClient(cc grpc.ClientConnInterface) HasherClient

type HasherServer

type HasherServer interface {
	GetHashes(context.Context, *HashRequest) (*HashResponse, error)
	// contains filtered or unexported methods
}

HasherServer is the server API for Hasher service. All implementations must embed UnimplementedHasherServer for forward compatibility

type IUsecase

type IUsecase interface {
	GetHashes(ctx context.Context, req []entity.HashRequestItem) ([]entity.HashResponseItem, error)
}

type UnimplementedHasherServer

type UnimplementedHasherServer struct {
}

UnimplementedHasherServer must be embedded to have forward compatible implementations.

func (UnimplementedHasherServer) GetHashes

type UnsafeHasherServer

type UnsafeHasherServer interface {
	// contains filtered or unexported methods
}

UnsafeHasherServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HasherServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL