client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_locker_proto protoreflect.FileDescriptor
View Source
var Locker_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "ru.softlynx.locker.api.Locker",
	HandlerType: (*LockerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Lock",
			Handler:       _Locker_Lock_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "TryLock",
			Handler:       _Locker_TryLock_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "locker.proto",
}

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

Functions

func RegisterLockerServer

func RegisterLockerServer(s grpc.ServiceRegistrar, srv LockerServer)

Types

type Entity

type Entity struct {

	// идентификатор владения
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Entity) Descriptor deprecated

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

Deprecated: Use Entity.ProtoReflect.Descriptor instead.

func (*Entity) GetName

func (x *Entity) GetName() string

func (*Entity) ProtoMessage

func (*Entity) ProtoMessage()

func (*Entity) ProtoReflect

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

func (*Entity) Reset

func (x *Entity) Reset()

func (*Entity) String

func (x *Entity) String() string

type Locker

type Locker struct {
	// contains filtered or unexported fields
}

func NewLocker

func NewLocker(apiEndpoint string, apiKey string, insecure bool) (*Locker, error)

func (*Locker) Lock

func (l *Locker) Lock(ctx context.Context, name string) error

func (*Locker) TryLock

func (l *Locker) TryLock(ctx context.Context, name string) (bool, error)

type LockerClient

type LockerClient interface {
	// Запрашивает блокировку имени Entity.name, как только она будет получена возвращает Entity и владеет именем до отмены вызова клиентом
	Lock(ctx context.Context, in *Entity, opts ...grpc.CallOption) (Locker_LockClient, error)
	// Запрашивает блокировку имени Entity.name, если она будет получена возвращает Entity и владеет именем до отмены вызова клиентом
	// либо возвращает пустой поток если получить блокировку не удалось
	TryLock(ctx context.Context, in *Entity, opts ...grpc.CallOption) (Locker_TryLockClient, error)
}

LockerClient is the client API for Locker 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 NewLockerClient

func NewLockerClient(cc grpc.ClientConnInterface) LockerClient

type LockerServer

type LockerServer interface {
	// Запрашивает блокировку имени Entity.name, как только она будет получена возвращает Entity и владеет именем до отмены вызова клиентом
	Lock(*Entity, Locker_LockServer) error
	// Запрашивает блокировку имени Entity.name, если она будет получена возвращает Entity и владеет именем до отмены вызова клиентом
	// либо возвращает пустой поток если получить блокировку не удалось
	TryLock(*Entity, Locker_TryLockServer) error
}

LockerServer is the server API for Locker service. All implementations should embed UnimplementedLockerServer for forward compatibility

type Locker_LockClient

type Locker_LockClient interface {
	Recv() (*Entity, error)
	grpc.ClientStream
}

type Locker_LockServer

type Locker_LockServer interface {
	Send(*Entity) error
	grpc.ServerStream
}

type Locker_TryLockClient

type Locker_TryLockClient interface {
	Recv() (*Entity, error)
	grpc.ClientStream
}

type Locker_TryLockServer

type Locker_TryLockServer interface {
	Send(*Entity) error
	grpc.ServerStream
}

type UnimplementedLockerServer

type UnimplementedLockerServer struct {
}

UnimplementedLockerServer should be embedded to have forward compatible implementations.

func (UnimplementedLockerServer) Lock

func (UnimplementedLockerServer) TryLock

type UnsafeLockerServer

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

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

Jump to

Keyboard shortcuts

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