locking

package
v0.0.0-...-bb9396b Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LifeCycleStateManufacturedInactive table.LifeCycleState = 8
	LifeCycleStateManufactured         table.LifeCycleState = 9
)
View Source
var (
	DefaultAuthorityWithMSID = &authority{}
)

Functions

func AuthorityFromName

func AuthorityFromName(user string, proof []byte) (*authority, bool)

func DefaultAdminAuthority

func DefaultAdminAuthority(proof []byte) *authority

func DefaultAuthority

func DefaultAuthority(proof []byte) *authority

Types

type AdminSPAuthenticator

type AdminSPAuthenticator interface {
	AuthenticateAdminSP(s *core.Session) error
}

type InitializeOpt

type InitializeOpt func(ic *initializeConfig)

func WithAuth

func WithAuth(auth AdminSPAuthenticator) InitializeOpt

func WithMaxComPacketSize

func WithMaxComPacketSize(size uint) InitializeOpt

func WithReceiveTimeout

func WithReceiveTimeout(retries int, interval time.Duration) InitializeOpt

type LockRange

type LockRange int
var (
	LockRangeUnspecified LockRange = -1
)

type LockingSP

type LockingSP struct {
	Session *core.Session
	// All authorities that have been discovered on the SP.
	// This will likely be only the authenticated UID unless authorized as an Admin
	Authorities map[string]uid.AuthorityObjectUID
	// The full range of Ranges (heh!) that the current session has access to see and possibly modify
	GlobalRange *Range
	Ranges      []*Range // Ranges[0] == GlobalRange

	// These are always false on SSC Enterprise
	MBREnabled     bool
	MBRDone        bool
	MBRDoneOnReset []table.ResetType
}

func NewSession

func NewSession(cs *core.ControlSession, lmeta *LockingSPMeta, auth LockingSPAuthenticator, opts ...core.SessionOpt) (*LockingSP, error)

func (*LockingSP) Close

func (l *LockingSP) Close() error

func (*LockingSP) SetMBRDone

func (l *LockingSP) SetMBRDone(v bool) error

type LockingSPAuthenticator

type LockingSPAuthenticator interface {
	AuthenticateLockingSP(s *core.Session, lmeta *LockingSPMeta) error
}

type LockingSPMeta

type LockingSPMeta struct {
	SPID uid.SPID
	MSID []byte
	D0   *core.Level0Discovery
}

func Initialize

func Initialize(coreObj *core.Core, opts ...InitializeOpt) (*core.ControlSession, *LockingSPMeta, error)

Initialize WHAT?

type Range

type Range struct {
	UID  uid.RowUID
	Name *string
	// All known authoritiers that have access to lock/unlock on this range
	// Only populated with other users if authenticated as an Admin
	// For enterprise this will always be just one user, the band-dedicated BandMasterN for RangeN
	Users map[string]uid.AuthorityObjectUID

	Start LockRange
	End   LockRange

	ReadLockEnabled  bool
	WriteLockEnabled bool

	ReadLocked  bool
	WriteLocked bool
	// contains filtered or unexported fields
}

func (*Range) Erase

func (r *Range) Erase() error

func (*Range) LockRead

func (r *Range) LockRead() error

func (*Range) LockWrite

func (r *Range) LockWrite() error

func (*Range) SetRange

func (r *Range) SetRange(from LockRange, to LockRange) error

func (*Range) SetReadLockEnabled

func (r *Range) SetReadLockEnabled(v bool) error

func (*Range) SetWriteLockEnabled

func (r *Range) SetWriteLockEnabled(v bool) error

func (*Range) UnlockRead

func (r *Range) UnlockRead() error

func (*Range) UnlockWrite

func (r *Range) UnlockWrite() error

Jump to

Keyboard shortcuts

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