コード例 #1
0
ファイル: resource.go プロジェクト: youtube/doorman
// LoadConfig loads cfg into the resource. LoadConfig takes care of
// locking the resource.
func (res *Resource) LoadConfig(cfg *pb.ResourceTemplate, expiryTime *time.Time) {
	res.mu.Lock()
	defer res.mu.Unlock()
	res.config = cfg
	res.expiryTime = expiryTime
	algo := cfg.GetAlgorithm()
	res.algorithm = GetAlgorithm(algo)
	res.learner = Learn(algo)
}