clientconfig

package
v0.0.0-...-6b979cb Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NVMF_DEF_DISC_TMO = 30
	InternalJson      = "internal.json"
)

Variables

View Source
var (
	NvmeCtrlPath = filepath.Join("/sys/class/nvme", "nvme[0-9]")
)

Functions

func CreateEntries

func CreateEntries(addresses []string, hostnqn string, nqn string, transport string) ([]*commonstructs.Entry, error)

func CreateFile

func CreateFile(filename string, entries []*commonstructs.Entry) error

func DetectEntriesByIOControllers

func DetectEntriesByIOControllers(nvmeCtrlPath string, discoveryServicePort uint) ([]*commonstructs.Entry, error)

func EntriesToString

func EntriesToString(entries []*Entry) string

func ShouldGenerateAutoDetectedEntries

func ShouldGenerateAutoDetectedEntries(clientConfigDir, internalDir string) bool

ShouldGenerateAutoDetectedEntries - return true only in case client and internal dirs are empty

func StoreEntries

func StoreEntries(filename string, entries []*commonstructs.Entry) error

Types

type Cache

type Cache interface {
	// Run start watching for changes
	Run(sync bool) error
	// Stop stop watching for changes
	Stop()
	// Clear clears the entries we have till now
	Clear()
	Connections() <-chan ConnectionMap
	HandleReferrals(referrals ReferralMap) error
}

func NewCache

func NewCache(ctx context.Context, userDirPath, internalDirPath string, autoDetectEntries *model.AutoDetectEntries) Cache

NewCache return a Cache implementation.

type ClientClusterPair

type ClientClusterPair struct {
	ClusterNqn string
	HostNqn    string
}

type ClusterConnections

type ClusterConnections struct {
	ClusterConnectionsMap map[TKey]*Connection
	ActiveConnection      *Connection
}

func (ClusterConnections) Exists

func (cc ClusterConnections) Exists(c *Connection) bool

func (ClusterConnections) GetRandomConnectionList

func (c ClusterConnections) GetRandomConnectionList() []*Connection

type Connection

type Connection struct {
	Hostnqn string
	Key     TKey
	Ctx     context.Context

	AENChan      chan hostapi.AENStruct
	ConnectionID hostapi.ConnectionID
	State        bool
	// contains filtered or unexported fields
}

func (*Connection) GetDiscoveryRequest

func (c *Connection) GetDiscoveryRequest(kato time.Duration) *hostapi.DiscoverRequest

func (*Connection) SetState

func (c *Connection) SetState(newState bool)

func (*Connection) Stop

func (c *Connection) Stop()

func (*Connection) String

func (c *Connection) String() string

type ConnectionMap

type ConnectionMap map[ClientClusterPair]ClusterConnections

func (ConnectionMap) AddConnection

func (cm ConnectionMap) AddConnection(key TKey, conn *Connection)

func (ConnectionMap) DeleteConnection

func (cm ConnectionMap) DeleteConnection(clientClusterPair ClientClusterPair, key TKey)

type Entry

type Entry struct {
	Transport  string
	Trsvcid    int
	Traddr     string
	Hostnqn    string
	Subsysnqn  string
	Persistent bool
	Hostaddr   string
}

type Event

type Event struct {
	Name string
	Op   EventOp
}

type EventOp

type EventOp string
var (
	Create EventOp = "Create"
	Remove EventOp = "Remove"
	Modify EventOp = "Modify"
	Rename EventOp = "Rename"
	Chmod  EventOp = "Chmod"
)

type FileWatcher

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

func (*FileWatcher) Watch

func (w *FileWatcher) Watch(ctx context.Context, path string) (<-chan *Event, error)

type ParserError

type ParserError struct {
	Msg     string
	Details string
	Err     error
}

func (*ParserError) Error

func (e *ParserError) Error() string

func (*ParserError) Unwrap

func (e *ParserError) Unwrap() error

type ReferralKey

type ReferralKey struct {
	Ip       string
	Port     uint16
	DPSubNqn string // Datapath subsystem nqn. The referral log page entry does not contain it but we need it to create a new connection based on the referral
	Hostnqn  string // The referral log page entry does not contain it but we need it to create a new connection based on the referral
}

type ReferralMap

type ReferralMap map[ReferralKey]*hostapi.NvmeDiscPageEntry

type TKey

type TKey struct {
	Ip string

	// subsystem nqn
	Nqn string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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