Documentation ¶
Index ¶
- Variables
- func ImageRepoName(m *types.ContainerBlueprint) string
- type AppCollection
- func (c *AppCollection) Create(r *AppResource) (*AppResource, error)
- func (c *AppCollection) EtcdKey(name types.ID) string
- func (c *AppCollection) Get(name types.ID) (*AppResource, error)
- func (c *AppCollection) InitializeResource(r Resource) error
- func (c *AppCollection) List() (*AppList, error)
- func (c *AppCollection) New() *AppResource
- type AppList
- type AppResource
- type AwsVolume
- type Collection
- type ComponentCollection
- func (c *ComponentCollection) Create(r *ComponentResource) (*ComponentResource, error)
- func (c *ComponentCollection) EtcdKey(name types.ID) string
- func (c *ComponentCollection) Get(name types.ID) (*ComponentResource, error)
- func (c *ComponentCollection) InitializeResource(r Resource) error
- func (c *ComponentCollection) List() (*ComponentList, error)
- func (c *ComponentCollection) New() *ComponentResource
- type ComponentList
- type ComponentResource
- func (r *ComponentResource) App() *AppResource
- func (r *ComponentResource) CurrentRelease() (*ReleaseResource, error)
- func (r *ComponentResource) Delete() error
- func (r *ComponentResource) PersistableObject() interface{}
- func (r *ComponentResource) Releases() *ReleaseCollection
- func (r *ComponentResource) Save() error
- func (r *ComponentResource) TargetRelease() (*ReleaseResource, error)
- type Core
- type DB
- func (db *DB) CompareAndSwap(r Collection, id types.ID, old Resource, new Resource) error
- func (db *DB) Create(r Collection, id types.ID, m Resource) error
- func (db *DB) CreateDir(key string) (*etcd.Response, error)
- func (db *DB) CreateInOrder(r Collection, m OrderedResource) error
- func (db *DB) Delete(r Collection, id types.ID) error
- func (db *DB) Get(r Collection, id types.ID, out Resource) error
- func (db *DB) List(r Collection, out interface{}) error
- func (db *DB) ListInOrder(r Collection, out interface{}) error
- func (db *DB) Update(r Collection, id types.ID, m Resource) error
- type EntrypointCollection
- func (c *EntrypointCollection) Create(r *EntrypointResource) (*EntrypointResource, error)
- func (c *EntrypointCollection) EtcdKey(domain types.ID) string
- func (c *EntrypointCollection) Get(domain types.ID) (*EntrypointResource, error)
- func (c *EntrypointCollection) InitializeResource(r Resource) error
- func (c *EntrypointCollection) List() (*EntrypointList, error)
- func (c *EntrypointCollection) New() *EntrypointResource
- type EntrypointList
- type EntrypointResource
- type ExternalPort
- type ImageRepoCollection
- func (c *ImageRepoCollection) Create(r *ImageRepoResource) (*ImageRepoResource, error)
- func (c *ImageRepoCollection) EtcdKey(name types.ID) string
- func (c *ImageRepoCollection) Get(name types.ID) (*ImageRepoResource, error)
- func (c *ImageRepoCollection) InitializeResource(r Resource) error
- func (c *ImageRepoCollection) List() (*ImageRepoList, error)
- func (c *ImageRepoCollection) New() *ImageRepoResource
- type ImageRepoList
- type ImageRepoResource
- type InstanceCollection
- type InstanceList
- type InstanceResource
- func (r *InstanceResource) App() *AppResource
- func (r *InstanceResource) Component() *ComponentResource
- func (r *InstanceResource) Delete() (err error)
- func (r *InstanceResource) DeleteVolumes() error
- func (r *InstanceResource) IsStarted() bool
- func (r *InstanceResource) IsStopped() bool
- func (r *InstanceResource) Release() *ReleaseResource
- func (r *InstanceResource) Start() error
- func (r *InstanceResource) Stop() error
- func (r *InstanceResource) Volumes() (vols []*AwsVolume)
- type InternalPort
- type OrderedResource
- type ReleaseCollection
- func (c *ReleaseCollection) Create(r *ReleaseResource) (*ReleaseResource, error)
- func (c *ReleaseCollection) EtcdKey(timestamp types.ID) string
- func (c *ReleaseCollection) Get(id types.ID) (*ReleaseResource, error)
- func (c *ReleaseCollection) InitializeResource(r Resource) error
- func (c *ReleaseCollection) List() (*ReleaseList, error)
- func (c *ReleaseCollection) New() *ReleaseResource
- type ReleaseList
- type ReleaseResource
- func (newR *ReleaseResource) AddNewPorts(oldR *ReleaseResource) error
- func (r *ReleaseResource) App() *AppResource
- func (r *ReleaseResource) Component() *ComponentResource
- func (r *ReleaseResource) Delete() error
- func (r *ReleaseResource) ExternalPorts() (ports []*ExternalPort)
- func (r *ReleaseResource) ExternalServiceName() string
- func (r *ReleaseResource) ImagePullSecrets() (pullSecrets []*guber.ImagePullSecret, err error)
- func (r *ReleaseResource) Instances() *InstanceCollection
- func (r *ReleaseResource) InternalPorts() (ports []*InternalPort)
- func (r *ReleaseResource) InternalServiceName() string
- func (r *ReleaseResource) IsStarted() bool
- func (r *ReleaseResource) IsStopped() bool
- func (r *ReleaseResource) PersistableObject() interface{}
- func (r *ReleaseResource) Provision() error
- func (newR *ReleaseResource) RemoveOldPorts(oldR *ReleaseResource) error
- func (r *ReleaseResource) Save() error
- type Resource
- type TaskCollection
- func (c *TaskCollection) Create(r *TaskResource) (*TaskResource, error)
- func (c *TaskCollection) EtcdKey(id types.ID) string
- func (c *TaskCollection) Get(id types.ID) (*TaskResource, error)
- func (c *TaskCollection) InitializeResource(r Resource) error
- func (c *TaskCollection) List() (*TaskList, error)
- func (c *TaskCollection) New() *TaskResource
- func (c *TaskCollection) Start(t types.TaskType, msg interface{}) (*TaskResource, error)
- type TaskList
- type TaskResource
- func (r *TaskResource) Claim() error
- func (r *TaskResource) Delete() error
- func (r *TaskResource) IsQueued() bool
- func (r *TaskResource) PersistableObject() interface{}
- func (r *TaskResource) RecordError(err error) error
- func (r *TaskResource) Save() error
- func (r *TaskResource) SetID(id types.ID)
- func (r *TaskResource) TypeName() string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ImageRepoName ¶
func ImageRepoName(m *types.ContainerBlueprint) string
Types ¶
type AppCollection ¶
type AppCollection struct {
// contains filtered or unexported fields
}
func (*AppCollection) Create ¶
func (c *AppCollection) Create(r *AppResource) (*AppResource, error)
Create takes an App and creates it in etcd. It also creates a Kubernetes Namespace with the name of the App.
func (*AppCollection) EtcdKey ¶
func (c *AppCollection) EtcdKey(name types.ID) string
EtcdKey implements the Collection interface.
func (*AppCollection) Get ¶
func (c *AppCollection) Get(name types.ID) (*AppResource, error)
Get takes a name and returns an AppResource if it exists.
func (*AppCollection) InitializeResource ¶
func (c *AppCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*AppCollection) List ¶
func (c *AppCollection) List() (*AppList, error)
List returns an AppList.
func (*AppCollection) New ¶
func (c *AppCollection) New() *AppResource
New initializes an App with a pointer to the Collection.
type AppList ¶
type AppList struct {
Items []*AppResource `json:"items"`
}
NOTE this does not inherit from types like model does; all we need is a List object, internally, that has a slice of our composed model above.
type AppResource ¶
func (*AppResource) Components ¶
func (r *AppResource) Components() *ComponentCollection
Components returns a ComponentCollection with a pointer to the AppResource.
func (*AppResource) Delete ¶
func (r *AppResource) Delete() error
Delete cascades deletes to all Components, deletes the Kube Namespace, and deletes the App in etcd.
func (*AppResource) PersistableObject ¶
func (r *AppResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
func (*AppResource) ProvisionSecret ¶
func (r *AppResource) ProvisionSecret(repo *ImageRepoResource) error
type AwsVolume ¶
type AwsVolume struct { Blueprint *types.VolumeBlueprint Instance *InstanceResource // contains filtered or unexported fields }
func (*AwsVolume) NeedsResize ¶ added in v0.3.0
NeedsResize returns true if the actual EBS size does not match the blueprint.
func (*AwsVolume) Resize ¶ added in v0.3.0
Resize snapshots the volume, creates a new volume from the snapshot, deletes the old volume, and renames the new volume to have the old name.
func (*AwsVolume) WaitForAvailable ¶
type Collection ¶
type Collection interface { EtcdKey(id types.ID) string // InitializeResource is called when unmarshalling objects from etcd. // Primarily, it sets a pointer to the Collection on the Resource. InitializeResource(r Resource) error }
Collection is an interface for defining behavior of a collection of Resources.
type ComponentCollection ¶
type ComponentCollection struct { App *AppResource // contains filtered or unexported fields }
func (*ComponentCollection) Create ¶
func (c *ComponentCollection) Create(r *ComponentResource) (*ComponentResource, error)
Create takes an Component and creates it in etcd.
func (*ComponentCollection) EtcdKey ¶
func (c *ComponentCollection) EtcdKey(name types.ID) string
EtcdKey implements the Collection interface.
func (*ComponentCollection) Get ¶
func (c *ComponentCollection) Get(name types.ID) (*ComponentResource, error)
Get takes a name and returns an ComponentResource if it exists.
func (*ComponentCollection) InitializeResource ¶
func (c *ComponentCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*ComponentCollection) List ¶
func (c *ComponentCollection) List() (*ComponentList, error)
List returns an ComponentList.
func (*ComponentCollection) New ¶
func (c *ComponentCollection) New() *ComponentResource
New initializes an Component with a pointer to the Collection.
type ComponentList ¶
type ComponentList struct {
Items []*ComponentResource `json:"items"`
}
type ComponentResource ¶
func (*ComponentResource) App ¶
func (r *ComponentResource) App() *AppResource
func (*ComponentResource) CurrentRelease ¶
func (r *ComponentResource) CurrentRelease() (*ReleaseResource, error)
func (*ComponentResource) Delete ¶
func (r *ComponentResource) Delete() error
Delete cascades delete calls to current and target releases, and deletes the Component in etcd.
TODO this should somehow stop any ongoing tasks related to the Component.
func (*ComponentResource) PersistableObject ¶
func (r *ComponentResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
func (*ComponentResource) Releases ¶
func (r *ComponentResource) Releases() *ReleaseCollection
func (*ComponentResource) Save ¶
func (r *ComponentResource) Save() error
Save saves the Component in etcd through an update.
func (*ComponentResource) TargetRelease ¶
func (r *ComponentResource) TargetRelease() (*ReleaseResource, error)
type Core ¶
type Core struct { DB *DB K8S *guber.Client EC2 *ec2.EC2 ELB *elb.ELB AutoScaling *autoscaling.AutoScaling }
func (*Core) Apps ¶
func (c *Core) Apps() *AppCollection
Top-level resources ==============================================================================
func (*Core) Entrypoints ¶
func (c *Core) Entrypoints() *EntrypointCollection
func (*Core) ImageRepos ¶
func (c *Core) ImageRepos() *ImageRepoCollection
func (*Core) Tasks ¶
func (c *Core) Tasks() *TaskCollection
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) CompareAndSwap ¶
func (*DB) CreateInOrder ¶
func (db *DB) CreateInOrder(r Collection, m OrderedResource) error
func (*DB) List ¶
func (db *DB) List(r Collection, out interface{}) error
func (*DB) ListInOrder ¶
func (db *DB) ListInOrder(r Collection, out interface{}) error
------------------------------------------------------------------------------
type EntrypointCollection ¶
type EntrypointCollection struct {
// contains filtered or unexported fields
}
func (*EntrypointCollection) Create ¶
func (c *EntrypointCollection) Create(r *EntrypointResource) (*EntrypointResource, error)
Create takes an Entrypoint and creates it in etcd. It also creates a Kubernetes Namespace with the name of the Entrypoint.
func (*EntrypointCollection) EtcdKey ¶
func (c *EntrypointCollection) EtcdKey(domain types.ID) string
EtcdKey implements the Collection interface.
func (*EntrypointCollection) Get ¶
func (c *EntrypointCollection) Get(domain types.ID) (*EntrypointResource, error)
Get takes a name and returns an EntrypointResource if it exists.
func (*EntrypointCollection) InitializeResource ¶
func (c *EntrypointCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*EntrypointCollection) List ¶
func (c *EntrypointCollection) List() (*EntrypointList, error)
List returns an EntrypointList.
func (*EntrypointCollection) New ¶
func (c *EntrypointCollection) New() *EntrypointResource
New initializes an Entrypoint with a pointer to the Collection.
type EntrypointList ¶
type EntrypointList struct {
Items []*EntrypointResource `json:"items"`
}
NOTE this does not inherit from types like model does; all we need is a List object, internally, that has a slice of our composed model above.
type EntrypointResource ¶
type EntrypointResource struct { *types.Entrypoint // contains filtered or unexported fields }
func (*EntrypointResource) AddPort ¶
func (r *EntrypointResource) AddPort(elbPort int, instancePort int) error
AddPort creates a listener on the ELB.
func (*EntrypointResource) Delete ¶
func (r *EntrypointResource) Delete() error
Delete cascades deletes to all Components, deletes the Kube Namespace, and deletes the Entrypoint in etcd.
func (*EntrypointResource) PersistableObject ¶
func (r *EntrypointResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
func (*EntrypointResource) RemovePort ¶
func (r *EntrypointResource) RemovePort(elbPort int) error
RemovePort removes a listener from the ELB.
func (*EntrypointResource) Save ¶
func (r *EntrypointResource) Save() error
Save saves the Entrypoint in etcd through an update.
type ExternalPort ¶ added in v0.3.2
type ExternalPort struct {
// contains filtered or unexported fields
}
func NewExternalPort ¶ added in v0.3.2
func NewExternalPort(p *types.Port, r *ReleaseResource, e *EntrypointResource) *ExternalPort
NOTE we pass entrypoint here, instead of simply finding from the port definition because it prevents unnecessary multiple lookups on the Entrypoint
func (*ExternalPort) AddToELB ¶ added in v0.3.2
func (ep *ExternalPort) AddToELB() error
TODO like the comment above, this only applies when there is an EntrypointDomain
func (*ExternalPort) Address ¶ added in v0.3.2
func (ep *ExternalPort) Address() *types.PortAddress
func (*ExternalPort) RemoveFromELB ¶ added in v0.3.2
func (ep *ExternalPort) RemoveFromELB() error
type ImageRepoCollection ¶
type ImageRepoCollection struct {
// contains filtered or unexported fields
}
func (*ImageRepoCollection) Create ¶
func (c *ImageRepoCollection) Create(r *ImageRepoResource) (*ImageRepoResource, error)
Create takes an ImageRepo and creates it in etcd. It also creates a Kubernetes Namespace with the name of the ImageRepo.
func (*ImageRepoCollection) EtcdKey ¶
func (c *ImageRepoCollection) EtcdKey(name types.ID) string
EtcdKey implements the Collection interface.
func (*ImageRepoCollection) Get ¶
func (c *ImageRepoCollection) Get(name types.ID) (*ImageRepoResource, error)
Get takes a name and returns an ImageRepoResource if it exists.
func (*ImageRepoCollection) InitializeResource ¶
func (c *ImageRepoCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*ImageRepoCollection) List ¶
func (c *ImageRepoCollection) List() (*ImageRepoList, error)
List returns an ImageRepoList.
func (*ImageRepoCollection) New ¶
func (c *ImageRepoCollection) New() *ImageRepoResource
New initializes an ImageRepo with a pointer to the Collection.
type ImageRepoList ¶
type ImageRepoList struct {
Items []*ImageRepoResource `json:"items"`
}
NOTE this does not inherit from types like model does; all we need is a List object, internally, that has a slice of our composed model above.
type ImageRepoResource ¶
func (*ImageRepoResource) Delete ¶
func (r *ImageRepoResource) Delete() error
Delete deletes the ImageRepo in etcd.
func (*ImageRepoResource) PersistableObject ¶
func (r *ImageRepoResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
type InstanceCollection ¶
type InstanceCollection struct { Release *ReleaseResource // contains filtered or unexported fields }
func (*InstanceCollection) Get ¶
func (c *InstanceCollection) Get(id types.ID) (*InstanceResource, error)
Get takes an id and returns an InstanceResource if it exists.
func (*InstanceCollection) List ¶
func (c *InstanceCollection) List() *InstanceList
List returns an InstanceList.
func (*InstanceCollection) New ¶
func (c *InstanceCollection) New(id types.ID) *InstanceResource
New initializes an Instance with a pointer to the Collection.
type InstanceList ¶
type InstanceList struct {
Items []*InstanceResource `json:"items"`
}
type InstanceResource ¶
func (*InstanceResource) App ¶
func (r *InstanceResource) App() *AppResource
func (*InstanceResource) Component ¶
func (r *InstanceResource) Component() *ComponentResource
func (*InstanceResource) Delete ¶
func (r *InstanceResource) Delete() (err error)
Delete tears down the instance
func (*InstanceResource) DeleteVolumes ¶
func (r *InstanceResource) DeleteVolumes() error
exposed for use in deploy_component.go
func (*InstanceResource) IsStarted ¶
func (r *InstanceResource) IsStarted() bool
func (*InstanceResource) IsStopped ¶
func (r *InstanceResource) IsStopped() bool
func (*InstanceResource) Release ¶
func (r *InstanceResource) Release() *ReleaseResource
func (*InstanceResource) Start ¶
func (r *InstanceResource) Start() error
The following 2 are only diff from Provision() and Delete() in that they do not delete the create or delete the volumes.
func (*InstanceResource) Stop ¶
func (r *InstanceResource) Stop() error
func (*InstanceResource) Volumes ¶
func (r *InstanceResource) Volumes() (vols []*AwsVolume)
type InternalPort ¶ added in v0.3.2
type InternalPort struct {
// contains filtered or unexported fields
}
func NewInternalPort ¶ added in v0.3.2
func NewInternalPort(p *types.Port, r *ReleaseResource) *InternalPort
func (*InternalPort) Address ¶ added in v0.3.2
func (ip *InternalPort) Address() *types.PortAddress
type OrderedResource ¶
OrderedResource is similar to Resource, but provides a SetID() method to set an auto-generated ID from etcd on the Resource.
type ReleaseCollection ¶
type ReleaseCollection struct { Component *ComponentResource // contains filtered or unexported fields }
func (*ReleaseCollection) Create ¶
func (c *ReleaseCollection) Create(r *ReleaseResource) (*ReleaseResource, error)
Create takes an Release and creates it in etcd.
func (*ReleaseCollection) EtcdKey ¶
func (c *ReleaseCollection) EtcdKey(timestamp types.ID) string
EtcdKey implements the Collection interface.
func (*ReleaseCollection) Get ¶
func (c *ReleaseCollection) Get(id types.ID) (*ReleaseResource, error)
Get takes an id and returns an ReleaseResource if it exists.
func (*ReleaseCollection) InitializeResource ¶
func (c *ReleaseCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*ReleaseCollection) List ¶
func (c *ReleaseCollection) List() (*ReleaseList, error)
List returns an ReleaseList.
func (*ReleaseCollection) New ¶
func (c *ReleaseCollection) New() *ReleaseResource
New initializes an Release with a pointer to the Collection.
type ReleaseList ¶
type ReleaseList struct {
Items []*ReleaseResource `json:"items"`
}
type ReleaseResource ¶
type ReleaseResource struct { *types.Release // TODO these are shared between releases, it's kinda funky right now ExternalService *guber.Service `json:"-"` InternalService *guber.Service `json:"-"` // contains filtered or unexported fields }
func (*ReleaseResource) AddNewPorts ¶ added in v0.3.2
func (newR *ReleaseResource) AddNewPorts(oldR *ReleaseResource) error
AddNewPorts adds any new ports defined in containers to the existing Services. This is used as a part of the deployment process, and is used in conjunction with RemoveOldPorts. We use the config returned from the services themselves, as opposed to just updating the config, because auto-assigned ports need to be preserved.
func (*ReleaseResource) App ¶
func (r *ReleaseResource) App() *AppResource
func (*ReleaseResource) Component ¶
func (r *ReleaseResource) Component() *ComponentResource
func (*ReleaseResource) Delete ¶
func (r *ReleaseResource) Delete() error
Delete removes all assets (volumes, pods, etc.) and deletes the Release in etcd.
func (*ReleaseResource) ExternalPorts ¶ added in v0.3.2
func (r *ReleaseResource) ExternalPorts() (ports []*ExternalPort)
func (*ReleaseResource) ExternalServiceName ¶ added in v0.3.2
func (r *ReleaseResource) ExternalServiceName() string
func (*ReleaseResource) ImagePullSecrets ¶
func (r *ReleaseResource) ImagePullSecrets() (pullSecrets []*guber.ImagePullSecret, err error)
TODO naming inconsistencies for kube definitions of resources ImagePullSecrets returns repo names defined for Kube pods
func (*ReleaseResource) Instances ¶
func (r *ReleaseResource) Instances() *InstanceCollection
func (*ReleaseResource) InternalPorts ¶ added in v0.3.2
func (r *ReleaseResource) InternalPorts() (ports []*InternalPort)
func (*ReleaseResource) InternalServiceName ¶ added in v0.3.2
func (r *ReleaseResource) InternalServiceName() string
func (*ReleaseResource) IsStarted ¶
func (r *ReleaseResource) IsStarted() bool
func (*ReleaseResource) IsStopped ¶
func (r *ReleaseResource) IsStopped() bool
func (*ReleaseResource) PersistableObject ¶
func (r *ReleaseResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
func (*ReleaseResource) Provision ¶
func (r *ReleaseResource) Provision() error
Provision creates needed assets for all instances. It does not actually start instances -- that is handled by deploy.go.
func (*ReleaseResource) RemoveOldPorts ¶ added in v0.3.2
func (newR *ReleaseResource) RemoveOldPorts(oldR *ReleaseResource) error
func (*ReleaseResource) Save ¶ added in v0.3.1
func (r *ReleaseResource) Save() error
Save saves the Release in etcd through an update.
type Resource ¶
type Resource interface { // PersistableObject returns the portion (or whole) of the Resource meant to // be marshalled and stored in the DB. This allows for dynamic "virtual" // values to be loaded and displayed in the API without needing to be stored. PersistableObject() interface{} }
Resource is an interface used mainly for generalized marshalling purposes for resource types.
type TaskCollection ¶
type TaskCollection struct {
// contains filtered or unexported fields
}
func (*TaskCollection) Create ¶
func (c *TaskCollection) Create(r *TaskResource) (*TaskResource, error)
Create takes an Task and creates it in etcd. It also creates a Kubernetes Namespace with the name of the Task.
func (*TaskCollection) EtcdKey ¶
func (c *TaskCollection) EtcdKey(id types.ID) string
EtcdKey implements the Collection interface.
func (*TaskCollection) Get ¶
func (c *TaskCollection) Get(id types.ID) (*TaskResource, error)
Get takes a name and returns an TaskResource if it exists.
func (*TaskCollection) InitializeResource ¶
func (c *TaskCollection) InitializeResource(r Resource) error
InitializeResource implements the Collection interface.
func (*TaskCollection) List ¶
func (c *TaskCollection) List() (*TaskList, error)
List returns an TaskList.
func (*TaskCollection) New ¶
func (c *TaskCollection) New() *TaskResource
New initializes an Task with a pointer to the Collection.
func (*TaskCollection) Start ¶
func (c *TaskCollection) Start(t types.TaskType, msg interface{}) (*TaskResource, error)
NOTE kinda like a New().Save()
type TaskList ¶
type TaskList struct {
Items []*TaskResource `json:"items"`
}
NOTE this does not inherit from types like model does; all we need is a List object, internally, that has a slice of our composed model above.
type TaskResource ¶
type TaskResource struct { *types.Task ID types.ID `json:"id"` // contains filtered or unexported fields }
func (*TaskResource) Claim ¶
func (r *TaskResource) Claim() error
Claim updates the Task status to "RUNNING" and returns nil. CompareAndSwap is used to prevent a race condition and ensure only one worker performs the task.
func (*TaskResource) Delete ¶
func (r *TaskResource) Delete() error
Delete deletes the Task in etcd.
func (*TaskResource) IsQueued ¶
func (r *TaskResource) IsQueued() bool
func (*TaskResource) PersistableObject ¶
func (r *TaskResource) PersistableObject() interface{}
PersistableObject satisfies the Resource interface
func (*TaskResource) RecordError ¶
func (r *TaskResource) RecordError(err error) error
func (*TaskResource) Save ¶
func (r *TaskResource) Save() error
Save saves the Task in etcd through an update.
func (*TaskResource) SetID ¶
func (r *TaskResource) SetID(id types.ID)
Implements OrderedModel interface
func (*TaskResource) TypeName ¶ added in v0.3.0
func (r *TaskResource) TypeName() string