Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDataType ¶
Types ¶
type BaseEntity ¶
type BaseEntity struct {
ID string `json:"id"`
Name string `json:"name"`
OrganizationID string `json:"organizationId"`
CreatedTime time.Time `json:"createdTime,omitempty"`
ModifiedTime time.Time `json:"modifiedTime,omitempty"`
Revision uint64 `json:"revision"`
Version uint64 `json:"version"`
Spec Spec `json:"state"`
Status Status `json:"status"`
Reason []string `json:"reason"`
Tags Tags `json:"tags"`
Delete bool `json:"delete"`
}
BaseEntity is the base struct for all stored objects
func (*BaseEntity) GetModifiedTime ¶
func (e *BaseEntity) GetModifiedTime() time.Time
func (*BaseEntity) GetName ¶
func (e *BaseEntity) GetName() string
GetName retreives the entity name
func (*BaseEntity) GetRevision ¶
func (e *BaseEntity) GetRevision() uint64
func (*BaseEntity) GetStatus ¶
func (e *BaseEntity) GetStatus() Status
type Entity ¶
type Entity interface {
GetName() string
GetRevision() uint64
GetTags() Tags
GetStatus() Status
GetModifiedTime() time.Time
// contains filtered or unexported methods
}
Entity is the base interface for all stored objects
type EntityStore ¶
type EntityStore interface {
// Add adds new entities to the store
Add(entity Entity) (id string, err error)
// Update updates existing entities to the store
Update(lastRevision uint64, entity Entity) (revision int64, err error)
// GetById gets a single entity by key from the store
Get(organizationID string, key string, entity Entity) error
// List fetches a list of entities of a single data type satisfying the filter.
// entities is a placeholder for results and must be a pointer to an empty slice of the desired entity type.
List(organizationID string, filter Filter, entities interface{}) error
// Delete delets a single entity from the store.
Delete(organizationID string, id string, entity Entity) error
// UpdateWithError is used by entity handlers to save changes and/or error status
// e.g. `defer func() { h.store.UpdateWithError(e, err) }()`
UpdateWithError(e Entity, err error)
}
EntityStore is a wrapper around libkv and provides convenience methods to serializing and deserializing objects
type Status ¶
type Status string
Status represents the current state
const ( // StatusINITIALIZED objet is INITIALIZED // this status is used by image manager StatusINITIALIZED Status = "INITIALIZED" // StatusCREATING object is CREATING // it is not a guarantee that the object is also created and ready in the underlying driver // should wait until the READY state to use the object StatusCREATING Status = "CREATING" // StatusREADY object is READY to be used StatusREADY Status = "READY" // StatusUPDATING object is UPDATING // it is not a guarantee that changes will be reflected by the underlying driver // when updated, will transfer to READY state StatusUPDATING Status = "UPDATING" // StatusDELETING object is DELETING // it is not a guarantee that it has been deleted from the underlying driver // user should not reuse the object name until it is transfered to DELETED state StatusDELETING Status = "DELETING" // StatusDELETED object is DELETED // Note for serverless team: // leave this here, reserved for when we use UUID instead of entity name StatusDELETED Status = "DELETED" // StatusERROR unexpected error state // you should not use the object until the state is tranfered to READY // or the object is deleted StatusERROR Status = "ERROR" )
Click to show internal directories.
Click to hide internal directories.