scheduler

package
v0.0.0-...-9ab011e Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoReservation = errors.New("条件を満たす予約がみつかりませんでした")
View Source
var IconSched = mustNewIconScheduler()
View Source
var LivecommentScheduler = mustNewLivecommentScheduler()
View Source
var (
	ReservationSched = mustNewReservationScheduler(config.BaseAt, config.NumSlots, config.NumHours+10)
)
View Source
var StatsSched = NewStatsScheduler()
View Source
var UserScheduler = mustNewUserScheduler()

Functions

func GetLivestreamLength

func GetLivestreamLength() int

func GetReaction

func GetReaction() string

func GetStreamIDsByTagID

func GetStreamIDsByTagID(id int64) []int64

func GetTagIDsByStreamID

func GetTagIDsByStreamID(id int64) []int64

func GetTagPoolLength

func GetTagPoolLength() int

func GetTagsMap

func GetTagsMap() map[int64]string

Types

type CommitState

type CommitState int

割当のコミット状態を管理

const (
	CommitState_None CommitState = iota
	CommitState_Inflight
	CommitState_Committed
)

type IconScheduler

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

func (*IconScheduler) GetRandomIcon

func (s *IconScheduler) GetRandomIcon() *Image

type Image

type Image struct {
	Image []byte
	Hash  [32]byte
}

type InitialLivecomment

type InitialLivecomment struct {
	UserID       int64
	LivestreamID int64
	Comment      string
}

type InitialNgWord

type InitialNgWord struct {
	UserID       int64
	LivestreamID int64
	Word         string
}

type InitialReaction

type InitialReaction struct {
	UserID       int64
	LivestreamID int64
	EmojiName    string
}

type Interval

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

func (*Interval) Hours

func (i *Interval) Hours() int

Hours は、当該区間が時間単位で何時間の区間であるかを返します

type IntervalTemperatures

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

IntervalTemperatures は、区間の温度を管理します

type Intervals

type Intervals []*Interval

Intervals は、区間長でソート可能な区間列です

func (Intervals) Len

func (i Intervals) Len() int

func (Intervals) Less

func (i Intervals) Less(j, k int) bool

func (Intervals) Swap

func (i Intervals) Swap(j, k int)

type Livecomment

type Livecomment struct {
	UserID       int
	LivestreamID int
	Comment      string
	Tip          int
}

type Livestream

type Livestream struct {
	OwnerID      int64  `json:"owner"`
	Title        string `json:"title"`
	Description  string `json:"description"`
	PlaylistUrl  string `json:"playlist_url"`
	ThumbnailUrl string `json:"thumbnail_url"`
	StartAt      int64  `json:"start_at"`
	EndAt        int64  `json:"end_at"`
}

func GetLivestreamByID

func GetLivestreamByID(id int64) *Livestream

type LivestreamStats

type LivestreamStats struct {
	LivestreamID int64

	// 視聴者数 (初期では0)
	TotalViewers int64

	// トータルレポート数 (初期では0)
	TotalReports int64

	// トータルリアクション数
	TotalReactions int64

	// 最大チップ金額 (ライブコメント)
	TotalTips int64
	MaxTip    int64
}

func NewLivestreamStats

func NewLivestreamStats(livestreamID int64) *LivestreamStats

func (*LivestreamStats) Score

func (s *LivestreamStats) Score() int64

type LivestreamStatsRanking

type LivestreamStatsRanking []*LivestreamStats

func (LivestreamStatsRanking) Len

func (r LivestreamStatsRanking) Len() int

func (LivestreamStatsRanking) Less

func (r LivestreamStatsRanking) Less(i, j int) bool

func (LivestreamStatsRanking) Swap

func (r LivestreamStatsRanking) Swap(i, j int)

type NegativeComment

type NegativeComment struct {
	Comment string
	NgWord  string
}

type NgWord

type NgWord struct {
	Word string
}

type PositiveComment

type PositiveComment struct {
	Comment string
}

type Reservation

type Reservation struct {
	Title        string
	Description  string
	StartAt      int64
	EndAt        int64
	PlaylistUrl  string
	ThumbnailUrl string
	// contains filtered or unexported fields
}

func ConvertFromIntInterface

func ConvertFromIntInterface(i []interval.IntInterface) ([]*Reservation, error)

func (*Reservation) Hours

func (r *Reservation) Hours() int

func (*Reservation) ID

func (r *Reservation) ID() uintptr

func (*Reservation) Overlap

func (r *Reservation) Overlap(interval interval.IntRange) bool

func (*Reservation) Range

func (r *Reservation) Range() interval.IntRange

type ReservationScheduler

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

func (*ReservationScheduler) AbortReservation

func (r *ReservationScheduler) AbortReservation(reservation *Reservation)

func (*ReservationScheduler) CommitReservation

func (r *ReservationScheduler) CommitReservation(reservation *Reservation)

CommitReservation は、予約追加リクエストが通ったことをintervalTemperturesに記録します

func (*ReservationScheduler) GetColdLongReservation

func (r *ReservationScheduler) GetColdLongReservation() (*Reservation, error)

func (*ReservationScheduler) GetColdShortReservation

func (r *ReservationScheduler) GetColdShortReservation() (*Reservation, error)

func (*ReservationScheduler) GetHotLongReservation

func (r *ReservationScheduler) GetHotLongReservation() (*Reservation, error)

func (*ReservationScheduler) GetHotShortReservation

func (r *ReservationScheduler) GetHotShortReservation() (*Reservation, error)

func (*ReservationScheduler) RangeReserved

func (r *ReservationScheduler) RangeReserved(fn func(*Reservation))

予約の突合処理に使う

type StatsScheduler

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

func NewStatsScheduler

func NewStatsScheduler() *StatsScheduler

func (*StatsScheduler) AddLivecomment

func (s *StatsScheduler) AddLivecomment(streamerName string, livestreamID int64, tip *Tip) error

func (*StatsScheduler) AddLivestream

func (s *StatsScheduler) AddLivestream(livestreamID int64)

func (*StatsScheduler) AddReaction

func (s *StatsScheduler) AddReaction(streamerName string, livestreamID int64, reaction string) error

func (*StatsScheduler) AddReport

func (s *StatsScheduler) AddReport(streamerName string, livestreamID int64) error

スパム報告追加 (ユーザの配信に対して)

func (*StatsScheduler) EnterLivestream

func (s *StatsScheduler) EnterLivestream(streamerName string, livestreamID int64) error

視聴開始/終了 ユーザ単位の視聴者数、ライブ配信単位の視聴者数を更新する必要がある

func (*StatsScheduler) ExitLivestream

func (s *StatsScheduler) ExitLivestream(streamerName string, livestreamID int64) error

func (*StatsScheduler) GetLivestreamRank

func (s *StatsScheduler) GetLivestreamRank(livestreamID int64) (int64, error)

func (*StatsScheduler) GetLivestreamStats

func (s *StatsScheduler) GetLivestreamStats(livestreamID int64) (*LivestreamStats, error)

func (*StatsScheduler) GetUserRank

func (s *StatsScheduler) GetUserRank(username string) (int64, error)

func (*StatsScheduler) GetUserStats

func (s *StatsScheduler) GetUserStats(username string) (*UserStats, error)

type Tip

type Tip struct {
	Level int
	Tip   int
}

type User

type User struct {
	Name           string
	DisplayName    string
	Description    string
	RawPassword    string
	HashedPassword string
	DarkMode       bool
}

func GetInitialUserByID

func GetInitialUserByID(id int64) *User

type UserStats

type UserStats struct {
	Username string

	// 視聴者数
	TotalViewers int64

	// トータルライブコメント数
	TotalLivecomments int64
	// チップ合計金額
	TotalTips int64
	// contains filtered or unexported fields
}

func NewUserStats

func NewUserStats(username string) *UserStats

func (*UserStats) FavoriteEmoji

func (s *UserStats) FavoriteEmoji() (string, bool)

func (*UserStats) Score

func (s *UserStats) Score() int64

func (*UserStats) TotalReactions

func (s *UserStats) TotalReactions() int64

type UserStatsRanking

type UserStatsRanking []*UserStats

func (UserStatsRanking) Len

func (r UserStatsRanking) Len() int

func (UserStatsRanking) Less

func (r UserStatsRanking) Less(i, j int) bool

func (UserStatsRanking) Swap

func (r UserStatsRanking) Swap(i, j int)

Jump to

Keyboard shortcuts

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