Documentation ¶
Index ¶
- func New() (plugin.Plugin, error)
- type CloudConfig
- type DB
- func (d *DB) AcquireTaskLock(task *models.Task) (bool, error)
- func (d *DB) AcquireTaskLockTx(tx *sqlx.Tx, task *entities.Task) (sql.Result, error)
- func (d *DB) BeginTx() (*sqlx.Tx, error)
- func (d *DB) Close() (err error)
- func (d *DB) Commit(tx *sqlx.Tx)
- func (d DB) CountCertByParentId(parentId string) (int, error)
- func (d *DB) CountProperty(name string) (int, error)
- func (d *DB) Create(tx interface{}, shadow *models.Shadow) (*models.Shadow, error)
- func (d DB) CreateCert(cert plugin.Cert) error
- func (d *DB) CreateIndex(namespace string, keyA, keyB common.Resource, valueA, valueB string) (sql.Result, error)
- func (d *DB) CreateIndexTx(tx *sqlx.Tx, namespace string, keyA, keyB common.Resource, ...) (sql.Result, error)
- func (d *DB) CreateModule(module *models.Module) (*models.Module, error)
- func (d *DB) CreateModuleTx(tx *sqlx.Tx, module *models.Module) error
- func (d *DB) CreateProperty(property *models.Property) error
- func (d *DB) CreateShadowTx(tx *sqlx.Tx, shadow *models.Shadow) (sql.Result, error)
- func (d *DB) CreateTask(task *models.Task) (bool, error)
- func (d *DB) CreateTaskTx(tx *sqlx.Tx, task *entities.Task) (sql.Result, error)
- func (d *DB) Delete(namespace, name string) error
- func (d DB) DeleteCert(certId string) error
- func (d *DB) DeleteIndex(namespace string, keyA, byKeyB common.Resource, valueB string) (sql.Result, error)
- func (d *DB) DeleteIndexTx(tx *sqlx.Tx, namespace string, keyA, byKeyB common.Resource, valueB string) (sql.Result, error)
- func (d *DB) DeleteModuleByVersion(name, version string) error
- func (d *DB) DeleteModuleByVersionTx(tx *sqlx.Tx, name, version string) error
- func (d *DB) DeleteModules(name string) error
- func (d *DB) DeleteModulesTx(tx *sqlx.Tx, name string) error
- func (d *DB) DeleteProperty(name string) error
- func (d *DB) DeleteShadowTx(tx *sqlx.Tx, namespace, name string) (sql.Result, error)
- func (d *DB) DeleteTask(taskName string) (bool, error)
- func (d *DB) DeleteTaskTx(tx *sqlx.Tx, name string) (sql.Result, error)
- func (d *DB) Exec(tx *sqlx.Tx, sql string, args ...interface{}) (res sql.Result, err error)
- func (d *DB) Get(tx interface{}, namespace, name string) (*models.Shadow, error)
- func (d DB) GetCert(certId string) (*plugin.Cert, error)
- func (d *DB) GetLatestModule(name string) (*models.Module, error)
- func (d *DB) GetLatestModuleImage(name string) (string, error)
- func (d *DB) GetLatestModuleImageTx(tx *sqlx.Tx, name string) (string, error)
- func (d *DB) GetLatestModuleProgram(name, platform string) (string, error)
- func (d *DB) GetLatestModuleProgramTx(tx *sqlx.Tx, name, platform string) (string, error)
- func (d *DB) GetLatestModuleTx(tx *sqlx.Tx, name string) (*models.Module, error)
- func (d *DB) GetModuleByImage(name, image string) (*models.Module, error)
- func (d *DB) GetModuleByImageTx(tx *sqlx.Tx, name, image string) (*models.Module, error)
- func (d *DB) GetModuleByVersion(name, version string) (*models.Module, error)
- func (d *DB) GetModuleByVersionTx(tx *sqlx.Tx, name, version string) (*models.Module, error)
- func (d *DB) GetModuleTx(tx *sqlx.Tx, name string) ([]models.Module, error)
- func (d *DB) GetModules(name string) ([]models.Module, error)
- func (d *DB) GetNeedProcessTask(batchNum, expiredSeconds int32) ([]*models.Task, error)
- func (d *DB) GetProperty(name string) (*models.Property, error)
- func (d *DB) GetPropertyValue(name string) (string, error)
- func (d *DB) GetShadowTx(tx *sqlx.Tx, namespace, name string) (*models.Shadow, error)
- func (d *DB) GetTask(name string) (*models.Task, error)
- func (d *DB) GetTaskTx(tx *sqlx.Tx, name string) (*models.Task, error)
- func (d *DB) List(namespace string, nodeList *models.NodeList) (*models.ShadowList, error)
- func (d *DB) ListIndex(namespace string, keyA, byKeyB common.Resource, valueB string) ([]string, error)
- func (d *DB) ListIndexTx(tx *sqlx.Tx, namespace string, keyA, byKeyB common.Resource, valueB string) ([]string, error)
- func (d *DB) ListModules(filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListOptionalSysModules(filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListOptionalSysModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListProperty(filter *models.Filter) ([]models.Property, error)
- func (d *DB) ListRuntimeModules(filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListRuntimeModulesTx(tx *sqlx.Tx, filter *models.Filter) ([]models.Module, error)
- func (d *DB) ListShadowByNamesTx(tx *sqlx.Tx, namespace string, names []string) ([]entities.Shadow, error)
- func (d *DB) Query(tx *sqlx.Tx, sql string, data interface{}, args ...interface{}) (err error)
- func (d *DB) RefreshIndex(tx interface{}, namespace string, keyA, keyB common.Resource, valueA string, ...) error
- func (d *DB) Rollback(tx *sqlx.Tx)
- func (d *DB) Transact(handler func(*sqlx.Tx) error) (err error)
- func (d DB) UpdateCert(cert plugin.Cert) error
- func (d *DB) UpdateDesire(tx interface{}, shadow *models.Shadow) (*models.Shadow, error)
- func (d *DB) UpdateModuleByVersion(module *models.Module) (*models.Module, error)
- func (d *DB) UpdateModuleByVersionTx(tx *sqlx.Tx, module *models.Module) error
- func (d *DB) UpdateProperty(property *models.Property) error
- func (d *DB) UpdateReport(shadow *models.Shadow) (*models.Shadow, error)
- func (d *DB) UpdateShadowDesireTx(tx *sqlx.Tx, shadow *models.Shadow) (sql.Result, error)
- func (d *DB) UpdateShadowReportTx(tx *sqlx.Tx, shadow *models.Shadow) (sql.Result, error)
- func (d *DB) UpdateTask(task *models.Task) (bool, error)
- func (d *DB) UpdateTaskTx(tx *sqlx.Tx, task *entities.Task) (sql.Result, error)
- type DBStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloudConfig ¶
type CloudConfig struct { Database struct { Type string `yaml:"type" json:"type" validate:"nonzero"` URL string `yaml:"url" json:"url" validate:"nonzero"` MaxConns int `yaml:"maxConns" json:"maxConns" default:20` MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns" default:5` ConnMaxLifetime int `yaml:"connMaxLifetime" json:"connMaxLifetime" default:150` } `yaml:"database" json:"database" default:"{}"` }
CloudConfig baetyl-cloud config
type DB ¶ added in v2.1.1
DBStorage
func NewDB ¶ added in v2.1.1
func NewDB(cfg CloudConfig) (*DB, error)
func (*DB) AcquireTaskLock ¶ added in v2.2.0
func (*DB) AcquireTaskLockTx ¶ added in v2.2.0
func (DB) CountCertByParentId ¶ added in v2.1.1
func (*DB) CreateIndex ¶ added in v2.1.1
func (*DB) CreateIndexTx ¶ added in v2.1.1
func (*DB) CreateModule ¶ added in v2.2.0
func (*DB) CreateModuleTx ¶ added in v2.2.0
func (*DB) CreateProperty ¶ added in v2.1.1
func (*DB) CreateShadowTx ¶ added in v2.1.1
func (*DB) CreateTaskTx ¶ added in v2.1.1
func (DB) DeleteCert ¶ added in v2.1.1
func (*DB) DeleteIndex ¶ added in v2.1.1
func (*DB) DeleteIndexTx ¶ added in v2.1.1
func (*DB) DeleteModuleByVersion ¶ added in v2.2.0
func (*DB) DeleteModuleByVersionTx ¶ added in v2.2.0
func (*DB) DeleteModules ¶ added in v2.2.0
func (*DB) DeleteModulesTx ¶ added in v2.2.0
func (*DB) DeleteProperty ¶ added in v2.1.1
func (*DB) DeleteShadowTx ¶ added in v2.1.1
func (*DB) DeleteTaskTx ¶ added in v2.1.1
func (*DB) GetLatestModule ¶ added in v2.2.0
func (*DB) GetLatestModuleImage ¶ added in v2.2.0
func (*DB) GetLatestModuleImageTx ¶ added in v2.2.0
func (*DB) GetLatestModuleProgram ¶ added in v2.2.0
func (*DB) GetLatestModuleProgramTx ¶ added in v2.2.0
func (*DB) GetLatestModuleTx ¶ added in v2.2.0
func (*DB) GetModuleByImage ¶ added in v2.2.0
func (*DB) GetModuleByImageTx ¶ added in v2.2.0
func (*DB) GetModuleByVersion ¶ added in v2.2.0
func (*DB) GetModuleByVersionTx ¶ added in v2.2.0
func (*DB) GetModuleTx ¶ added in v2.2.0
func (*DB) GetModules ¶ added in v2.2.0
func (*DB) GetNeedProcessTask ¶ added in v2.2.0
GetNeedProcessTask only support for mysql
func (*DB) GetProperty ¶ added in v2.1.1
func (*DB) GetPropertyValue ¶ added in v2.1.1
func (*DB) GetShadowTx ¶ added in v2.1.1
func (*DB) ListIndexTx ¶ added in v2.1.1
func (*DB) ListModules ¶ added in v2.2.0
func (*DB) ListModulesTx ¶ added in v2.2.0
func (*DB) ListOptionalSysModules ¶ added in v2.2.0
func (*DB) ListOptionalSysModulesTx ¶ added in v2.2.0
func (*DB) ListProperty ¶ added in v2.1.1
func (*DB) ListRuntimeModules ¶ added in v2.2.0
func (*DB) ListRuntimeModulesTx ¶ added in v2.2.0
func (*DB) ListShadowByNamesTx ¶ added in v2.1.1
func (*DB) RefreshIndex ¶ added in v2.1.1
func (*DB) UpdateDesire ¶ added in v2.1.1
func (*DB) UpdateModuleByVersion ¶ added in v2.2.0
func (*DB) UpdateModuleByVersionTx ¶ added in v2.2.0
func (*DB) UpdateProperty ¶ added in v2.1.1
func (*DB) UpdateReport ¶ added in v2.1.1
func (*DB) UpdateShadowDesireTx ¶ added in v2.1.1
func (*DB) UpdateShadowReportTx ¶ added in v2.1.1
type DBStorage ¶ added in v2.1.1
type DBStorage interface { Transact(func(*sqlx.Tx) error) error Exec(tx *sqlx.Tx, sql string, args ...interface{}) (sql.Result, error) Query(tx *sqlx.Tx, sql string, data interface{}, args ...interface{}) error BeginTx() (*sqlx.Tx, error) Commit(tx *sqlx.Tx) Rollback(tx *sqlx.Tx) io.Closer }
DBStorage
Source Files ¶
Click to show internal directories.
Click to hide internal directories.