Documentation ¶
Index ¶
- Constants
- func AddWatchedResources(resources ...string)
- func Create(ctx context.Context, obj *ModelObject) error
- func Delete(ctx context.Context, obj *ModelObject) error
- func DeleteWatchedResources(resources ...string)
- func GetWatchResources() sets.String
- func Init(be IInformerBackend)
- func IsInit() bool
- func Set(be IInformerBackend)
- func Update(ctx context.Context, obj *ModelObject, oldObj *jsonutils.JSONDict) error
- type EtcdBackend
- func (b *EtcdBackend) Create(ctx context.Context, obj *ModelObject) error
- func (b *EtcdBackend) Delete(ctx context.Context, obj *ModelObject) error
- func (b *EtcdBackend) GetType() string
- func (b *EtcdBackend) PutSession(ctx context.Context, key, val string) error
- func (b *EtcdBackend) PutWithLease(ctx context.Context, key, val string, ttlSeconds int64) error
- func (b *EtcdBackend) StartClientWatch(ctx context.Context)
- func (b *EtcdBackend) Update(ctx context.Context, obj *ModelObject, oldObj *jsonutils.JSONDict) error
- type EtcdBackendForClient
- type IInformerBackend
- type IWatcher
- type ModelObject
- type ResourceEventHandler
- type TEventType
Constants ¶
View Source
const ( EtcdInformerPrefix = "/onecloud/informer" EtcdInformerClientsKey = "@clients" EventTypeCreate = "CREATE" EventTypeUpdate = "UPDATE" EventTypeDelete = "DELETE" )
View Source
const (
ErrBackendNotInit = errors.Error("InformerBackend not init")
)
Variables ¶
This section is empty.
Functions ¶
func AddWatchedResources ¶
func AddWatchedResources(resources ...string)
func DeleteWatchedResources ¶
func DeleteWatchedResources(resources ...string)
func GetWatchResources ¶
func Init ¶
func Init(be IInformerBackend)
func Set ¶
func Set(be IInformerBackend)
Types ¶
type EtcdBackend ¶
type EtcdBackend struct {
// contains filtered or unexported fields
}
func NewEtcdBackend ¶
func NewEtcdBackend(opt *etcd.SEtcdOptions, onKeepaliveFailure func()) (*EtcdBackend, error)
func (*EtcdBackend) Create ¶
func (b *EtcdBackend) Create(ctx context.Context, obj *ModelObject) error
func (*EtcdBackend) Delete ¶
func (b *EtcdBackend) Delete(ctx context.Context, obj *ModelObject) error
func (*EtcdBackend) GetType ¶
func (b *EtcdBackend) GetType() string
func (*EtcdBackend) PutSession ¶
func (b *EtcdBackend) PutSession(ctx context.Context, key, val string) error
func (*EtcdBackend) PutWithLease ¶
func (*EtcdBackend) StartClientWatch ¶
func (b *EtcdBackend) StartClientWatch(ctx context.Context)
func (*EtcdBackend) Update ¶
func (b *EtcdBackend) Update(ctx context.Context, obj *ModelObject, oldObj *jsonutils.JSONDict) error
type EtcdBackendForClient ¶
type EtcdBackendForClient struct { *EtcdBackend // contains filtered or unexported fields }
func NewEtcdBackendForClient ¶
func NewEtcdBackendForClient(opt *etcd.SEtcdOptions) (*EtcdBackendForClient, error)
func (*EtcdBackendForClient) StartClientWatch ¶
func (b *EtcdBackendForClient) StartClientWatch(ctx context.Context)
func (*EtcdBackendForClient) Unwatch ¶
func (b *EtcdBackendForClient) Unwatch(key string)
func (*EtcdBackendForClient) Watch ¶
func (b *EtcdBackendForClient) Watch(ctx context.Context, key string, handler ResourceEventHandler) error
type IInformerBackend ¶
type IInformerBackend interface { GetType() string Create(ctx context.Context, obj *ModelObject) error Update(ctx context.Context, obj *ModelObject, oldObj *jsonutils.JSONDict) error Delete(ctx context.Context, obj *ModelObject) error }
func GetDefaultBackend ¶
func GetDefaultBackend() IInformerBackend
type ModelObject ¶
type ModelObject struct { Object *jsonutils.JSONDict KeywordPlural string Id string IsJoint bool MasterId string SlaveId string }
func NewJointModel ¶
func NewJointModel(obj interface{}, keywordPlural, masterId, slaveId string) *ModelObject
func NewModel ¶
func NewModel(obj interface{}, keywordPlural, id string) *ModelObject
type ResourceEventHandler ¶
type TEventType ¶
type TEventType string
Click to show internal directories.
Click to hide internal directories.