ipc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

This file contains the IPC method definitions and implementations

This file contains the IPC server implementation. IPC methods are defined in ipc.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSocketPath

func DefaultSocketPath() string

DefaultSocketPath returns a default socket path based on the os

func Run

func Run(lsrv LockServer, c *IPCConfig) (func(), error)

Run starts the IPC server and returns a cleanup function and an error.

It takes a LockServer and an IPCConfig pointer as parameters. It returns a cleanup function and an error.

Types

type IPC

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

IPC is the IPC server implementation.

func (*IPC) ListLocks

func (i *IPC) ListLocks(_ ListLocksRequest, locks *ListLocksResponse) error

ListLocks handles the IPC ListLocks request.

Parameters:

  • UnlockRequest
  • pointer to UnlockResponse

Returns an error.

func (*IPC) Unlock

func (i *IPC) Unlock(req UnlockRequest, resp *UnlockResponse) error

Unlock unlocks the specified lock.

Parameters:

  • UnlockRequest
  • pointer to UnlockResponse

Returns an error.

type IPCConfig

type IPCConfig struct {
	IPCSocketFile string `desc:"Path to the IPC socket file. Use an empty string to disable IPC." default:"<platform specific>"`
}

Config is the configuration for the IPC server.

type ListLocksRequest

type ListLocksRequest struct{}

IPC request and response types for the ListLocks method

type ListLocksResponse

type ListLocksResponse []string

type LockServer

type LockServer interface {
	Locks() []cl.ClientLock
	Unlock(context.Context, *pb.UnlockRequest) (*pb.UnlockResponse, error)
}

LockServer is an interface for interacting with locks. It must support methods required by IPC commands

type UnlockRequest

type UnlockRequest struct {
	Name string
	Key  string
}

type UnlockResponse

type UnlockResponse bool

IPC request and response types used in the Unlock method

Jump to

Keyboard shortcuts

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