lockmap

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: 5 Imported by: 0

Documentation

Overview

This file contains LockMap struct definition and methods. A LockMap holds a mapping of client -> locks so that locks can be unlocked when a client disconnects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockMap

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

LockMap defines the server's clientLocks map

func New

func New(c *LockMapConfig) *LockMap

New creates a new LockMap instance.

Parameter(s): c *Config Returns: *LockMap

func (*LockMap) Add

func (l *LockMap) Add(name string, key string)

Add adds lock to the client -> lock map

func (*LockMap) AddSession

func (l *LockMap) AddSession(sessionKey string)

AddSession adds a session to the clientLocks map

func (*LockMap) Load

func (l *LockMap) Load() ([]cl.ClientLock, error)

Load loads the server's clientLocks map from the ReadWriter's state file

func (*LockMap) Locks

func (l *LockMap) Locks() map[string][]cl.ClientLock

Locks returns the server's clientLocks map

func (*LockMap) Remove

func (l *LockMap) Remove(name string, sessionKey string)

Remove removes a lock from the client <-> lock map

func (*LockMap) RemoveSession

func (l *LockMap) RemoveSession(sessionKey string) []cl.ClientLock

RemoveSession deletes the session and returns all locks associated with it

func (*LockMap) Save

func (l *LockMap) Save() error

Save saves the server's clientLocks map to the readWriter's state file

func (*LockMap) SetReadWriter

func (l *LockMap) SetReadWriter(rw ReadWriter)

SetReadWriter sets the lockmap readwriter

type LockMapConfig

type LockMapConfig struct {
	rw.Config
}

Config defines the configuration for a LockMap instance

type ReadWriter

type ReadWriter interface {
	Write(map[string][]cl.ClientLock) error
	Read() (map[string][]cl.ClientLock, error)
}

ReadWriter defines the readWriter interface

Directories

Path Synopsis
This file contains the ClientLock struct definition and methods.
This file contains the ClientLock struct definition and methods.
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.

Jump to

Keyboard shortcuts

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