func (driver *NgCloudStorageDriver) GetLocationSimpleJobs(location string) []*models.SimpleJob {
	driver.RLock()
	defer driver.RUnlock()
	query := map[string][]string{"f_location": []string{location}}
	jobs, err := driver.engine.readSimpleJobs(query)
	if err != nil {
		logger.ERROR("[#cache#] engine read simple jobs %+v error, %s", query, err.Error())
		return []*models.SimpleJob{}
	}
	return jobs
}
GetLocationSimpleJobs is exported
package ngcloud
import "github.com/cloudtask/cloudtask-center/cache/driver"
import "github.com/cloudtask/cloudtask-center/cache/driver/types"
import "github.com/cloudtask/common/models"
import "github.com/cloudtask/libtools/gounits/logger"
import (
	"errors"
	"net/url"
	"path"
	"strconv"
	"sync"
)
const (
	defaultReadPageSize = 512
)
var (
	ErrNgCloudStorageDriverURLInvalid = errors.New("ngcloud storage driver apiURL invalid.")
)
type NgCloudStorageDriver struct {
	sync.RWMutex
	driver.StorageDriver
	engine *Engine
}
func init() {
	driver.AddDriver(types.NGCLOUD, New)
}
func New(parameters types.Parameters) (driver.StorageDriver, error) {
	rawAPIURL, readPageSize, err := parseEngineConfigs(parameters)
	if err != nil {
		return nil, err
	}
	return &NgCloudStorageDriver{
		engine: NewEngine(rawAPIURL, readPageSize),
	}, nil
}
func parseEngineConfigs(parameters types.Parameters) (string, int, error) {
	var (
		value        interface{}
		ret          bool
		readPageSize int
		rawAPIURL    string
	)
	readPageSize = defaultReadPageSize
	value, ret = parameters["readpagesize"]
	if ret {
		if pValue, err := strconv.Atoi(value.(string)); err == nil {
			readPageSize = pValue
		}
	}
	value, ret = parameters["apiurl"]
	if !ret {
		return "", 0, ErrNgCloudStorageDriverURLInvalid
	}
	pRawURL, err := url.Parse(value.(string))
	if err != nil {
		return "", 0, ErrNgCloudStorageDriverURLInvalid
	}
	scheme := pRawURL.Scheme
	if scheme == "" {
		scheme = "http"
	}
	rawAPIURL = scheme + "://" + pRawURL.Host + path.Clean(pRawURL.Path)
	if pRawURL.RawQuery != "" {
		rawAPIURL = rawAPIURL + "?" + pRawURL.RawQuery
	}
	return rawAPIURL, readPageSize, nil
}
func (driver *NgCloudStorageDriver) Open() error {
	return nil
}
func (driver *NgCloudStorageDriver) Close() {
}
func (driver *NgCloudStorageDriver) SetConfigParameters(parameters types.Parameters) {
	rawAPIURL, readPageSize, err := parseEngineConfigs(parameters)
	if err != nil {
		logger.ERROR("[#cache#] ngcloud driver parse configs error, %s", err.Error())
		return
	}
	driver.engine.SetConfigParameters(rawAPIURL, readPageSize)
	logger.ERROR("[#cache#] ngcloud driver configs changed, %s %s", rawAPIURL, readPageSize)
}
func (driver *NgCloudStorageDriver) GetLocationsName() []string {
	driver.RLock()
	defer driver.RUnlock()
	names, err := driver.engine.readLocationsName()
	if err != nil {
		logger.ERROR("[#cache#] engine read locations name error, %s", err.Error())
		return []string{}
	}
	return names
}
func (driver *NgCloudStorageDriver) GetLocation(location string) *models.WorkLocation {
	driver.RLock()
	defer driver.RUnlock()
	workLocation, err := driver.engine.getLocation(location)
	if err != nil {
		logger.ERROR("[#cache#] engine read location %s error, %s", location, err.Error())
		return nil
	}
	return workLocation
}