model

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Copyright 2017 The Goock Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegMatcher

func RegMatcher(text string, matcher string) []string

RegMatcher returns slices of string between adjacent matchers

func RegSplit

func RegSplit(text string, delimiter string) []string

RegSplit splits by regexp specified by delimiter

func SetExecutor

func SetExecutor(e exec.Interface)

func SetLogger

func SetLogger(l *logrus.Logger)

func SetValue

func SetValue(field reflect.Value, value interface{})

Types

type DeviceInfo

type DeviceInfo struct {
	Device  string
	Host    string
	Channel int
	Target  int
	Lun     int
	// contains filtered or unexported fields
}

func NewDeviceInfo

func NewDeviceInfo(path string) []DeviceInfo

func (*DeviceInfo) GetCommand

func (d *DeviceInfo) GetCommand() []string

func (*DeviceInfo) GetDeviceIdentifier

func (d *DeviceInfo) GetDeviceIdentifier() string

Returns a string with format: <host>:<channel>:<Target>:<Lun>

func (*DeviceInfo) GetHostId

func (d *DeviceInfo) GetHostId() int

func (*DeviceInfo) GetPattern

func (d *DeviceInfo) GetPattern() interface{}

func (*DeviceInfo) GetValue

func (d *DeviceInfo) GetValue(key string) interface{}

func (*DeviceInfo) Parse

func (d *DeviceInfo) Parse() []DeviceInfo

type FibreChannelTarget added in v0.1.1

type FibreChannelTarget struct {
	ClassDevice     string
	ClassDevicePath string
	NodeName        string
	PortId          string
	PortName        string
	Device          string
	DevicePath      string
	// contains filtered or unexported fields
}

(FibreChannelTarget) Subclass of Interface Represents the FC targets connected with HBA

func NewFibreChannelTarget added in v0.1.1

func NewFibreChannelTarget() []FibreChannelTarget

func (*FibreChannelTarget) GetCommand added in v0.1.1

func (s *FibreChannelTarget) GetCommand() []string

func (*FibreChannelTarget) GetHostChannelTarget added in v0.1.1

func (s *FibreChannelTarget) GetHostChannelTarget() ([]int, error)

Parse Device "target9:0:0" to []int{9, 0, 0}

func (*FibreChannelTarget) GetPattern added in v0.1.1

func (s *FibreChannelTarget) GetPattern() interface{}

func (*FibreChannelTarget) GetValue added in v0.1.1

func (s *FibreChannelTarget) GetValue(key string) interface{}

func (*FibreChannelTarget) Parse added in v0.1.1

type HBA

type HBA struct {
	Name            string
	Path            string
	FabricName      string
	NodeName        string
	PortName        string
	PortState       string
	Speed           string
	SupportedSpeeds string
	DevicePath      string
	// contains filtered or unexported fields
}

(HBA) Subclass of Interface

func NewHBA

func NewHBA() []HBA

func (*HBA) GetCommand

func (s *HBA) GetCommand() []string

func (*HBA) GetHostId added in v0.1.1

func (s *HBA) GetHostId() (int, error)

Return the id of HBA, host7 -> 7

func (*HBA) GetPattern

func (s *HBA) GetPattern() interface{}

func (*HBA) GetValue

func (s *HBA) GetValue(key string) interface{}

func (*HBA) Parse

func (s *HBA) Parse() []HBA

type ISCSISession

type ISCSISession struct {
	TargetIqn    string
	TargetPortal string
	TargetIp     string
	Tag          string
	// contains filtered or unexported fields
}

Implementation of ISCSISession

func DiscoverISCSISession

func DiscoverISCSISession(targetPortals []string) []ISCSISession

Discover all the targets provided by targetPortals Use goroutine to accelerate the target discovery process. the "--op new" is important, or the existing node info will be overwritten after the discovery.

func NewISCSISession

func NewISCSISession() []ISCSISession

func (*ISCSISession) GetCommand

func (iscsi *ISCSISession) GetCommand() []string

func (*ISCSISession) GetPattern

func (iscsi *ISCSISession) GetPattern() interface{}

func (*ISCSISession) GetValue

func (iscsi *ISCSISession) GetValue(key string) interface{}

func (*ISCSISession) Parse

func (iscsi *ISCSISession) Parse() []ISCSISession

type Interface

type Interface interface {
	GetPattern() interface{}
	GetCommand() []string

	GetValue(key string) interface{}

	Parse() []interface{}
	// contains filtered or unexported methods
}

Interface declaration

type LineParser

type LineParser struct {
	Delimiter string
	Matcher   string
}

LineParse parse each line as a single data map The data map could be used to initialize a new Object derived from Interface

func (*LineParser) Parse

func (p *LineParser) Parse(output string, pat interface{}) []map[string]string

func (*LineParser) Split

func (p *LineParser) Split(output string) []string

type Multipath

type Multipath struct {

	// reload or reject
	Action          string
	Wwn             string
	DmDeviceName    string
	Vendor          string
	Product         string
	Size            float64
	Features        string
	HWHandler       string
	WritePermission string
	Paths           []SinglePath
	// contains filtered or unexported fields
}

(Multipath) Subclass of Interface Each Multipath contains one or more SinglePath

func FindMultipath

func FindMultipath(path string) []Multipath

func NewMultipath

func NewMultipath() []Multipath

func (*Multipath) GetCommand

func (s *Multipath) GetCommand() []string

func (*Multipath) GetPattern

func (s *Multipath) GetPattern() interface{}

func (*Multipath) GetValue

func (s *Multipath) GetValue(key string) interface{}

func (*Multipath) Parse

func (s *Multipath) Parse() []Multipath

func (*Multipath) SetParams

func (s *Multipath) SetParams(params []string)

type PairParser

type PairParser struct {
	Delimiter string
	Matcher   string
}

func (*PairParser) Parse

func (f *PairParser) Parse(output string, pat interface{}) []map[string]string

func (*PairParser) Split

func (f *PairParser) Split(output string) []string

type Parser

type Parser interface {
	Parse(output string, pat interface{}) []map[string]string

	Split(output string) []string
	// contains filtered or unexported methods
}

type SinglePath

type SinglePath struct {

	//Policy string
	//Priority string
	Host    int
	Channel int
	Id      int
	Lun     int
	DevNode string
	Major   int
	Minor   int
	// possible value: failed, active
	DmStatus string
	// possible value: ready, ghost, faulty, shaky
	PathStatus string
	// possible value: running, offline
	OnlineStatus string
	// contains filtered or unexported fields
}

(SinglePath) Subclass of Interface

func NewSinglePath

func NewSinglePath(output string) []SinglePath

func (*SinglePath) GetCommand

func (single *SinglePath) GetCommand() []string

func (*SinglePath) GetPattern

func (single *SinglePath) GetPattern() interface{}

func (*SinglePath) GetValue

func (single *SinglePath) GetValue(key string) interface{}

func (*SinglePath) Parse

func (single *SinglePath) Parse() []SinglePath

func (*SinglePath) SetOutput

func (single *SinglePath) SetOutput(output string)

Jump to

Keyboard shortcuts

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