utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: UPL-1.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CSID int = iota // CSI Driver
	CTRL            // Controller Service
	NODE            // Node Service
	IDTY            // Identity Service
	REST            // REST interface
	UTIL            // Utilities that may be controller or node
	SENTINEL
)
View Source
const (
	VolumeIdLen     = 6
	VolumeHandleLen = 8
	SnapshotIdLen   = 7
	VolumeHrefLen   = 10
	SnapshotHrefLen = 12
)
View Source
const (
	BlockVolume string = "lun"
	MountVolume        = "mnt"
)
View Source
const (
	ResourceNamePattern string = `^[a-zA-Z0-9_\-\.\:]+$`
	ResourceNameLength  int    = 64
)
View Source
const MAX_LEVEL int = 5

Variables

This section is empty.

Functions

func DateToUnix

func DateToUnix(date string) (*timestamp.Timestamp, error)

func GetLogCSID

func GetLogCSID(ctx context.Context, level int) *log.Logger

Public function returning the appropriate logger.

func GetLogCTRL

func GetLogCTRL(ctx context.Context, level int) *log.Logger

func GetLogIDTY

func GetLogIDTY(ctx context.Context, level int) *log.Logger

func GetLogNODE

func GetLogNODE(ctx context.Context, level int) *log.Logger

func GetLogREST

func GetLogREST(ctx context.Context, level int) *log.Logger

func GetLogUTIL

func GetLogUTIL(ctx context.Context, level int) *log.Logger

func GetNewContext

func GetNewContext(ctx context.Context) context.Context

Creates a new context by duplicating the context passed in and adding a array of loggers with a value added. The value is unique and is generated in this function. That value will be systematically displayed each time any of the loggers in the array are called.

func GetValueFromYAML added in v1.0.2

func GetValueFromYAML(yamlFilePath string, key string) (string, error)

func InitLogs

func InitLogs(level, driverName, version, nodeID string)

Log service initialization. The original loggers are created with a prefix identifying the service (service, controller, node, indentifier, REST interface and utility), the node, the driver and its version. These loggers will be clone for each request.

func IsResourceNameValid

func IsResourceNameValid(name string) bool

func SnapshotIdStringFromHref

func SnapshotIdStringFromHref(zfssa, hRef string) (string, error)

func VolumeIdStringFromHref

func VolumeIdStringFromHref(zfssa, hRef string) (string, error)

Types

type Bolt

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

func NewBolt

func NewBolt() *Bolt

func (*Bolt) Lock

func (l *Bolt) Lock(ctx context.Context)

func (*Bolt) Unlock

func (l *Bolt) Unlock(ctx context.Context)

type SnapshotId

type SnapshotId struct {
	VolumeId *VolumeId
	Name     string
}

Snapshot ID ----------- This structure is what identifies a volume (lun or filesystem).

func NewSnapshotId

func NewSnapshotId(volumeId *VolumeId, snapshotName string) *SnapshotId

func SnapshotIdFromHref

func SnapshotIdFromHref(zfssa, hRef string) (*SnapshotId, error)

func SnapshotIdFromString

func SnapshotIdFromString(snapshotId string) (*SnapshotId, error)

func (*SnapshotId) GetVolumeId

func (zsi *SnapshotId) GetVolumeId() *VolumeId

func (*SnapshotId) String

func (zsi *SnapshotId) String() string

type VolumeId

type VolumeId struct {
	Type    string
	Zfssa   string
	Pool    string
	Project string
	Name    string
}

Volume ID --------- This structure is what identifies a volume (lun or filesystem).

func NewVolumeId

func NewVolumeId(vType, zfssaName, pool, project, name string) *VolumeId

func VolumeIdFromString

func VolumeIdFromString(volumeId string) (*VolumeId, error)

func (*VolumeId) IsBlock

func (zvi *VolumeId) IsBlock() bool

func (*VolumeId) String

func (zvi *VolumeId) String() string

Jump to

Keyboard shortcuts

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