func (driver *NgCloudStorageDriver) Close() {
}
Close 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
}