event

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceOrder_CreateOrderSuccess = "resource.create_order.cmd"
View Source
const ResourceOrder_ReNewOrderSuccess = "resource.renew_order.cmd"
View Source
const ResourceOrder_Recover = "resource.recover_order.cmd"
View Source
const ResourceOrder_TheGraph = "resource.thegraph"
View Source
const ResourceOrder_WithdrawLockedOrderPriceSuccess = "resource.cancel_order.cmd"

Variables

View Source
var GlobalEventBus = newEventBus()

Functions

This section is empty.

Types

type AbstractHandler

type AbstractHandler struct {
}

func (*AbstractHandler) EventHandleFunc

func (h *AbstractHandler) EventHandleFunc(handler IHandler) EventHandleFunc

type CreateVmHandler

type CreateVmHandler struct {
	AbstractHandler
	CoreContext *EventContext
}

func (*CreateVmHandler) HandlerEvent

func (h *CreateVmHandler) HandlerEvent(e *VmRequest)

func (*CreateVmHandler) Name

func (h *CreateVmHandler) Name() string

type DestroyVmHandler

type DestroyVmHandler struct {
	AbstractHandler
	CoreContext *EventContext
}

func (*DestroyVmHandler) HandlerEvent

func (h *DestroyVmHandler) HandlerEvent(e *VmRequest)

func (*DestroyVmHandler) Name

func (h *DestroyVmHandler) Name() string

type EventBus

type EventBus struct {
	// contains filtered or unexported fields
}

func (*EventBus) Pub

func (me *EventBus) Pub(e string, args interface{})

func (*EventBus) Sub

func (me *EventBus) Sub(e string, id string, handleFunc EventHandleFunc)

func (*EventBus) Unsub

func (me *EventBus) Unsub(e string, id string)

type EventContext

type EventContext struct {
	ReportClient chain.ReportClient
	VmManager    provider.Manager
	TimerService *utils.TimerService
	Cm           *config.ConfigManager
	P2pClient    *p2p.P2pClient
}

func (*EventContext) GetConfig

func (ec *EventContext) GetConfig() *config.Config

type EventHandleFunc

type EventHandleFunc func(e string, args interface{})

type EventHandler

type EventHandler struct {
	ID      string
	Handler EventHandleFunc
}

type EventService

type EventService struct {
	// contains filtered or unexported fields
}

func (*EventService) Create

func (s *EventService) Create(req *VmRequest)

func (*EventService) Destroy

func (s *EventService) Destroy(req *VmRequest)

func (*EventService) Recover

func (s *EventService) Recover(req *VmRequest)

func (*EventService) Renew

func (s *EventService) Renew(req *VmRequest)

type IEventBus

type IEventBus interface {
	Pub(e string, args interface{})
	Sub(e string, id string, handleFunc EventHandleFunc)
	Unsub(e string, id string)
}

type IEventService

type IEventService interface {
	Create(r *VmRequest)
	Destroy(r *VmRequest)
	Renew(r *VmRequest)
	Recover(r *VmRequest)
}

func NewEventService

func NewEventService(coreContext *EventContext) IEventService

type IHandler

type IHandler interface {
	Name() string
	HandlerEvent(e *VmRequest)
}

type IVmEventHandler

type IVmEventHandler interface {
	EventHandleFunc(e string, args interface{})
}

type OperationTag

type OperationTag int
const OPCreatedVm OperationTag = 1
const OPDestroyVm OperationTag = 2
const OPFreeResourceApply OperationTag = 5
const OPRecoverVM OperationTag = 4
const OPRenewVM OperationTag = 3

type RecoverVmHandler

type RecoverVmHandler struct {
	AbstractHandler
	CoreContext *EventContext
}

func (*RecoverVmHandler) HandlerEvent

func (h *RecoverVmHandler) HandlerEvent(e *VmRequest)

func (*RecoverVmHandler) Name

func (h *RecoverVmHandler) Name() string

type RenewVmHandler

type RenewVmHandler struct {
	AbstractHandler
	CoreContext *EventContext
}

func (*RenewVmHandler) HandlerEvent

func (h *RenewVmHandler) HandlerEvent(e *VmRequest)

func (*RenewVmHandler) Name

func (h *RenewVmHandler) Name() string

type TheGraphHandler added in v1.2.0

type TheGraphHandler struct {
	AbstractHandler
	CoreContext *EventContext
}

func (*TheGraphHandler) HandlerEvent added in v1.2.0

func (h *TheGraphHandler) HandlerEvent(e *VmRequest)

func (*TheGraphHandler) Name added in v1.2.0

func (h *TheGraphHandler) Name() string

type VmRequest

type VmRequest struct {
	Tag         OperationTag
	Cpu         uint64
	Mem         uint64
	Disk        uint64
	AccessPort  uint64
	Type        string
	Image       string
	System      string
	PublicKey   string
	OrderNo     uint64
	AgreementNo uint64
	Duration    uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL