task

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = &commandsMapper{
	sorted: &commands{
		commands: make([]*Command, 0),
	},
}

commands storage in runtime

Functions

func ResetStorage

func ResetStorage()

ResetStorage resets storage of commands for agent

Types

type Command

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

command information

func (*Command) AddMessage

func (t *Command) AddMessage(m *Message)

func (*Command) AddTask

func (t *Command) AddTask(task *Task)

func (*Command) GetAuthor

func (t *Command) GetAuthor() string

func (*Command) GetClosedAt

func (t *Command) GetClosedAt() time.Time

func (*Command) GetCmd

func (t *Command) GetCmd() string

func (*Command) GetCreatedAt

func (t *Command) GetCreatedAt() time.Time

func (*Command) GetData

func (t *Command) GetData() *CommandResults

func (*Command) GetId

func (t *Command) GetId() int64

func (*Command) GetIdHex

func (t *Command) GetIdHex() string

func (*Command) GetTaskById

func (t *Command) GetTaskById(id int64) *Task

func (*Command) SetAuthor

func (t *Command) SetAuthor(author string)

func (*Command) SetClosedAt

func (t *Command) SetClosedAt(closedAt time.Time)

func (*Command) SetCmd

func (t *Command) SetCmd(cmd string)

func (*Command) SetCreatedAt

func (t *Command) SetCreatedAt(createdAt time.Time)

func (*Command) SetId

func (t *Command) SetId(id int64)

func (*Command) UpdateTask

func (t *Command) UpdateTask(task *Task)

type CommandResults

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

command's results (tasks and messages)

func (*CommandResults) AddMessage

func (t *CommandResults) AddMessage(m *Message)

AddMessage saves command's message to storage

func (*CommandResults) AddTask

func (t *CommandResults) AddTask(task *Task)

AddTask adds command's task to storage

func (*CommandResults) Fill

func (t *CommandResults) Fill()

Fill fills sorted task data results

func (*CommandResults) Get

func (t *CommandResults) Get() []TaskData

Get returns task data

func (*CommandResults) GetTaskById

func (t *CommandResults) GetTaskById(id int64) *Task

GetTaskById returns task by ID

func (*CommandResults) UpdateTask

func (t *CommandResults) UpdateTask(v *Task)

UpdateTask updates task in storage

type Message

type Message struct {
	TaskData
	// contains filtered or unexported fields
}

Message implements TaskData interface and stores infromation about command's message

func (*Message) GetCreatedAt

func (m *Message) GetCreatedAt() time.Time

func (*Message) GetId

func (m *Message) GetId() int64

func (*Message) GetKind

func (m *Message) GetKind() shared.TaskMessage

func (*Message) GetMessage

func (m *Message) GetMessage() string

func (*Message) SetCreatedAt

func (m *Message) SetCreatedAt(t time.Time)

func (*Message) SetId

func (m *Message) SetId(id int64)

func (*Message) SetKind

func (m *Message) SetKind(kind shared.TaskMessage)

func (*Message) SetMessage

func (m *Message) SetMessage(message string)

func (*Message) String

func (m *Message) String() string

type Task

type Task struct {
	TaskData
	// contains filtered or unexported fields
}

Task implements TaskData interface and stores infromation about command's task

func (*Task) GetCapability

func (t *Task) GetCapability() shared.Capability

func (*Task) GetCreatedAt

func (t *Task) GetCreatedAt() time.Time

func (*Task) GetId

func (t *Task) GetId() int64

func (*Task) GetIdHex

func (t *Task) GetIdHex() string

func (*Task) GetIdStr

func (t *Task) GetIdStr() string

func (*Task) GetIsBinary

func (t *Task) GetIsBinary() bool

func (*Task) GetIsOutputBig

func (t *Task) GetIsOutputBig() bool

func (*Task) GetOutput

func (t *Task) GetOutput() []byte

func (*Task) GetOutputLen

func (t *Task) GetOutputLen() uint64

func (*Task) GetOutputString

func (t *Task) GetOutputString() string

func (*Task) GetStatus

func (t *Task) GetStatus() shared.TaskStatus

func (*Task) SetCapability

func (t *Task) SetCapability(cap shared.Capability)

func (*Task) SetCreatedAt

func (t *Task) SetCreatedAt(createdAt time.Time)

func (*Task) SetId

func (t *Task) SetId(id int64)

func (*Task) SetIsBinary

func (t *Task) SetIsBinary(flag bool)

func (*Task) SetIsOutputBig

func (t *Task) SetIsOutputBig(flag bool)

func (*Task) SetOutput

func (t *Task) SetOutput(data []byte)

func (*Task) SetOutputLen

func (t *Task) SetOutputLen(length uint64)

func (*Task) SetStatus

func (t *Task) SetStatus(status shared.TaskStatus)

func (*Task) StringStatus

func (t *Task) StringStatus() string

type TaskData

type TaskData interface {
	GetCreatedAt() time.Time
}

Jump to

Keyboard shortcuts

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