config

package
v0.0.0-...-319b14c Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUpdateInterval for watching ptpconfigmap update
	DefaultUpdateInterval = 60
	// DefaultProfilePath  default ptp profile path
	DefaultProfilePath = "/etc/linuxptp"
)

Variables

This section is empty.

Functions

func GetPTPProfileName

func GetPTPProfileName(ptpConfig string) string

GetPTPProfileName ... get profile name from ptpconfig

Types

type LinuxPTPConfigMapUpdate

type LinuxPTPConfigMapUpdate struct {
	UpdateCh     chan bool
	NodeProfiles []PtpProfile

	EventThreshold map[string]*PtpClockThreshold
	PtpProcessOpts map[string]*PtpProcessOpts
	PtpSettings    map[string]map[string]string

	HAProfile string
	// contains filtered or unexported fields
}

LinuxPTPConfigMapUpdate for ptp-conf update

func NewLinuxPTPConfUpdate

func NewLinuxPTPConfUpdate() *LinuxPTPConfigMapUpdate

NewLinuxPTPConfUpdate -- profile updater

func (*LinuxPTPConfigMapUpdate) AppliedNodeProfileJSON

func (l *LinuxPTPConfigMapUpdate) AppliedNodeProfileJSON() []byte

AppliedNodeProfileJSON ....

func (*LinuxPTPConfigMapUpdate) DeleteAllPTPThreshold

func (l *LinuxPTPConfigMapUpdate) DeleteAllPTPThreshold()

DeleteAllPTPThreshold ... delete all threshold per config

func (*LinuxPTPConfigMapUpdate) DeletePTPThreshold

func (l *LinuxPTPConfigMapUpdate) DeletePTPThreshold(name string)

DeletePTPThreshold ... delete threshold for profile

func (*LinuxPTPConfigMapUpdate) FileWatcherUpdateInProgress

func (l *LinuxPTPConfigMapUpdate) FileWatcherUpdateInProgress(inProgress bool)

FileWatcherUpdateInProgress ... if config file watcher delay config update reads

func (*LinuxPTPConfigMapUpdate) IsFileWatcherUpdateInProgress

func (l *LinuxPTPConfigMapUpdate) IsFileWatcherUpdateInProgress() bool

IsFileWatcherUpdateInProgress ... if config file watcher delay config update reads

func (*LinuxPTPConfigMapUpdate) PushPtpConfigMapChanges

func (l *LinuxPTPConfigMapUpdate) PushPtpConfigMapChanges(nodeName string)

PushPtpConfigMapChanges ... push configMap updates

func (*LinuxPTPConfigMapUpdate) SetAppliedNodeProfileJSON

func (l *LinuxPTPConfigMapUpdate) SetAppliedNodeProfileJSON(appliedNodeProfileJSON []byte)

SetAppliedNodeProfileJSON ...

func (*LinuxPTPConfigMapUpdate) UpdateConfig

func (l *LinuxPTPConfigMapUpdate) UpdateConfig(nodeProfilesJSON []byte) (bool, error)

UpdateConfig ... update profile

func (*LinuxPTPConfigMapUpdate) UpdatePTPProcessOptions

func (l *LinuxPTPConfigMapUpdate) UpdatePTPProcessOptions()

UpdatePTPProcessOptions ..

func (*LinuxPTPConfigMapUpdate) UpdatePTPSetting

func (l *LinuxPTPConfigMapUpdate) UpdatePTPSetting()

UpdatePTPSetting ... ptp settings

func (*LinuxPTPConfigMapUpdate) UpdatePTPThreshold

func (l *LinuxPTPConfigMapUpdate) UpdatePTPThreshold()

UpdatePTPThreshold ... update ptp threshold

func (*LinuxPTPConfigMapUpdate) WatchConfigMapUpdate

func (l *LinuxPTPConfigMapUpdate) WatchConfigMapUpdate(nodeName string, closeCh chan struct{}, keepAlive bool)

WatchConfigMapUpdate watch for ptp config update

type PtpClockThreshold

type PtpClockThreshold struct {
	// clock state to stay in holdover state in secs
	HoldOverTimeout int64 `json:"holdOverTimeout,omitempty"`
	// max offset in nano secs
	MaxOffsetThreshold int64 `json:"maxOffsetThreshold,omitempty"`
	// min offset in nano secs
	MinOffsetThreshold int64 `json:"minOffsetThreshold,omitempty"`
	// Close  any  previous holdover
	Close chan struct{} `json:"close,omitempty"`
}

PtpClockThreshold ... ptp clock threshold values

func GetDefaultThreshold

func GetDefaultThreshold() PtpClockThreshold

GetDefaultThreshold ... get default threshold

func (*PtpClockThreshold) SafeClose

func (pt *PtpClockThreshold) SafeClose() (justClosed bool)

SafeClose ... handle close channel

type PtpProcessOpts

type PtpProcessOpts struct {
	// ptp4lOpts are set
	Ptp4lOpts *string `json:"Ptp4lOpts,omitempty"`
	// Phc2Opts options are set
	Phc2Opts *string `json:"Phc2Opts,omitempty"`
	// TS2PhcOpts
	TS2PhcOpts *string `json:"TS2PhcOpts,omitempty"`
	// SyncE4lOpts
	SyncE4lOpts *string `json:"SyncE4lOpts,omitempty"`
}

PtpProcessOpts ... prp process options

func (*PtpProcessOpts) Phc2SysEnabled

func (ptpOpts *PtpProcessOpts) Phc2SysEnabled() bool

Phc2SysEnabled check if phc2sys is enabled

func (*PtpProcessOpts) Ptp4lEnabled

func (ptpOpts *PtpProcessOpts) Ptp4lEnabled() bool

Ptp4lEnabled check if ptp4l is enabled

func (*PtpProcessOpts) SyncE4lEnabled

func (ptpOpts *PtpProcessOpts) SyncE4lEnabled() bool

SyncE4lEnabled check if ptp4l is enabled

func (*PtpProcessOpts) TS2PhcEnabled

func (ptpOpts *PtpProcessOpts) TS2PhcEnabled() bool

TS2PhcEnabled check if ts2phc is enabled

type PtpProfile

type PtpProfile struct {
	Name              *string            `json:"name"`
	Interface         *string            `json:"interface"`
	PtpClockThreshold *PtpClockThreshold `json:"ptpClockThreshold,omitempty"`
	Ptp4lOpts         *string            `json:"ptp4lOpts,omitempty"`
	Phc2sysOpts       *string            `json:"phc2sysOpts,omitempty"`
	TS2PhcOpts        *string            `json:"ts2PhcOpts,omitempty"`
	Ptp4lConf         *string            `json:"ptp4lConf,omitempty"`
	TS2PhcConf        *string            `json:"ts2PhcConf,omitempty"`
	PtpSettings       map[string]string  `json:"ptpSettings,omitempty"`
	Interfaces        []*string
}

PtpProfile ... ptp profile

func (*PtpProfile) GetInterface

func (p *PtpProfile) GetInterface() (interfaces []*string)

GetInterface ... return interfaces from configmap

Jump to

Keyboard shortcuts

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