Documentation
¶
Index ¶
- Constants
- Variables
- type Echo
- type GlobalKVSBucket
- type KVSBucket
- type KVSCriteria
- type KVSEntry
- type LeaderBoard
- type LeaderBoardScore
- type LobbyService
- type MasterData
- type MasterDataService
- type PrivateKVSBucket
- type Room
- type RoomType
- type User
- type UserAuthentication
- type UserProfile
- type UserStatus
Constants ¶
View Source
const ( // DeletedUserEmail は、削除されたユーザのメールアドレスを表します。 // メールアドレスの UNIQUE 制約は論理削除されていないレコードのみを対象としているため、削除済みユーザのメールアドレスが重複しても問題ない。 DeletedUserEmail = "" )
Variables ¶
View Source
var ( ErrKVSEntryValueTooLarge = errors.New("value size is too large") ErrPrivateKVSETagMismatch = errors.New("private KVS etag mismatch") )
View Source
var ( ErrRoomSecretEmpty = errors.New("room secret is empty") ErrRoomSecretMismatch = errors.New("room secret mismatch") ErrRoomMaxCapacity = errors.New("room is full") ErrUserAlreadyInRoom = errors.New("user is already in room") ErrUserNotInRoom = errors.New("user is not in room") )
View Source
var (
ErrMasterDataContentTooLarge = errors.New("master data content is too large")
)
View Source
var (
ErrUserDeactivated = errors.New("user is deactivated")
)
View Source
var (
ErrUserProfileTooLarge = errors.New("user profile is too large")
)
Functions ¶
This section is empty.
Types ¶
type GlobalKVSBucket ¶
type GlobalKVSBucket struct {
KVSBucket
}
GlobalKVSBucket は、全ユーザで共有される KVS を表します。 専用 API が提供されていないプロダクト固有の機能は、この機能で代用される想定です。
func NewGlobalKVSBucket ¶
func NewGlobalKVSBucket(entries []KVSEntry) GlobalKVSBucket
type KVSBucket ¶
type KVSBucket struct {
// contains filtered or unexported fields
}
KVSBucket は、KVS におけるエントリの配列操作を提供します。
func NewKVSBucket ¶
type KVSCriteria ¶
func NewKVSCriteria ¶
func NewKVSCriteria(exactMatch, prefixMatch []string) KVSCriteria
func (KVSCriteria) IsEmpty ¶
func (c KVSCriteria) IsEmpty() bool
type LeaderBoard ¶ added in v0.2.0
type LeaderBoard struct {
ID string
Scores []LeaderBoardScore
}
func NewLeaderBoard ¶ added in v0.2.0
func NewLeaderBoard(id string, scored []LeaderBoardScore) LeaderBoard
func (*LeaderBoard) SubmitScore ¶ added in v0.2.0
func (l *LeaderBoard) SubmitScore(score LeaderBoardScore)
SubmitScore は、リーダーボードにスコアを提出します。 スコアの保持者はユーザとは限らない ので、誰でもスコアを上書きできるようになっています。 例えばブログのいいね数ランキングをリーダーボード機能で実現する場合、いいね送信者がスコアを提出することになります。
type LeaderBoardScore ¶ added in v0.2.0
type LeaderBoardScore struct {
// ScoreID は、スコア集計対象である任意のオブジェクトIDが指定されます。
// 例: ユーザID、ブログID
ScoreID string
Score int
Timestamp time.Time
}
LeaderBoardScore は、リーダーボードに登録されるスコアを表します。
func NewLeaderBoardScore ¶ added in v0.2.0
func NewLeaderBoardScore(scoreID string, score int, timestamp time.Time) LeaderBoardScore
type LobbyService ¶ added in v0.3.0
type LobbyService struct{}
LobbyService は、WebRTC のロビー機能を提供します。
func NewLobbyService ¶ added in v0.3.0
func NewLobbyService() LobbyService
func (LobbyService) CreatePrivateRoom ¶ added in v0.3.0
func (LobbyService) CreatePublicRoom ¶ added in v0.3.0
type MasterData ¶ added in v0.3.0
type MasterData struct {
Revision int
Content []byte
IsActive bool
Comment string
CreatedAt time.Time
}
func NewMasterData ¶ added in v0.3.0
type MasterDataService ¶ added in v0.3.0
type MasterDataService struct {
// contains filtered or unexported fields
}
func NewMasterDataService ¶ added in v0.3.0
func NewMasterDataService(active MasterData, revisions []int) (*MasterDataService, error)
func (*MasterDataService) NewNextRevision ¶ added in v0.3.0
func (s *MasterDataService) NewNextRevision(content []byte, comment string, now time.Time) (MasterData, error)
func (*MasterDataService) SwitchActive ¶ added in v0.3.0
func (s *MasterDataService) SwitchActive(target MasterData) (MasterData, MasterData, error)
type PrivateKVSBucket ¶
type PrivateKVSBucket struct {
KVSBucket
UserID uuid.UUID
// contains filtered or unexported fields
}
PrivateKVSBucket はユーザごとに独立した KVS で、他ユーザには公開されません。
func NewPrivateKVSBucket ¶
func (PrivateKVSBucket) ETag ¶
func (m PrivateKVSBucket) ETag() uuid.UUID
type Room ¶ added in v0.3.0
type Room struct {
ID uuid.UUID
OwnerUserID uuid.UUID
Type RoomType
MaxCapacity int
Secret string
Details []byte
UserIDs []uuid.UUID
}
Room は、WebRTC のルームを表します。
type User ¶
type User struct {
ID uuid.UUID
Email string
Status UserStatus
}
func (User) IsUnavailable ¶ added in v0.2.0
type UserAuthentication ¶
type UserAuthentication struct {
UserID uuid.UUID
// BaaS ごとにユーザIDの表現が異なるため、文字列型にしている。
BaasUserID string
LastAuthenticatedAt time.Time
}
UserAuthentication はユーザの認証に必要な情報を提供します。 認証/再認証のみで利用され、セッション管理のコンテキストでは利用されません。
func NewUserAuthentication ¶
func (*UserAuthentication) Refresh ¶
func (a *UserAuthentication) Refresh(now time.Time)
type UserProfile ¶
プロフィールのデータ構造はプロダクトによって異なり、汎化が難しい。 そのため、プロフィールをバイナリデータとして扱い、プロダクトごとに独自スキーマを定義させる。
func NewUserProfile ¶
func NewUserProfile(userID uuid.UUID, v []byte) (UserProfile, error)
func (UserProfile) Bytes ¶
func (p UserProfile) Bytes() []byte
type UserStatus ¶
type UserStatus int
const ( // 設定が未完了で、他ユーザには公開されていない状態。 // サインイン後、設定を完了するまでこの状態が続く。 UserStatusPending UserStatus = 1 + iota // アカウントが利用可能で、他ユーザにも公開されている状態。 UserStatusActive // アカウントが削除され、利用不可な状態。 // この状態になると、二度と利用できなくなる。 UserStatusDeactivated )
Click to show internal directories.
Click to hide internal directories.