session

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeNotifier

type ChangeNotifier func(ctx context.Context, updated CompleteSessionView) error

func NewChangeNotifier

func NewChangeNotifier(dynamo DynamoClient, watcherTable string, dispatchMessage api.MessageDispatcher) ChangeNotifier

type CompleteSessionView

type CompleteSessionView struct {
	SessionID             string `json:"sessionId"`
	VotesShown            bool   `json:"votesShown"`
	FacilitatorSessionKey string `json:"facilitatorSessionKey,omitempty"`
	Facilitator           User   `json:"facilitator"`
	FacilitatorPoints     bool   `json:"facilitatorPoints"`
	Participants          []User `json:"participants"`
}

type Disconnector

type Disconnector func(ctx context.Context, connectionID string) error

func NewDisconnector

func NewDisconnector(dynamo DynamoClient, tableName string, locker lock.GlobalLockAppropriator, loadSession Loader, saveSession Saver) Disconnector

type DynamoClient

type DynamoClient interface {
	GetItemWithContext(ctx aws.Context, input *dynamodb.GetItemInput, opts ...request.Option) (*dynamodb.GetItemOutput, error)
	PutItemWithContext(ctx aws.Context, input *dynamodb.PutItemInput, opts ...request.Option) (*dynamodb.PutItemOutput, error)
	DeleteItemWithContext(ctx aws.Context, input *dynamodb.DeleteItemInput, opts ...request.Option) (*dynamodb.DeleteItemOutput, error)
}

type InterestRecorder

type InterestRecorder func(ctx context.Context, sessionID string, connectionID string) error

func NewInterestRecorder

func NewInterestRecorder(dynamo DynamoClient, sessionTable string, watcherTable string, locker lock.GlobalLockAppropriator, sessionExpiration time.Duration) InterestRecorder

type JoinSessionRequest

type JoinSessionRequest struct {
	SessionID string `json:"sessionId"`
	User      User   `json:"user"`
}

type LoadFacilitatorSessionRequest

type LoadFacilitatorSessionRequest struct {
	SessionID             string `json:"sessionId"`
	FacilitatorSessionKey string `json:"facilitatorSessionKey"`
	MarkActive            bool   `json:"markActive"`
}

type LoadSessionRequest

type LoadSessionRequest struct {
	SessionID string `json:"sessionId"`
}

type Loader

type Loader func(ctx context.Context, sessionID string) (*CompleteSessionView, error)

func NewLoader

func NewLoader(dynamo DynamoClient, tableName string) Loader

type ParticipantSessionView

type ParticipantSessionView struct {
	SessionID         string `json:"sessionId"`
	VotesShown        bool   `json:"votesShown"`
	Facilitator       User   `json:"facilitator"`
	FacilitatorPoints bool   `json:"facilitatorPoints"`
	Participants      []User `json:"participants"`
}

func ToParticipantView

func ToParticipantView(s CompleteSessionView, connectionID string) ParticipantSessionView

type Saver

type Saver func(ctx context.Context, toSave CompleteSessionView) error

func NewSaver

func NewSaver(dynamo DynamoClient, tableName string, notifyObservers ChangeNotifier, sessionExpiration time.Duration) Saver

type ShowVotesRequest

type ShowVotesRequest struct {
	SessionID             string `json:"sessionId"`
	FacilitatorSessionKey string `json:"facilitatorSessionKey"`
}

type StartRequest

type StartRequest struct {
	Facilitator       User `json:"facilitator"`
	FacilitatorPoints bool `json:"facilitatorPoints"`
}

type Starter

type Starter func(ctx context.Context, toStart StartRequest) (CompleteSessionView, error)

func NewStarter

func NewStarter(dynamo DynamoClient, tableName string, sessionExpiration time.Duration) Starter

type User

type User struct {
	UserID      string  `json:"userId"`
	Name        string  `json:"name,omitempty"`
	Handle      string  `json:"handle,omitempty"`
	CurrentVote *string `json:"currentVote,omitempty"`
	SocketID    string  `json:"-"`
}

type VoteRequest

type VoteRequest struct {
	SessionID string `json:"sessionId"`
	Vote      string `json:"vote"`
}

Jump to

Keyboard shortcuts

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