{"modulePath":"github.com/ProxySQL/orchestrator","version":"v2.1.5+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package process\n\n## Variables\n\n```go\nvar ThisHostname string\n```\n\n## Functions\n\n```go\nfunc AcquireAccessToken(publicToken string) (secretToken string, err error)\n```\nAcquireAccessToken attempts to acquire a hopefully free token; returning in such case the secretToken as proof of ownership.\n\n```go\nfunc AttemptElection() (bool, error)\n```\nAttemptElection tries to grab leadership (become active node)\n\n```go\nfunc ContinuousRegistration(extraInfo string, command string)\n```\nContinuousRegistration will continuously update the node\\_health table showing that the current process is still running.\n\n```go\nfunc ExpireAccessTokens() error\n```\nExpireAccessTokens removes old, known to be uneligible tokens\n\n```go\nfunc ExpireAvailableNodes()\n```\nExpireAvailableNodes is an aggressive purging method to remove node entries who have skipped their keepalive for two times.\n\n```go\nfunc ExpireNodesHistory() error\n```\nExpireNodesHistory cleans up the nodes history and is run by the orchestrator active node.\n\n```go\nfunc GenerateAccessToken(owner string) (publicToken string, err error)\n```\nGenerateAccessToken attempts to generate a new access token and returns the public part of the token\n\n```go\nfunc GetHash(input []byte) string\n```\n\n```go\nfunc GetRandomData() []byte\n```\n\n```go\nfunc GrabElection() error\n```\nGrabElection forcibly grabs leadership. Use with care!!\n\n```go\nfunc Reelect() error\n```\nReelect clears the way for re-elections. Active node is immediately demoted.\n\n```go\nfunc RegisterNode(extraInfo string, command string, firstTime bool) (healthy bool, err error)\n```\nRegisterNode writes down this node in the node\\_health table\n\n```go\nfunc TokenBelongsToHealthyHttpService(token string) (result bool, err error)\n```\n\n```go\nfunc TokenIsValid(publicToken string, secretToken string) (result bool, err error)\n```\nTokenIsValid checks to see whether a given token exists and is not outdated.\n\n## Types\n\n```go\ntype HealthStatus struct {\n\tHealthy        bool\n\tHostname       string\n\tToken          string\n\tIsActiveNode   bool\n\tActiveNode     NodeHealth\n\tError          error\n\tAvailableNodes [](*NodeHealth)\n}\n```\n\n```go\nfunc HealthTest() (*HealthStatus, error)\n```\nHealthTest attempts to write to the backend database and get a result\n\n```go\nfunc SimpleHealthTest() (*HealthStatus, error)\n```\nJust check to make sure we can connect to the database\n\n```go\ntype NodeHealth struct {\n\tHostname        string\n\tToken           string\n\tAppVersion      string\n\tFirstSeenActive string\n\tLastSeenActive  string\n\tDBBackend       string\n}\n```\n\n```go\nfunc ElectedNode() (node NodeHealth, isElected bool, err error)\n```\nElectedNode returns the details of the elected node, as well as answering the question \"is this process the elected one\"?\n\n```go\nfunc ReadAvailableNodes(onlyHttpNodes bool) (nodes [](*NodeHealth), err error)\n```\n\n```go\ntype OrchestratorExecutionMode string\n```\n\n```go\nconst (\n\tOrchestratorExecutionCliMode  OrchestratorExecutionMode = \"CLIMode\"\n\tOrchestratorExecutionHttpMode                           = \"HttpMode\"\n)\n```\n\n```go\ntype Token struct {\n\tHash string\n}\n```\nToken is used to identify and validate requests to this service\n\n```go\nvar ProcessToken *Token = NewToken()\n```\n\n```go\nfunc NewToken() *Token\n```\n\n","path":"github.com/ProxySQL/orchestrator/go/process","name":"process","synopsis":"","isRedistributable":true}
