volumeset

package
v0.0.0-...-c5655c4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 8 Imported by: 36

Documentation

Index

Constants

View Source
const (

	// ASC means ascending order for the query result.
	ASC = "asc"
	// DESC means descending order for the query result.
	DESC = "desc"

	// OrderByTime indicates sortby creation time.
	OrderByTime = "creation_time"
	// OrderBySize indicates sortby size.
	OrderBySize = "size"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID ...

func ConvertIDs

func ConvertIDs(vsids []uuid.UUID) []ID

ConvertIDs convert a slice of uuid into a slice of ID.

func NewID

func NewID(s string) ID

NewID creates a ID from a string returned from a previous call to ID.String.

func NewIDFromUUID

func NewIDFromUUID(id uuid.UUID) ID

NewIDFromUUID creates a id from uuid.UUID.

func NewRandomID

func NewRandomID() ID

NewRandomID generates a new unused snapshot identifier at random.

func NilID

func NilID() ID

NilID returns an empty ID.

func (ID) Equals

func (id ID) Equals(target ID) bool

Equals ..

func (ID) IsNilID

func (id ID) IsNilID() bool

IsNilID ...

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

MarshalJSON is a json helper.

func (ID) String

func (id ID) String() string

String ...

func (ID) UUID

func (id ID) UUID() uuid.UUID

UUID ...

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(in []byte) error

UnmarshalJSON is a json helper.

type Query

type Query struct {
	// TODO: Combine ID and IDs into one? Any UI impact?
	// Query by ID
	ID  ID   `json:"id"`
	IDs []ID `json:"ids"`

	// Pagination
	Offset    int    `json:"offset"`
	Limit     int    `json:"limit"`
	SortBy    string `json:"sortby"`
	OrderType string `json:"order"`

	// Group 1 attributes.
	Name            string `json:"name"`
	Prefix          string `json:"prefix"`
	Creator         string `json:"creator"`
	CreatorUsername string `json:"creator_username"`
	Owner           string `json:"owner"`
	OwnerUsername   string `json:"owner_username"`

	// For now, the query will try to match entries that matches
	// all attributes present in here.
	Attr attrs.Attrs `json:"attr"`

	Search string `json:"search"`

	// Short UUID specifies the short UUID to match with ID.
	ShortUUID string

	// RegExName specifies the regulr expression used to match prefix + name
	RegExName string
}

Query ..

func (Query) Matches

func (q Query) Matches(vs VolumeSet) bool

Matches ..

func (Query) Validate

func (q Query) Validate() error

Validate ..

type VolumeSet

type VolumeSet struct {
	ID               ID          `json:"id"`
	Attrs            attrs.Attrs `json:"attrs"`
	CreationTime     time.Time   `json:"creation_time"`
	Size             uint64      `json:"size"`
	Creator          string      `json:"creator"`
	CreatorUsername  string      `json:"creator_username"`
	Owner            string      `json:"owner"`
	OwnerUsername    string      `json:"owner_username"`
	Name             string      `json:"name"`
	Prefix           string      `json:"prefix"`
	LastModifiedTime time.Time   `json:"last_modified_time"` // last time the meta data is modified
	LastSnapshotTime time.Time   `json:"last_snapshot_time"` // last time a snapshot is taken on this volume
	NumSnapshots     int         `json:"num_snapshots"`
	NumBranches      int         `json:"num_branches"`
	Description      string      `json:"description"`
}

VolumeSet ...

func (*VolumeSet) Copy

func (vs *VolumeSet) Copy() *VolumeSet

Copy ...

func (*VolumeSet) MetaEqual

func (vs *VolumeSet) MetaEqual(that *VolumeSet) bool

MetaEqual compares two volume sets for equality.

func (*VolumeSet) RetrieveKnownKeys

func (vs *VolumeSet) RetrieveKnownKeys()

RetrieveKnownKeys retrives all known keys from attributes

func (*VolumeSet) SetCreatorUUID

func (vs *VolumeSet) SetCreatorUUID(currentUser string) error

SetCreatorUUID sets creator uuid given the current user

func (*VolumeSet) SetOwnerUUID

func (vs *VolumeSet) SetOwnerUUID(currentUser string) error

SetOwnerUUID sets owner uuid from name and current client and creator

func (*VolumeSet) StoreKnownKeys

func (vs *VolumeSet) StoreKnownKeys()

StoreKnownKeys stores all known keys to attributes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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