Documentation ¶
Overview ¶
This file contains LockSrv methods for handling client connects and disconnects. It is specified as a grpc.StatsHandler and implements the grpc.stats.Handler interface. This is the only way to hook into client connect and disconnect events in a gRPC server in go.
This file contains the gRPC exposed, protocol buffer defined services for the ldlm lock server. The ldlm lock server is essentially a gRPC wrapper around a single lock.Manager which manages a group of locks.
Index ¶
- Variables
- type LockSrv
- func (l *LockSrv) HandleConn(ctx context.Context, s stats.ConnStats)
- func (l *LockSrv) HandleRPC(ctx context.Context, s stats.RPCStats)
- func (l *LockSrv) Lock(ctx context.Context, r *pb.LockRequest) (*pb.LockResponse, error)
- func (l *LockSrv) Locks() []cl.ClientLock
- func (l *LockSrv) RefreshLock(ctx context.Context, r *pb.RefreshLockRequest) (*pb.LockResponse, error)
- func (l *LockSrv) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (l *LockSrv) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- func (l *LockSrv) TryLock(ctx context.Context, r *pb.TryLockRequest) (*pb.LockResponse, error)
- func (l *LockSrv) Unlock(ctx context.Context, r *pb.UnlockRequest) (*pb.UnlockResponse, error)
- type LockSrvConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrLockWaitTimeout = errors.New("timeout waiting to acquire lock") ErrEmptyName = errors.New("lock name cannot be empty") )
Functions ¶
This section is empty.
Types ¶
type LockSrv ¶
type LockSrv struct { pb.UnsafeLDLMServer // contains filtered or unexported fields }
RPC and connection handler struct
func (*LockSrv) HandleConn ¶
HandleConn handles connection and disconnection of clients
func (*LockSrv) Lock ¶
func (l *LockSrv) Lock(ctx context.Context, r *pb.LockRequest) (*pb.LockResponse, error)
Lock blocks until the lock is obtained or is canceled / timed out by context
func (*LockSrv) Locks ¶
func (l *LockSrv) Locks() []cl.ClientLock
Locks returns a list of client locks.
func (*LockSrv) RefreshLock ¶
func (l *LockSrv) RefreshLock(ctx context.Context, r *pb.RefreshLockRequest) (*pb.LockResponse, error)
RefreshLock refreshes a lock timer
func (*LockSrv) TagConn ¶
TagConn tags each new connection with a unique session key that is used when the client associated with this connection locks any lock.
func (*LockSrv) TryLock ¶
func (l *LockSrv) TryLock(ctx context.Context, r *pb.TryLockRequest) (*pb.LockResponse, error)
TryLock attempts to acquire the lock and immediately fails or succeeds
func (*LockSrv) Unlock ¶
func (l *LockSrv) Unlock(ctx context.Context, r *pb.UnlockRequest) (*pb.UnlockResponse, error)
Unlock removes the lock held by the client
type LockSrvConfig ¶
type LockSrvConfig struct { LockGcInterval time.Duration `desc:"Interval at which to garbage collect unused locks." default:"30m" short:"g"` LockGcMinIdle time.Duration `` /* 133-byte string literal not displayed */ DefaultLockTimeout time.Duration `desc:"Lock timeout to use when loading locks from state file on startup" default:"10m" short:"d"` NoClearOnDisconnect bool `desc:"Do not clear locks on client disconnect" default:"false" short:"n"` ipc.IPCConfig lockmap.LockMapConfig }
Directories ¶
Path | Synopsis |
---|---|
This file contains the IPC method definitions and implementations
|
This file contains the IPC method definitions and implementations |
This file contains LockMap struct definition and methods.
|
This file contains LockMap struct definition and methods. |
clientlock
This file contains the ClientLock struct definition and methods.
|
This file contains the ClientLock struct definition and methods. |
readwriter
This file contains the readWriter struct, its methods, and some helper functions related to serialization.
|
This file contains the readWriter struct, its methods, and some helper functions related to serialization. |