container

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseContainerPool

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

func NewBaseContainerPool

func NewBaseContainerPool() *BaseContainerPool

func (*BaseContainerPool) Contain

func (b *BaseContainerPool) Contain(uniqueId string) bool

func (*BaseContainerPool) DestroyByInstance

func (b *BaseContainerPool) DestroyByInstance(jobInstanceId int64) bool

func (*BaseContainerPool) Get

func (b *BaseContainerPool) Get(uniqueId string) Container

func (*BaseContainerPool) GetContainerMap

func (b *BaseContainerPool) GetContainerMap() *sync.Map

func (*BaseContainerPool) GetContext

func (b *BaseContainerPool) GetContext() *jobcontext.JobContext

func (*BaseContainerPool) GetInstanceLock

func (b *BaseContainerPool) GetInstanceLock(jobInstanceId int64) interface{}

func (*BaseContainerPool) Put

func (b *BaseContainerPool) Put(uniqueId string, container Container)

func (*BaseContainerPool) ReleaseInstanceLock

func (b *BaseContainerPool) ReleaseInstanceLock(jobInstanceId int64)

func (*BaseContainerPool) Remove

func (b *BaseContainerPool) Remove(uniqueId string)

func (*BaseContainerPool) RemoveContext

func (b *BaseContainerPool) RemoveContext()

func (*BaseContainerPool) SetContext

func (b *BaseContainerPool) SetContext(jobContext *jobcontext.JobContext)

func (*BaseContainerPool) Submit

func (b *BaseContainerPool) Submit(jobId int64, jobInstanceId int64, taskId int64, container Container, consumerSize int32) error

type Container

type Container interface {
	Start()
	Kill()
}

type ContainerPool

type ContainerPool interface {
	Contain(uniqueId string) bool
	DestroyByInstance(jobInstanceId int64) bool
	Get(uniqueId string) Container
	GetContainerMap() *sync.Map // map[string]Container
	GetContext() *jobcontext.JobContext
	GetInstanceLock(jobInstanceId int64) interface{}
	Put(uniqueId string, container Container)
	ReleaseInstanceLock(jobInstanceId int64)
	Remove(uniqueId string)
	RemoveContext()
	SetContext(jobContext *jobcontext.JobContext)
	Submit(jobId int64, jobInstanceId int64, taskId int64, container Container, consumerSize int32) error
}

type ThreadContainer

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

func NewThreadContainer

func NewThreadContainer(jobCtx *jobcontext.JobContext, actorCtx actor.Context, containerPool ContainerPool) (*ThreadContainer, error)

func (*ThreadContainer) GetContext

func (c *ThreadContainer) GetContext() *jobcontext.JobContext

func (*ThreadContainer) Kill

func (c *ThreadContainer) Kill()

func (*ThreadContainer) Run

func (c *ThreadContainer) Run()

func (*ThreadContainer) SetContext

func (c *ThreadContainer) SetContext(context *jobcontext.JobContext)

func (*ThreadContainer) Start

func (c *ThreadContainer) Start()

func (*ThreadContainer) Stop

func (c *ThreadContainer) Stop()

type ThreadContainerPool

type ThreadContainerPool struct {
	*BaseContainerPool
	// contains filtered or unexported fields
}

func GetThreadContainerPool

func GetThreadContainerPool() *ThreadContainerPool

func (*ThreadContainerPool) DestroyByInstance

func (p *ThreadContainerPool) DestroyByInstance(jobInstanceId int64) bool

func (*ThreadContainerPool) GetContext

func (p *ThreadContainerPool) GetContext() *jobcontext.JobContext

func (*ThreadContainerPool) GetInstanceLock

func (p *ThreadContainerPool) GetInstanceLock(jobInstanceId int64) interface{}

func (*ThreadContainerPool) GetSharedThreadPool

func (p *ThreadContainerPool) GetSharedThreadPool() *ants.Pool

func (*ThreadContainerPool) ReleaseInstanceLock

func (p *ThreadContainerPool) ReleaseInstanceLock(jobInstanceId int64)

func (*ThreadContainerPool) RemoveContext

func (p *ThreadContainerPool) RemoveContext()

func (*ThreadContainerPool) SetContext

func (p *ThreadContainerPool) SetContext(jobContext *jobcontext.JobContext)

func (*ThreadContainerPool) Submit

func (p *ThreadContainerPool) Submit(jobId, jobInstanceId, taskId int64, container Container, consumerSize int32) (err error)

Jump to

Keyboard shortcuts

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