glusterutils

package
v0.0.0-...-3ebaacc Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: LGPL-2.1 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCmd

func ExecuteCmd(cmd string) ([]byte, error)

ExecuteCmd enables to execute system cmds and returns stdout, err

func GetClusterID

func GetClusterID() (clusterID string)

GetClusterID returns local clusterd ID

func GetGlusterVersion

func GetGlusterVersion() (string, error)

GetGlusterVersion gets the glusterfs version

Types

type Brick

type Brick struct {
	Host       string `json:"host"`
	ID         string `json:"id"`
	Path       string `json:"path"`
	PeerID     string `json:"peer-id"`
	Type       string `json:"type"`
	VolumeID   string `json:"volume-id"`
	VolumeName string `json:"volume-name"`
}

Brick represents Gluster Brick

type BrickStatus

type BrickStatus struct {
	Hostname       string
	PeerID         string
	Status         int
	PID            int
	Port           int
	Path           string
	Volume         string
	Capacity       uint64
	Free           uint64
	Gd1InodesFree  int64 // only valid with GD1, -1 with GD2
	Gd1InodesTotal int64 // only valid with GD1, -1 with GD2
}

BrickStatus describes the status details of volume brick

type FopStat

type FopStat struct {
	Name       string
	Hits       int
	AvgLatency float64
	MinLatency float64
	MaxLatency float64
}

FopStat defines file ops related details

type GCache

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

GCache is a wrapper around 'GInterface' object

func NewGCache

func NewGCache(gd GInterface) *GCache

NewGCache method creates a new GCache wrapper instance, with 1 minute default time_to_live

func NewGCacheWithTTL

func NewGCacheWithTTL(gd GInterface, ttl time.Duration) *GCache

NewGCacheWithTTL method creates a new GCache wrapper instance. Caching will be disabled if ttl is ZERO

func (*GCache) EnableCacheForFuncs

func (gc *GCache) EnableCacheForFuncs(fNames []string)

EnableCacheForFuncs method will enable caching for the given list of functions. If the provided function is not there in the existing list, it will be ignored

func (*GCache) EnableVolumeProfiling

func (gc *GCache) EnableVolumeProfiling(vInfo Volume) error

EnableVolumeProfiling method wraps the GInterface.EnableVolumeProfiling call

func (*GCache) GConfig

func (gc *GCache) GConfig() (gConf *conf.GConfig)

GConfig implements GConfigInterface

func (*GCache) HealInfo

func (gc *GCache) HealInfo(vol string) ([]HealEntry, error)

HealInfo method wraps the GInterface.HealInfo call

func (*GCache) IsLeader

func (gc *GCache) IsLeader() (bool, error)

IsLeader method wraps the GInterface.IsLeader call

func (*GCache) LocalPeerID

func (gc *GCache) LocalPeerID() (string, error)

LocalPeerID method wraps the GInterface.LocalPeerID call

func (*GCache) Peers

func (gc *GCache) Peers() ([]Peer, error)

Peers method wraps the GInterface.Peers call

func (*GCache) SetTTL

func (gc *GCache) SetTTL(ttl time.Duration)

SetTTL method sets a new time_to_live

func (*GCache) Snapshots

func (gc *GCache) Snapshots() ([]Snapshot, error)

Snapshots method wraps the GInterface.Snapshots call

func (*GCache) SplitBrainHealInfo

func (gc *GCache) SplitBrainHealInfo(vol string) ([]HealEntry, error)

SplitBrainHealInfo wraps the GInterface.SplitBrainHealInfo call

func (*GCache) TTL

func (gc *GCache) TTL() time.Duration

TTL method returns the current time_to_live duration

func (*GCache) VolumeBrickStatus

func (gc *GCache) VolumeBrickStatus(vol string) ([]BrickStatus, error)

VolumeBrickStatus method wraps the GInterface.VolumeBrickStatus call

func (*GCache) VolumeInfo

func (gc *GCache) VolumeInfo() ([]Volume, error)

VolumeInfo method wraps the GInterface.VolumeInfo call

func (*GCache) VolumeProfileInfo

func (gc *GCache) VolumeProfileInfo(vol string) ([]ProfileInfo, error)

VolumeProfileInfo method wraps the GInterface.VolumeProfileInfo call

func (*GCache) VolumeStatus

func (gc *GCache) VolumeStatus() ([]VolumeStatus, error)

VolumeStatus method wraps the GInterface.VolumeStatus call

type GD1

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

GD1 enables users to interact with gd1 version

func (*GD1) EnableVolumeProfiling

func (g *GD1) EnableVolumeProfiling(volume Volume) error

EnableVolumeProfiling enables profiling for a volume

func (*GD1) GConfig

func (g *GD1) GConfig() *conf.GConfig

GConfig method returns the configuration this implements the 'conf.GConfigInterface'

func (GD1) HealInfo

func (g GD1) HealInfo(vol string) ([]HealEntry, error)

HealInfo gets gluster vol heal info (GD1)

func (*GD1) IsLeader

func (g *GD1) IsLeader() (bool, error)

IsLeader returns true or false based on whether the node is the leader of the cluster or not

func (*GD1) LocalPeerID

func (g *GD1) LocalPeerID() (string, error)

LocalPeerID returns local peer ID of glusterd

func (*GD1) Peers

func (g *GD1) Peers() ([]Peer, error)

Peers returns the list of peers ( for GlusterD1 )

func (*GD1) Snapshots

func (g *GD1) Snapshots() ([]Snapshot, error)

Snapshots returns snaphosts list for the cluster

func (GD1) SplitBrainHealInfo

func (g GD1) SplitBrainHealInfo(vol string) ([]HealEntry, error)

SplitBrainHealInfo gets gluster vol heal info (GD1)

func (GD1) VolumeBrickStatus

func (g GD1) VolumeBrickStatus(vol string) ([]BrickStatus, error)

VolumeBrickStatus gets brick status info from glusterd2 using rest api

func (*GD1) VolumeInfo

func (g *GD1) VolumeInfo() ([]Volume, error)

VolumeInfo returns gluster vol info (glusterd)

func (*GD1) VolumeProfileInfo

func (g *GD1) VolumeProfileInfo(vol string) ([]ProfileInfo, error)

VolumeProfileInfo returns profile info details for the volume

func (*GD1) VolumeStatus

func (g *GD1) VolumeStatus() ([]VolumeStatus, error)

VolumeStatus returns gluster vol status (glusterd)

type GD2

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

GD2 is struct to interact with Glusterd2 using REST API

func (*GD2) EnableVolumeProfiling

func (g *GD2) EnableVolumeProfiling(volume Volume) error

EnableVolumeProfiling enables profiling for a volume

func (*GD2) GConfig

func (g *GD2) GConfig() *conf.GConfig

GConfig method returns the configuration this implements the 'conf.GConfigInterface'

func (GD2) HealInfo

func (g GD2) HealInfo(vol string) ([]HealEntry, error)

HealInfo gets heal info from glusterd2 using rest api

func (*GD2) IsLeader

func (g *GD2) IsLeader() (bool, error)

IsLeader returns true or false based on whether the node is the leader of the cluster or not

func (*GD2) LocalPeerID

func (g *GD2) LocalPeerID() (string, error)

LocalPeerID returns local peer ID of glusterd2

func (*GD2) Peers

func (g *GD2) Peers() ([]Peer, error)

Peers returns the list of peers ( for GlusterD2 )

func (*GD2) Snapshots

func (g *GD2) Snapshots() ([]Snapshot, error)

Snapshots returns snaphosts list for the cluster

func (GD2) SplitBrainHealInfo

func (g GD2) SplitBrainHealInfo(vol string) ([]HealEntry, error)

SplitBrainHealInfo gets heal info from glusterd2 using rest api

func (GD2) VolumeBrickStatus

func (g GD2) VolumeBrickStatus(vol string) ([]BrickStatus, error)

VolumeBrickStatus gets brick status info from glusterd2 using rest api

func (*GD2) VolumeInfo

func (g *GD2) VolumeInfo() ([]Volume, error)

VolumeInfo returns gluster vol info (glusterd2)

func (*GD2) VolumeProfileInfo

func (g *GD2) VolumeProfileInfo(vol string) ([]ProfileInfo, error)

VolumeProfileInfo returns profile info details for the volume

func (*GD2) VolumeStatus

func (g *GD2) VolumeStatus() ([]VolumeStatus, error)

VolumeStatus returns gluster vol status (glusterd2)

type GInterface

type GInterface interface {
	Peers() ([]Peer, error)
	LocalPeerID() (string, error)
	IsLeader() (bool, error)
	HealInfo(vol string) ([]HealEntry, error)
	SplitBrainHealInfo(vol string) ([]HealEntry, error)
	VolumeInfo() ([]Volume, error)
	Snapshots() ([]Snapshot, error)
	VolumeProfileInfo(vol string) ([]ProfileInfo, error)
	VolumeBrickStatus(vol string) ([]BrickStatus, error)
	EnableVolumeProfiling(volinfo Volume) error
	VolumeStatus() ([]VolumeStatus, error)
}

GInterface should be implemented in GD1 and GD2 structs

func MakeGluster

func MakeGluster(expConf *conf.Config) (gi GInterface)

MakeGluster returns respective gluster obj based on configuration

type HealEntry

type HealEntry struct {
	PeerID         string
	Hostname       string
	Brick          string
	Connected      string
	NumHealEntries int64
}

HealEntry describe gluster heal info for each brick

type Peer

type Peer struct {
	ID            string   `json:"id"`
	PeerAddresses []string `json:"peer-addresses"`
	Online        bool     `json:"online"`
	Gd1State      int      // GD1 only
}

Peer represents a Gluster Peer

type ProfileInfo

type ProfileInfo struct {
	BrickName      string
	Duration       uint64
	TotalReads     uint64
	TotalWrites    uint64
	FopStats       []FopStat
	DurationInt    uint64
	TotalReadsInt  uint64
	TotalWritesInt uint64
	FopStatsInt    []FopStat
}

ProfileInfo represents volume profile info brickwise

type Snapshot

type Snapshot struct {
	Name       string
	VolumeName string
	Started    bool
}

Snapshot represents a Volume snapshot

type SubVolume

type SubVolume struct {
	ArbiterCount            int     `json:"arbiter-count"`
	Bricks                  []Brick `json:"bricks"`
	DisperseCount           int     `json:"disperse-count"`
	DisperseDataCount       int     `json:"disperse-data-count"`
	DisperseRedundancyCount int     `json:"disperse-redundancy-count"`
	Name                    string  `json:"name"`
	ReplicaCount            int     `json:"replica-count"`
	Type                    string  `json:"type"`
}

SubVolume represents Gluster SubVolume

type Volume

type Volume struct {
	DistributeCount         int               `json:"distribute-count"`
	ID                      string            `json:"id"`
	Metadata                map[string]string `json:"metadata"`
	Name                    string            `json:"name"`
	Options                 map[string]string `json:"options"`
	SnapList                []string          `json:"snap-list"`
	State                   string            `json:"state"`
	SubVolumes              []SubVolume       `json:"subvols"`
	Transport               string            `json:"transport"`
	Type                    string            `json:"type"`
	DisperseCount           int               `json:"disperse-count"`
	DisperseDataCount       int               `json:"disperse-data-count"`
	DisperseRedundancyCount int               `json:"disperse-redundancy-count"`
	ReplicaCount            int               `json:"replica-count"`
}

Volume represents Gluster Volume

type VolumeStatus

type VolumeStatus struct {
	Name  string
	Nodes []BrickStatus
}

VolumeStatus represents the detailed status of a Gluster volume

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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