service

package
v0.0.0-...-3e8c5dd Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ALike

type ALike struct {
	AsyncAction
}

Like implement IExec, async like 3 times

func (ALike) Do

func (ALike) Do(user User, medal dto.MedalInfo) bool

func (ALike) Finish

func (ALike) Finish(user User, medal []dto.MedalInfo)

type AShare

type AShare struct {
	AsyncAction
}

Share implement IExec, async share 5 times

func (AShare) Do

func (AShare) Do(user User, medal dto.MedalInfo) bool

func (AShare) Finish

func (AShare) Finish(user User, medal []dto.MedalInfo)

type AsyncAction

type AsyncAction struct{}

AsyncAction implement IConcurrency, support asynchronous actions

func (*AsyncAction) Exec

func (a *AsyncAction) Exec(user User, job *sync.WaitGroup, child IExec) []dto.MedalInfo

type Danmaku

type Danmaku struct {
	SyncAction
}

Danmaku implement IExec, default sync, include sending daily danmu

func (Danmaku) Do

func (Danmaku) Do(user User, medal dto.MedalInfo) bool

func (Danmaku) Finish

func (Danmaku) Finish(user User, medal []dto.MedalInfo)

type IAction

type IAction interface {
	IConcurrency
	IExec
}

Action represent a single action for a single user

type IConcurrency

type IConcurrency interface {
	// Exec the action of child and execute retry backup if
	Exec(user User, work *sync.WaitGroup, child IExec) []dto.MedalInfo
}

type IExec

type IExec interface {
	// Do represent real action
	Do(user User, medal dto.MedalInfo) bool
	// Finish represent action complete
	Finish(user User, medal []dto.MedalInfo)
}

type Like

type Like struct {
	SyncAction
}

Like implement IExec, sync like 3 times

func (Like) Do

func (Like) Do(user User, medal dto.MedalInfo) bool

func (Like) Finish

func (Like) Finish(user User, medal []dto.MedalInfo)

type Share

type Share struct {
	SyncAction
}

Share implement IExec, sync share 5 times

func (Share) Do

func (Share) Do(user User, medal dto.MedalInfo) bool

func (Share) Finish

func (Share) Finish(user User, medal []dto.MedalInfo)

type SyncAction

type SyncAction struct{}

SyncAction implement IConcurrency, support synchronous actions

func (*SyncAction) Exec

func (a *SyncAction) Exec(user User, job *sync.WaitGroup, child IExec) []dto.MedalInfo

type Task

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

Task aggregate user info and corresponding action

func NewTask

func NewTask(user User, actions []IAction) Task

func (*Task) Start

func (task *Task) Start()

type User

type User struct {
	// 用户ID
	Uid int
	// 用户名称
	Name string
	// contains filtered or unexported fields
}

func NewUser

func NewUser(accessKey, pushName string, allowUIDs, banUIDs []int) User

func (*User) Init

func (user *User) Init() bool

func (*User) RunOnce

func (user *User) RunOnce() bool

func (*User) Start

func (user *User) Start(wg *sync.WaitGroup)

type WatchLive

type WatchLive struct {
	AsyncAction
}

WatchLive implement IExec, default async, include sending heartbeat

func (WatchLive) Do

func (WatchLive) Do(user User, medal dto.MedalInfo) bool

func (WatchLive) Finish

func (WatchLive) Finish(user User, medal []dto.MedalInfo)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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