Documentation
¶
Index ¶
- Constants
- type ID
- type Query
- type Snapshot
- func (sn *Snapshot) Copy() *Snapshot
- func (sn *Snapshot) Equals(that *Snapshot) bool
- func (sn Snapshot) HasParent() bool
- func (sn *Snapshot) RetrieveKnownKeys()
- func (sn *Snapshot) SetCreatorUUID(currentUser string) error
- func (sn *Snapshot) SetOwnerUUID(currentUser string) error
- func (sn *Snapshot) StoreKnownKeys()
Constants ¶
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 NewRandomID ¶
func NewRandomID() ID
NewRandomID generates a new unused snapshot identifier at random.
func (*ID) UnmarshalJSON ¶
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 ..
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) Equals ¶
Equals returns true if a and b contain exactly the same data, false otherwise.
func (*Snapshot) RetrieveKnownKeys ¶
func (sn *Snapshot) RetrieveKnownKeys()
RetrieveKnownKeys retrives all known keys from attributes
func (*Snapshot) SetCreatorUUID ¶
SetCreatorUUID sets creator uuid given the current user
func (*Snapshot) SetOwnerUUID ¶
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