open-nomad/client/allocrunnerv2/taskrunner/task_runner_getters.go

28 lines
576 B
Go
Raw Normal View History

2018-06-22 00:35:07 +00:00
package taskrunner
import "github.com/hashicorp/nomad/nomad/structs"
2018-07-12 23:15:33 +00:00
func (tr *TaskRunner) Alloc() *structs.Allocation {
tr.allocLock.Lock()
defer tr.allocLock.Unlock()
return tr.alloc
}
2018-06-22 00:35:07 +00:00
func (tr *TaskRunner) Task() *structs.Task {
tr.taskLock.RLock()
defer tr.taskLock.RUnlock()
return tr.task
}
2018-07-12 23:15:33 +00:00
func (tr *TaskRunner) getVaultToken() string {
tr.vaultTokenLock.Lock()
defer tr.vaultTokenLock.Unlock()
return tr.vaultToken
}
func (tr *TaskRunner) setVaultToken(token string) {
tr.vaultTokenLock.Lock()
defer tr.vaultTokenLock.Unlock()
tr.vaultToken = token
}