client

package
v0.50.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWaitForClosedConnection = errors.New("cannot wait for closed connection")
	ErrWaitTooLong             = errors.New("cannot reconnect to sync service")
)

Functions

func NewConnection

func NewConnection(ctx context.Context) *connection

func NewLease

func NewLease(
	ctx context.Context,
	appPrefix string,
	ownIp string,
	client managementpb.ServiceClient,
	logger golog.Logger,
) *lease

func NewPeers

func NewPeers(
	ctx context.Context,
	client managementpb.ServiceClient,
	logger golog.Logger,
	appPrefix string,
	onConnect func(),
	onDisconnect func(numberOfPeerNodes int),
) (*peers, error)

Types

type Service

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

func NewService

func NewService(
	ctx context.Context,
	client managementpb.ServiceClient,
	logger golog.Logger,
	appPrefix string,
	ownIp string,
) (*Service, error)

func (*Service) IsPeer

func (s *Service) IsPeer(address string) bool

func (*Service) Lock

func (s *Service) Lock(tenant string, resource []string) error

func (*Service) OnPeerLeave

func (s *Service) OnPeerLeave(handler func(peerIp string))

func (*Service) PeerIps

func (s *Service) PeerIps() []string

func (*Service) RLock added in v0.32.0

func (s *Service) RLock(tenant string, resource []string) error

func (*Service) RUnlock added in v0.32.0

func (s *Service) RUnlock(tenant string, resource []string)

func (*Service) TryLock added in v0.49.0

func (s *Service) TryLock(tenant string, resource []string) (bool, error)

func (*Service) TryRLock added in v0.49.0

func (s *Service) TryRLock(tenant string, resource []string) (bool, error)

func (*Service) Unlock

func (s *Service) Unlock(tenant string, resource []string)

func (*Service) WaitForStop

func (s *Service) WaitForStop()

Jump to

Keyboard shortcuts

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