scenario

package
v0.0.0-...-6b7e659 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrokeReceiveScore int64 = 1
)

Variables

This section is empty.

Functions

func APIAndHTMLMustBeConsistent

func APIAndHTMLMustBeConsistent(origins []string)

APIとHTMLの整合性が取れているかをチェック

func Adler32

func Adler32(s []byte) int32

copied from react's src/renderers/shared/utils/adler32.js BSD License

For React software

Copyright (c) 2013-present, Facebook, Inc. All rights reserved.

func CSRFTokenRefreshed

func CSRFTokenRefreshed(origins []string)

ページ内のCSRFトークンが毎回変わっている

func CantDrawFirstStrokeOnSomeoneElsesRoom

func CantDrawFirstStrokeOnSomeoneElsesRoom(origins []string)

他人の作った部屋に最初の線を描けない

func CheckStaticFiles

func CheckStaticFiles(origins []string)

静的ファイルが正しいかをチェック

func DrawOnRandomRoom

func DrawOnRandomRoom(origins []string)

/api/rooms にリクエストして、その中の一つの部屋を開いてstrokeをPOST

func LoadIndexPage

func LoadIndexPage(origins []string) bool

トップページと画像に負荷をかける

func LoadIndexPageWithSession

func LoadIndexPageWithSession(s *session.Session) bool

func Matsuri

func Matsuri(origins []string, timeout int)

一人がroomを作る→大勢がそのroomをwatchする

func RoomWithoutStrokeNotShownAtTop

func RoomWithoutStrokeNotShownAtTop(origins []string)

線の描かれてない部屋はトップページに並ばない

func StrokeReflectedToTop

func StrokeReflectedToTop(origins []string)

部屋を作って線を描くとトップページに出てくる & 線がSVGに反映される

func TopPageContent

func TopPageContent(origins []string)

トップページの内容が正しいかをチェック

func WatcherCountIncreases

func WatcherCountIncreases(origins []string)

入室するとWatcherCountが増える 退室すると減るほうは、時間がたたないと正しい値に落ち着かないのでチェックしない

Types

type Point

type Point struct {
	ID       int64   `json:"id" db:"id"`
	StrokeID int64   `json:"stroke_id" db:"stroke_id"`
	X        float64 `json:"x" db:"x"`
	Y        float64 `json:"y" db:"y"`
}

type Response

type Response struct {
	Error     string  `json:"error,omitempty"`
	Room      *Room   `json:"room,omitempty"`
	Rooms     []Room  `json:"rooms,omitempty"`
	Stroke    *Stroke `json:"stroke,omitempty"`
	Token     string  `json:"token,omitempty"`     // /api/csrf_tokenはこっち
	CSRFToken string  `json:"csrfToken,omitempty"` // HTMLの__ASYNC_PROPS__はこっち
}

type Room

type Room struct {
	ID           int64     `json:"id" db:"id"`
	Name         string    `json:"name" db:"name"`
	CanvasWidth  int       `json:"canvas_width" db:"canvas_width"`
	CanvasHeight int       `json:"canvas_height" db:"canvas_height"`
	CreatedAt    time.Time `json:"created_at" db:"created_at"`
	Strokes      []Stroke  `json:"strokes"`
	StrokeCount  int       `json:"stroke_count"`
	WatcherCount int       `json:"watcher_count"`
}

type RoomWatcher

type RoomWatcher struct {
	EndCh            chan struct{}
	StrokeLogs       []StrokeLog
	WatcherCountLogs []WatcherCountLog
	// contains filtered or unexported fields
}

func NewRoomWatcher

func NewRoomWatcher(target string, roomID int64) *RoomWatcher

func (*RoomWatcher) Leave

func (w *RoomWatcher) Leave()

Watcherを部屋から退出させるために呼ぶ。Leaveを呼ばれたらWatcher内部でクリーンアップ処理などをし、EndChに通知が行く

type StaticFile

type StaticFile struct {
	Path string
	MD5  string
}

type Stroke

type Stroke struct {
	ID        int64     `json:"id" db:"id"`
	RoomID    int64     `json:"room_id" db:"room_id"`
	Width     int       `json:"width" db:"width"`
	Red       int       `json:"red" db:"red"`
	Green     int       `json:"green" db:"green"`
	Blue      int       `json:"blue" db:"blue"`
	Alpha     float64   `json:"alpha" db:"alpha"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	Points    []Point   `json:"points" db:"points"`
}

type StrokeLog

type StrokeLog struct {
	ReceivedTime time.Time
	Stroke
}

type WatcherCountLog

type WatcherCountLog struct {
	ReceivedTime time.Time
	Count        int
}

Jump to

Keyboard shortcuts

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