protos

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package protos is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	LDLM_Lock_FullMethodName    = "/ldlm.LDLM/Lock"
	LDLM_TryLock_FullMethodName = "/ldlm.LDLM/TryLock"
	LDLM_Unlock_FullMethodName  = "/ldlm.LDLM/Unlock"
	LDLM_Renew_FullMethodName   = "/ldlm.LDLM/Renew"
)

Variables

View Source
var (
	ErrorCode_name = map[int32]string{
		0: "Unknown",
		1: "LockDoesNotExist",
		2: "InvalidLockKey",
		3: "LockWaitTimeout",
		4: "NotLocked",
		5: "LockDoesNotExistOrInvalidKey",
		6: "LockSizeMismatch",
		7: "InvalidLockSize",
	}
	ErrorCode_value = map[string]int32{
		"Unknown":                      0,
		"LockDoesNotExist":             1,
		"InvalidLockKey":               2,
		"LockWaitTimeout":              3,
		"NotLocked":                    4,
		"LockDoesNotExistOrInvalidKey": 5,
		"LockSizeMismatch":             6,
		"InvalidLockSize":              7,
	}
)

Enum value maps for ErrorCode.

View Source
var LDLM_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "ldlm.LDLM",
	HandlerType: (*LDLMServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Lock",
			Handler:    _LDLM_Lock_Handler,
		},
		{
			MethodName: "TryLock",
			Handler:    _LDLM_TryLock_Handler,
		},
		{
			MethodName: "Unlock",
			Handler:    _LDLM_Unlock_Handler,
		},
		{
			MethodName: "Renew",
			Handler:    _LDLM_Renew_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "ldlm.proto",
}

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

Functions

func RegisterLDLMHandler

func RegisterLDLMHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterLDLMHandler registers the http handlers for service LDLM to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterLDLMHandlerClient

func RegisterLDLMHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LDLMClient) error

RegisterLDLMHandlerClient registers the http handlers for service LDLM to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LDLMClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LDLMClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "LDLMClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterLDLMHandlerFromEndpoint

func RegisterLDLMHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterLDLMHandlerFromEndpoint is same as RegisterLDLMHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterLDLMHandlerServer

func RegisterLDLMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LDLMServer) error

RegisterLDLMHandlerServer registers the http handlers for service LDLM to "mux". UnaryRPC :call LDLMServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLDLMHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterLDLMServer

func RegisterLDLMServer(s grpc.ServiceRegistrar, srv LDLMServer)

Types

type Error

type Error struct {
	Code    ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ldlm.ErrorCode" json:"code,omitempty"`
	Message string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() ErrorCode

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_Unknown                      ErrorCode = 0
	ErrorCode_LockDoesNotExist             ErrorCode = 1
	ErrorCode_InvalidLockKey               ErrorCode = 2
	ErrorCode_LockWaitTimeout              ErrorCode = 3
	ErrorCode_NotLocked                    ErrorCode = 4
	ErrorCode_LockDoesNotExistOrInvalidKey ErrorCode = 5
	ErrorCode_LockSizeMismatch             ErrorCode = 6
	ErrorCode_InvalidLockSize              ErrorCode = 7
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

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

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type LDLMClient

type LDLMClient interface {
	Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error)
	TryLock(ctx context.Context, in *TryLockRequest, opts ...grpc.CallOption) (*LockResponse, error)
	Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error)
	Renew(ctx context.Context, in *RenewRequest, opts ...grpc.CallOption) (*LockResponse, error)
}

LDLMClient is the client API for LDLM 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 NewLDLMClient

func NewLDLMClient(cc grpc.ClientConnInterface) LDLMClient

type LDLMServer

type LDLMServer interface {
	Lock(context.Context, *LockRequest) (*LockResponse, error)
	TryLock(context.Context, *TryLockRequest) (*LockResponse, error)
	Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error)
	Renew(context.Context, *RenewRequest) (*LockResponse, error)
	// contains filtered or unexported methods
}

LDLMServer is the server API for LDLM service. All implementations must embed UnimplementedLDLMServer for forward compatibility.

type LockRequest

type LockRequest struct {
	Name               string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	WaitTimeoutSeconds *int32 `protobuf:"varint,3,opt,name=wait_timeout_seconds,json=waitTimeoutSeconds,proto3,oneof" json:"wait_timeout_seconds,omitempty"`
	LockTimeoutSeconds *int32 `` /* 126-byte string literal not displayed */
	Size               *int32 `protobuf:"varint,4,opt,name=size,proto3,oneof" json:"size,omitempty"`
	// contains filtered or unexported fields
}

func (*LockRequest) Descriptor deprecated

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

Deprecated: Use LockRequest.ProtoReflect.Descriptor instead.

func (*LockRequest) GetLockTimeoutSeconds

func (x *LockRequest) GetLockTimeoutSeconds() int32

func (*LockRequest) GetName

func (x *LockRequest) GetName() string

func (*LockRequest) GetSize

func (x *LockRequest) GetSize() int32

func (*LockRequest) GetWaitTimeoutSeconds

func (x *LockRequest) GetWaitTimeoutSeconds() int32

func (*LockRequest) ProtoMessage

func (*LockRequest) ProtoMessage()

func (*LockRequest) ProtoReflect

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

func (*LockRequest) Reset

func (x *LockRequest) Reset()

func (*LockRequest) String

func (x *LockRequest) String() string

type LockResponse

type LockResponse struct {
	Locked bool   `protobuf:"varint,1,opt,name=locked,proto3" json:"locked,omitempty"`
	Name   string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Key    string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
	Error  *Error `protobuf:"bytes,4,opt,name=error,proto3,oneof" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*LockResponse) Descriptor deprecated

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

Deprecated: Use LockResponse.ProtoReflect.Descriptor instead.

func (*LockResponse) GetError

func (x *LockResponse) GetError() *Error

func (*LockResponse) GetKey

func (x *LockResponse) GetKey() string

func (*LockResponse) GetLocked

func (x *LockResponse) GetLocked() bool

func (*LockResponse) GetName

func (x *LockResponse) GetName() string

func (*LockResponse) ProtoMessage

func (*LockResponse) ProtoMessage()

func (*LockResponse) ProtoReflect

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

func (*LockResponse) Reset

func (x *LockResponse) Reset()

func (*LockResponse) String

func (x *LockResponse) String() string

type RenewRequest

type RenewRequest struct {
	Name               string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Key                string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	LockTimeoutSeconds int32  `protobuf:"varint,100,opt,name=lock_timeout_seconds,json=lockTimeoutSeconds,proto3" json:"lock_timeout_seconds,omitempty"`
	// contains filtered or unexported fields
}

func (*RenewRequest) Descriptor deprecated

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

Deprecated: Use RenewRequest.ProtoReflect.Descriptor instead.

func (*RenewRequest) GetKey

func (x *RenewRequest) GetKey() string

func (*RenewRequest) GetLockTimeoutSeconds

func (x *RenewRequest) GetLockTimeoutSeconds() int32

func (*RenewRequest) GetName

func (x *RenewRequest) GetName() string

func (*RenewRequest) ProtoMessage

func (*RenewRequest) ProtoMessage()

func (*RenewRequest) ProtoReflect

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

func (*RenewRequest) Reset

func (x *RenewRequest) Reset()

func (*RenewRequest) String

func (x *RenewRequest) String() string

type TryLockRequest

type TryLockRequest struct {
	Name               string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	LockTimeoutSeconds *int32 `` /* 126-byte string literal not displayed */
	Size               *int32 `protobuf:"varint,4,opt,name=size,proto3,oneof" json:"size,omitempty"`
	// contains filtered or unexported fields
}

func (*TryLockRequest) Descriptor deprecated

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

Deprecated: Use TryLockRequest.ProtoReflect.Descriptor instead.

func (*TryLockRequest) GetLockTimeoutSeconds

func (x *TryLockRequest) GetLockTimeoutSeconds() int32

func (*TryLockRequest) GetName

func (x *TryLockRequest) GetName() string

func (*TryLockRequest) GetSize

func (x *TryLockRequest) GetSize() int32

func (*TryLockRequest) ProtoMessage

func (*TryLockRequest) ProtoMessage()

func (*TryLockRequest) ProtoReflect

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

func (*TryLockRequest) Reset

func (x *TryLockRequest) Reset()

func (*TryLockRequest) String

func (x *TryLockRequest) String() string

type UnimplementedLDLMServer

type UnimplementedLDLMServer struct{}

UnimplementedLDLMServer 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.

func (UnimplementedLDLMServer) Lock

func (UnimplementedLDLMServer) Renew

func (UnimplementedLDLMServer) TryLock

func (UnimplementedLDLMServer) Unlock

type UnlockRequest

type UnlockRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Key  string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockRequest) Descriptor deprecated

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

Deprecated: Use UnlockRequest.ProtoReflect.Descriptor instead.

func (*UnlockRequest) GetKey

func (x *UnlockRequest) GetKey() string

func (*UnlockRequest) GetName

func (x *UnlockRequest) GetName() string

func (*UnlockRequest) ProtoMessage

func (*UnlockRequest) ProtoMessage()

func (*UnlockRequest) ProtoReflect

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

func (*UnlockRequest) Reset

func (x *UnlockRequest) Reset()

func (*UnlockRequest) String

func (x *UnlockRequest) String() string

type UnlockResponse

type UnlockResponse struct {
	Unlocked bool   `protobuf:"varint,1,opt,name=unlocked,proto3" json:"unlocked,omitempty"`
	Name     string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Error    *Error `protobuf:"bytes,3,opt,name=error,proto3,oneof" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*UnlockResponse) Descriptor deprecated

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

Deprecated: Use UnlockResponse.ProtoReflect.Descriptor instead.

func (*UnlockResponse) GetError

func (x *UnlockResponse) GetError() *Error

func (*UnlockResponse) GetName

func (x *UnlockResponse) GetName() string

func (*UnlockResponse) GetUnlocked

func (x *UnlockResponse) GetUnlocked() bool

func (*UnlockResponse) ProtoMessage

func (*UnlockResponse) ProtoMessage()

func (*UnlockResponse) ProtoReflect

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

func (*UnlockResponse) Reset

func (x *UnlockResponse) Reset()

func (*UnlockResponse) String

func (x *UnlockResponse) String() string

type UnsafeLDLMServer

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

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

Jump to

Keyboard shortcuts

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