Documentation ¶
Overview ¶
Package fish core defines all the internals of the Fish processes
Index ¶
- Constants
- type Config
- type ConfigDriver
- type Fish
- func (f *Fish) ApplicationCreate(a *types.Application) error
- func (f *Fish) ApplicationFind(filter *string) (as []types.Application, err error)
- func (f *Fish) ApplicationGet(uid types.ApplicationUID) (a *types.Application, err error)
- func (f *Fish) ApplicationIsAllocated(appUID types.ApplicationUID) (err error)
- func (f *Fish) ApplicationListGetStatusNew() (as []types.Application, err error)
- func (f *Fish) ApplicationStateCreate(as *types.ApplicationState) error
- func (f *Fish) ApplicationStateGet(uid types.ApplicationStateUID) (as *types.ApplicationState, err error)
- func (f *Fish) ApplicationStateGetByApplication(appUID types.ApplicationUID) (as *types.ApplicationState, err error)
- func (*Fish) ApplicationStateIsActive(status types.ApplicationStatus) bool
- func (f *Fish) ApplicationStateList() (ass []types.ApplicationState, err error)
- func (f *Fish) ApplicationTaskCreate(at *types.ApplicationTask) error
- func (f *Fish) ApplicationTaskFindByApplication(uid types.ApplicationUID, filter *string) (at []types.ApplicationTask, err error)
- func (f *Fish) ApplicationTaskGet(uid types.ApplicationTaskUID) (at *types.ApplicationTask, err error)
- func (f *Fish) ApplicationTaskListByApplicationAndWhen(appUID types.ApplicationUID, when types.ApplicationStatus) (at []types.ApplicationTask, err error)
- func (f *Fish) ApplicationTaskSave(at *types.ApplicationTask) error
- func (f *Fish) Close()
- func (f *Fish) GetLocationName() types.LocationName
- func (f *Fish) GetNode() *types.Node
- func (f *Fish) GetNodeUID() types.ApplicationUID
- func (f *Fish) Init() error
- func (f *Fish) LabelCreate(l *types.Label) error
- func (f *Fish) LabelDelete(uid types.LabelUID) error
- func (f *Fish) LabelFind(filter *string) (labels []types.Label, err error)
- func (f *Fish) LabelGet(uid types.LabelUID) (label *types.Label, err error)
- func (f *Fish) LocationCreate(l *types.Location) error
- func (f *Fish) LocationDelete(name types.LocationName) error
- func (f *Fish) LocationFind(filter *string) (ls []types.Location, err error)
- func (f *Fish) LocationGet(name types.LocationName) (l *types.Location, err error)
- func (f *Fish) LocationSave(l *types.Location) error
- func (f *Fish) MaintenanceSet(value bool)
- func (f *Fish) NewUID() uuid.UUID
- func (f *Fish) NodeActiveList() (ns []types.Node, err error)
- func (f *Fish) NodeCreate(n *types.Node) error
- func (f *Fish) NodeFind(filter *string) (ns []types.Node, err error)
- func (f *Fish) NodeGet(name string) (node *types.Node, err error)
- func (f *Fish) NodePing(node *types.Node) error
- func (f *Fish) NodeSave(node *types.Node) error
- func (f *Fish) ResourceAccessCreate(r *types.ResourceAccess) error
- func (f *Fish) ResourceAccessDelete(uid types.ResourceAccessUID) error
- func (f *Fish) ResourceAccessDeleteByResource(resourceUID types.ResourceUID) error
- func (f *Fish) ResourceAccessSingleUsePassword(username string, password string) (ra *types.ResourceAccess, err error)
- func (f *Fish) ResourceCreate(r *types.Resource) error
- func (f *Fish) ResourceDelete(uid types.ResourceUID) error
- func (f *Fish) ResourceFind(filter *string) (rs []types.Resource, err error)
- func (f *Fish) ResourceGet(uid types.ResourceUID) (res *types.Resource, err error)
- func (f *Fish) ResourceGetByApplication(appUID types.ApplicationUID) (res *types.Resource, err error)
- func (f *Fish) ResourceGetByIP(ip string) (res *types.Resource, err error)
- func (f *Fish) ResourceListNode(nodeUID types.NodeUID) (rs []types.Resource, err error)
- func (f *Fish) ResourceSave(res *types.Resource) error
- func (f *Fish) ResourceServiceMappingByApplicationAndDest(appUID types.ApplicationUID, dest string) string
- func (f *Fish) ServiceMappingCreate(sm *types.ServiceMapping) error
- func (f *Fish) ServiceMappingDelete(uid types.ServiceMappingUID) error
- func (f *Fish) ServiceMappingFind(filter *string) (sms []types.ServiceMapping, err error)
- func (f *Fish) ServiceMappingGet(uid types.ServiceMappingUID) (sm *types.ServiceMapping, err error)
- func (f *Fish) ServiceMappingSave(sm *types.ServiceMapping) error
- func (f *Fish) ShutdownDelaySet(delay time.Duration)
- func (f *Fish) ShutdownSet(value bool)
- func (f *Fish) UserAuth(name string, password string) *types.User
- func (f *Fish) UserCreate(u *types.User) error
- func (f *Fish) UserDelete(name string) error
- func (f *Fish) UserFind(filter *string) (us []types.User, err error)
- func (f *Fish) UserGet(name string) (u *types.User, err error)
- func (f *Fish) UserNew(name string, password string) (string, *types.User, error)
- func (f *Fish) UserSave(u *types.User) error
- func (f *Fish) VoteCreate(v *types.Vote) error
- func (f *Fish) VoteCurrentRoundGet(appUID types.ApplicationUID) uint16
- func (f *Fish) VoteFind(filter *string) (vs []types.Vote, err error)
- func (f *Fish) VoteGet(uid types.VoteUID) (v *types.Vote, err error)
- func (f *Fish) VoteGetElectionWinner(appUID types.ApplicationUID, round uint16) (v *types.Vote, err error)
- func (f *Fish) VoteGetNodeApplication(nodeUID types.NodeUID, appUID types.ApplicationUID) (v *types.Vote, err error)
- func (f *Fish) VoteListGetApplicationRound(appUID types.ApplicationUID, round uint16) (vs []types.Vote, err error)
Constants ¶
const ElectionRoundTime = 30
ElectionRoundTime defines how long the voting round will take in seconds - so cluster nodes will be able to interchange their responses
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Directory string `json:"directory"` // Where to store database and other useful data (if relative - to CWD) APIAddress string `json:"api_address"` // Where to serve Web UI, API & Meta API ProxySocksAddress string `json:"proxy_socks_address"` // Where to serve SOCKS5 proxy for the allocated resources ProxySSHAddress string `json:"proxy_ssh_address"` // Where to serve SSH proxy for the allocated resources NodeAddress string `json:"node_address"` // What is the external address of the node CPULimit uint16 `json:"cpu_limit"` // How many CPU threads Node allowed to use (serve API, ...) MemTarget util.HumanSize `json:"mem_target"` // What's the target memory utilization by the Node (GC target where it becomes more aggressive) ClusterJoin []string `json:"cluster_join"` // The node addresses to join the cluster TLSKey string `json:"tls_key"` // TLS PEM private key (if relative - to directory) TLSCrt string `json:"tls_crt"` // TLS PEM public certificate (if relative - to directory) TLSCaCrt string `json:"tls_ca_crt"` // TLS PEM certificate authority certificate (if relative - to directory) NodeName string `json:"node_name"` // Last resort in case you need to override the default host node name NodeLocation string `json:"node_location"` // Specify cluster node location for multi-dc configurations NodeIdentifiers []string `json:"node_identifiers"` // The list of node identifiers which could be used to find the right Node for Resource NodeSSHKey string `json:"ssh_key"` // The SSH RSA identity private key for the fish node (if relative - to directory) DefaultResourceLifetime string `json:"default_resource_lifetime"` // Sets the lifetime of the resource which will be used if label definition one is not set // Configuration for the node drivers, if defined - only the listed plugins will be loaded // Each configuration could instantinate the same driver multiple times by adding instance name // separated from driver by slash symbol (like "<driver>/prod" - will create "prod" instance). Drivers []ConfigDriver `json:"drivers"` }
Config defines Fish node configuration
func (*Config) ReadConfigFile ¶
ReadConfigFile needed to read the config file
type ConfigDriver ¶
type ConfigDriver struct { Name string `json:"name"` Cfg util.UnparsedJSON `json:"cfg"` }
ConfigDriver helper to store driver config without parsing it right away
type Fish ¶
type Fish struct { // Signal to stop the fish Quit chan os.Signal // contains filtered or unexported fields }
Fish structure is used to store the node internal state
func (*Fish) ApplicationCreate ¶
func (f *Fish) ApplicationCreate(a *types.Application) error
ApplicationCreate makes new Applciation
func (*Fish) ApplicationFind ¶
func (f *Fish) ApplicationFind(filter *string) (as []types.Application, err error)
ApplicationFind lists Applications by filter
func (*Fish) ApplicationGet ¶
func (f *Fish) ApplicationGet(uid types.ApplicationUID) (a *types.Application, err error)
ApplicationGet returns Application by UID
func (*Fish) ApplicationIsAllocated ¶
func (f *Fish) ApplicationIsAllocated(appUID types.ApplicationUID) (err error)
ApplicationIsAllocated returns if specific Application is allocated
func (*Fish) ApplicationListGetStatusNew ¶
func (f *Fish) ApplicationListGetStatusNew() (as []types.Application, err error)
ApplicationListGetStatusNew returns new Applications
func (*Fish) ApplicationStateCreate ¶
func (f *Fish) ApplicationStateCreate(as *types.ApplicationState) error
ApplicationStateCreate makes new ApplicationState
func (*Fish) ApplicationStateGet ¶
func (f *Fish) ApplicationStateGet(uid types.ApplicationStateUID) (as *types.ApplicationState, err error)
ApplicationStateGet returns specific ApplicationState
func (*Fish) ApplicationStateGetByApplication ¶
func (f *Fish) ApplicationStateGetByApplication(appUID types.ApplicationUID) (as *types.ApplicationState, err error)
ApplicationStateGetByApplication returns ApplicationState by ApplicationUID
func (*Fish) ApplicationStateIsActive ¶
func (*Fish) ApplicationStateIsActive(status types.ApplicationStatus) bool
ApplicationStateIsActive returns false if Status in ERROR, DEALLOCATE or DEALLOCATED state
func (*Fish) ApplicationStateList ¶
func (f *Fish) ApplicationStateList() (ass []types.ApplicationState, err error)
ApplicationStateList returns list of ApplicationStates
func (*Fish) ApplicationTaskCreate ¶ added in v0.6.0
func (f *Fish) ApplicationTaskCreate(at *types.ApplicationTask) error
ApplicationTaskCreate makes a new ApplicationTask
func (*Fish) ApplicationTaskFindByApplication ¶ added in v0.6.0
func (f *Fish) ApplicationTaskFindByApplication(uid types.ApplicationUID, filter *string) (at []types.ApplicationTask, err error)
ApplicationTaskFindByApplication allows to find all the ApplicationTasks by ApplciationUID
func (*Fish) ApplicationTaskGet ¶ added in v0.6.0
func (f *Fish) ApplicationTaskGet(uid types.ApplicationTaskUID) (at *types.ApplicationTask, err error)
ApplicationTaskGet returns the ApplicationTask by ApplicationTaskUID
func (*Fish) ApplicationTaskListByApplicationAndWhen ¶ added in v0.6.0
func (f *Fish) ApplicationTaskListByApplicationAndWhen(appUID types.ApplicationUID, when types.ApplicationStatus) (at []types.ApplicationTask, err error)
ApplicationTaskListByApplicationAndWhen returns list of ApplicationTasks by ApplicationUID and When it need to be executed
func (*Fish) ApplicationTaskSave ¶ added in v0.6.0
func (f *Fish) ApplicationTaskSave(at *types.ApplicationTask) error
ApplicationTaskSave stores the ApplicationTask
func (*Fish) Close ¶
func (f *Fish) Close()
Close tells the node that the Fish execution need to be stopped
func (*Fish) GetLocationName ¶
func (f *Fish) GetLocationName() types.LocationName
GetLocationName returns node location
func (*Fish) GetNodeUID ¶
func (f *Fish) GetNodeUID() types.ApplicationUID
GetNodeUID returns node UID
func (*Fish) LabelCreate ¶
LabelCreate makes new Label
func (*Fish) LabelDelete ¶
LabelDelete deletes the Label by UID
func (*Fish) LocationCreate ¶
LocationCreate makes new Location
func (*Fish) LocationDelete ¶
func (f *Fish) LocationDelete(name types.LocationName) error
LocationDelete removes location
func (*Fish) LocationFind ¶
LocationFind returns list of Locations fits filter
func (*Fish) LocationGet ¶
LocationGet returns Location by it's unique name
func (*Fish) LocationSave ¶
LocationSave stores the Location
func (*Fish) MaintenanceSet ¶ added in v0.7.0
MaintenanceSet sets/unsets the maintenance mode which will not allow to accept the additional Applications
func (*Fish) NodeActiveList ¶
NodeActiveList lists all the nodes in the cluster
func (*Fish) ResourceAccessCreate ¶ added in v0.7.4
func (f *Fish) ResourceAccessCreate(r *types.ResourceAccess) error
ResourceAccessCreate makes new ResourceAccess
func (*Fish) ResourceAccessDelete ¶ added in v0.7.4
func (f *Fish) ResourceAccessDelete(uid types.ResourceAccessUID) error
ResourceAccessDelete removes ResourceAccess by UID
func (*Fish) ResourceAccessDeleteByResource ¶ added in v0.7.4
func (f *Fish) ResourceAccessDeleteByResource(resourceUID types.ResourceUID) error
ResourceAccessDeleteByResource removes ResourceAccess by ResourceUID
func (*Fish) ResourceAccessSingleUsePassword ¶ added in v0.7.4
func (f *Fish) ResourceAccessSingleUsePassword(username string, password string) (ra *types.ResourceAccess, err error)
ResourceAccessSingleUsePassword retrieves the password from the database *AND* deletes it. Users must issue another curl call to request a new access password.
func (*Fish) ResourceCreate ¶
ResourceCreate makes new Resource
func (*Fish) ResourceDelete ¶
func (f *Fish) ResourceDelete(uid types.ResourceUID) error
ResourceDelete removes Resource
func (*Fish) ResourceFind ¶
ResourceFind lists Resources that fits filter
func (*Fish) ResourceGet ¶
ResourceGet returns Resource by it's UID
func (*Fish) ResourceGetByApplication ¶
func (f *Fish) ResourceGetByApplication(appUID types.ApplicationUID) (res *types.Resource, err error)
ResourceGetByApplication returns Resource by ApplicationUID
func (*Fish) ResourceGetByIP ¶
ResourceGetByIP returns Resource by it's IP address
func (*Fish) ResourceListNode ¶
ResourceListNode returns list of resources for provided NodeUID
func (*Fish) ResourceSave ¶
ResourceSave stores Resource
func (*Fish) ResourceServiceMappingByApplicationAndDest ¶ added in v0.7.5
func (f *Fish) ResourceServiceMappingByApplicationAndDest(appUID types.ApplicationUID, dest string) string
ResourceServiceMappingByApplicationAndDest is trying to find the ResourceServiceMapping record with Application and Location if possible. The application in priority, location - secondary priority, if no such records found - default will be used.
func (*Fish) ServiceMappingCreate ¶
func (f *Fish) ServiceMappingCreate(sm *types.ServiceMapping) error
ServiceMappingCreate makes new ServiceMapping
func (*Fish) ServiceMappingDelete ¶
func (f *Fish) ServiceMappingDelete(uid types.ServiceMappingUID) error
ServiceMappingDelete removes ServiceMapping
func (*Fish) ServiceMappingFind ¶
func (f *Fish) ServiceMappingFind(filter *string) (sms []types.ServiceMapping, err error)
ServiceMappingFind returns list of ServiceMappings that fits the filter
func (*Fish) ServiceMappingGet ¶
func (f *Fish) ServiceMappingGet(uid types.ServiceMappingUID) (sm *types.ServiceMapping, err error)
ServiceMappingGet returns ServiceMapping by UID
func (*Fish) ServiceMappingSave ¶
func (f *Fish) ServiceMappingSave(sm *types.ServiceMapping) error
ServiceMappingSave stores ServiceMapping
func (*Fish) ShutdownDelaySet ¶ added in v0.7.0
ShutdownDelaySet set of how much time to wait before executing the node shutdown operation
func (*Fish) ShutdownSet ¶ added in v0.7.0
ShutdownSet tells node it need to execute graceful shutdown operation
func (*Fish) VoteCurrentRoundGet ¶
func (f *Fish) VoteCurrentRoundGet(appUID types.ApplicationUID) uint16
VoteCurrentRoundGet returns the current round of voting based on the known Votes
func (*Fish) VoteGetElectionWinner ¶
func (f *Fish) VoteGetElectionWinner(appUID types.ApplicationUID, round uint16) (v *types.Vote, err error)
VoteGetElectionWinner returns Vote that won the election
func (*Fish) VoteGetNodeApplication ¶
func (f *Fish) VoteGetNodeApplication(nodeUID types.NodeUID, appUID types.ApplicationUID) (v *types.Vote, err error)
VoteGetNodeApplication returns latest Vote by Node and Application
func (*Fish) VoteListGetApplicationRound ¶
func (f *Fish) VoteListGetApplicationRound(appUID types.ApplicationUID, round uint16) (vs []types.Vote, err error)
VoteListGetApplicationRound returns Votes for the specified round