volume

package
v0.0.0-...-678448a Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2016 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package volume contains some types associated with GlusterFS volumes that will be used in GlusterD

Index

Constants

This section is empty.

Variables

View Source
var (
	ExistsFunc            = Exists
	AddOrUpdateVolumeFunc = AddOrUpdateVolume
)
View Source
var (
	ValidateBrickEntriesFunc = ValidateBrickEntries

	NewVolinfoFunc = NewVolinfo

	NewBrickEntriesFunc = NewBrickEntries
)

Functions

func AddOrUpdateVolume

func AddOrUpdateVolume(v *Volinfo) error

AddOrUpdateVolume marshals to volume object and passes to store to add/update

func DeleteVolume

func DeleteVolume(name string) error

DeleteVolume passes the volname to store to delete the volume object

func Exists

func Exists(name string) bool

Exists check whether a given volume exist or not

func GetVolumesList

func GetVolumesList() (map[string]uuid.UUID, error)

func RemoveBrickPaths

func RemoveBrickPaths(bricks []Brickinfo) error

RemoveBrickPaths is to clean up the bricks in case commit fails for volume create

func ValidateBrickEntries

func ValidateBrickEntries(bricks []Brickinfo, volID uuid.UUID, force bool) (int, error)

ValidateBrickEntries validates the brick list

Types

type Brickinfo

type Brickinfo struct {
	Hostname string
	Path     string
	ID       uuid.UUID
}

Brickinfo represents the information of a brick

func NewBrickEntries

func NewBrickEntries(bricks []string) ([]Brickinfo, error)

NewBrickEntries creates the brick list

type VolCreateRequest

type VolCreateRequest struct {
	Name            string   `json:"name"`
	Transport       string   `json:"transport,omitempty"`
	DistCount       uint64   `json:"distcount,omitempty"`
	ReplicaCount    uint16   `json:"replica,omitempty"`
	StripeCount     uint16   `json:"stripecount,omitempty"`
	DisperseCount   uint16   `json:"dispersecount,omitempty"`
	RedundancyCount uint16   `json:"redundancycount,omitempty"`
	Bricks          []string `json:"bricks"`
	Force           bool     `json:"force,omitempty"`
}

VolCreateRequest defines the parameters for creating a volume in the volume-create command TODO: This should probably be moved out of here.

type VolStatus

type VolStatus uint16

VolStatus is the current status of a volume

const (
	// VolCreated should be set only for a volume that has been just created
	VolCreated VolStatus = iota
	// VolStarted should be set only for volumes that are running
	VolStarted
	// VolStopped should be set only for volumes that are not running, excluding newly created volumes
	VolStopped
)

type VolType

type VolType uint16

VolType is the status of the volume

const (
	// Distribute is a plain distribute volume
	Distribute VolType = iota
	// Replicate is plain replicate volume
	Replicate
	// Stripe is a plain stripe volume
	Stripe
	// Disperse is a plain erasure coded volume
	Disperse
	// DistReplicate is a distribute-replicate volume
	DistReplicate
	// DistStripe is  a distribute-stripe volume
	DistStripe
	// DistDisperse is a distribute-'erasure coded' volume
	DistDisperse
	// DistRepStripe is a distribute-replicate-stripe volume
	DistRepStripe
	// DistDispStripe is distrbute-'erasure coded'-stripe volume
	DistDispStripe
)

type Volinfo

type Volinfo struct {
	ID   uuid.UUID
	Name string
	Type VolType

	Transport       string
	DistCount       uint64
	ReplicaCount    uint16
	StripeCount     uint16
	DisperseCount   uint16
	RedundancyCount uint16

	Options map[string]string

	Status VolStatus

	Checksum uint64
	Version  uint64
	Bricks   []Brickinfo
}

Volinfo repesents a volume

func GetVolume

func GetVolume(name string) (*Volinfo, error)

GetVolume fetches the json object from the store and unmarshalls it into volinfo object

func GetVolumes

func GetVolumes() ([]Volinfo, error)

GetVolumes retrives the json objects from the store and converts them into respective volinfo objects

func NewVolinfo

func NewVolinfo() *Volinfo

NewVolinfo returns an empty Volinfo

func NewVolumeEntry

func NewVolumeEntry(req *VolCreateRequest) (*Volinfo, error)

NewVolumeEntry returns an initialized Volinfo using the given parameters

func (*Volinfo) String

func (v *Volinfo) String() string

Jump to

Keyboard shortcuts

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