snapshot

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: 10 Imported by: 0

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 is the opaque, globally unique identifier of a snapshot. An ID can be used across time and scopes of control to refer to a particular snapshot.

func NewID

func NewID(s string) ID

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

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(that *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) UnmarshalJSON

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

UnmarshalJSON is a json helper.

type Query

type Query struct {
	// Query by ID
	ID  ID   `json:"id"`
	IDs []ID `json:"ids"`

	// Pagination ..
	Offset int `json:"offset"`
	Limit  int `json:"limit"`

	Name        string `json:"name"`
	Creator     string `json:"creator"`
	CreatorName string `json:"creator_username"`
	Owner       string `json:"owner"`
	OwnerName   string `json:"owner_username"`

	// Flag to signal orders
	SortBy    string `json:"sortby"`
	OrderType string `json:"order"`

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

	// Query snapshot within a particular snapshot.
	VolSetID volumeset.ID `json:"volset_id"`

	Search string `json:"search"`
}

Query ..

func (*Query) Matches

func (q *Query) Matches(ss Snapshot) bool

Matches ..

func (Query) Validate

func (q Query) Validate() error

Validate ..

type Snapshot

type Snapshot struct {
	ID               ID           `json:"id"`
	ParentID         *ID          `json:"parent_id"`
	VolSetID         volumeset.ID `json:"volsetid"`
	CreationTime     time.Time    `json:"creation_time"`
	Size             uint64       `json:"size"`
	Creator          string       `json:"creator"`
	CreatorName      string       `json:"creator_name"`
	Owner            string       `json:"owner"`
	OwnerName        string       `json:"owner_name"`
	Attrs            attrs.Attrs  `json:"attrs"`
	Name             string       `json:"name"`
	LastModifiedTime time.Time    `json:"last_modified_time"` // last time the meta data is modified
	Description      string       `json:"description"`

	// Local fields that should nt be synced to another MDS
	// TODO: This json skip only works for a remote MDS which passes objects marshalled by JSON.
	// It doesn't work for a local MDS.
	// BlobID is the current blob id
	BlobID blob.ID `json:"-"`

	// PrevBlobID is the blob id at the time this object is created
	PrevBlobID blob.ID `json:"-"`

	// Note: Following fields are used by different logic including sync, adding new snapshots, etc.
	//       They are exposed and can be used for other purposes, for example, show to UI.
	//       These fields are immutable. Also, they are only valid after a read from the MDS.
	//       (For example, after calling ImportSnapshot(), the snapshots passed for import may not have
	//       the right depth)
	Depth       int    `json:"depth"`
	NumChildren int    `json:"number_children"`
	IsTip       bool   `json:"is_tip"`      // True if the snapshot is the end of a branch(may not be a leaf)
	BranchName  string `json:"branch_name"` // valid only if 'IsTip' is true
}

Snapshot represents a point-in-time consistent version of a volumeset. It can be unambiguously addressed with a ID, snapshot.ID pair. It exists in a forest-like structure with other snapshots in the same volumeset.

func (*Snapshot) Copy

func (sn *Snapshot) Copy() *Snapshot

Copy ...

func (*Snapshot) Equals

func (sn *Snapshot) Equals(that *Snapshot) bool

Equals returns true if a and b contain exactly the same data, false otherwise.

func (Snapshot) HasParent

func (sn Snapshot) HasParent() bool

HasParent ...

func (*Snapshot) RetrieveKnownKeys

func (sn *Snapshot) RetrieveKnownKeys()

RetrieveKnownKeys retrives all known keys from attributes

func (*Snapshot) SetCreatorUUID

func (sn *Snapshot) SetCreatorUUID(currentUser string) error

SetCreatorUUID sets creator uuid given the current user

func (*Snapshot) SetOwnerUUID

func (sn *Snapshot) SetOwnerUUID(currentUser string) error

SetOwnerUUID sets owner uuid from name and current client and creator

func (*Snapshot) StoreKnownKeys

func (sn *Snapshot) 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